29 integer,
parameter :: veg_type_landice_target = 15
36 type(esmf_field
),
public :: canopy_mc_target_grid
38 type(esmf_field
),
public :: f10m_target_grid
41 type(esmf_field
),
public :: ffmm_target_grid
44 type(esmf_field
),
public :: q2m_target_grid
46 type(esmf_field
),
public :: seaice_depth_target_grid
48 type(esmf_field
),
public :: seaice_fract_target_grid
50 type(esmf_field
),
public :: seaice_skin_temp_target_grid
52 type(esmf_field
),
public :: skin_temp_target_grid
54 type(esmf_field
),
public :: srflag_target_grid
56 type(esmf_field
),
public :: snow_liq_equiv_target_grid
58 type(esmf_field
),
public :: snow_depth_target_grid
60 type(esmf_field
),
public :: soil_temp_target_grid
62 type(esmf_field
),
public :: soilm_liq_target_grid
64 type(esmf_field
),
public :: soilm_tot_target_grid
66 type(esmf_field
),
public :: t2m_target_grid
68 type(esmf_field
),
public :: tprcp_target_grid
70 type(esmf_field
),
public :: ustar_target_grid
72 type(esmf_field
),
public :: z0_target_grid
74 type(esmf_field
),
public :: lai_target_grid
78 type(esmf_field
),
public :: c_d_target_grid
80 type(esmf_field
),
public :: c_0_target_grid
82 type(esmf_field
),
public :: d_conv_target_grid
84 type(esmf_field
),
public :: dt_cool_target_grid
86 type(esmf_field
),
public :: ifd_target_grid
89 type(esmf_field
),
public :: qrain_target_grid
91 type(esmf_field
),
public :: tref_target_grid
93 type(esmf_field
),
public :: w_d_target_grid
95 type(esmf_field
),
public :: w_0_target_grid
97 type(esmf_field
),
public :: xs_target_grid
100 type(esmf_field
),
public :: xt_target_grid
103 type(esmf_field
),
public :: xu_target_grid
106 type(esmf_field
),
public :: xv_target_grid
109 type(esmf_field
),
public :: xz_target_grid
111 type(esmf_field
),
public :: xtts_target_grid
113 type(esmf_field
),
public :: xzts_target_grid
115 type(esmf_field
),
public :: z_c_target_grid
117 type(esmf_field
),
public :: zm_target_grid
120 type(esmf_field
) :: soil_type_from_input_grid
123 type(esmf_field
) :: terrain_from_input_grid
126 type(esmf_field
) :: terrain_from_input_grid_land
130 real,
parameter,
private :: blim = 5.5
132 real,
parameter,
private :: frz_h2o = 273.15
134 real,
parameter,
private :: frz_ice = 271.21
136 real,
parameter,
private :: grav = 9.81
138 real,
parameter,
private :: hlice = 3.335E5
165 integer,
intent(in) :: localpet
313 use input_data, only : canopy_mc_input_grid, &
316 landsea_mask_input_grid, &
318 seaice_depth_input_grid, &
319 seaice_fract_input_grid, &
320 seaice_skin_temp_input_grid, &
321 skin_temp_input_grid, &
322 snow_depth_input_grid, &
323 snow_liq_equiv_input_grid, &
324 soil_temp_input_grid, &
325 soil_type_input_grid, &
326 soilm_tot_input_grid, &
331 veg_type_input_grid, &
336 dt_cool_input_grid, &
350 zm_input_grid, terrain_input_grid, &
351 veg_type_landice_input, &
352 veg_greenness_input_grid, &
353 max_veg_greenness_input_grid, &
354 min_veg_greenness_input_grid, &
357 use model_grid, only : input_grid, target_grid, &
358 i_target, j_target, &
360 num_tiles_target_grid, &
361 landmask_target_grid, &
362 seamask_target_grid, &
369 minmax_vgfrc_from_climo, &
376 soil_type_target_grid, &
377 veg_greenness_target_grid, &
378 substrate_temp_target_grid,&
379 min_veg_greenness_target_grid,&
380 max_veg_greenness_target_grid
386 integer,
intent(in) :: localpet
388 integer :: l(1), u(1)
389 integer :: i, j, ij, rc, tile
390 integer :: clb_target(2), cub_target(2)
391 integer :: isrctermprocessing
392 integer(esmf_kind_i4),
pointer :: unmapped_ptr(:)
393 integer(esmf_kind_i4),
pointer :: mask_input_ptr(:,:)
394 integer(esmf_kind_i4),
pointer :: mask_target_ptr(:,:)
395 integer(esmf_kind_i8),
pointer :: landmask_target_ptr(:,:)
396 integer(esmf_kind_i8),
allocatable :: mask_target_one_tile(:,:)
397 integer(esmf_kind_i8),
allocatable :: water_target_one_tile(:,:)
398 integer(esmf_kind_i8),
allocatable :: land_target_one_tile(:,:)
399 integer(esmf_kind_i8),
pointer :: seamask_target_ptr(:,:)
401 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
402 real(esmf_kind_r8),
allocatable :: data_one_tile2(:,:)
403 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
404 real(esmf_kind_r8),
allocatable :: latitude_one_tile(:,:)
405 real(esmf_kind_r8),
pointer :: canopy_mc_target_ptr(:,:)
406 real(esmf_kind_r8),
pointer :: c_d_target_ptr(:,:)
407 real(esmf_kind_r8),
pointer :: c_0_target_ptr(:,:)
408 real(esmf_kind_r8),
pointer :: d_conv_target_ptr(:,:)
409 real(esmf_kind_r8),
pointer :: dt_cool_target_ptr(:,:)
410 real(esmf_kind_r8),
pointer :: ifd_target_ptr(:,:)
411 real(esmf_kind_r8),
pointer :: qrain_target_ptr(:,:)
412 real(esmf_kind_r8),
pointer :: tref_target_ptr(:,:)
413 real(esmf_kind_r8),
pointer :: w_d_target_ptr(:,:)
414 real(esmf_kind_r8),
pointer :: w_0_target_ptr(:,:)
415 real(esmf_kind_r8),
pointer :: xs_target_ptr(:,:)
416 real(esmf_kind_r8),
pointer :: xt_target_ptr(:,:)
417 real(esmf_kind_r8),
pointer :: xu_target_ptr(:,:)
418 real(esmf_kind_r8),
pointer :: xv_target_ptr(:,:)
419 real(esmf_kind_r8),
pointer :: xz_target_ptr(:,:)
420 real(esmf_kind_r8),
pointer :: xtts_target_ptr(:,:)
421 real(esmf_kind_r8),
pointer :: xzts_target_ptr(:,:)
422 real(esmf_kind_r8),
pointer :: z_c_target_ptr(:,:)
423 real(esmf_kind_r8),
pointer :: zm_target_ptr(:,:)
424 real(esmf_kind_r8),
pointer :: seaice_depth_target_ptr(:,:)
425 real(esmf_kind_r8),
pointer :: seaice_fract_target_ptr(:,:)
426 real(esmf_kind_r8),
pointer :: seaice_skin_temp_target_ptr(:,:)
427 real(esmf_kind_r8),
pointer :: skin_temp_target_ptr(:,:)
428 real(esmf_kind_r8),
pointer :: snow_depth_target_ptr(:,:)
429 real(esmf_kind_r8),
pointer :: snow_liq_equiv_target_ptr(:,:)
430 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
431 real(esmf_kind_r8),
pointer :: soil_type_from_input_ptr(:,:)
432 real(esmf_kind_r8),
pointer :: soilm_tot_target_ptr(:,:,:)
433 real(esmf_kind_r8),
pointer :: srflag_target_ptr(:,:)
434 real(esmf_kind_r8),
pointer :: terrain_from_input_ptr(:,:)
435 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
436 real(esmf_kind_r8),
pointer :: z0_target_ptr(:,:)
437 real(esmf_kind_r8),
pointer :: landmask_input_ptr(:,:)
438 real(esmf_kind_r8),
pointer :: veg_type_input_ptr(:,:)
439 real(esmf_kind_r8),
allocatable :: veg_type_target_one_tile(:,:)
440 real(esmf_kind_r8),
pointer :: veg_greenness_target_ptr(:,:)
441 real(esmf_kind_r8),
pointer :: min_veg_greenness_target_ptr(:,:)
442 real(esmf_kind_r8),
pointer :: max_veg_greenness_target_ptr(:,:)
443 real(esmf_kind_r8),
pointer :: lai_target_ptr(:,:)
445 type(esmf_regridmethod_flag
) :: method
446 type(esmf_routehandle
) :: regrid_bl_no_mask
447 type(esmf_routehandle
) :: regrid_all_land
448 type(esmf_routehandle
) :: regrid_land
449 type(esmf_routehandle
) :: regrid_landice
450 type(esmf_routehandle
) :: regrid_nonland
451 type(esmf_routehandle
) :: regrid_seaice
452 type(esmf_routehandle
) :: regrid_water
458 method=esmf_regridmethod_bilinear
460 isrctermprocessing = 1
462 print*,
"- CALL FieldRegridStore FOR NON-MASKED BILINEAR INTERPOLATION."
463 call esmf_fieldregridstore(t2m_input_grid, &
465 polemethod=esmf_polemethod_allavg, &
466 srctermprocessing=isrctermprocessing, &
467 routehandle=regrid_bl_no_mask, &
468 regridmethod=method, rc=rc)
469 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
472 print*,
"- CALL Field_Regrid T2M."
473 call esmf_fieldregrid(t2m_input_grid, &
475 routehandle=regrid_bl_no_mask, &
476 termorderflag=esmf_termorder_srcseq, rc=rc)
477 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
480 print*,
"- CALL Field_Regrid Q2M."
481 call esmf_fieldregrid(q2m_input_grid, &
483 routehandle=regrid_bl_no_mask, &
484 termorderflag=esmf_termorder_srcseq, rc=rc)
485 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
488 print*,
"- CALL Field_Regrid TPRCP."
489 call esmf_fieldregrid(tprcp_input_grid, &
491 routehandle=regrid_bl_no_mask, &
492 termorderflag=esmf_termorder_srcseq, rc=rc)
493 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
496 print*,
"- CALL Field_Regrid F10M."
497 call esmf_fieldregrid(f10m_input_grid, &
499 routehandle=regrid_bl_no_mask, &
500 termorderflag=esmf_termorder_srcseq, rc=rc)
501 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
504 print*,
"- CALL Field_Regrid FFMM."
505 call esmf_fieldregrid(ffmm_input_grid, &
507 routehandle=regrid_bl_no_mask, &
508 termorderflag=esmf_termorder_srcseq, rc=rc)
509 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
512 print*,
"- CALL Field_Regrid USTAR."
513 call esmf_fieldregrid(ustar_input_grid, &
515 routehandle=regrid_bl_no_mask, &
516 termorderflag=esmf_termorder_srcseq, rc=rc)
517 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
520 print*,
"- CALL Field_Regrid SRFLAG."
521 call esmf_fieldregrid(srflag_input_grid, &
522 srflag_target_grid, &
523 routehandle=regrid_bl_no_mask, &
524 termorderflag=esmf_termorder_srcseq, rc=rc)
525 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
528 print*,
"- CALL FieldGet FOR SRFLAG."
529 call esmf_fieldget(srflag_target_grid, &
530 farrayptr=srflag_target_ptr, rc=rc)
531 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
539 srflag_target_ptr = nint(srflag_target_ptr)
541 print*,
"- CALL FieldRegridRelease."
542 call esmf_fieldregridrelease(routehandle=regrid_bl_no_mask, rc=rc)
543 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
550 print*,
"- CALL GridAddItem FOR TARGET GRID."
551 call esmf_gridadditem(target_grid, &
552 itemflag=esmf_griditem_mask, &
553 staggerloc=esmf_staggerloc_center, rc=rc)
554 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
557 print*,
"- CALL GridGetItem FOR TARGET GRID."
558 call esmf_gridgetitem(target_grid, &
559 itemflag=esmf_griditem_mask, &
560 farrayptr=mask_target_ptr, rc=rc)
561 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
564 print*,
"- CALL FieldGet FOR TARGET GRID SEAMASK."
565 call esmf_fieldget(seamask_target_grid, &
566 computationallbound=clb_target, &
567 computationalubound=cub_target, &
568 farrayptr=seamask_target_ptr, rc=rc)
569 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
572 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
573 call esmf_fieldget(landmask_target_grid, &
574 farrayptr=landmask_target_ptr, rc=rc)
575 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
578 print*,
"- CALL GridAddItem FOR INPUT GRID SEAMASK."
579 call esmf_gridadditem(input_grid, &
580 itemflag=esmf_griditem_mask, &
581 staggerloc=esmf_staggerloc_center, rc=rc)
582 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
585 print*,
"- CALL FieldGet FOR INPUT GRID LANDMASK."
586 call esmf_fieldget(landsea_mask_input_grid, &
587 farrayptr=landmask_input_ptr, rc=rc)
588 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
591 print*,
"- CALL GridGetItem FOR INPUT GRID LANDMASK."
592 call esmf_gridgetitem(input_grid, &
593 itemflag=esmf_griditem_mask, &
594 farrayptr=mask_input_ptr, rc=rc)
595 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
598 if (localpet == 0)
then
599 allocate(data_one_tile(i_target,j_target))
600 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
601 allocate(mask_target_one_tile(i_target,j_target))
603 allocate(data_one_tile(0,0))
604 allocate(data_one_tile_3d(0,0,0))
605 allocate(mask_target_one_tile(0,0))
613 method=esmf_regridmethod_nearest_stod
615 isrctermprocessing = 1
618 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
621 where (landmask_target_ptr == 1) mask_target_ptr = 1
623 print*,
"- CALL FieldCreate FOR TERRAIN FROM INPUT GRID LAND."
624 terrain_from_input_grid_land = esmf_fieldcreate(target_grid, &
625 typekind=esmf_typekind_r8, &
626 staggerloc=esmf_staggerloc_center, rc=rc)
627 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
630 print*,
"- CALL FieldRegridStore for land fields."
631 call esmf_fieldregridstore(terrain_input_grid, &
632 terrain_from_input_grid_land, &
633 srcmaskvalues=(/0/), &
634 dstmaskvalues=(/0/), &
635 polemethod=esmf_polemethod_none, &
636 srctermprocessing=isrctermprocessing, &
637 unmappedaction=esmf_unmappedaction_ignore, &
638 normtype=esmf_normtype_fracarea, &
639 routehandle=regrid_all_land, &
640 regridmethod=method, &
641 unmappeddstlist=unmapped_ptr, rc=rc)
642 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
645 print*,
"- CALL Field_Regrid TERRAIN."
646 call esmf_fieldregrid(terrain_input_grid, &
647 terrain_from_input_grid_land, &
648 routehandle=regrid_all_land, &
649 termorderflag=esmf_termorder_srcseq, rc=rc)
650 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
653 print*,
"- CALL FieldGet FOR terrain from input grid at land."
654 call esmf_fieldget(terrain_from_input_grid_land, &
655 farrayptr=terrain_from_input_ptr, rc=rc)
656 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
659 l = lbound(unmapped_ptr)
660 u = ubound(unmapped_ptr)
663 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
664 terrain_from_input_ptr(i,j) = -9999.9
666 nullify(terrain_from_input_ptr)
668 do tile = 1, num_tiles_target_grid
670 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
671 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
672 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
675 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID: ", tile
676 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
677 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
680 if (localpet == 0)
then
681 allocate(land_target_one_tile(i_target,j_target))
682 land_target_one_tile = 0
683 where(mask_target_one_tile == 1) land_target_one_tile = 1
684 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7)
685 deallocate(land_target_one_tile)
688 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID: ", tile
689 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
690 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
694 if(.not. vgtyp_from_climo)
then
696 do tile = 1, num_tiles_target_grid
697 print*,
"-CALL FieldGather VEG TYPE TARGET GRID"
698 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
699 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
702 data_one_tile(:,:) = 0
705 print*,
"- CALL FieldRegrid VEG TYPE."
706 call esmf_fieldregrid(veg_type_input_grid, &
707 veg_type_target_grid, &
708 routehandle=regrid_all_land, &
709 termorderflag=esmf_termorder_srcseq, rc=rc)
710 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
713 print*,
"- CALL FieldGet FOR TARGET grid veg type."
714 call esmf_fieldget(veg_type_target_grid, &
715 farrayptr=veg_type_target_ptr, rc=rc)
716 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
719 l = lbound(unmapped_ptr)
720 u = ubound(unmapped_ptr)
723 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
724 veg_type_target_ptr(i,j) = -9999.9
727 do tile = 1, num_tiles_target_grid
728 print*,
"- CALL FieldGather FOR TARGET GRID VEG TYPE TILE: ", tile
729 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
730 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
733 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
734 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
735 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
738 if (localpet == 0)
then
739 allocate(land_target_one_tile(i_target,j_target))
740 land_target_one_tile = 0
741 where(mask_target_one_tile == 1) land_target_one_tile = 1
742 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 225)
743 deallocate(land_target_one_tile)
746 print*,
"- CALL FieldScatter FOR TARGET GRID VEG TYPE: ", tile
747 call esmf_fieldscatter(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
748 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
751 nullify(veg_type_target_ptr)
753 print*,
"- CALL FieldRegridRelease."
754 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
755 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
764 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0
766 mask_target_ptr = seamask_target_ptr
768 method=esmf_regridmethod_conserve
770 isrctermprocessing = 1
772 print*,
"- CALL FieldRegridStore for sea ice fraction."
773 call esmf_fieldregridstore(seaice_fract_input_grid, &
774 seaice_fract_target_grid, &
775 srcmaskvalues=(/0/), &
776 dstmaskvalues=(/0/), &
777 polemethod=esmf_polemethod_none, &
778 srctermprocessing=isrctermprocessing, &
779 unmappedaction=esmf_unmappedaction_ignore, &
780 normtype=esmf_normtype_fracarea, &
781 routehandle=regrid_nonland, &
782 regridmethod=method, &
783 unmappeddstlist=unmapped_ptr, rc=rc)
784 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
787 print*,
"- CALL Field_Regrid for sea ice fraction."
788 call esmf_fieldregrid(seaice_fract_input_grid, &
789 seaice_fract_target_grid, &
790 routehandle=regrid_nonland, &
791 termorderflag=esmf_termorder_srcseq, rc=rc)
792 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
795 print*,
"- CALL FieldGet FOR TARGET grid sea ice fraction."
796 call esmf_fieldget(seaice_fract_target_grid, &
797 farrayptr=seaice_fract_target_ptr, rc=rc)
798 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
801 l = lbound(unmapped_ptr)
802 u = ubound(unmapped_ptr)
805 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
806 seaice_fract_target_ptr(i,j) = -9999.9
811 if (localpet == 0)
then
812 allocate(latitude_one_tile(i_target,j_target))
814 allocate(latitude_one_tile(0,0))
817 do tile = 1, num_tiles_target_grid
819 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE FRACTION TILE: ", tile
820 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
821 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
824 print*,
"- CALL FieldGather FOR TARGET GRID MASK TILE: ", tile
825 call esmf_fieldgather(seamask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
826 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
829 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
830 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
831 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
834 if (localpet == 0)
then
835 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 91, &
836 latitude=latitude_one_tile)
839 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
840 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
841 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
845 if (localpet == 0)
then
848 if (data_one_tile(i,j) > 1.0_esmf_kind_r8)
then
849 data_one_tile(i,j) = 1.0_esmf_kind_r8
851 if (data_one_tile(i,j) < 0.15_esmf_kind_r8) data_one_tile(i,j) = 0.0_esmf_kind_r8
852 if (data_one_tile(i,j) >= 0.15_esmf_kind_r8) mask_target_one_tile(i,j) = 2
857 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE FRACTION TILE: ", tile
858 call esmf_fieldscatter(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
859 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
862 print*,
"- CALL FieldScatter FOR TARGET LANDMASK TILE: ", tile
863 call esmf_fieldscatter(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
864 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
869 deallocate(latitude_one_tile)
871 print*,
"- CALL FieldRegridRelease."
872 call esmf_fieldregridrelease(routehandle=regrid_nonland, rc=rc)
873 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
882 where (nint(landmask_input_ptr) == 2) mask_input_ptr = 1
884 print*,
"- CALL FieldGet FOR TARGET land sea mask."
885 call esmf_fieldget(landmask_target_grid, &
886 farrayptr=landmask_target_ptr, rc=rc)
887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
891 do j = clb_target(2), cub_target(2)
892 do i = clb_target(1), cub_target(1)
893 if (landmask_target_ptr(i,j) == 2) mask_target_ptr(i,j) = 1
897 method=esmf_regridmethod_nearest_stod
898 isrctermprocessing = 1
900 print*,
"- CALL FieldRegridStore for 3d seaice fields."
901 call esmf_fieldregridstore(soil_temp_input_grid, &
902 soil_temp_target_grid, &
903 srcmaskvalues=(/0/), &
904 dstmaskvalues=(/0/), &
905 polemethod=esmf_polemethod_none, &
906 srctermprocessing=isrctermprocessing, &
907 unmappedaction=esmf_unmappedaction_ignore, &
908 normtype=esmf_normtype_fracarea, &
909 routehandle=regrid_seaice, &
910 regridmethod=method, &
911 unmappeddstlist=unmapped_ptr, rc=rc)
912 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
915 print*,
"- CALL Field_Regrid for soil temperature over seaice."
916 call esmf_fieldregrid(soil_temp_input_grid, &
917 soil_temp_target_grid, &
918 routehandle=regrid_seaice, &
919 termorderflag=esmf_termorder_srcseq, rc=rc)
920 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
923 print*,
"- CALL FieldGet FOR TARGET grid soil temperature over seaice."
924 call esmf_fieldget(soil_temp_target_grid, &
925 farrayptr=soil_temp_target_ptr, rc=rc)
926 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
929 print*,
"- CALL Field_Regrid for sea ice depth."
930 call esmf_fieldregrid(seaice_depth_input_grid, &
931 seaice_depth_target_grid, &
932 routehandle=regrid_seaice, &
933 termorderflag=esmf_termorder_srcseq, rc=rc)
934 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
937 print*,
"- CALL FieldGet FOR TARGET grid sea ice depth."
938 call esmf_fieldget(seaice_depth_target_grid, &
939 farrayptr=seaice_depth_target_ptr, rc=rc)
940 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
943 print*,
"- CALL Field_Regrid for snow depth."
944 call esmf_fieldregrid(snow_depth_input_grid, &
945 snow_depth_target_grid, &
946 routehandle=regrid_seaice, &
947 termorderflag=esmf_termorder_srcseq, rc=rc)
948 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
951 print*,
"- CALL FieldGet FOR TARGET grid snow depth."
952 call esmf_fieldget(snow_depth_target_grid, &
953 farrayptr=snow_depth_target_ptr, rc=rc)
954 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
957 print*,
"- CALL Field_Regrid for snow liq equiv."
958 call esmf_fieldregrid(snow_liq_equiv_input_grid, &
959 snow_liq_equiv_target_grid, &
960 routehandle=regrid_seaice, &
961 termorderflag=esmf_termorder_srcseq, rc=rc)
962 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
965 print*,
"- CALL FieldGet FOR TARGET grid snow liq equiv."
966 call esmf_fieldget(snow_liq_equiv_target_grid, &
967 farrayptr=snow_liq_equiv_target_ptr, rc=rc)
968 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
971 print*,
"- CALL Field_Regrid for sea ice skin temp."
972 call esmf_fieldregrid(seaice_skin_temp_input_grid, &
973 seaice_skin_temp_target_grid, &
974 routehandle=regrid_seaice, &
975 termorderflag=esmf_termorder_srcseq, rc=rc)
976 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
979 print*,
"- CALL FieldGet FOR TARGET grid sea ice skin temp."
980 call esmf_fieldget(seaice_skin_temp_target_grid, &
981 farrayptr=seaice_skin_temp_target_ptr, rc=rc)
982 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
985 l = lbound(unmapped_ptr)
986 u = ubound(unmapped_ptr)
989 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
990 seaice_depth_target_ptr(i,j) = -9999.9
991 snow_depth_target_ptr(i,j) = -9999.9
992 snow_liq_equiv_target_ptr(i,j) = -9999.9
993 seaice_skin_temp_target_ptr(i,j) = -9999.9
994 soil_temp_target_ptr(i,j,:) = -9999.9
997 do tile = 1, num_tiles_target_grid
999 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE DEPTH TILE: ", tile
1000 call esmf_fieldgather(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1001 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1004 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1005 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1006 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1009 if (localpet == 0)
then
1013 where(mask_target_one_tile == 1) mask_target_one_tile = 0
1014 where(mask_target_one_tile == 2) mask_target_one_tile = 1
1015 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 92)
1018 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE DEPTH TILE: ", tile
1019 call esmf_fieldscatter(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1020 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1023 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile
1024 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1025 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1028 if (localpet == 0)
then
1029 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 66)
1032 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH TILE: ", tile
1033 call esmf_fieldscatter(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1034 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1037 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile
1038 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1039 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1042 if (localpet == 0)
then
1043 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 65)
1046 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile
1047 call esmf_fieldscatter(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1048 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1051 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE SKIN TEMP: ", tile
1052 call esmf_fieldgather(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1053 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1056 if (localpet == 0)
then
1057 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 21)
1060 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE SKIN TEMP: ", tile
1061 call esmf_fieldscatter(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1062 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1065 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
1066 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1067 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1070 if (localpet == 0)
then
1071 do j = 1, lsoil_target
1072 data_one_tile = data_one_tile_3d(:,:,j)
1073 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 21)
1074 data_one_tile_3d(:,:,j) = data_one_tile
1078 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
1079 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1080 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1085 print*,
"- CALL FieldRegridRelease."
1086 call esmf_fieldregridrelease(routehandle=regrid_seaice, rc=rc)
1087 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1095 where (nint(landmask_input_ptr) == 0) mask_input_ptr = 1
1098 where (landmask_target_ptr == 0) mask_target_ptr = 1
1100 method=esmf_regridmethod_conserve
1101 isrctermprocessing = 1
1103 print*,
"- CALL FieldRegridStore for water fields."
1104 call esmf_fieldregridstore(skin_temp_input_grid, &
1105 skin_temp_target_grid, &
1106 srcmaskvalues=(/0/), &
1107 dstmaskvalues=(/0/), &
1108 polemethod=esmf_polemethod_none, &
1109 srctermprocessing=isrctermprocessing, &
1110 unmappedaction=esmf_unmappedaction_ignore, &
1111 normtype=esmf_normtype_fracarea, &
1112 routehandle=regrid_water, &
1113 regridmethod=method, &
1114 unmappeddstlist=unmapped_ptr, rc=rc)
1115 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1118 print*,
"- CALL Field_Regrid for skin temperature over water."
1119 call esmf_fieldregrid(skin_temp_input_grid, &
1120 skin_temp_target_grid, &
1121 routehandle=regrid_water, &
1122 termorderflag=esmf_termorder_srcseq, rc=rc)
1123 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1126 print*,
"- CALL FieldGet FOR TARGET skin temperature."
1127 call esmf_fieldget(skin_temp_target_grid, &
1128 farrayptr=skin_temp_target_ptr, rc=rc)
1129 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1132 print*,
"- CALL Field_Regrid for z0 over water."
1133 call esmf_fieldregrid(z0_input_grid, &
1135 routehandle=regrid_water, &
1136 termorderflag=esmf_termorder_srcseq, rc=rc)
1137 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1140 print*,
"- CALL FieldGet FOR TARGET z0."
1141 call esmf_fieldget(z0_target_grid, &
1142 farrayptr=z0_target_ptr, rc=rc)
1143 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1146 l = lbound(unmapped_ptr)
1147 u = ubound(unmapped_ptr)
1150 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1151 skin_temp_target_ptr(i,j) = -9999.9
1152 z0_target_ptr(i,j) = -9999.9
1155 if (convert_nst)
then
1157 print*,
"- CALL Field_Regrid for c_d over water."
1158 call esmf_fieldregrid(c_d_input_grid, &
1160 routehandle=regrid_water, &
1161 termorderflag=esmf_termorder_srcseq, rc=rc)
1162 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1165 print*,
"- CALL Field_Regrid for c_0 over water."
1166 call esmf_fieldregrid(c_0_input_grid, &
1168 routehandle=regrid_water, &
1169 termorderflag=esmf_termorder_srcseq, rc=rc)
1170 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1173 print*,
"- CALL Field_Regrid for d_conv over water."
1174 call esmf_fieldregrid(d_conv_input_grid, &
1175 d_conv_target_grid, &
1176 routehandle=regrid_water, &
1177 termorderflag=esmf_termorder_srcseq, rc=rc)
1178 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1181 print*,
"- CALL Field_Regrid for dt_cool over water."
1182 call esmf_fieldregrid(dt_cool_input_grid, &
1183 dt_cool_target_grid, &
1184 routehandle=regrid_water, &
1185 termorderflag=esmf_termorder_srcseq, rc=rc)
1186 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1189 print*,
"- CALL Field_Regrid for ifd over water."
1190 call esmf_fieldregrid(ifd_input_grid, &
1192 routehandle=regrid_water, &
1193 termorderflag=esmf_termorder_srcseq, rc=rc)
1194 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1197 print*,
"- CALL Field_Regrid for qrain over water."
1198 call esmf_fieldregrid(qrain_input_grid, &
1199 qrain_target_grid, &
1200 routehandle=regrid_water, &
1201 termorderflag=esmf_termorder_srcseq, rc=rc)
1202 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1205 print*,
"- CALL Field_Regrid for tref over water."
1206 call esmf_fieldregrid(tref_input_grid, &
1208 routehandle=regrid_water, &
1209 termorderflag=esmf_termorder_srcseq, rc=rc)
1210 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1213 print*,
"- CALL Field_Regrid for w_d over water."
1214 call esmf_fieldregrid(w_d_input_grid, &
1216 routehandle=regrid_water, &
1217 termorderflag=esmf_termorder_srcseq, rc=rc)
1218 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1221 print*,
"- CALL Field_Regrid for w_0 over water."
1222 call esmf_fieldregrid(w_0_input_grid, &
1224 routehandle=regrid_water, &
1225 termorderflag=esmf_termorder_srcseq, rc=rc)
1226 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1229 print*,
"- CALL Field_Regrid for xs over water."
1230 call esmf_fieldregrid(xs_input_grid, &
1232 routehandle=regrid_water, &
1233 termorderflag=esmf_termorder_srcseq, rc=rc)
1234 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1237 print*,
"- CALL Field_Regrid for xt over water."
1238 call esmf_fieldregrid(xt_input_grid, &
1240 routehandle=regrid_water, &
1241 termorderflag=esmf_termorder_srcseq, rc=rc)
1242 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1245 print*,
"- CALL Field_Regrid for xu over water."
1246 call esmf_fieldregrid(xu_input_grid, &
1248 routehandle=regrid_water, &
1249 termorderflag=esmf_termorder_srcseq, rc=rc)
1250 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1253 print*,
"- CALL Field_Regrid for xv over water."
1254 call esmf_fieldregrid(xv_input_grid, &
1256 routehandle=regrid_water, &
1257 termorderflag=esmf_termorder_srcseq, rc=rc)
1258 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1261 print*,
"- CALL Field_Regrid for xz over water."
1262 call esmf_fieldregrid(xz_input_grid, &
1264 routehandle=regrid_water, &
1265 termorderflag=esmf_termorder_srcseq, rc=rc)
1266 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1269 print*,
"- CALL Field_Regrid for xtts over water."
1270 call esmf_fieldregrid(xtts_input_grid, &
1272 routehandle=regrid_water, &
1273 termorderflag=esmf_termorder_srcseq, rc=rc)
1274 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1277 print*,
"- CALL Field_Regrid for xzts over water."
1278 call esmf_fieldregrid(xzts_input_grid, &
1280 routehandle=regrid_water, &
1281 termorderflag=esmf_termorder_srcseq, rc=rc)
1282 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1285 print*,
"- CALL Field_Regrid for z_c over water."
1286 call esmf_fieldregrid(z_c_input_grid, &
1288 routehandle=regrid_water, &
1289 termorderflag=esmf_termorder_srcseq, rc=rc)
1290 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1293 print*,
"- CALL Field_Regrid for zm over water."
1294 call esmf_fieldregrid(zm_input_grid, &
1296 routehandle=regrid_water, &
1297 termorderflag=esmf_termorder_srcseq, rc=rc)
1298 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1303 print*,
"- CALL FieldGet FOR TARGET c_d."
1304 call esmf_fieldget(c_d_target_grid, &
1305 farrayptr=c_d_target_ptr, rc=rc)
1306 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1309 print*,
"- CALL FieldGet FOR TARGET c_0."
1310 call esmf_fieldget(c_0_target_grid, &
1311 farrayptr=c_0_target_ptr, rc=rc)
1312 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1315 print*,
"- CALL FieldGet FOR TARGET d_conv."
1316 call esmf_fieldget(d_conv_target_grid, &
1317 farrayptr=d_conv_target_ptr, rc=rc)
1318 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1321 print*,
"- CALL FieldGet FOR TARGET dt_cool."
1322 call esmf_fieldget(dt_cool_target_grid, &
1323 farrayptr=dt_cool_target_ptr, rc=rc)
1324 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1327 print*,
"- CALL FieldGet FOR TARGET ifd."
1328 call esmf_fieldget(ifd_target_grid, &
1329 farrayptr=ifd_target_ptr, rc=rc)
1330 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1333 ifd_target_ptr = float(nint(ifd_target_ptr))
1335 print*,
"- CALL FieldGet FOR TARGET qrain."
1336 call esmf_fieldget(qrain_target_grid, &
1337 farrayptr=qrain_target_ptr, rc=rc)
1338 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1341 print*,
"- CALL FieldGet FOR TARGET tref."
1342 call esmf_fieldget(tref_target_grid, &
1343 farrayptr=tref_target_ptr, rc=rc)
1344 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1347 print*,
"- CALL FieldGet FOR TARGET w_d."
1348 call esmf_fieldget(w_d_target_grid, &
1349 farrayptr=w_d_target_ptr, rc=rc)
1350 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1353 print*,
"- CALL FieldGet FOR TARGET w_0."
1354 call esmf_fieldget(w_0_target_grid, &
1355 farrayptr=w_0_target_ptr, rc=rc)
1356 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1359 print*,
"- CALL FieldGet FOR TARGET xs."
1360 call esmf_fieldget(xs_target_grid, &
1361 farrayptr=xs_target_ptr, rc=rc)
1362 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1365 print*,
"- CALL FieldGet FOR TARGET xt."
1366 call esmf_fieldget(xt_target_grid, &
1367 farrayptr=xt_target_ptr, rc=rc)
1368 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1371 print*,
"- CALL FieldGet FOR TARGET xu."
1372 call esmf_fieldget(xu_target_grid, &
1373 farrayptr=xu_target_ptr, rc=rc)
1374 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1377 print*,
"- CALL FieldGet FOR TARGET xv."
1378 call esmf_fieldget(xv_target_grid, &
1379 farrayptr=xv_target_ptr, rc=rc)
1380 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1383 print*,
"- CALL FieldGet FOR TARGET xz."
1384 call esmf_fieldget(xz_target_grid, &
1385 farrayptr=xz_target_ptr, rc=rc)
1386 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1389 print*,
"- CALL FieldGet FOR TARGET xtts."
1390 call esmf_fieldget(xtts_target_grid, &
1391 farrayptr=xtts_target_ptr, rc=rc)
1392 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1395 print*,
"- CALL FieldGet FOR TARGET xzts."
1396 call esmf_fieldget(xzts_target_grid, &
1397 farrayptr=xzts_target_ptr, rc=rc)
1398 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1401 print*,
"- CALL FieldGet FOR TARGET z_c."
1402 call esmf_fieldget(z_c_target_grid, &
1403 farrayptr=z_c_target_ptr, rc=rc)
1404 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1407 print*,
"- CALL FieldGet FOR TARGET zm."
1408 call esmf_fieldget(zm_target_grid, &
1409 farrayptr=zm_target_ptr, rc=rc)
1410 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1414 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1415 c_d_target_ptr(i,j) = -9999.9
1416 c_0_target_ptr(i,j) = -9999.9
1417 d_conv_target_ptr(i,j) = -9999.9
1418 dt_cool_target_ptr(i,j) = -9999.9
1419 ifd_target_ptr(i,j) = -9999.9
1420 qrain_target_ptr(i,j) = -9999.9
1421 tref_target_ptr(i,j) = -9999.9
1422 w_d_target_ptr(i,j) = -9999.9
1423 w_0_target_ptr(i,j) = -9999.9
1424 xs_target_ptr(i,j) = -9999.9
1425 xt_target_ptr(i,j) = -9999.9
1426 xu_target_ptr(i,j) = -9999.9
1427 xv_target_ptr(i,j) = -9999.9
1428 xz_target_ptr(i,j) = -9999.9
1429 xtts_target_ptr(i,j) = -9999.9
1430 xzts_target_ptr(i,j) = -9999.9
1431 z_c_target_ptr(i,j) = -9999.9
1432 zm_target_ptr(i,j) = -9999.9
1437 if (localpet == 0)
then
1438 allocate(latitude_one_tile(i_target,j_target))
1440 allocate(latitude_one_tile(0,0))
1443 do tile = 1, num_tiles_target_grid
1447 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE TILE: ", tile
1448 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1449 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1452 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1453 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1454 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1457 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
1458 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
1459 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1462 if (localpet == 0)
then
1463 allocate(water_target_one_tile(i_target,j_target))
1464 water_target_one_tile = 0
1465 where(mask_target_one_tile == 0) water_target_one_tile = 1
1466 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 11, &
1467 latitude=latitude_one_tile)
1470 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMP: ", tile
1471 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1472 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1477 print*,
"- CALL FieldGather FOR TARGET GRID Z0 TILE: ", tile
1478 call esmf_fieldgather(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1479 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1482 if (localpet == 0)
then
1483 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 83)
1486 print*,
"- CALL FieldScatter FOR TARGET GRID Z0: ", tile
1487 call esmf_fieldscatter(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1488 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1491 if (convert_nst)
then
1495 print*,
"- CALL FieldGather FOR TARGET GRID C_D TILE: ", tile
1496 call esmf_fieldgather(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1497 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1500 if (localpet == 0)
then
1501 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1504 print*,
"- CALL FieldScatter FOR TARGET GRID C_D: ", tile
1505 call esmf_fieldscatter(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1506 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1511 print*,
"- CALL FieldGather FOR TARGET GRID C_0 TILE: ", tile
1512 call esmf_fieldgather(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1513 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1516 if (localpet == 0)
then
1517 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1520 print*,
"- CALL FieldScatter FOR TARGET GRID C_0: ", tile
1521 call esmf_fieldscatter(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1522 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1527 print*,
"- CALL FieldGather FOR TARGET GRID D_CONV TILE: ", tile
1528 call esmf_fieldgather(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1529 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1532 if (localpet == 0)
then
1533 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1536 print*,
"- CALL FieldScatter FOR TARGET GRID D_CONV: ", tile
1537 call esmf_fieldscatter(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1538 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1543 print*,
"- CALL FieldGather FOR TARGET GRID DT_COOL TILE: ", tile
1544 call esmf_fieldgather(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1545 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1548 if (localpet == 0)
then
1549 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1552 print*,
"- CALL FieldScatter FOR TARGET GRID DT_COOL: ", tile
1553 call esmf_fieldscatter(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1554 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1559 print*,
"- CALL FieldGather FOR TARGET GRID IFD TILE: ", tile
1560 call esmf_fieldgather(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1561 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1564 if (localpet == 0)
then
1565 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 1)
1568 print*,
"- CALL FieldScatter FOR TARGET GRID IFD: ", tile
1569 call esmf_fieldscatter(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1570 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1575 print*,
"- CALL FieldGather FOR TARGET GRID QRAIN TILE: ", tile
1576 call esmf_fieldgather(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1577 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1580 if (localpet == 0)
then
1581 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1584 print*,
"- CALL FieldScatter FOR TARGET GRID QRAIN: ", tile
1585 call esmf_fieldscatter(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1586 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1591 print*,
"- CALL FieldGather FOR TARGET GRID TREF TILE: ", tile
1592 call esmf_fieldgather(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1593 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1596 if (localpet == 0)
then
1597 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 11, &
1598 latitude=latitude_one_tile)
1601 print*,
"- CALL FieldScatter FOR TARGET GRID TREF: ", tile
1602 call esmf_fieldscatter(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1603 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1608 print*,
"- CALL FieldGather FOR TARGET GRID W_D TILE: ", tile
1609 call esmf_fieldgather(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1610 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1613 if (localpet == 0)
then
1614 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1617 print*,
"- CALL FieldScatter FOR TARGET GRID W_D: ", tile
1618 call esmf_fieldscatter(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1619 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1624 print*,
"- CALL FieldGather FOR TARGET GRID W_0 TILE: ", tile
1625 call esmf_fieldgather(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1626 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1629 if (localpet == 0)
then
1630 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1633 print*,
"- CALL FieldScatter FOR TARGET GRID W_0: ", tile
1634 call esmf_fieldscatter(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1635 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1640 print*,
"- CALL FieldGather FOR TARGET GRID XS TILE: ", tile
1641 call esmf_fieldgather(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1642 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1645 if (localpet == 0)
then
1646 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1649 print*,
"- CALL FieldScatter FOR TARGET GRID XS: ", tile
1650 call esmf_fieldscatter(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1651 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1656 print*,
"- CALL FieldGather FOR TARGET GRID XT TILE: ", tile
1657 call esmf_fieldgather(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1658 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1661 if (localpet == 0)
then
1662 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1665 print*,
"- CALL FieldScatter FOR TARGET GRID XT: ", tile
1666 call esmf_fieldscatter(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1667 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1672 print*,
"- CALL FieldGather FOR TARGET GRID XU TILE: ", tile
1673 call esmf_fieldgather(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1674 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1677 if (localpet == 0)
then
1678 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1681 print*,
"- CALL FieldScatter FOR TARGET GRID XU: ", tile
1682 call esmf_fieldscatter(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1683 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1688 print*,
"- CALL FieldGather FOR TARGET GRID XV TILE: ", tile
1689 call esmf_fieldgather(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1690 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1693 if (localpet == 0)
then
1694 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1697 print*,
"- CALL FieldScatter FOR TARGET GRID XV: ", tile
1698 call esmf_fieldscatter(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1699 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1704 print*,
"- CALL FieldGather FOR TARGET GRID XZ TILE: ", tile
1705 call esmf_fieldgather(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1706 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1709 if (localpet == 0)
then
1710 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 30)
1713 print*,
"- CALL FieldScatter FOR TARGET GRID XZ: ", tile
1714 call esmf_fieldscatter(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1715 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1720 print*,
"- CALL FieldGather FOR TARGET GRID XTTS TILE: ", tile
1721 call esmf_fieldgather(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1722 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1725 if (localpet == 0)
then
1726 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1729 print*,
"- CALL FieldScatter FOR TARGET GRID XTTS: ", tile
1730 call esmf_fieldscatter(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1731 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1736 print*,
"- CALL FieldGather FOR TARGET GRID XZTS TILE: ", tile
1737 call esmf_fieldgather(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1738 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1741 if (localpet == 0)
then
1742 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1745 print*,
"- CALL FieldScatter FOR TARGET GRID XZTS: ", tile
1746 call esmf_fieldscatter(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1747 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1752 print*,
"- CALL FieldGather FOR TARGET GRID Z_C TILE: ", tile
1753 call esmf_fieldgather(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1754 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1757 if (localpet == 0)
then
1758 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1761 print*,
"- CALL FieldScatter FOR TARGET GRID Z_C: ", tile
1762 call esmf_fieldscatter(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1763 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1768 print*,
"- CALL FieldGather FOR TARGET GRID ZM TILE: ", tile
1769 call esmf_fieldgather(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1770 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1773 if (localpet == 0)
then
1774 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1777 print*,
"- CALL FieldScatter FOR TARGET GRID ZM: ", tile
1778 call esmf_fieldscatter(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1779 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1784 if (localpet == 0)
deallocate(water_target_one_tile)
1788 deallocate(latitude_one_tile)
1790 print*,
"- CALL FieldRegridRelease."
1791 call esmf_fieldregridrelease(routehandle=regrid_water, rc=rc)
1792 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1800 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
1803 where (landmask_target_ptr == 1) mask_target_ptr = 1
1805 method=esmf_regridmethod_conserve
1806 isrctermprocessing = 1
1808 print*,
"- CALL FieldRegridStore for land fields."
1809 call esmf_fieldregridstore(snow_depth_input_grid, &
1810 snow_depth_target_grid, &
1811 srcmaskvalues=(/0/), &
1812 dstmaskvalues=(/0/), &
1813 polemethod=esmf_polemethod_none, &
1814 srctermprocessing=isrctermprocessing, &
1815 unmappedaction=esmf_unmappedaction_ignore, &
1816 normtype=esmf_normtype_fracarea, &
1817 routehandle=regrid_all_land, &
1818 regridmethod=method, &
1819 unmappeddstlist=unmapped_ptr, rc=rc)
1820 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1823 print*,
"- CALL Field_Regrid for snow depth over land."
1824 call esmf_fieldregrid(snow_depth_input_grid, &
1825 snow_depth_target_grid, &
1826 routehandle=regrid_all_land, &
1827 termorderflag=esmf_termorder_srcseq, &
1828 zeroregion=esmf_region_select, &
1831 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1834 print*,
"- CALL Field_Regrid for snow liq equiv over land."
1835 call esmf_fieldregrid(snow_liq_equiv_input_grid, &
1836 snow_liq_equiv_target_grid, &
1837 routehandle=regrid_all_land, &
1838 termorderflag=esmf_termorder_srcseq, &
1839 zeroregion=esmf_region_select, rc=rc)
1840 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1843 print*,
"- CALL Field_Regrid for canopy mc."
1844 call esmf_fieldregrid(canopy_mc_input_grid, &
1845 canopy_mc_target_grid, &
1846 routehandle=regrid_all_land, &
1847 termorderflag=esmf_termorder_srcseq, rc=rc)
1848 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1851 print*,
"- CALL FieldGet FOR TARGET snow depth."
1852 call esmf_fieldget(snow_depth_target_grid, &
1853 farrayptr=snow_depth_target_ptr, rc=rc)
1854 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1857 print*,
"- CALL FieldGet FOR TARGET snow liq equiv."
1858 call esmf_fieldget(snow_liq_equiv_target_grid, &
1859 farrayptr=snow_liq_equiv_target_ptr, rc=rc)
1860 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1863 print*,
"- CALL FieldGet FOR TARGET canopy moisture."
1864 call esmf_fieldget(canopy_mc_target_grid, &
1865 farrayptr=canopy_mc_target_ptr, rc=rc)
1866 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1869 l = lbound(unmapped_ptr)
1870 u = ubound(unmapped_ptr)
1873 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1874 snow_depth_target_ptr(i,j) = -9999.9
1875 snow_liq_equiv_target_ptr(i,j) = -9999.9
1876 canopy_mc_target_ptr(i,j) = -9999.9
1879 do tile = 1, num_tiles_target_grid
1881 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile
1882 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1883 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1886 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1887 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1888 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1891 if (localpet == 0)
then
1892 allocate(land_target_one_tile(i_target,j_target))
1893 land_target_one_tile = 0
1894 where(mask_target_one_tile == 1) land_target_one_tile = 1
1895 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 66)
1898 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH: ", tile
1899 call esmf_fieldscatter(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1900 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1903 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQUID EQUIV: ", tile
1904 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1905 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1908 if (localpet == 0)
then
1909 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 65)
1912 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW LIQUID EQUIV: ", tile
1913 call esmf_fieldscatter(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1914 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1917 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MC: ", tile
1918 call esmf_fieldgather(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1919 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1922 if (localpet == 0)
then
1923 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 223)
1924 deallocate(land_target_one_tile)
1927 print*,
"- CALL FieldScatter FOR TARGET GRID CANOPY MC: ", tile
1928 call esmf_fieldscatter(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1929 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1934 print*,
"- CALL FieldRegridRelease."
1935 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
1936 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1943 print*,
"- CALL FieldGet FOR INPUT GRID VEG TYPE."
1944 call esmf_fieldget(veg_type_input_grid, &
1945 farrayptr=veg_type_input_ptr, rc=rc)
1946 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1949 print*,
'land ice check ',veg_type_landice_input
1952 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 1
1954 print*,
"- CALL FieldGet FOR TARGET GRID VEG TYPE."
1955 call esmf_fieldget(veg_type_target_grid, &
1956 farrayptr=veg_type_target_ptr, rc=rc)
1957 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1961 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 1
1963 method=esmf_regridmethod_nearest_stod
1964 isrctermprocessing = 1
1966 print*,
"- CALL FieldRegridStore for landice fields."
1967 call esmf_fieldregridstore(soil_temp_input_grid, &
1968 soil_temp_target_grid, &
1969 srcmaskvalues=(/0/), &
1970 dstmaskvalues=(/0/), &
1971 polemethod=esmf_polemethod_none, &
1972 srctermprocessing=isrctermprocessing, &
1973 unmappedaction=esmf_unmappedaction_ignore, &
1974 normtype=esmf_normtype_fracarea, &
1975 routehandle=regrid_landice, &
1976 regridmethod=method, &
1977 unmappeddstlist=unmapped_ptr, rc=rc)
1978 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1981 print*,
"- CALL Field_Regrid for soil temperature over landice."
1982 call esmf_fieldregrid(soil_temp_input_grid, &
1983 soil_temp_target_grid, &
1984 routehandle=regrid_landice, &
1985 termorderflag=esmf_termorder_srcseq, &
1986 zeroregion=esmf_region_select, rc=rc)
1987 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1990 print*,
"- CALL Field_Regrid for skin temperature over landice."
1991 call esmf_fieldregrid(skin_temp_input_grid, &
1992 skin_temp_target_grid, &
1993 routehandle=regrid_landice, &
1994 termorderflag=esmf_termorder_srcseq, &
1995 zeroregion=esmf_region_select, rc=rc)
1996 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1999 print*,
"- CALL Field_Regrid for terrain over landice."
2000 call esmf_fieldregrid(terrain_input_grid, &
2001 terrain_from_input_grid, &
2002 routehandle=regrid_landice, &
2003 termorderflag=esmf_termorder_srcseq, &
2004 zeroregion=esmf_region_select, rc=rc)
2005 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2008 print*,
"- CALL FieldGet FOR TARGET grid column temperature over landice."
2009 call esmf_fieldget(soil_temp_target_grid, &
2010 farrayptr=soil_temp_target_ptr, rc=rc)
2011 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2014 print*,
"- CALL FieldGet FOR TARGET skin temperature."
2015 call esmf_fieldget(skin_temp_target_grid, &
2016 farrayptr=skin_temp_target_ptr, rc=rc)
2017 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2020 print*,
"- CALL FieldGet FOR terrain from input grid."
2021 call esmf_fieldget(terrain_from_input_grid, &
2022 farrayptr=terrain_from_input_ptr, rc=rc)
2023 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2026 l = lbound(unmapped_ptr)
2027 u = ubound(unmapped_ptr)
2030 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
2031 soil_temp_target_ptr(i,j,:) = -9999.9
2032 skin_temp_target_ptr(i,j) = -9999.9
2033 terrain_from_input_ptr(i,j) = -9999.9
2036 if (localpet == 0)
then
2037 allocate (veg_type_target_one_tile(i_target,j_target))
2038 allocate (land_target_one_tile(i_target,j_target))
2039 allocate (data_one_tile2(i_target,j_target))
2041 allocate (veg_type_target_one_tile(0,0))
2042 allocate (land_target_one_tile(0,0))
2043 allocate (data_one_tile2(0,0))
2046 do tile = 1, num_tiles_target_grid
2048 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP TILE: ", tile
2049 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2050 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2053 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
2054 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
2055 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2058 if (localpet == 0)
then
2059 land_target_one_tile = 0
2060 where(nint(veg_type_target_one_tile) == veg_type_landice_target) land_target_one_tile = 1
2061 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 21)
2064 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMP, TILE: ", tile
2065 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2066 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2069 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2070 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2071 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2074 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID LAND, TILE: ", tile
2075 call esmf_fieldgather(terrain_from_input_grid_land, data_one_tile2, rootpet=0, tile=tile, rc=rc)
2076 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2079 if (localpet == 0)
then
2080 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7, terrain_land=data_one_tile2)
2083 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2084 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2085 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2088 print*,
"- CALL FieldGather FOR TARGET GRID LANDICE COLUMN TEMP: ", tile
2089 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2090 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2093 if (localpet == 0)
then
2094 do j = 1, lsoil_target
2095 data_one_tile = data_one_tile_3d(:,:,j)
2096 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 21)
2097 data_one_tile_3d(:,:,j) = data_one_tile
2101 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
2102 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2103 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2108 deallocate (veg_type_target_one_tile)
2109 deallocate (land_target_one_tile)
2111 print*,
"- CALL FieldRegridRelease."
2112 call esmf_fieldregridrelease(routehandle=regrid_landice, rc=rc)
2113 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2121 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
2122 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 0
2125 where (landmask_target_ptr == 1) mask_target_ptr = 1
2126 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 0
2128 method=esmf_regridmethod_nearest_stod
2129 isrctermprocessing = 1
2131 print*,
"- CALL FieldRegridStore for 3d land (but no land ice) fields."
2132 call esmf_fieldregridstore(soilm_tot_input_grid, &
2133 soilm_tot_target_grid, &
2134 srcmaskvalues=(/0/), &
2135 dstmaskvalues=(/0/), &
2136 polemethod=esmf_polemethod_none, &
2137 srctermprocessing=isrctermprocessing, &
2138 unmappedaction=esmf_unmappedaction_ignore, &
2139 normtype=esmf_normtype_fracarea, &
2140 routehandle=regrid_land, &
2141 regridmethod=method, &
2142 unmappeddstlist=unmapped_ptr, rc=rc)
2143 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2146 print*,
"- CALL Field_Regrid for total soil moisture over land."
2147 call esmf_fieldregrid(soilm_tot_input_grid, &
2148 soilm_tot_target_grid, &
2149 routehandle=regrid_land, &
2150 termorderflag=esmf_termorder_srcseq, rc=rc)
2151 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2154 print*,
"- CALL Field_Regrid for soil temperature over land."
2155 call esmf_fieldregrid(soil_temp_input_grid, &
2156 soil_temp_target_grid, &
2157 routehandle=regrid_land, &
2158 termorderflag=esmf_termorder_srcseq, &
2159 zeroregion=esmf_region_select, rc=rc)
2160 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2163 print*,
"- CALL Field_Regrid for skin temperature over land."
2164 call esmf_fieldregrid(skin_temp_input_grid, &
2165 skin_temp_target_grid, &
2166 routehandle=regrid_land, &
2167 termorderflag=esmf_termorder_srcseq, &
2168 zeroregion=esmf_region_select, rc=rc)
2169 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2172 print*,
"- CALL Field_Regrid for terrain over land."
2173 call esmf_fieldregrid(terrain_input_grid, &
2174 terrain_from_input_grid, &
2175 routehandle=regrid_land, &
2176 termorderflag=esmf_termorder_srcseq, &
2177 zeroregion=esmf_region_select, rc=rc)
2178 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2181 print*,
"- CALL Field_Regrid for soil type over land."
2182 call esmf_fieldregrid(soil_type_input_grid, &
2183 soil_type_from_input_grid, &
2184 routehandle=regrid_land, &
2185 termorderflag=esmf_termorder_srcseq, rc=rc)
2186 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2189 if (.not. vgfrc_from_climo)
then
2190 print*,
"- CALL Field_Regrid for veg greenness over land."
2191 call esmf_fieldregrid(veg_greenness_input_grid, &
2192 veg_greenness_target_grid, &
2193 routehandle=regrid_land, &
2194 termorderflag=esmf_termorder_srcseq, rc=rc)
2195 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2199 if (.not. minmax_vgfrc_from_climo)
then
2200 print*,
"- CALL Field_Regrid for max veg greenness over land."
2201 call esmf_fieldregrid(max_veg_greenness_input_grid, &
2202 max_veg_greenness_target_grid, &
2203 routehandle=regrid_land, &
2204 termorderflag=esmf_termorder_srcseq, rc=rc)
2205 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2208 print*,
"- CALL Field_Regrid for min veg greenness over land."
2209 call esmf_fieldregrid(min_veg_greenness_input_grid, &
2210 min_veg_greenness_target_grid, &
2211 routehandle=regrid_land, &
2212 termorderflag=esmf_termorder_srcseq, rc=rc)
2213 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2217 if (.not. lai_from_climo)
then
2218 print*,
"- CALL Field_Regrid for leaf area index over land."
2219 call esmf_fieldregrid(lai_input_grid, &
2221 routehandle=regrid_land, &
2222 termorderflag=esmf_termorder_srcseq, rc=rc)
2223 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2228 print*,
"- CALL FieldGet FOR TARGET grid total soil moisture over land."
2229 call esmf_fieldget(soilm_tot_target_grid, &
2230 farrayptr=soilm_tot_target_ptr, rc=rc)
2231 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2234 print*,
"- CALL FieldGet FOR TARGET grid soil temp over ice."
2235 call esmf_fieldget(soil_temp_target_grid, &
2236 farrayptr=soil_temp_target_ptr, rc=rc)
2237 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2240 print*,
"- CALL FieldGet FOR TARGET skin temperature."
2241 call esmf_fieldget(skin_temp_target_grid, &
2242 farrayptr=skin_temp_target_ptr, rc=rc)
2243 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2246 print*,
"- CALL FieldGet FOR terrain from input grid."
2247 call esmf_fieldget(terrain_from_input_grid, &
2248 farrayptr=terrain_from_input_ptr, rc=rc)
2249 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2252 print*,
"- CALL FieldGet FOR soil type from input grid."
2253 call esmf_fieldget(soil_type_from_input_grid, &
2254 farrayptr=soil_type_from_input_ptr, rc=rc)
2255 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2258 if (.not. vgfrc_from_climo)
then
2259 print*,
"- CALL FieldGet FOR TARGET veg greenness."
2260 call esmf_fieldget(veg_greenness_target_grid, &
2261 farrayptr=veg_greenness_target_ptr, rc=rc)
2262 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2266 if (.not. minmax_vgfrc_from_climo)
then
2267 print*,
"- CALL FieldGet FOR TARGET max veg greenness."
2268 call esmf_fieldget(max_veg_greenness_target_grid, &
2269 farrayptr=max_veg_greenness_target_ptr, rc=rc)
2270 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2273 print*,
"- CALL FieldGet FOR TARGET min veg greenness."
2274 call esmf_fieldget(min_veg_greenness_target_grid, &
2275 farrayptr=min_veg_greenness_target_ptr, rc=rc)
2276 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2280 if (.not. lai_from_climo)
then
2281 print*,
"- CALL FieldGet FOR TARGET lai."
2282 call esmf_fieldget(lai_target_grid, &
2283 farrayptr=lai_target_ptr, rc=rc)
2284 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2288 l = lbound(unmapped_ptr)
2289 u = ubound(unmapped_ptr)
2291 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
2292 soilm_tot_target_ptr(i,j,:) = -9999.9
2293 soil_temp_target_ptr(i,j,:) = -9999.9
2294 skin_temp_target_ptr(i,j) = -9999.9
2295 terrain_from_input_ptr(i,j) = -9999.9
2296 soil_type_from_input_ptr(i,j) = -9999.9
2297 veg_greenness_target_ptr(i,j) = -9999.9
2298 max_veg_greenness_target_ptr(i,j) = -9999.9
2299 min_veg_greenness_target_ptr(i,j) = -9999.9
2300 lai_target_ptr(i,j) = -9999.9
2303 if (localpet == 0)
then
2304 allocate (veg_type_target_one_tile(i_target,j_target))
2306 allocate (veg_type_target_one_tile(0,0))
2309 do tile = 1, num_tiles_target_grid
2311 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
2312 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
2313 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2316 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
2317 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
2318 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2321 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2322 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2323 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2326 if (localpet == 0)
then
2327 where(nint(veg_type_target_one_tile) == veg_type_landice_target) mask_target_one_tile = 0
2328 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 7)
2331 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2332 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2333 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2336 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile
2337 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2338 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2341 if (localpet == 0)
then
2342 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 85)
2345 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile
2346 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2347 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2350 print*,
"- CALL FieldGather FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile
2351 call esmf_fieldgather(soil_type_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2352 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2355 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID, TILE: ", tile
2356 call esmf_fieldgather(soil_type_target_grid, data_one_tile2, rootpet=0,tile=tile, rc=rc)
2357 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2366 if (.not. sotyp_from_climo)
then
2367 if (localpet==0)
then
2368 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224,soilt_climo=data_one_tile2)
2371 if (localpet == 0 .and. maxval(data_one_tile) > 0 .and. (trim(external_model) .ne.
"GFS" .or. trim(input_type) .ne.
"grib2"))
then
2374 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224)
2375 elseif (localpet == 0)
then
2376 data_one_tile = data_one_tile2
2380 if (.not. sotyp_from_climo)
then
2381 print*,
"- CALL FieldScatter FOR SOIL TYPE TARGET GRID, TILE: ", tile
2382 call esmf_fieldscatter(soil_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2383 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2387 print*,
"- CALL FieldScatter FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile
2388 call esmf_fieldscatter(soil_type_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2389 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2394 if (.not. vgfrc_from_climo)
then
2395 print*,
"- CALL FieldGather FOR TARGET GRID VEG GREENNESS, TILE: ", tile
2396 call esmf_fieldgather(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2397 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2400 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2401 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 226)
2404 print*,
"- CALL FieldScatter FOR VEG GREENNESS TARGET GRID, TILE: ", tile
2405 call esmf_fieldscatter(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2406 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2410 if (.not. minmax_vgfrc_from_climo)
then
2411 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEG GREENNESS, TILE: ", tile
2412 call esmf_fieldgather(max_veg_greenness_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2413 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2416 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2417 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 227)
2420 print*,
"- CALL FieldScatter FOR MAX VEG GREENNESS TARGET GRID, TILE: ", tile
2421 call esmf_fieldscatter(max_veg_greenness_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2422 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2425 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEG GREENNESS, TILE: ", tile
2426 call esmf_fieldgather(min_veg_greenness_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2427 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2430 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2431 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile,228)
2435 print*,
"- CALL FieldScatter FOR MIN VEG GREENNESS TARGET GRID, TILE: ",tile
2436 call esmf_fieldscatter(min_veg_greenness_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2437 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2442 if (.not. lai_from_climo)
then
2443 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX, TILE: ", tile
2444 call esmf_fieldgather(lai_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2445 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2448 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2449 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 229)
2452 print*,
"- CALL FieldScatter FOR LEAF AREA INDEX TARGET GRID, TILE: ", tile
2453 call esmf_fieldscatter(lai_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2454 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2458 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
2459 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2460 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2463 if (localpet == 0)
then
2464 do j = 1, lsoil_target
2465 data_one_tile = data_one_tile_3d(:,:,j)
2466 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 86)
2467 data_one_tile_3d(:,:,j) = data_one_tile
2471 print*,
"- CALL FieldScatter FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
2472 call esmf_fieldscatter(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2473 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2476 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
2477 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2478 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2481 if (localpet == 0)
then
2482 do j = 1, lsoil_target
2483 data_one_tile = data_one_tile_3d(:,:,j)
2484 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 85)
2485 data_one_tile_3d(:,:,j) = data_one_tile
2489 print*,
"- CALL FieldScatter FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
2490 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2491 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2494 if (tg3_from_soil)
then
2495 print*,
"- CALL FieldScatter FOR TARGET GRID SUBSTRATE TEMPERATURE, TILE: ", tile
2496 call esmf_fieldscatter(substrate_temp_target_grid, data_one_tile_3d(:,:,lsoil_target), rootpet=0, tile=tile, rc=rc)
2497 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2503 print*,
"- CALL FieldRegridRelease."
2504 call esmf_fieldregridrelease(routehandle=regrid_land, rc=rc)
2505 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2508 deallocate(veg_type_target_one_tile)
2510 deallocate(data_one_tile, data_one_tile2)
2511 deallocate(data_one_tile_3d)
2512 deallocate(mask_target_one_tile)
2532 veg_type_target_grid
2536 integer :: clb(3), cub(3), rc
2537 integer :: i, j, n, soil_type
2539 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2542 real(esmf_kind_r8),
pointer :: soilm_liq_ptr(:,:,:)
2543 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
2544 real(esmf_kind_r8),
pointer :: soil_temp_ptr(:,:,:)
2545 real(esmf_kind_r8),
pointer :: soil_type_ptr(:,:)
2546 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
2548 print*,
"- COMPUTE LIQUID PORTION OF TOTAL SOIL MOISTURE."
2550 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
2551 call esmf_fieldget(soilm_tot_target_grid, &
2552 computationallbound=clb, &
2553 computationalubound=cub, &
2554 farrayptr=soilm_tot_ptr, rc=rc)
2555 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2558 print*,
"- CALL FieldGet FOR LIQUID SOIL MOISTURE."
2559 call esmf_fieldget(soilm_liq_target_grid, &
2560 farrayptr=soilm_liq_ptr, rc=rc)
2561 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2564 print*,
"- CALL FieldGet FOR SOIL TEMPERATURE."
2565 call esmf_fieldget(soil_temp_target_grid, &
2566 farrayptr=soil_temp_ptr, rc=rc)
2567 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2570 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
2571 call esmf_fieldget(veg_type_target_grid, &
2572 farrayptr=veg_type_ptr, rc=rc)
2573 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2576 print*,
"- CALL FieldGet FOR SOIL TYPE."
2577 call esmf_fieldget(soil_type_target_grid, &
2578 farrayptr=soil_type_ptr, rc=rc)
2579 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2582 print*,
"- CALL FieldGet FOR LANDMASK."
2583 call esmf_fieldget(landmask_target_grid, &
2584 farrayptr=landmask_ptr, rc=rc)
2585 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2588 do j = clb(2), cub(2)
2589 do i = clb(1), cub(1)
2595 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
2597 soil_type = nint(soil_type_ptr(i,j))
2599 do n = clb(3), cub(3)
2601 if (soil_temp_ptr(i,j,n) < (frz_h2o-0.0001))
then
2603 bx = bb_target(soil_type)
2605 if (bx .gt. blim) bx = blim
2607 fk=(((hlice/(grav*(-satpsi_target(soil_type))))* &
2608 ((soil_temp_ptr(i,j,n)-frz_h2o)/soil_temp_ptr(i,j,n)))** &
2609 (-1/bx))*maxsmc_target(soil_type)
2611 if (fk .lt. 0.02) fk = 0.02
2613 soilm_liq_ptr(i,j,n) = min( fk, soilm_tot_ptr(i,j,n) )
2621 soilm_liq_ptr(i,j,n) =
frh2o(soil_temp_ptr(i,j,n), &
2622 soilm_tot_ptr(i,j,n), soilm_liq_ptr(i,j,n), &
2623 maxsmc_target(soil_type),bb_target(soil_type), &
2624 satpsi_target(soil_type))
2628 soilm_liq_ptr(i,j,n) = soilm_tot_ptr(i,j,n)
2798 use static_data, only : veg_type_target_grid, veg_greenness_target_grid, &
2799 soil_type_target_grid, max_veg_greenness_target_grid,&
2800 min_veg_greenness_target_grid, mxsno_albedo_target_grid, &
2801 alvsf_target_grid,alvwf_target_grid,&
2802 alnsf_target_grid,alnwf_target_grid,&
2803 facsf_target_grid,facwf_target_grid, &
2804 slope_type_target_grid
2808 integer :: clb(3), cub(3), i, j, rc
2810 integer(esmf_kind_r8),
pointer :: landmask_ptr(:,:)
2812 real(esmf_kind_r8),
pointer :: soilm_target_ptr(:,:,:), &
2813 soilt_target_ptr(:,:,:), &
2814 alvsf_target_ptr(:,:), &
2815 alnsf_target_ptr(:,:), &
2816 alvwf_target_ptr(:,:), &
2817 alnwf_target_ptr(:,:), &
2818 veg_greenness_target_ptr(:,:), &
2819 min_veg_greenness_target_ptr(:,:), &
2820 max_veg_greenness_target_ptr(:,:), &
2821 canopy_mc_target_ptr(:,:), &
2822 mxsno_albedo_target_ptr(:,:), &
2823 soil_type_target_ptr(:,:), &
2824 veg_type_target_ptr(:,:), &
2825 facsf_target_ptr(:,:), &
2826 facwf_target_ptr(:,:), &
2827 slope_type_target_ptr(:,:)
2830 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
2831 call esmf_fieldget(landmask_target_grid, &
2832 farrayptr=landmask_ptr, rc=rc)
2833 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2836 print*,
"- CALL FieldGet FOR SOIL MOIS TARGET GRID."
2837 call esmf_fieldget(soilm_tot_target_grid, &
2838 computationallbound=clb, &
2839 computationalubound=cub, &
2840 farrayptr=soilm_target_ptr, rc=rc)
2841 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2844 print*,
"- CALL FieldGet FOR SOIL TEMP TARGET GRID."
2845 call esmf_fieldget(soil_temp_target_grid, &
2846 farrayptr=soilt_target_ptr, rc=rc)
2847 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2850 print*,
"- CALL FieldGet FOR TARGET GRID SOIL TYPE."
2851 call esmf_fieldget(soil_type_target_grid, &
2852 farrayptr=soil_type_target_ptr, rc=rc)
2853 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2856 print*,
"- CALL FieldGet FOR TARGET GRID SOIL TYPE."
2857 call esmf_fieldget(slope_type_target_grid, &
2858 farrayptr=slope_type_target_ptr, rc=rc)
2859 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2862 print*,
"- CALL FieldGet FOR TARGET GRID VEG TYPE."
2863 call esmf_fieldget(veg_type_target_grid, &
2864 farrayptr=veg_type_target_ptr, rc=rc)
2865 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2868 print*,
"- CALL FieldGet FOR TARGET GRID ALVSF."
2869 call esmf_fieldget(alvsf_target_grid, &
2870 farrayptr=alvsf_target_ptr, rc=rc)
2871 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2874 print*,
"- CALL FieldGet FOR TARGET GRID ALNSF."
2875 call esmf_fieldget(alnsf_target_grid, &
2876 farrayptr=alnsf_target_ptr, rc=rc)
2877 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2880 print*,
"- CALL FieldGet FOR TARGET GRID ALVWF."
2881 call esmf_fieldget(alvwf_target_grid, &
2882 farrayptr=alvwf_target_ptr, rc=rc)
2883 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2886 print*,
"- CALL FieldGet FOR TARGET GRID ALNWF."
2887 call esmf_fieldget(alnwf_target_grid, &
2888 farrayptr=alnwf_target_ptr, rc=rc)
2889 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2892 print*,
"- CALL FieldGet FOR TARGET GRID FACSF."
2893 call esmf_fieldget(facsf_target_grid, &
2894 farrayptr=facsf_target_ptr, rc=rc)
2895 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2898 print*,
"- CALL FieldGet FOR TARGET GRID FACWF."
2899 call esmf_fieldget(facwf_target_grid, &
2900 farrayptr=facwf_target_ptr, rc=rc)
2901 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2904 print*,
"- CALL FieldGet FOR TARGET GRID VEG FRAC."
2905 call esmf_fieldget(veg_greenness_target_grid, &
2906 farrayptr=veg_greenness_target_ptr, rc=rc)
2907 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2910 print*,
"- CALL FieldGet FOR TARGET GRID MAX VEG FRAC."
2911 call esmf_fieldget(max_veg_greenness_target_grid, &
2912 farrayptr=max_veg_greenness_target_ptr, rc=rc)
2913 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2916 print*,
"- CALL FieldGet FOR TARGET GRID MIN VEG FRAC."
2917 call esmf_fieldget(min_veg_greenness_target_grid, &
2918 farrayptr=min_veg_greenness_target_ptr, rc=rc)
2919 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2922 print*,
"- CALL FieldGet FOR TARGET GRID CANOPY MC."
2923 call esmf_fieldget(canopy_mc_target_grid, &
2924 farrayptr=canopy_mc_target_ptr, rc=rc)
2925 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2928 print*,
"- CALL FieldGet FOR TARGET GRID SNOW ALBEDO."
2929 call esmf_fieldget(mxsno_albedo_target_grid, &
2930 farrayptr=mxsno_albedo_target_ptr, rc=rc)
2931 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2935 do j = clb(2),cub(2)
2936 if (landmask_ptr(i,j)==1 .and. soilm_target_ptr(i,j,1) < 0.001 .and. nint(veg_type_target_ptr(i,j)) /= veg_type_landice_target)
then
2937 WRITE(*,
'(a,2i5,a,2i3)')
" CORRECTING G.P. ",i,j,
" PARAMS FROM SEA TO LAND &
2938 VALUES; curr stype,vtype=", nint(soil_type_target_ptr(i,j)),nint(veg_type_target_ptr(i,j))
2942 soilm_target_ptr(i,j,:) = -99999.9
2943 soilt_target_ptr(i,j,:) = -99999.9
2945 soil_type_target_ptr(i,j) = -99999.9
2946 veg_type_target_ptr(i,j) = -99999.9
2948 alvsf_target_ptr(i,j) = -99999.9
2949 alvwf_target_ptr(i,j) = -99999.9
2950 alnsf_target_ptr(i,j) = -99999.9
2951 alnwf_target_ptr(i,j) = -99999.9
2952 facsf_target_ptr(i,j) = -99999.9
2953 facwf_target_ptr(i,j) = -99999.9
2954 min_veg_greenness_target_ptr(i,j) = -99999.9
2955 max_veg_greenness_target_ptr(i,j) = -99999.9
2956 veg_greenness_target_ptr(i,j) = -99999.9
2957 mxsno_albedo_target_ptr(i,j) = -99999.9
2958 canopy_mc_target_ptr(i,j) = -99999.9
2959 slope_type_target_ptr(i,j) = -99999.9
2981 use model_grid, only : lsoil_target, i_target, j_target, &
2982 landmask_target_grid
2984 alvsf_target_grid, &
2985 alvwf_target_grid, &
2986 alnsf_target_grid, &
2987 alnwf_target_grid, &
2988 facsf_target_grid, &
2989 facwf_target_grid, &
2990 mxsno_albedo_target_grid, &
2991 max_veg_greenness_target_grid, &
2992 min_veg_greenness_target_grid, &
2993 slope_type_target_grid, &
2994 veg_greenness_target_grid, &
2995 veg_type_target_grid
2999 integer,
intent(in) :: localpet
3001 integer :: rc, k_soil
3002 integer(esmf_kind_i8) :: maskdata_one_tile(i_target,j_target)
3003 real(esmf_kind_r8) :: soiltdata_one_tile_3d(i_target,j_target,lsoil_target), &
3004 soilmdata_one_tile_3d(i_target,j_target,lsoil_target), &
3005 soiltype_one_tile(i_target,j_target), &
3006 alvsf_one_tile(i_target,j_target), &
3007 alvwf_one_tile(i_target,j_target), &
3008 alnsf_one_tile(i_target,j_target), &
3009 alnwf_one_tile(i_target,j_target), &
3010 facsf_one_tile(i_target,j_target), &
3011 facwf_one_tile(i_target,j_target), &
3012 mxsno_albedo_one_tile(i_target,j_target), &
3013 max_veg_greenness_one_tile(i_target,j_target), &
3014 min_veg_greenness_one_tile(i_target,j_target), &
3015 slope_type_one_tile(i_target,j_target), &
3016 veg_greenness_one_tile(i_target,j_target), &
3017 veg_type_one_tile(i_target,j_target), &
3018 canopy_mc_one_tile(i_target,j_target), &
3019 tmp(i_target,j_target)
3022 call esmf_fieldgather(landmask_target_grid, maskdata_one_tile,rootpet=0,tile=1,rc=rc)
3023 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3028 call esmf_fieldgather(soil_temp_target_grid, soiltdata_one_tile_3d, rootpet=0, tile=1,rc=rc)
3029 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3031 call esmf_fieldgather(soilm_tot_target_grid, soilmdata_one_tile_3d, rootpet=0,tile=1,rc=rc)
3032 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3034 call esmf_fieldgather(soil_type_target_grid, soiltype_one_tile,rootpet=0,tile=1,rc=rc)
3035 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3037 call esmf_fieldgather(alvsf_target_grid, alvsf_one_tile,rootpet=0,tile=1,rc=rc)
3038 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3040 call esmf_fieldgather(alvwf_target_grid, alvwf_one_tile,rootpet=0,tile=1,rc=rc)
3041 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3043 call esmf_fieldgather(alnsf_target_grid, alnsf_one_tile,rootpet=0,tile=1,rc=rc)
3044 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3046 call esmf_fieldgather(alnwf_target_grid, alnwf_one_tile,rootpet=0,tile=1,rc=rc)
3047 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3049 call esmf_fieldgather(facsf_target_grid, facsf_one_tile,rootpet=0,tile=1,rc=rc)
3050 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3052 call esmf_fieldgather(facwf_target_grid, facwf_one_tile,rootpet=0,tile=1,rc=rc)
3053 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3055 call esmf_fieldgather(mxsno_albedo_target_grid,mxsno_albedo_one_tile,rootpet=0,tile=1,rc=rc)
3056 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3058 call esmf_fieldgather(max_veg_greenness_target_grid, max_veg_greenness_one_tile,rootpet=0,tile=1,rc=rc)
3059 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3061 call esmf_fieldgather(min_veg_greenness_target_grid, min_veg_greenness_one_tile,rootpet=0,tile=1,rc=rc)
3062 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3064 call esmf_fieldgather(slope_type_target_grid, slope_type_one_tile,rootpet=0,tile=1,rc=rc)
3065 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3067 call esmf_fieldgather(veg_greenness_target_grid, veg_greenness_one_tile,rootpet=0,tile=1,rc=rc)
3068 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3070 call esmf_fieldgather(veg_type_target_grid, veg_type_one_tile,rootpet=0,tile=1,rc=rc)
3071 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3073 call esmf_fieldgather(canopy_mc_target_grid,canopy_mc_one_tile,rootpet=0,tile=1,rc=rc)
3074 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3076 if (localpet == 0)
then
3078 call
search(soiltype_one_tile,maskdata_one_tile,i_target,j_target,1,224)
3079 call
search(alvsf_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3080 call
search(alvwf_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3081 call
search(alnsf_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3082 call
search(alnwf_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3083 call
search(facsf_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3084 call
search(facwf_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3085 call
search(mxsno_albedo_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3086 call
search(max_veg_greenness_one_tile,maskdata_one_tile,i_target,j_target,1,226)
3087 call
search(min_veg_greenness_one_tile,maskdata_one_tile,i_target,j_target,1,226)
3088 call
search(slope_type_one_tile,maskdata_one_tile,i_target,j_target,1,0)
3089 call
search(veg_greenness_one_tile,maskdata_one_tile,i_target,j_target,1,226)
3090 call
search(veg_type_one_tile,maskdata_one_tile,i_target,j_target,1,225)
3091 call
search(canopy_mc_one_tile,maskdata_one_tile,i_target,j_target,1,223)
3093 do k_soil = 1, lsoil_target
3094 tmp = soiltdata_one_tile_3d(:,:,k_soil)
3095 call
search(tmp,maskdata_one_tile,i_target,j_target,1,85)
3096 soiltdata_one_tile_3d(:,:,k_soil) = tmp
3098 tmp = soilmdata_one_tile_3d(:,:,k_soil)
3099 call
search(tmp,maskdata_one_tile,i_target,j_target,1,86)
3100 soilmdata_one_tile_3d(:,:,k_soil) = tmp
3105 call esmf_fieldscatter(soilm_tot_target_grid, soilmdata_one_tile_3d, rootpet=0, rc=rc)
3106 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3108 call esmf_fieldscatter(soil_temp_target_grid, soiltdata_one_tile_3d, rootpet=0, rc=rc)
3109 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3111 call esmf_fieldscatter(soil_type_target_grid, soiltype_one_tile, rootpet=0,rc=rc)
3112 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3114 call esmf_fieldscatter(alvsf_target_grid, alvsf_one_tile, rootpet=0,rc=rc)
3115 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3117 call esmf_fieldscatter(alvwf_target_grid, alvwf_one_tile, rootpet=0,rc=rc)
3118 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3120 call esmf_fieldscatter(alnsf_target_grid, alnsf_one_tile, rootpet=0,rc=rc)
3121 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3123 call esmf_fieldscatter(alnwf_target_grid, alnwf_one_tile, rootpet=0,rc=rc)
3124 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3126 call esmf_fieldscatter(facsf_target_grid, facsf_one_tile, rootpet=0,rc=rc)
3127 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3129 call esmf_fieldscatter(facwf_target_grid, facwf_one_tile, rootpet=0,rc=rc)
3130 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3132 call esmf_fieldscatter(mxsno_albedo_target_grid, mxsno_albedo_one_tile, rootpet=0,rc=rc)
3133 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3135 call esmf_fieldscatter(max_veg_greenness_target_grid, max_veg_greenness_one_tile, rootpet=0,rc=rc)
3136 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3138 call esmf_fieldscatter(min_veg_greenness_target_grid, min_veg_greenness_one_tile, rootpet=0,rc=rc)
3139 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3141 call esmf_fieldscatter(slope_type_target_grid, slope_type_one_tile, rootpet=0,rc=rc)
3142 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3144 call esmf_fieldscatter(veg_greenness_target_grid, veg_greenness_one_tile, rootpet=0,rc=rc)
3145 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3147 call esmf_fieldscatter(veg_type_target_grid, veg_type_one_tile, rootpet=0,rc=rc)
3148 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3150 call esmf_fieldscatter(canopy_mc_target_grid, canopy_mc_one_tile, rootpet=0,rc=rc)
3151 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3181 FUNCTION frh2o (TKELV,SMC,SH2O,SMCMAX,BEXP,PSIS)
3198 REAL(esmf_kind_r8) :: sh2o
3199 REAL(esmf_kind_r8) :: smc
3203 REAL(esmf_kind_r8) :: tkelv
3205 REAL,
PARAMETER :: ck = 8.0
3206 REAL,
PARAMETER :: error = 0.005
3215 IF (bexp .GT. blim) bx = blim
3224 IF (ck .NE. 0.0)
THEN
3239 IF (swl .GT. (smc-0.02)) swl = smc-0.02
3240 IF (swl .LT. 0.) swl = 0.
3246 DO WHILE ( (nlog .LT. 10) .AND. (kcount .EQ. 0) )
3249 df = log(( psis*grav/hlice ) * ( ( 1.+ck*swl )**2. ) * &
3250 ( smcmax/(smc-swl) )**bx) - log(-(tkelv-frz_h2o)/tkelv)
3251 denom = 2. * ck / ( 1.+ck*swl ) + bx / ( smc - swl )
3252 swlk = swl - df/denom
3258 IF (swlk .GT. (smc-0.02)) swlk = smc - 0.02
3259 IF (swlk .LT. 0.) swlk = 0.
3265 dswl = abs(swlk-swl)
3273 IF ( dswl .LE. error )
THEN
3299 IF (kcount .EQ. 0)
THEN
3301 fk = (((hlice/(grav*(-psis)))* &
3302 ((tkelv-frz_h2o)/tkelv))**(-1/bx))*smcmax
3304 IF (fk .LT. 0.02) fk = 0.02
3306 frh2o = min(fk, smc)
3326 maxsmc_input, maxsmc_target, &
3327 refsmc_input, refsmc_target, &
3328 wltsmc_input, wltsmc_target
3331 veg_greenness_target_grid, &
3332 veg_type_target_grid
3336 integer :: clb(3), cub(3), i, j, k, rc
3337 integer :: soilt_input, soilt_target
3338 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3340 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
3341 real(esmf_kind_r8),
pointer :: soil_type_input_ptr(:,:)
3342 real(esmf_kind_r8),
pointer :: soil_type_target_ptr(:,:)
3343 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
3344 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3345 real :: f1, fn, smcdir, smctra
3347 print*,
"- RESCALE SOIL MOISTURE FOR CHANGES IN SOIL TYPE."
3349 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
3350 call esmf_fieldget(soilm_tot_target_grid, &
3351 computationallbound=clb, &
3352 computationalubound=cub, &
3353 farrayptr=soilm_tot_ptr, rc=rc)
3354 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3357 print*,
"- CALL FieldGet FOR LAND MASK."
3358 call esmf_fieldget(landmask_target_grid, &
3359 farrayptr=landmask_ptr, rc=rc)
3360 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3363 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
3364 call esmf_fieldget(veg_type_target_grid, &
3365 farrayptr=veg_type_ptr, rc=rc)
3366 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3369 print*,
"- CALL FieldGet FOR VEGETATION GREENNESS."
3370 call esmf_fieldget(veg_greenness_target_grid, &
3371 farrayptr=veg_greenness_ptr, rc=rc)
3372 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3375 print*,
"- CALL FieldGet FOR TARGET GRID SOIL TYPE."
3376 call esmf_fieldget(soil_type_target_grid, &
3377 farrayptr=soil_type_target_ptr, rc=rc)
3378 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3381 print*,
"- CALL FieldGet FOR SOIL TYPE FROM INPUT GRID."
3382 call esmf_fieldget(soil_type_from_input_grid, &
3383 farrayptr=soil_type_input_ptr, rc=rc)
3384 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3387 do j = clb(2), cub(2)
3388 do i = clb(1), cub(1)
3394 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
3396 soilt_target = nint(soil_type_target_ptr(i,j))
3397 soilt_input = nint(soil_type_input_ptr(i,j))
3405 if (soilt_target /= soilt_input)
then
3410 f1=(soilm_tot_ptr(i,j,1)-drysmc_input(soilt_input)) / &
3411 (maxsmc_input(soilt_input)-drysmc_input(soilt_input))
3413 smcdir=drysmc_target(soilt_target) + f1 * &
3414 (maxsmc_target(soilt_target) - drysmc_target(soilt_target))
3420 if (soilm_tot_ptr(i,j,1) < refsmc_input(soilt_input))
then
3421 f1=(soilm_tot_ptr(i,j,1) - wltsmc_input(soilt_input)) / &
3422 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
3423 smctra=wltsmc_target(soilt_target) + f1 * &
3424 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
3426 f1=(soilm_tot_ptr(i,j,1) - refsmc_input(soilt_input)) / &
3427 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
3428 smctra=refsmc_target(soilt_target) + f1 * &
3429 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
3436 soilm_tot_ptr(i,j,1) = ((1.0 - veg_greenness_ptr(i,j)) * smcdir) + &
3437 (veg_greenness_ptr(i,j) * smctra)
3447 if (soilm_tot_ptr(i,j,k) < refsmc_input(soilt_input))
then
3448 fn = (soilm_tot_ptr(i,j,k) - wltsmc_input(soilt_input)) / &
3449 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
3450 soilm_tot_ptr(i,j,k) = wltsmc_target(soilt_target) + fn * &
3451 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
3453 fn = (soilm_tot_ptr(i,j,k) - refsmc_input(soilt_input)) / &
3454 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
3455 soilm_tot_ptr(i,j,k) = refsmc_target(soilt_target) + fn * &
3456 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
3466 soilm_tot_ptr(i,j,1)=min(soilm_tot_ptr(i,j,1),maxsmc_target(soilt_target))
3467 soilm_tot_ptr(i,j,1)=max(drysmc_target(soilt_target),soilm_tot_ptr(i,j,1))
3470 soilm_tot_ptr(i,j,k)=min(soilm_tot_ptr(i,j,k),maxsmc_target(soilt_target))
3471 soilm_tot_ptr(i,j,k)=max(wltsmc_target(soilt_target),soilm_tot_ptr(i,j,k))
3489 use model_grid, only : landmask_target_grid, &
3496 integer :: clb(3), cub(3), i, j, k, rc
3497 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3499 real,
parameter :: lapse_rate = 6.5e-03
3500 real :: terrain_diff
3501 real(esmf_kind_r8),
pointer :: terrain_input_ptr(:,:)
3502 real(esmf_kind_r8),
pointer :: terrain_target_ptr(:,:)
3503 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
3504 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
3506 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3507 call esmf_fieldget(landmask_target_grid, &
3508 farrayptr=landmask_ptr, rc=rc)
3509 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3512 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
3513 call esmf_fieldget(veg_type_target_grid, &
3514 farrayptr=veg_type_target_ptr, rc=rc)
3515 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3518 print*,
"- CALL FieldGet FOR TARGET GRID TERRAIN."
3519 call esmf_fieldget(terrain_target_grid, &
3520 farrayptr=terrain_target_ptr, rc=rc)
3521 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3524 print*,
"- CALL FieldGet FOR TERRAIN INTERP TO TARGET GRID."
3525 call esmf_fieldget(terrain_from_input_grid, &
3526 farrayptr=terrain_input_ptr, rc=rc)
3527 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3530 print*,
"- CALL FieldGet FOR SOIL TEMP TARGET GRID."
3531 call esmf_fieldget(soil_temp_target_grid, &
3532 computationallbound=clb, &
3533 computationalubound=cub, &
3534 farrayptr=soil_temp_target_ptr, rc=rc)
3535 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3538 do j = clb(2), cub(2)
3539 do i = clb(1), cub(1)
3540 if (landmask_ptr(i,j) == 1)
then
3541 terrain_diff = abs(terrain_input_ptr(i,j) - terrain_target_ptr(i,j))
3542 if (terrain_diff > 100.0)
then
3543 do k = clb(3), cub(3)
3544 soil_temp_target_ptr(i,j,k) = soil_temp_target_ptr(i,j,k) + &
3545 ((terrain_input_ptr(i,j) - terrain_target_ptr(i,j)) * lapse_rate)
3546 if (nint(veg_type_target_ptr(i,j)) == veg_type_landice_target)
then
3547 soil_temp_target_ptr(i,j,k) = min(soil_temp_target_ptr(i,j,k), 273.16)
3564 use model_grid, only : lsoil_target, i_input, j_input, input_grid
3565 use input_data, only : lsoil_input, soil_temp_input_grid, &
3566 soilm_liq_input_grid, soilm_tot_input_grid
3568 integer,
intent(in) :: localpet
3569 character(len=1000) :: msg
3571 real(esmf_kind_r8) :: tmp(i_input,j_input), &
3572 data_one_tile(i_input,j_input,lsoil_input), &
3573 tmp3d(i_input,j_input,lsoil_target)
3574 if (lsoil_input == 9 .and. lsoil_target == 4)
then
3575 print*,
"CONVERTING FROM 9 INPUT SOIL LEVELS TO 4 TARGET SOIL LEVELS"
3576 call esmf_fieldgather(soil_temp_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3577 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3580 call esmf_fielddestroy(soil_temp_input_grid,rc=rc)
3581 soil_temp_input_grid = esmf_fieldcreate(input_grid, &
3582 typekind=esmf_typekind_r8, &
3583 staggerloc=esmf_staggerloc_center, &
3584 ungriddedlbound=(/1/), &
3585 ungriddedubound=(/lsoil_target/), rc=rc)
3588 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3589 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3590 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3591 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3592 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3593 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3594 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3595 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3596 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3597 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3598 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3601 call esmf_fieldscatter(soil_temp_input_grid, tmp3d, rootpet=0, rc=rc)
3602 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3605 call esmf_fieldgather(soilm_tot_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3606 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3609 call esmf_fielddestroy(soilm_tot_input_grid,rc=rc)
3610 soilm_tot_input_grid = esmf_fieldcreate(input_grid, &
3611 typekind=esmf_typekind_r8, &
3612 staggerloc=esmf_staggerloc_center, &
3613 ungriddedlbound=(/1/), &
3614 ungriddedubound=(/lsoil_target/), rc=rc)
3616 if(localpet==0)
then
3617 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3618 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3619 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3620 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3621 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3622 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3623 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3624 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3625 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3626 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3627 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3630 call esmf_fieldscatter(soilm_tot_input_grid, tmp3d, rootpet=0, rc=rc)
3631 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3634 call esmf_fieldgather(soilm_liq_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3635 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3638 call esmf_fielddestroy(soilm_liq_input_grid,rc=rc)
3639 soilm_liq_input_grid = esmf_fieldcreate(input_grid, &
3640 typekind=esmf_typekind_r8, &
3641 staggerloc=esmf_staggerloc_center, &
3642 ungriddedlbound=(/1/), &
3643 ungriddedubound=(/lsoil_target/), rc=rc)
3644 if(localpet==0)
then
3645 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3646 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3647 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3648 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3649 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3650 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3651 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3652 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3653 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3654 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3655 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3658 call esmf_fieldscatter(soilm_liq_input_grid, tmp3d, rootpet=0, rc=rc)
3659 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3662 elseif (lsoil_input /= lsoil_target)
then
3665 write(msg,
'("NUMBER OF SOIL LEVELS IN INPUT (",I2,") and OUPUT &
3666 (",I2,") MUST EITHER BE EQUAL OR 9 AND 4, RESPECTIVELY")') &
3667 lsoil_input, lsoil_target
3686 integer :: clb(2), cub(2), i, j, rc
3687 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3690 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3691 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3693 data z0_igbp /1.089, 2.653, 0.854, 0.826, 0.800, 0.050, &
3694 0.030, 0.856, 0.856, 0.150, 0.040, 0.130, &
3695 1.000, 0.250, 0.011, 0.011, 0.001, 0.076, &
3698 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3699 call esmf_fieldget(landmask_target_grid, &
3700 computationallbound=clb, &
3701 computationalubound=cub, &
3702 farrayptr=landmask_ptr, rc=rc)
3703 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3706 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
3707 call esmf_fieldget(veg_type_target_grid, &
3708 farrayptr=veg_type_ptr, rc=rc)
3709 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3712 print*,
"- CALL FieldGet FOR TARGET GRID Z0."
3713 call esmf_fieldget(z0_target_grid, &
3714 farrayptr=data_ptr, rc=rc)
3715 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3718 do j = clb(2), cub(2)
3719 do i = clb(1), cub(1)
3720 if (landmask_ptr(i,j) == 2)
then
3722 elseif (landmask_ptr(i,j) == 1)
then
3723 data_ptr(i,j) = z0_igbp(nint(veg_type_ptr(i,j))) * 100.0
3738 alvwf_target_grid, &
3739 alnsf_target_grid, &
3740 alnwf_target_grid, &
3741 facsf_target_grid, &
3742 facwf_target_grid, &
3743 mxsno_albedo_target_grid, &
3744 max_veg_greenness_target_grid, &
3745 min_veg_greenness_target_grid, &
3746 slope_type_target_grid, &
3747 soil_type_target_grid, &
3748 substrate_temp_target_grid, &
3749 veg_greenness_target_grid, &
3750 veg_type_target_grid
3754 integer :: clb(2), cub(2), i, j, rc
3755 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3757 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3758 real(esmf_kind_r8),
pointer :: data3d_ptr(:,:,:)
3759 real(esmf_kind_r8),
pointer :: soilmt_ptr(:,:,:)
3760 real(esmf_kind_r8),
pointer :: soilml_ptr(:,:,:)
3761 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
3762 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3763 real(esmf_kind_r8),
pointer :: seaice_skint_ptr(:,:)
3764 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
3765 real(esmf_kind_r8),
pointer :: fice_ptr(:,:)
3766 real(esmf_kind_r8),
pointer :: hice_ptr(:,:)
3768 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3769 call esmf_fieldget(landmask_target_grid, &
3770 computationallbound=clb, &
3771 computationalubound=cub, &
3772 farrayptr=landmask_ptr, rc=rc)
3773 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3776 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE."
3777 call esmf_fieldget(slope_type_target_grid, &
3778 farrayptr=data_ptr, rc=rc)
3779 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3782 do j = clb(2), cub(2)
3783 do i = clb(1), cub(1)
3784 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3788 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SOIL TYPE."
3789 call esmf_fieldget(soil_type_target_grid, &
3790 farrayptr=data_ptr, rc=rc)
3791 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3794 do j = clb(2), cub(2)
3795 do i = clb(1), cub(1)
3796 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3800 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION TYPE."
3801 call esmf_fieldget(veg_type_target_grid, &
3802 farrayptr=veg_type_ptr, rc=rc)
3803 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3806 do j = clb(2), cub(2)
3807 do i = clb(1), cub(1)
3808 if (landmask_ptr(i,j) /= 1) veg_type_ptr(i,j) = 0.0
3812 print*,
"- SET TARGET GRID ALVSF AT NON-LAND."
3813 call esmf_fieldget(alvsf_target_grid, &
3814 farrayptr=data_ptr, rc=rc)
3815 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3818 do j = clb(2), cub(2)
3819 do i = clb(1), cub(1)
3820 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3824 print*,
"- SET TARGET GRID ALVWF AT NON-LAND."
3825 call esmf_fieldget(alvwf_target_grid, &
3826 farrayptr=data_ptr, rc=rc)
3827 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3830 do j = clb(2), cub(2)
3831 do i = clb(1), cub(1)
3832 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3836 print*,
"- SET TARGET GRID ALNSF AT NON-LAND."
3837 call esmf_fieldget(alnsf_target_grid, &
3838 farrayptr=data_ptr, rc=rc)
3839 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3842 do j = clb(2), cub(2)
3843 do i = clb(1), cub(1)
3844 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3848 print*,
"- SET TARGET GRID ALNWF AT NON-LAND."
3849 call esmf_fieldget(alnwf_target_grid, &
3850 farrayptr=data_ptr, rc=rc)
3851 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3854 do j = clb(2), cub(2)
3855 do i = clb(1), cub(1)
3856 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3860 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
3861 call esmf_fieldget(facsf_target_grid, &
3862 farrayptr=data_ptr, rc=rc)
3863 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3866 do j = clb(2), cub(2)
3867 do i = clb(1), cub(1)
3868 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3872 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
3873 call esmf_fieldget(facwf_target_grid, &
3874 farrayptr=data_ptr, rc=rc)
3875 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3878 do j = clb(2), cub(2)
3879 do i = clb(1), cub(1)
3880 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3884 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAXIMUM GREENNESS."
3885 call esmf_fieldget(max_veg_greenness_target_grid, &
3886 farrayptr=data_ptr, rc=rc)
3887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3890 do j = clb(2), cub(2)
3891 do i = clb(1), cub(1)
3892 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3896 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MINIMUM GREENNESS."
3897 call esmf_fieldget(min_veg_greenness_target_grid, &
3898 farrayptr=data_ptr, rc=rc)
3899 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3902 do j = clb(2), cub(2)
3903 do i = clb(1), cub(1)
3904 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3908 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION GREENNESS."
3909 call esmf_fieldget(veg_greenness_target_grid, &
3910 farrayptr=veg_greenness_ptr, rc=rc)
3911 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3914 do j = clb(2), cub(2)
3915 do i = clb(1), cub(1)
3916 if (landmask_ptr(i,j) /= 1) veg_greenness_ptr(i,j) = 0.0
3920 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAX SNOW ALBEDO."
3921 call esmf_fieldget(mxsno_albedo_target_grid, &
3922 farrayptr=data_ptr, rc=rc)
3923 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3926 do j = clb(2), cub(2)
3927 do i = clb(1), cub(1)
3928 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3932 print*,
"- ZERO OUT TARGET GRID CANOPY MOISTURE CONTENT WHERE NO PLANTS."
3933 call esmf_fieldget(canopy_mc_target_grid, &
3934 farrayptr=data_ptr, rc=rc)
3935 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3938 do j = clb(2), cub(2)
3939 do i = clb(1), cub(1)
3940 if (veg_greenness_ptr(i,j) <= 0.01) data_ptr(i,j) = 0.0
3944 print*,
"- CALL FieldGet FOR TARGET GRID ICE SKIN TEMP."
3945 call esmf_fieldget(seaice_skin_temp_target_grid, &
3946 farrayptr=seaice_skint_ptr, rc=rc)
3947 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3950 print*,
"- SET TARGET GRID SKIN TEMP AT ICE POINTS."
3951 call esmf_fieldget(skin_temp_target_grid, &
3952 farrayptr=skint_ptr, rc=rc)
3953 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3956 print*,
"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION."
3957 call esmf_fieldget(seaice_fract_target_grid, &
3958 farrayptr=fice_ptr, rc=rc)
3959 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3962 print*,
"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS."
3963 call esmf_fieldget(seaice_depth_target_grid, &
3964 farrayptr=hice_ptr, rc=rc)
3965 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3968 do j = clb(2), cub(2)
3969 do i = clb(1), cub(1)
3970 if (fice_ptr(i,j) > 0.0)
then
3971 skint_ptr(i,j) = (fice_ptr(i,j) * seaice_skint_ptr(i,j)) + &
3972 ( (1.0 - fice_ptr(i,j)) * frz_ice )
3974 seaice_skint_ptr(i,j) = skint_ptr(i,j)
3980 print*,
"- SET TARGET GRID SUBSTRATE TEMP AT ICE."
3981 call esmf_fieldget(substrate_temp_target_grid, &
3982 farrayptr=data_ptr, rc=rc)
3983 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3986 do j = clb(2), cub(2)
3987 do i = clb(1), cub(1)
3988 if (landmask_ptr(i,j) == 2)
then
3989 data_ptr(i,j) = frz_ice
3990 elseif (landmask_ptr(i,j) == 0)
then
3991 data_ptr(i,j) = skint_ptr(i,j)
3996 print*,
"- ZERO OUT TARGET GRID SNOW DEPTH AT OPEN WATER."
3997 call esmf_fieldget(snow_depth_target_grid, &
3998 farrayptr=data_ptr, rc=rc)
3999 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4002 do j = clb(2), cub(2)
4003 do i = clb(1), cub(1)
4004 if (landmask_ptr(i,j) == 0)
then
4010 print*,
"- ZERO OUT TARGET GRID SNOW LIQ AT OPEN WATER."
4011 call esmf_fieldget(snow_liq_equiv_target_grid, &
4012 farrayptr=data_ptr, rc=rc)
4013 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4016 do j = clb(2), cub(2)
4017 do i = clb(1), cub(1)
4018 if (landmask_ptr(i,j) == 0)
then
4024 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID TOTAL SOIL MOISTURE."
4025 call esmf_fieldget(soilm_tot_target_grid, &
4026 farrayptr=soilmt_ptr, rc=rc)
4027 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4030 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE."
4031 call esmf_fieldget(soilm_liq_target_grid, &
4032 farrayptr=soilml_ptr, rc=rc)
4033 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4036 do j = clb(2), cub(2)
4037 do i = clb(1), cub(1)
4038 if (landmask_ptr(i,j) == 2 .or. landmask_ptr(i,j) == 0 .or. &
4039 nint(veg_type_ptr(i,j)) == veg_type_landice_target)
then
4040 soilmt_ptr(i,j,:) = 1.0
4041 soilml_ptr(i,j,:) = 1.0
4046 print*,
"- SET OPEN WATER FLAG FOR TARGET GRID SOIL TEMPERATURE."
4047 call esmf_fieldget(soil_temp_target_grid, &
4048 farrayptr=data3d_ptr, rc=rc)
4049 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4052 do j = clb(2), cub(2)
4053 do i = clb(1), cub(1)
4054 if (landmask_ptr(i,j) == 0)
then
4055 data3d_ptr(i,j,:) = skint_ptr(i,j)
4074 integer(esmf_kind_i8),
pointer :: mask_ptr(:,:)
4077 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
4078 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
4080 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
4081 call esmf_fieldget(landmask_target_grid, &
4082 farrayptr=mask_ptr, rc=rc)
4083 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4088 print*,
"- CALL FieldGet FOR C_D."
4089 call esmf_fieldget(c_d_target_grid, &
4090 farrayptr=data_ptr, rc=rc)
4091 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4094 where(mask_ptr /= 0) data_ptr = 0.0
4098 print*,
"- CALL FieldGet FOR C_0."
4099 call esmf_fieldget(c_0_target_grid, &
4100 farrayptr=data_ptr, rc=rc)
4101 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4104 where(mask_ptr /= 0) data_ptr = 0.0
4108 print*,
"- CALL FieldGet FOR D_CONV."
4109 call esmf_fieldget(d_conv_target_grid, &
4110 farrayptr=data_ptr, rc=rc)
4111 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4114 where(mask_ptr /= 0) data_ptr = 0.0
4118 print*,
"- CALL FieldGet FOR DT_COOL."
4119 call esmf_fieldget(dt_cool_target_grid, &
4120 farrayptr=data_ptr, rc=rc)
4121 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4124 where(mask_ptr /= 0) data_ptr = 0.0
4128 print*,
"- CALL FieldGet FOR IFD."
4129 call esmf_fieldget(ifd_target_grid, &
4130 farrayptr=data_ptr, rc=rc)
4131 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4134 where(mask_ptr /= 0) data_ptr = 0.0
4138 print*,
"- CALL FieldGet FOR QRAIN."
4139 call esmf_fieldget(qrain_target_grid, &
4140 farrayptr=data_ptr, rc=rc)
4141 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4144 where(mask_ptr /= 0) data_ptr = 0.0
4148 print*,
"- CALL FieldGet FOR TREF."
4149 call esmf_fieldget(tref_target_grid, &
4150 farrayptr=data_ptr, rc=rc)
4151 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4154 print*,
"- CALL FieldGet FOR SKIN T."
4155 call esmf_fieldget(skin_temp_target_grid, &
4156 farrayptr=skint_ptr, rc=rc)
4157 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4160 where(mask_ptr /= 0) data_ptr = skint_ptr
4164 print*,
"- CALL FieldGet FOR W_D."
4165 call esmf_fieldget(w_d_target_grid, &
4166 farrayptr=data_ptr, rc=rc)
4167 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4170 where(mask_ptr /= 0) data_ptr = 0.0
4174 print*,
"- CALL FieldGet FOR W_0."
4175 call esmf_fieldget(w_0_target_grid, &
4176 farrayptr=data_ptr, rc=rc)
4177 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4180 where(mask_ptr /= 0) data_ptr = 0.0
4184 print*,
"- CALL FieldGet FOR XS."
4185 call esmf_fieldget(xs_target_grid, &
4186 farrayptr=data_ptr, rc=rc)
4187 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4190 where(mask_ptr /= 0) data_ptr = 0.0
4194 print*,
"- CALL FieldGet FOR XT."
4195 call esmf_fieldget(xt_target_grid, &
4196 farrayptr=data_ptr, rc=rc)
4197 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4200 where(mask_ptr /= 0) data_ptr = 0.0
4204 print*,
"- CALL FieldGet FOR XU."
4205 call esmf_fieldget(xu_target_grid, &
4206 farrayptr=data_ptr, rc=rc)
4207 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4210 where(mask_ptr /= 0) data_ptr = 0.0
4214 print*,
"- CALL FieldGet FOR XV."
4215 call esmf_fieldget(xv_target_grid, &
4216 farrayptr=data_ptr, rc=rc)
4217 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4220 where(mask_ptr /= 0) data_ptr = 0.0
4224 print*,
"- CALL FieldGet FOR XZ."
4225 call esmf_fieldget(xz_target_grid, &
4226 farrayptr=data_ptr, rc=rc)
4227 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4230 where(mask_ptr /= 0) data_ptr = 30.0
4234 print*,
"- CALL FieldGet FOR XTTS."
4235 call esmf_fieldget(xtts_target_grid, &
4236 farrayptr=data_ptr, rc=rc)
4237 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4240 where(mask_ptr /= 0) data_ptr = 0.0
4244 print*,
"- CALL FieldGet FOR XZTS."
4245 call esmf_fieldget(xzts_target_grid, &
4246 farrayptr=data_ptr, rc=rc)
4247 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4250 where(mask_ptr /= 0) data_ptr = 0.0
4254 print*,
"- CALL FieldGet FOR Z_C."
4255 call esmf_fieldget(z_c_target_grid, &
4256 farrayptr=data_ptr, rc=rc)
4257 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4260 where(mask_ptr /= 0) data_ptr = 0.0
4264 print*,
"- CALL FieldGet FOR ZM."
4265 call esmf_fieldget(zm_target_grid, &
4266 farrayptr=data_ptr, rc=rc)
4267 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4270 where(mask_ptr /= 0) data_ptr = 0.0
4279 use model_grid, only : target_grid, lsoil_target
4285 real(esmf_kind_r8),
pointer :: target_ptr(:,:), target_ptr_3d(:,:,:)
4286 real :: init_val = -999.9
4288 print*,
"- CALL FieldCreate FOR TARGET GRID T2M."
4289 t2m_target_grid = esmf_fieldcreate(target_grid, &
4290 typekind=esmf_typekind_r8, &
4291 staggerloc=esmf_staggerloc_center, rc=rc)
4292 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4295 print*,
"- INITIALIZE TARGET grid t2m."
4296 call esmf_fieldget(t2m_target_grid, &
4297 farrayptr=target_ptr, rc=rc)
4298 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4301 target_ptr = init_val
4303 print*,
"- CALL FieldCreate FOR TARGET GRID Q2M."
4304 q2m_target_grid = esmf_fieldcreate(target_grid, &
4305 typekind=esmf_typekind_r8, &
4306 staggerloc=esmf_staggerloc_center, rc=rc)
4307 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4310 print*,
"- INITIALIZE TARGET grid q2m."
4311 call esmf_fieldget(q2m_target_grid, &
4312 farrayptr=target_ptr, rc=rc)
4313 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4316 target_ptr = init_val
4318 print*,
"- CALL FieldCreate FOR TARGET GRID TPRCP."
4319 tprcp_target_grid = esmf_fieldcreate(target_grid, &
4320 typekind=esmf_typekind_r8, &
4321 staggerloc=esmf_staggerloc_center, rc=rc)
4322 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4325 print*,
"- INITIALIZE TARGET grid tprcp."
4326 call esmf_fieldget(tprcp_target_grid, &
4327 farrayptr=target_ptr, rc=rc)
4328 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4331 target_ptr = init_val
4333 print*,
"- CALL FieldCreate FOR TARGET GRID F10M."
4334 f10m_target_grid = esmf_fieldcreate(target_grid, &
4335 typekind=esmf_typekind_r8, &
4336 staggerloc=esmf_staggerloc_center, rc=rc)
4337 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4340 print*,
"- INITIALIZE TARGET grid f10m."
4341 call esmf_fieldget(f10m_target_grid, &
4342 farrayptr=target_ptr, rc=rc)
4343 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4346 target_ptr = init_val
4348 print*,
"- CALL FieldCreate FOR TARGET GRID FFMM."
4349 ffmm_target_grid = esmf_fieldcreate(target_grid, &
4350 typekind=esmf_typekind_r8, &
4351 staggerloc=esmf_staggerloc_center, rc=rc)
4352 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4355 print*,
"- INITIALIZE TARGET grid ffmm."
4356 call esmf_fieldget(ffmm_target_grid, &
4357 farrayptr=target_ptr, rc=rc)
4358 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4361 target_ptr = init_val
4363 print*,
"- CALL FieldCreate FOR TARGET GRID USTAR."
4364 ustar_target_grid = esmf_fieldcreate(target_grid, &
4365 typekind=esmf_typekind_r8, &
4366 staggerloc=esmf_staggerloc_center, rc=rc)
4367 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4370 print*,
"- INITIALIZE TARGET grid ustar."
4371 call esmf_fieldget(ustar_target_grid, &
4372 farrayptr=target_ptr, rc=rc)
4373 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4376 target_ptr = init_val
4378 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV."
4379 snow_liq_equiv_target_grid = esmf_fieldcreate(target_grid, &
4380 typekind=esmf_typekind_r8, &
4381 staggerloc=esmf_staggerloc_center, rc=rc)
4382 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4385 print*,
"- INITIALIZE TARGET grid snow liq equiv."
4386 call esmf_fieldget(snow_liq_equiv_target_grid, &
4387 farrayptr=target_ptr, rc=rc)
4388 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4391 target_ptr = init_val
4393 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH."
4394 snow_depth_target_grid = esmf_fieldcreate(target_grid, &
4395 typekind=esmf_typekind_r8, &
4396 staggerloc=esmf_staggerloc_center, rc=rc)
4397 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4400 print*,
"- INITIALIZE TARGET grid snow depth."
4401 call esmf_fieldget(snow_depth_target_grid, &
4402 farrayptr=target_ptr, rc=rc)
4403 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4406 target_ptr = init_val
4408 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE FRACTION."
4409 seaice_fract_target_grid = esmf_fieldcreate(target_grid, &
4410 typekind=esmf_typekind_r8, &
4411 staggerloc=esmf_staggerloc_center, rc=rc)
4412 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4415 print*,
"- INITIALIZE TARGET grid sea ice fraction."
4416 call esmf_fieldget(seaice_fract_target_grid, &
4417 farrayptr=target_ptr, rc=rc)
4418 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4421 target_ptr = init_val
4423 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE DEPTH."
4424 seaice_depth_target_grid = esmf_fieldcreate(target_grid, &
4425 typekind=esmf_typekind_r8, &
4426 staggerloc=esmf_staggerloc_center, rc=rc)
4427 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4430 print*,
"- INITIALIZE TARGET sea ice depth."
4431 call esmf_fieldget(seaice_depth_target_grid, &
4432 farrayptr=target_ptr, rc=rc)
4433 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4436 target_ptr = init_val
4438 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE SKIN TEMP."
4439 seaice_skin_temp_target_grid = esmf_fieldcreate(target_grid, &
4440 typekind=esmf_typekind_r8, &
4441 staggerloc=esmf_staggerloc_center, rc=rc)
4442 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4445 print*,
"- INITIALIZE TARGET sea ice skin temp."
4446 call esmf_fieldget(seaice_skin_temp_target_grid, &
4447 farrayptr=target_ptr, rc=rc)
4448 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4451 target_ptr = init_val
4453 print*,
"- CALL FieldCreate FOR TARGET GRID SRFLAG."
4454 srflag_target_grid = esmf_fieldcreate(target_grid, &
4455 typekind=esmf_typekind_r8, &
4456 staggerloc=esmf_staggerloc_center, rc=rc)
4457 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4460 print*,
"- INITIALIZE TARGET srflag."
4461 call esmf_fieldget(srflag_target_grid, &
4462 farrayptr=target_ptr, rc=rc)
4463 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4466 target_ptr = init_val
4468 print*,
"- CALL FieldCreate FOR TARGET GRID SKIN TEMPERATURE."
4469 skin_temp_target_grid = esmf_fieldcreate(target_grid, &
4470 typekind=esmf_typekind_r8, &
4471 staggerloc=esmf_staggerloc_center, rc=rc)
4472 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4475 print*,
"- INITIALIZE TARGET grid skin temp."
4476 call esmf_fieldget(skin_temp_target_grid, &
4477 farrayptr=target_ptr, rc=rc)
4478 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4481 target_ptr = init_val
4483 print*,
"- CALL FieldCreate FOR TARGET GRID CANOPY MOISTURE CONTENT."
4484 canopy_mc_target_grid = esmf_fieldcreate(target_grid, &
4485 typekind=esmf_typekind_r8, &
4486 staggerloc=esmf_staggerloc_center, rc=rc)
4487 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4490 print*,
"- INITIALIZE TARGET grid canopy moisture."
4491 call esmf_fieldget(canopy_mc_target_grid, &
4492 farrayptr=target_ptr, rc=rc)
4493 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4496 target_ptr = init_val
4498 print*,
"- CALL FieldCreate FOR TARGET GRID LEAF AREA INDEX."
4499 lai_target_grid = esmf_fieldcreate(target_grid, &
4500 typekind=esmf_typekind_r8, &
4501 staggerloc=esmf_staggerloc_center, rc=rc)
4502 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4505 print*,
"- INITIALIZE TARGET leaf area index."
4506 call esmf_fieldget(lai_target_grid, &
4507 farrayptr=target_ptr, rc=rc)
4508 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4511 target_ptr = init_val
4513 print*,
"- CALL FieldCreate FOR TARGET GRID Z0."
4514 z0_target_grid = esmf_fieldcreate(target_grid, &
4515 typekind=esmf_typekind_r8, &
4516 staggerloc=esmf_staggerloc_center, rc=rc)
4517 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4520 print*,
"- INITIALIZE TARGET grid z0."
4521 call esmf_fieldget(z0_target_grid, &
4522 farrayptr=target_ptr, rc=rc)
4523 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4526 target_ptr = init_val
4528 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID TERRAIN."
4529 terrain_from_input_grid = esmf_fieldcreate(target_grid, &
4530 typekind=esmf_typekind_r8, &
4531 staggerloc=esmf_staggerloc_center, rc=rc)
4532 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4535 print*,
"- INITIALIZE TARGET grid interpolated terrain."
4536 call esmf_fieldget(terrain_from_input_grid, &
4537 farrayptr=target_ptr, rc=rc)
4538 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4541 target_ptr = init_val
4543 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID SOIL TYPE."
4544 soil_type_from_input_grid = esmf_fieldcreate(target_grid, &
4545 typekind=esmf_typekind_r8, &
4546 staggerloc=esmf_staggerloc_center, rc=rc)
4547 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4550 print*,
"- INITIALIZE TARGET grid soil type"
4551 call esmf_fieldget(soil_type_from_input_grid, &
4552 farrayptr=target_ptr, rc=rc)
4553 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4556 target_ptr = init_val
4558 print*,
"- CALL FieldCreate FOR TARGET GRID SOIL TEMPERATURE."
4559 soil_temp_target_grid = esmf_fieldcreate(target_grid, &
4560 typekind=esmf_typekind_r8, &
4561 staggerloc=esmf_staggerloc_center, &
4562 ungriddedlbound=(/1/), &
4563 ungriddedubound=(/lsoil_target/), rc=rc)
4564 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4567 print*,
"- INITIALIZE TARGET grid soil temp"
4568 call esmf_fieldget(soil_temp_target_grid, &
4569 farrayptr=target_ptr_3d, rc=rc)
4570 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4573 target_ptr_3d = init_val
4575 print*,
"- CALL FieldCreate FOR TARGET GRID TOTAL SOIL MOISTURE."
4576 soilm_tot_target_grid = esmf_fieldcreate(target_grid, &
4577 typekind=esmf_typekind_r8, &
4578 staggerloc=esmf_staggerloc_center, &
4579 ungriddedlbound=(/1/), &
4580 ungriddedubound=(/lsoil_target/), rc=rc)
4581 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4584 print*,
"- INITIALIZE TARGET grid soil moist"
4585 call esmf_fieldget(soilm_tot_target_grid, &
4586 farrayptr=target_ptr_3d, rc=rc)
4587 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4590 target_ptr_3d = init_val
4592 print*,
"- CALL FieldCreate FOR TARGET GRID LIQUID SOIL MOISTURE."
4593 soilm_liq_target_grid = esmf_fieldcreate(target_grid, &
4594 typekind=esmf_typekind_r8, &
4595 staggerloc=esmf_staggerloc_center, &
4596 ungriddedlbound=(/1/), &
4597 ungriddedubound=(/lsoil_target/), rc=rc)
4598 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4601 print*,
"- INITIALIZE TARGET grid soil liq"
4602 call esmf_fieldget(soilm_liq_target_grid, &
4603 farrayptr=target_ptr_3d, rc=rc)
4604 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4607 target_ptr_3d = init_val
4622 print*,
"- CALL FieldCreate FOR TARGET GRID C_D."
4623 c_d_target_grid = esmf_fieldcreate(target_grid, &
4624 typekind=esmf_typekind_r8, &
4625 staggerloc=esmf_staggerloc_center, rc=rc)
4626 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4629 print*,
"- CALL FieldCreate FOR TARGET GRID C_0."
4630 c_0_target_grid = esmf_fieldcreate(target_grid, &
4631 typekind=esmf_typekind_r8, &
4632 staggerloc=esmf_staggerloc_center, rc=rc)
4633 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4636 print*,
"- CALL FieldCreate FOR TARGET GRID D_CONV."
4637 d_conv_target_grid = esmf_fieldcreate(target_grid, &
4638 typekind=esmf_typekind_r8, &
4639 staggerloc=esmf_staggerloc_center, rc=rc)
4640 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4643 print*,
"- CALL FieldCreate FOR TARGET GRID DT_COOL."
4644 dt_cool_target_grid = esmf_fieldcreate(target_grid, &
4645 typekind=esmf_typekind_r8, &
4646 staggerloc=esmf_staggerloc_center, rc=rc)
4647 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4650 print*,
"- CALL FieldCreate FOR TARGET GRID IFD."
4651 ifd_target_grid = esmf_fieldcreate(target_grid, &
4652 typekind=esmf_typekind_r8, &
4653 staggerloc=esmf_staggerloc_center, rc=rc)
4654 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4657 print*,
"- CALL FieldCreate FOR TARGET GRID QRAIN."
4658 qrain_target_grid = esmf_fieldcreate(target_grid, &
4659 typekind=esmf_typekind_r8, &
4660 staggerloc=esmf_staggerloc_center, rc=rc)
4661 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4664 print*,
"- CALL FieldCreate FOR TARGET GRID TREF."
4665 tref_target_grid = esmf_fieldcreate(target_grid, &
4666 typekind=esmf_typekind_r8, &
4667 staggerloc=esmf_staggerloc_center, rc=rc)
4668 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4671 print*,
"- CALL FieldCreate FOR TARGET GRID W_D."
4672 w_d_target_grid = esmf_fieldcreate(target_grid, &
4673 typekind=esmf_typekind_r8, &
4674 staggerloc=esmf_staggerloc_center, rc=rc)
4675 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4678 print*,
"- CALL FieldCreate FOR TARGET GRID W_0."
4679 w_0_target_grid = esmf_fieldcreate(target_grid, &
4680 typekind=esmf_typekind_r8, &
4681 staggerloc=esmf_staggerloc_center, rc=rc)
4682 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4685 print*,
"- CALL FieldCreate FOR TARGET GRID XS."
4686 xs_target_grid = esmf_fieldcreate(target_grid, &
4687 typekind=esmf_typekind_r8, &
4688 staggerloc=esmf_staggerloc_center, rc=rc)
4689 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4692 print*,
"- CALL FieldCreate FOR TARGET GRID XT."
4693 xt_target_grid = esmf_fieldcreate(target_grid, &
4694 typekind=esmf_typekind_r8, &
4695 staggerloc=esmf_staggerloc_center, rc=rc)
4696 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4699 print*,
"- CALL FieldCreate FOR TARGET GRID XU."
4700 xu_target_grid = esmf_fieldcreate(target_grid, &
4701 typekind=esmf_typekind_r8, &
4702 staggerloc=esmf_staggerloc_center, rc=rc)
4703 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4706 print*,
"- CALL FieldCreate FOR TARGET GRID XV."
4707 xv_target_grid = esmf_fieldcreate(target_grid, &
4708 typekind=esmf_typekind_r8, &
4709 staggerloc=esmf_staggerloc_center, rc=rc)
4710 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4713 print*,
"- CALL FieldCreate FOR TARGET GRID XZ."
4714 xz_target_grid = esmf_fieldcreate(target_grid, &
4715 typekind=esmf_typekind_r8, &
4716 staggerloc=esmf_staggerloc_center, rc=rc)
4717 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4720 print*,
"- CALL FieldCreate FOR TARGET GRID XTTS."
4721 xtts_target_grid = esmf_fieldcreate(target_grid, &
4722 typekind=esmf_typekind_r8, &
4723 staggerloc=esmf_staggerloc_center, rc=rc)
4724 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4727 print*,
"- CALL FieldCreate FOR TARGET GRID XZTS."
4728 xzts_target_grid = esmf_fieldcreate(target_grid, &
4729 typekind=esmf_typekind_r8, &
4730 staggerloc=esmf_staggerloc_center, rc=rc)
4731 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4734 print*,
"- CALL FieldCreate FOR TARGET GRID Z_C."
4735 z_c_target_grid = esmf_fieldcreate(target_grid, &
4736 typekind=esmf_typekind_r8, &
4737 staggerloc=esmf_staggerloc_center, rc=rc)
4738 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4741 print*,
"- CALL FieldCreate FOR TARGET GRID ZM."
4742 zm_target_grid = esmf_fieldcreate(target_grid, &
4743 typekind=esmf_typekind_r8, &
4744 staggerloc=esmf_staggerloc_center, rc=rc)
4745 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4762 integer(esmf_kind_i4),
intent(in) :: ij
4763 integer ,
intent(in) :: itile, jtile
4765 integer ,
intent(out) :: i, j
4768 integer :: pt_loc_this_tile
4770 tile_num = ((ij-1) / (itile*jtile))
4771 pt_loc_this_tile = ij - (tile_num * itile * jtile)
4774 j = (pt_loc_this_tile - 1) / itile + 1
4775 i = mod(pt_loc_this_tile, itile)
4793 print*,
"- DESTROY TARGET GRID SURFACE FIELDS."
4795 call esmf_fielddestroy(t2m_target_grid, rc=rc)
4796 call esmf_fielddestroy(q2m_target_grid, rc=rc)
4797 call esmf_fielddestroy(tprcp_target_grid, rc=rc)
4798 call esmf_fielddestroy(f10m_target_grid, rc=rc)
4799 call esmf_fielddestroy(ffmm_target_grid, rc=rc)
4800 call esmf_fielddestroy(ustar_target_grid, rc=rc)
4801 call esmf_fielddestroy(snow_liq_equiv_target_grid, rc=rc)
4802 call esmf_fielddestroy(snow_depth_target_grid, rc=rc)
4803 call esmf_fielddestroy(seaice_fract_target_grid, rc=rc)
4804 call esmf_fielddestroy(seaice_depth_target_grid, rc=rc)
4805 call esmf_fielddestroy(seaice_skin_temp_target_grid, rc=rc)
4806 call esmf_fielddestroy(srflag_target_grid, rc=rc)
4807 call esmf_fielddestroy(skin_temp_target_grid, rc=rc)
4808 call esmf_fielddestroy(canopy_mc_target_grid, rc=rc)
4809 call esmf_fielddestroy(z0_target_grid, rc=rc)
4810 call esmf_fielddestroy(terrain_from_input_grid, rc=rc)
4811 call esmf_fielddestroy(terrain_from_input_grid_land, rc=rc)
4812 call esmf_fielddestroy(soil_type_from_input_grid, rc=rc)
4813 call esmf_fielddestroy(soil_temp_target_grid, rc=rc)
4814 call esmf_fielddestroy(soilm_tot_target_grid, rc=rc)
4815 call esmf_fielddestroy(soilm_liq_target_grid, rc=rc)
4829 print*,
"- DESTROY TARGET GRID NST DATA."
4831 call esmf_fielddestroy(c_d_target_grid, rc=rc)
4832 call esmf_fielddestroy(c_0_target_grid, rc=rc)
4833 call esmf_fielddestroy(d_conv_target_grid, rc=rc)
4834 call esmf_fielddestroy(dt_cool_target_grid, rc=rc)
4835 call esmf_fielddestroy(ifd_target_grid, rc=rc)
4836 call esmf_fielddestroy(qrain_target_grid, rc=rc)
4837 call esmf_fielddestroy(tref_target_grid, rc=rc)
4838 call esmf_fielddestroy(w_d_target_grid, rc=rc)
4839 call esmf_fielddestroy(w_0_target_grid, rc=rc)
4840 call esmf_fielddestroy(xs_target_grid, rc=rc)
4841 call esmf_fielddestroy(xt_target_grid, rc=rc)
4842 call esmf_fielddestroy(xu_target_grid, rc=rc)
4843 call esmf_fielddestroy(xv_target_grid, rc=rc)
4844 call esmf_fielddestroy(xz_target_grid, rc=rc)
4845 call esmf_fielddestroy(xtts_target_grid, rc=rc)
4846 call esmf_fielddestroy(xzts_target_grid, rc=rc)
4847 call esmf_fielddestroy(z_c_target_grid, rc=rc)
4848 call esmf_fielddestroy(zm_target_grid, rc=rc)
subroutine, public calc_soil_params_driver(localpet)
Driver routine to compute soil parameters for each soil type.
subroutine qc_check
Perform some quality control checks before output.
subroutine write_fv3_sfc_data_netcdf(localpet)
Writes surface and nst data into a 'coldstart' file (netcdf).
subroutine, public get_static_fields(localpet)
Driver routine to read/time interpolate static/climo fields on the fv3 target grid.
subroutine create_surface_esmf_fields
Create ESMF fields for the target grid surface variables.
Process surface and nst fields.
subroutine nst_land_fill
nst is not active at land or sea ice points.
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
subroutine, public cleanup_static_fields
Free up memory for fields in this module.
Replace undefined values with a valid value.
subroutine interp(localpet)
Horizontally interpolate surface fields from input to target FV3 grid using esmf routines.
subroutine create_nst_esmf_fields
Create ESMF fields for the target grid nst variables.
subroutine cleanup_target_nst_data
Free up memory once the target grid nst fields are no longer needed.
subroutine replace_land_sfcparams(localpet)
Replace bad surface points.
subroutine rescale_soil_moisture
Adjust soil moisture for changes in soil type between the input and target grids. ...
subroutine adjust_soil_levels(localpet)
Adjust soil levels of the input grid if there is a mismatch between input and target grids...
subroutine error_handler(string, rc)
General error handler.
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
real function frh2o(TKELV, SMC, SH2O, SMCMAX, BEXP, PSIS)
Calculate supercooled soil moisture.
subroutine ij_to_i_j(ij, itile, jtile, i, j)
Convert 1d index to 2d indices.
subroutine cleanup_target_sfc_data
Free up memory once the target grid surface fields are no longer needed.
subroutine check_smois_land
Check soil mositure.
subroutine adjust_soilt_for_terrain
Adjust soil temperature for changes in terrain height between the input and target grids...
subroutine roughness
Set roughness length at land and sea ice.
Reads static surface climatological data for the target FV3 grid (such as soil type and vegetation ty...
subroutine, public search(field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo)
Replace undefined surface values.
subroutine calc_liq_soil_moisture
Compute liquid portion of the total soil moisture.
subroutine, public surface_driver(localpet)
Driver routine to process surface/nst data.