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
171 integer,
intent(in) :: localpet
298 use input_data, only : canopy_mc_input_grid, &
301 landsea_mask_input_grid, &
303 seaice_depth_input_grid, &
304 seaice_fract_input_grid, &
305 seaice_skin_temp_input_grid, &
306 skin_temp_input_grid, &
307 snow_depth_input_grid, &
308 snow_liq_equiv_input_grid, &
309 soil_temp_input_grid, &
310 soil_type_input_grid, &
311 soilm_tot_input_grid, &
316 veg_type_input_grid, &
321 dt_cool_input_grid, &
335 zm_input_grid, terrain_input_grid, &
336 veg_type_landice_input, &
337 veg_greenness_input_grid, &
338 max_veg_greenness_input_grid, &
339 min_veg_greenness_input_grid, &
342 use model_grid, only : input_grid, target_grid, &
343 i_target, j_target, &
345 num_tiles_target_grid, &
346 landmask_target_grid, &
347 seamask_target_grid, &
354 minmax_vgfrc_from_climo, &
361 soil_type_target_grid, &
362 veg_greenness_target_grid, &
363 substrate_temp_target_grid,&
364 min_veg_greenness_target_grid,&
365 max_veg_greenness_target_grid
371 integer,
intent(in) :: localpet
373 integer :: l(1), u(1)
374 integer :: i, j, ij, rc, tile
375 integer :: clb_target(2), cub_target(2)
376 integer :: isrctermprocessing
377 integer(esmf_kind_i4),
pointer :: unmapped_ptr(:)
378 integer(esmf_kind_i4),
pointer :: mask_input_ptr(:,:)
379 integer(esmf_kind_i4),
pointer :: mask_target_ptr(:,:)
380 integer(esmf_kind_i8),
pointer :: landmask_target_ptr(:,:)
381 integer(esmf_kind_i8),
allocatable :: mask_target_one_tile(:,:)
382 integer(esmf_kind_i8),
allocatable :: water_target_one_tile(:,:)
383 integer(esmf_kind_i8),
allocatable :: land_target_one_tile(:,:)
384 integer(esmf_kind_i8),
pointer :: seamask_target_ptr(:,:)
386 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
387 real(esmf_kind_r8),
allocatable :: data_one_tile2(:,:)
388 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
389 real(esmf_kind_r8),
allocatable :: latitude_one_tile(:,:)
390 real(esmf_kind_r8),
allocatable :: soil_type_target_grid_save(:,:)
391 real(esmf_kind_r8),
pointer :: canopy_mc_target_ptr(:,:)
392 real(esmf_kind_r8),
pointer :: c_d_target_ptr(:,:)
393 real(esmf_kind_r8),
pointer :: c_0_target_ptr(:,:)
394 real(esmf_kind_r8),
pointer :: d_conv_target_ptr(:,:)
395 real(esmf_kind_r8),
pointer :: dt_cool_target_ptr(:,:)
396 real(esmf_kind_r8),
pointer :: ifd_target_ptr(:,:)
397 real(esmf_kind_r8),
pointer :: qrain_target_ptr(:,:)
398 real(esmf_kind_r8),
pointer :: tref_target_ptr(:,:)
399 real(esmf_kind_r8),
pointer :: w_d_target_ptr(:,:)
400 real(esmf_kind_r8),
pointer :: w_0_target_ptr(:,:)
401 real(esmf_kind_r8),
pointer :: xs_target_ptr(:,:)
402 real(esmf_kind_r8),
pointer :: xt_target_ptr(:,:)
403 real(esmf_kind_r8),
pointer :: xu_target_ptr(:,:)
404 real(esmf_kind_r8),
pointer :: xv_target_ptr(:,:)
405 real(esmf_kind_r8),
pointer :: xz_target_ptr(:,:)
406 real(esmf_kind_r8),
pointer :: xtts_target_ptr(:,:)
407 real(esmf_kind_r8),
pointer :: xzts_target_ptr(:,:)
408 real(esmf_kind_r8),
pointer :: z_c_target_ptr(:,:)
409 real(esmf_kind_r8),
pointer :: zm_target_ptr(:,:)
410 real(esmf_kind_r8),
pointer :: seaice_depth_target_ptr(:,:)
411 real(esmf_kind_r8),
pointer :: seaice_fract_target_ptr(:,:)
412 real(esmf_kind_r8),
pointer :: seaice_skin_temp_target_ptr(:,:)
413 real(esmf_kind_r8),
pointer :: skin_temp_target_ptr(:,:)
414 real(esmf_kind_r8),
pointer :: snow_depth_target_ptr(:,:)
415 real(esmf_kind_r8),
pointer :: snow_liq_equiv_target_ptr(:,:)
416 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
417 real(esmf_kind_r8),
pointer :: soil_type_from_input_ptr(:,:)
418 real(esmf_kind_r8),
pointer :: soil_type_target_ptr(:,:)
419 real(esmf_kind_r8),
pointer :: soilm_tot_target_ptr(:,:,:)
420 real(esmf_kind_r8),
pointer :: srflag_target_ptr(:,:)
421 real(esmf_kind_r8),
pointer :: terrain_from_input_ptr(:,:)
422 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
423 real(esmf_kind_r8),
pointer :: z0_target_ptr(:,:)
424 real(esmf_kind_r8),
pointer :: landmask_input_ptr(:,:)
425 real(esmf_kind_r8),
pointer :: veg_type_input_ptr(:,:)
426 real(esmf_kind_r8),
allocatable :: veg_type_target_one_tile(:,:)
427 real(esmf_kind_r8),
pointer :: veg_greenness_target_ptr(:,:)
428 real(esmf_kind_r8),
pointer :: min_veg_greenness_target_ptr(:,:)
429 real(esmf_kind_r8),
pointer :: max_veg_greenness_target_ptr(:,:)
430 real(esmf_kind_r8),
pointer :: lai_target_ptr(:,:)
432 type(esmf_regridmethod_flag
) :: method
433 type(esmf_routehandle
) :: regrid_bl_no_mask
434 type(esmf_routehandle
) :: regrid_all_land
435 type(esmf_routehandle
) :: regrid_land
436 type(esmf_routehandle
) :: regrid_landice
437 type(esmf_routehandle
) :: regrid_nonland
438 type(esmf_routehandle
) :: regrid_seaice
439 type(esmf_routehandle
) :: regrid_water
445 method=esmf_regridmethod_bilinear
447 isrctermprocessing = 1
449 print*,
"- CALL FieldRegridStore FOR NON-MASKED BILINEAR INTERPOLATION."
450 call esmf_fieldregridstore(t2m_input_grid, &
452 polemethod=esmf_polemethod_allavg, &
453 srctermprocessing=isrctermprocessing, &
454 routehandle=regrid_bl_no_mask, &
455 regridmethod=method, rc=rc)
456 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
459 print*,
"- CALL Field_Regrid T2M."
460 call esmf_fieldregrid(t2m_input_grid, &
462 routehandle=regrid_bl_no_mask, &
463 termorderflag=esmf_termorder_srcseq, rc=rc)
464 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
467 print*,
"- CALL Field_Regrid Q2M."
468 call esmf_fieldregrid(q2m_input_grid, &
470 routehandle=regrid_bl_no_mask, &
471 termorderflag=esmf_termorder_srcseq, rc=rc)
472 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
475 print*,
"- CALL Field_Regrid TPRCP."
476 call esmf_fieldregrid(tprcp_input_grid, &
478 routehandle=regrid_bl_no_mask, &
479 termorderflag=esmf_termorder_srcseq, rc=rc)
480 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
483 print*,
"- CALL Field_Regrid F10M."
484 call esmf_fieldregrid(f10m_input_grid, &
486 routehandle=regrid_bl_no_mask, &
487 termorderflag=esmf_termorder_srcseq, rc=rc)
488 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
491 print*,
"- CALL Field_Regrid FFMM."
492 call esmf_fieldregrid(ffmm_input_grid, &
494 routehandle=regrid_bl_no_mask, &
495 termorderflag=esmf_termorder_srcseq, rc=rc)
496 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
499 print*,
"- CALL Field_Regrid USTAR."
500 call esmf_fieldregrid(ustar_input_grid, &
502 routehandle=regrid_bl_no_mask, &
503 termorderflag=esmf_termorder_srcseq, rc=rc)
504 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
507 print*,
"- CALL Field_Regrid SRFLAG."
508 call esmf_fieldregrid(srflag_input_grid, &
509 srflag_target_grid, &
510 routehandle=regrid_bl_no_mask, &
511 termorderflag=esmf_termorder_srcseq, rc=rc)
512 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
515 print*,
"- CALL FieldGet FOR SRFLAG."
516 call esmf_fieldget(srflag_target_grid, &
517 farrayptr=srflag_target_ptr, rc=rc)
518 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
526 srflag_target_ptr = nint(srflag_target_ptr)
528 print*,
"- CALL FieldRegridRelease."
529 call esmf_fieldregridrelease(routehandle=regrid_bl_no_mask, rc=rc)
530 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
537 print*,
"- CALL GridAddItem FOR TARGET GRID."
538 call esmf_gridadditem(target_grid, &
539 itemflag=esmf_griditem_mask, &
540 staggerloc=esmf_staggerloc_center, rc=rc)
541 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
544 print*,
"- CALL GridGetItem FOR TARGET GRID."
545 call esmf_gridgetitem(target_grid, &
546 itemflag=esmf_griditem_mask, &
547 farrayptr=mask_target_ptr, rc=rc)
548 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
551 print*,
"- CALL FieldGet FOR TARGET GRID SEAMASK."
552 call esmf_fieldget(seamask_target_grid, &
553 computationallbound=clb_target, &
554 computationalubound=cub_target, &
555 farrayptr=seamask_target_ptr, rc=rc)
556 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
559 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
560 call esmf_fieldget(landmask_target_grid, &
561 farrayptr=landmask_target_ptr, rc=rc)
562 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
565 print*,
"- CALL GridAddItem FOR INPUT GRID SEAMASK."
566 call esmf_gridadditem(input_grid, &
567 itemflag=esmf_griditem_mask, &
568 staggerloc=esmf_staggerloc_center, rc=rc)
569 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
572 print*,
"- CALL FieldGet FOR INPUT GRID LANDMASK."
573 call esmf_fieldget(landsea_mask_input_grid, &
574 farrayptr=landmask_input_ptr, rc=rc)
575 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
578 print*,
"- CALL GridGetItem FOR INPUT GRID LANDMASK."
579 call esmf_gridgetitem(input_grid, &
580 itemflag=esmf_griditem_mask, &
581 farrayptr=mask_input_ptr, rc=rc)
582 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
585 if (localpet == 0)
then
586 allocate(data_one_tile(i_target,j_target))
587 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
588 allocate(mask_target_one_tile(i_target,j_target))
589 allocate(soil_type_target_grid_save(i_target,j_target))
591 allocate(data_one_tile(0,0))
592 allocate(data_one_tile_3d(0,0,0))
593 allocate(mask_target_one_tile(0,0))
594 allocate(soil_type_target_grid_save(0,0))
602 method=esmf_regridmethod_nearest_stod
604 isrctermprocessing = 1
607 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
610 where (landmask_target_ptr == 1) mask_target_ptr = 1
612 print*,
"- CALL FieldCreate FOR TERRAIN FROM INPUT GRID LAND."
613 terrain_from_input_grid_land = esmf_fieldcreate(target_grid, &
614 typekind=esmf_typekind_r8, &
615 staggerloc=esmf_staggerloc_center, rc=rc)
616 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
619 print*,
"- CALL FieldRegridStore for land fields."
620 call esmf_fieldregridstore(terrain_input_grid, &
621 terrain_from_input_grid_land, &
622 srcmaskvalues=(/0/), &
623 dstmaskvalues=(/0/), &
624 polemethod=esmf_polemethod_none, &
625 srctermprocessing=isrctermprocessing, &
626 unmappedaction=esmf_unmappedaction_ignore, &
627 normtype=esmf_normtype_fracarea, &
628 routehandle=regrid_all_land, &
629 regridmethod=method, &
630 unmappeddstlist=unmapped_ptr, rc=rc)
631 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
634 print*,
"- CALL Field_Regrid TERRAIN."
635 call esmf_fieldregrid(terrain_input_grid, &
636 terrain_from_input_grid_land, &
637 routehandle=regrid_all_land, &
638 termorderflag=esmf_termorder_srcseq, rc=rc)
639 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
642 print*,
"- CALL FieldGet FOR terrain from input grid at land."
643 call esmf_fieldget(terrain_from_input_grid_land, &
644 farrayptr=terrain_from_input_ptr, rc=rc)
645 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
648 l = lbound(unmapped_ptr)
649 u = ubound(unmapped_ptr)
652 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
653 terrain_from_input_ptr(i,j) = -9999.9
655 nullify(terrain_from_input_ptr)
657 do tile = 1, num_tiles_target_grid
659 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
660 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
661 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
664 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID: ", tile
665 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
666 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
669 if (localpet == 0)
then
670 allocate(land_target_one_tile(i_target,j_target))
671 land_target_one_tile = 0
672 where(mask_target_one_tile == 1) land_target_one_tile = 1
673 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7)
674 deallocate(land_target_one_tile)
677 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID: ", tile
678 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
679 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
683 if(.not. vgtyp_from_climo)
then
685 print*,
"- CALL FieldRegrid VEG TYPE."
686 call esmf_fieldregrid(veg_type_input_grid, &
687 veg_type_target_grid, &
688 routehandle=regrid_all_land, &
689 termorderflag=esmf_termorder_srcseq, rc=rc)
690 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
693 print*,
"- CALL FieldGet FOR TARGET grid veg type."
694 call esmf_fieldget(veg_type_target_grid, &
695 farrayptr=veg_type_target_ptr, rc=rc)
696 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
699 l = lbound(unmapped_ptr)
700 u = ubound(unmapped_ptr)
703 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
704 veg_type_target_ptr(i,j) = -9999.9
707 do tile = 1, num_tiles_target_grid
708 print*,
"- CALL FieldGather FOR TARGET GRID VEG TYPE TILE: ", tile
709 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
710 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
713 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
714 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
715 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
718 if (localpet == 0)
then
719 allocate(land_target_one_tile(i_target,j_target))
720 land_target_one_tile = 0
721 where(mask_target_one_tile == 1) land_target_one_tile = 1
722 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 225)
723 deallocate(land_target_one_tile)
726 print*,
"- CALL FieldScatter FOR TARGET GRID VEG TYPE: ", tile
727 call esmf_fieldscatter(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
728 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
731 nullify(veg_type_target_ptr)
733 print*,
"- CALL FieldRegridRelease."
734 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
735 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
744 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0
746 mask_target_ptr = seamask_target_ptr
748 method=esmf_regridmethod_conserve
750 isrctermprocessing = 1
752 print*,
"- CALL FieldRegridStore for sea ice fraction."
753 call esmf_fieldregridstore(seaice_fract_input_grid, &
754 seaice_fract_target_grid, &
755 srcmaskvalues=(/0/), &
756 dstmaskvalues=(/0/), &
757 polemethod=esmf_polemethod_none, &
758 srctermprocessing=isrctermprocessing, &
759 unmappedaction=esmf_unmappedaction_ignore, &
760 normtype=esmf_normtype_fracarea, &
761 routehandle=regrid_nonland, &
762 regridmethod=method, &
763 unmappeddstlist=unmapped_ptr, rc=rc)
764 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
767 print*,
"- CALL Field_Regrid for sea ice fraction."
768 call esmf_fieldregrid(seaice_fract_input_grid, &
769 seaice_fract_target_grid, &
770 routehandle=regrid_nonland, &
771 termorderflag=esmf_termorder_srcseq, rc=rc)
772 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
775 print*,
"- CALL FieldGet FOR TARGET grid sea ice fraction."
776 call esmf_fieldget(seaice_fract_target_grid, &
777 farrayptr=seaice_fract_target_ptr, rc=rc)
778 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
781 l = lbound(unmapped_ptr)
782 u = ubound(unmapped_ptr)
785 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
786 seaice_fract_target_ptr(i,j) = -9999.9
791 if (localpet == 0)
then
792 allocate(latitude_one_tile(i_target,j_target))
794 allocate(latitude_one_tile(0,0))
797 do tile = 1, num_tiles_target_grid
799 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE FRACTION TILE: ", tile
800 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
801 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
804 print*,
"- CALL FieldGather FOR TARGET GRID MASK TILE: ", tile
805 call esmf_fieldgather(seamask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
806 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
809 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
810 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
811 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
814 if (localpet == 0)
then
815 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 91, &
816 latitude=latitude_one_tile)
819 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
820 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
821 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
825 if (localpet == 0)
then
828 if (data_one_tile(i,j) > 1.0_esmf_kind_r8)
then
829 data_one_tile(i,j) = 1.0_esmf_kind_r8
831 if (data_one_tile(i,j) < 0.15_esmf_kind_r8) data_one_tile(i,j) = 0.0_esmf_kind_r8
832 if (data_one_tile(i,j) >= 0.15_esmf_kind_r8) mask_target_one_tile(i,j) = 2
837 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE FRACTION TILE: ", tile
838 call esmf_fieldscatter(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
839 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
842 print*,
"- CALL FieldScatter FOR TARGET LANDMASK TILE: ", tile
843 call esmf_fieldscatter(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
844 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
849 deallocate(latitude_one_tile)
851 print*,
"- CALL FieldRegridRelease."
852 call esmf_fieldregridrelease(routehandle=regrid_nonland, rc=rc)
853 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
862 where (nint(landmask_input_ptr) == 2) mask_input_ptr = 1
864 print*,
"- CALL FieldGet FOR TARGET land sea mask."
865 call esmf_fieldget(landmask_target_grid, &
866 farrayptr=landmask_target_ptr, rc=rc)
867 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
871 do j = clb_target(2), cub_target(2)
872 do i = clb_target(1), cub_target(1)
873 if (landmask_target_ptr(i,j) == 2) mask_target_ptr(i,j) = 1
877 method=esmf_regridmethod_nearest_stod
878 isrctermprocessing = 1
880 print*,
"- CALL FieldRegridStore for 3d seaice fields."
881 call esmf_fieldregridstore(soil_temp_input_grid, &
882 soil_temp_target_grid, &
883 srcmaskvalues=(/0/), &
884 dstmaskvalues=(/0/), &
885 polemethod=esmf_polemethod_none, &
886 srctermprocessing=isrctermprocessing, &
887 unmappedaction=esmf_unmappedaction_ignore, &
888 normtype=esmf_normtype_fracarea, &
889 routehandle=regrid_seaice, &
890 regridmethod=method, &
891 unmappeddstlist=unmapped_ptr, rc=rc)
892 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
895 print*,
"- CALL Field_Regrid for soil temperature over seaice."
896 call esmf_fieldregrid(soil_temp_input_grid, &
897 soil_temp_target_grid, &
898 routehandle=regrid_seaice, &
899 termorderflag=esmf_termorder_srcseq, rc=rc)
900 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
903 print*,
"- CALL FieldGet FOR TARGET grid soil temperature over seaice."
904 call esmf_fieldget(soil_temp_target_grid, &
905 farrayptr=soil_temp_target_ptr, rc=rc)
906 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
909 print*,
"- CALL Field_Regrid for sea ice depth."
910 call esmf_fieldregrid(seaice_depth_input_grid, &
911 seaice_depth_target_grid, &
912 routehandle=regrid_seaice, &
913 termorderflag=esmf_termorder_srcseq, rc=rc)
914 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
917 print*,
"- CALL FieldGet FOR TARGET grid sea ice depth."
918 call esmf_fieldget(seaice_depth_target_grid, &
919 farrayptr=seaice_depth_target_ptr, rc=rc)
920 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
923 print*,
"- CALL Field_Regrid for snow depth."
924 call esmf_fieldregrid(snow_depth_input_grid, &
925 snow_depth_target_grid, &
926 routehandle=regrid_seaice, &
927 termorderflag=esmf_termorder_srcseq, rc=rc)
928 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
931 print*,
"- CALL FieldGet FOR TARGET grid snow depth."
932 call esmf_fieldget(snow_depth_target_grid, &
933 farrayptr=snow_depth_target_ptr, rc=rc)
934 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
937 print*,
"- CALL Field_Regrid for snow liq equiv."
938 call esmf_fieldregrid(snow_liq_equiv_input_grid, &
939 snow_liq_equiv_target_grid, &
940 routehandle=regrid_seaice, &
941 termorderflag=esmf_termorder_srcseq, rc=rc)
942 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
945 print*,
"- CALL FieldGet FOR TARGET grid snow liq equiv."
946 call esmf_fieldget(snow_liq_equiv_target_grid, &
947 farrayptr=snow_liq_equiv_target_ptr, rc=rc)
948 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
951 print*,
"- CALL Field_Regrid for sea ice skin temp."
952 call esmf_fieldregrid(seaice_skin_temp_input_grid, &
953 seaice_skin_temp_target_grid, &
954 routehandle=regrid_seaice, &
955 termorderflag=esmf_termorder_srcseq, rc=rc)
956 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
959 print*,
"- CALL FieldGet FOR TARGET grid sea ice skin temp."
960 call esmf_fieldget(seaice_skin_temp_target_grid, &
961 farrayptr=seaice_skin_temp_target_ptr, rc=rc)
962 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
965 l = lbound(unmapped_ptr)
966 u = ubound(unmapped_ptr)
969 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
970 seaice_depth_target_ptr(i,j) = -9999.9
971 snow_depth_target_ptr(i,j) = -9999.9
972 snow_liq_equiv_target_ptr(i,j) = -9999.9
973 seaice_skin_temp_target_ptr(i,j) = -9999.9
974 soil_temp_target_ptr(i,j,:) = -9999.9
977 do tile = 1, num_tiles_target_grid
979 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE DEPTH TILE: ", tile
980 call esmf_fieldgather(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
981 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
984 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
985 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
986 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
989 if (localpet == 0)
then
993 where(mask_target_one_tile == 1) mask_target_one_tile = 0
994 where(mask_target_one_tile == 2) mask_target_one_tile = 1
995 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 92)
998 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE DEPTH TILE: ", tile
999 call esmf_fieldscatter(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1000 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1003 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile
1004 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1005 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1008 if (localpet == 0)
then
1009 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 66)
1012 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH TILE: ", tile
1013 call esmf_fieldscatter(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1014 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1017 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile
1018 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1019 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1022 if (localpet == 0)
then
1023 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 65)
1026 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile
1027 call esmf_fieldscatter(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1028 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1031 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE SKIN TEMP: ", tile
1032 call esmf_fieldgather(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1033 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1036 if (localpet == 0)
then
1037 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 21)
1040 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE SKIN TEMP: ", tile
1041 call esmf_fieldscatter(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1042 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1045 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
1046 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1047 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1050 if (localpet == 0)
then
1051 do j = 1, lsoil_target
1052 data_one_tile = data_one_tile_3d(:,:,j)
1053 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 21)
1054 data_one_tile_3d(:,:,j) = data_one_tile
1058 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
1059 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1060 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1064 print*,
"- CALL FieldRegridRelease."
1065 call esmf_fieldregridrelease(routehandle=regrid_seaice, rc=rc)
1066 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1074 where (nint(landmask_input_ptr) == 0) mask_input_ptr = 1
1077 where (landmask_target_ptr == 0) mask_target_ptr = 1
1079 method=esmf_regridmethod_conserve
1080 isrctermprocessing = 1
1082 print*,
"- CALL FieldRegridStore for water fields."
1083 call esmf_fieldregridstore(skin_temp_input_grid, &
1084 skin_temp_target_grid, &
1085 srcmaskvalues=(/0/), &
1086 dstmaskvalues=(/0/), &
1087 polemethod=esmf_polemethod_none, &
1088 srctermprocessing=isrctermprocessing, &
1089 unmappedaction=esmf_unmappedaction_ignore, &
1090 normtype=esmf_normtype_fracarea, &
1091 routehandle=regrid_water, &
1092 regridmethod=method, &
1093 unmappeddstlist=unmapped_ptr, rc=rc)
1094 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1097 print*,
"- CALL Field_Regrid for skin temperature over water."
1098 call esmf_fieldregrid(skin_temp_input_grid, &
1099 skin_temp_target_grid, &
1100 routehandle=regrid_water, &
1101 termorderflag=esmf_termorder_srcseq, rc=rc)
1102 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1105 print*,
"- CALL FieldGet FOR TARGET skin temperature."
1106 call esmf_fieldget(skin_temp_target_grid, &
1107 farrayptr=skin_temp_target_ptr, rc=rc)
1108 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1111 print*,
"- CALL Field_Regrid for z0 over water."
1112 call esmf_fieldregrid(z0_input_grid, &
1114 routehandle=regrid_water, &
1115 termorderflag=esmf_termorder_srcseq, rc=rc)
1116 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1119 print*,
"- CALL FieldGet FOR TARGET z0."
1120 call esmf_fieldget(z0_target_grid, &
1121 farrayptr=z0_target_ptr, rc=rc)
1122 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1125 l = lbound(unmapped_ptr)
1126 u = ubound(unmapped_ptr)
1129 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1130 skin_temp_target_ptr(i,j) = -9999.9
1131 z0_target_ptr(i,j) = -9999.9
1134 if (convert_nst)
then
1136 print*,
"- CALL Field_Regrid for c_d over water."
1137 call esmf_fieldregrid(c_d_input_grid, &
1139 routehandle=regrid_water, &
1140 termorderflag=esmf_termorder_srcseq, rc=rc)
1141 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1144 print*,
"- CALL Field_Regrid for c_0 over water."
1145 call esmf_fieldregrid(c_0_input_grid, &
1147 routehandle=regrid_water, &
1148 termorderflag=esmf_termorder_srcseq, rc=rc)
1149 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1152 print*,
"- CALL Field_Regrid for d_conv over water."
1153 call esmf_fieldregrid(d_conv_input_grid, &
1154 d_conv_target_grid, &
1155 routehandle=regrid_water, &
1156 termorderflag=esmf_termorder_srcseq, rc=rc)
1157 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1160 print*,
"- CALL Field_Regrid for dt_cool over water."
1161 call esmf_fieldregrid(dt_cool_input_grid, &
1162 dt_cool_target_grid, &
1163 routehandle=regrid_water, &
1164 termorderflag=esmf_termorder_srcseq, rc=rc)
1165 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1168 print*,
"- CALL Field_Regrid for ifd over water."
1169 call esmf_fieldregrid(ifd_input_grid, &
1171 routehandle=regrid_water, &
1172 termorderflag=esmf_termorder_srcseq, rc=rc)
1173 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1176 print*,
"- CALL Field_Regrid for qrain over water."
1177 call esmf_fieldregrid(qrain_input_grid, &
1178 qrain_target_grid, &
1179 routehandle=regrid_water, &
1180 termorderflag=esmf_termorder_srcseq, rc=rc)
1181 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1184 print*,
"- CALL Field_Regrid for tref over water."
1185 call esmf_fieldregrid(tref_input_grid, &
1187 routehandle=regrid_water, &
1188 termorderflag=esmf_termorder_srcseq, rc=rc)
1189 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1192 print*,
"- CALL Field_Regrid for w_d over water."
1193 call esmf_fieldregrid(w_d_input_grid, &
1195 routehandle=regrid_water, &
1196 termorderflag=esmf_termorder_srcseq, rc=rc)
1197 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1200 print*,
"- CALL Field_Regrid for w_0 over water."
1201 call esmf_fieldregrid(w_0_input_grid, &
1203 routehandle=regrid_water, &
1204 termorderflag=esmf_termorder_srcseq, rc=rc)
1205 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1208 print*,
"- CALL Field_Regrid for xs over water."
1209 call esmf_fieldregrid(xs_input_grid, &
1211 routehandle=regrid_water, &
1212 termorderflag=esmf_termorder_srcseq, rc=rc)
1213 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1216 print*,
"- CALL Field_Regrid for xt over water."
1217 call esmf_fieldregrid(xt_input_grid, &
1219 routehandle=regrid_water, &
1220 termorderflag=esmf_termorder_srcseq, rc=rc)
1221 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1224 print*,
"- CALL Field_Regrid for xu over water."
1225 call esmf_fieldregrid(xu_input_grid, &
1227 routehandle=regrid_water, &
1228 termorderflag=esmf_termorder_srcseq, rc=rc)
1229 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1232 print*,
"- CALL Field_Regrid for xv over water."
1233 call esmf_fieldregrid(xv_input_grid, &
1235 routehandle=regrid_water, &
1236 termorderflag=esmf_termorder_srcseq, rc=rc)
1237 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1240 print*,
"- CALL Field_Regrid for xz over water."
1241 call esmf_fieldregrid(xz_input_grid, &
1243 routehandle=regrid_water, &
1244 termorderflag=esmf_termorder_srcseq, rc=rc)
1245 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1248 print*,
"- CALL Field_Regrid for xtts over water."
1249 call esmf_fieldregrid(xtts_input_grid, &
1251 routehandle=regrid_water, &
1252 termorderflag=esmf_termorder_srcseq, rc=rc)
1253 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1256 print*,
"- CALL Field_Regrid for xzts over water."
1257 call esmf_fieldregrid(xzts_input_grid, &
1259 routehandle=regrid_water, &
1260 termorderflag=esmf_termorder_srcseq, rc=rc)
1261 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1264 print*,
"- CALL Field_Regrid for z_c over water."
1265 call esmf_fieldregrid(z_c_input_grid, &
1267 routehandle=regrid_water, &
1268 termorderflag=esmf_termorder_srcseq, rc=rc)
1269 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1272 print*,
"- CALL Field_Regrid for zm over water."
1273 call esmf_fieldregrid(zm_input_grid, &
1275 routehandle=regrid_water, &
1276 termorderflag=esmf_termorder_srcseq, rc=rc)
1277 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1282 print*,
"- CALL FieldGet FOR TARGET c_d."
1283 call esmf_fieldget(c_d_target_grid, &
1284 farrayptr=c_d_target_ptr, rc=rc)
1285 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1288 print*,
"- CALL FieldGet FOR TARGET c_0."
1289 call esmf_fieldget(c_0_target_grid, &
1290 farrayptr=c_0_target_ptr, rc=rc)
1291 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1294 print*,
"- CALL FieldGet FOR TARGET d_conv."
1295 call esmf_fieldget(d_conv_target_grid, &
1296 farrayptr=d_conv_target_ptr, rc=rc)
1297 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1300 print*,
"- CALL FieldGet FOR TARGET dt_cool."
1301 call esmf_fieldget(dt_cool_target_grid, &
1302 farrayptr=dt_cool_target_ptr, rc=rc)
1303 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1306 print*,
"- CALL FieldGet FOR TARGET ifd."
1307 call esmf_fieldget(ifd_target_grid, &
1308 farrayptr=ifd_target_ptr, rc=rc)
1309 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1312 ifd_target_ptr = float(nint(ifd_target_ptr))
1314 print*,
"- CALL FieldGet FOR TARGET qrain."
1315 call esmf_fieldget(qrain_target_grid, &
1316 farrayptr=qrain_target_ptr, rc=rc)
1317 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1320 print*,
"- CALL FieldGet FOR TARGET tref."
1321 call esmf_fieldget(tref_target_grid, &
1322 farrayptr=tref_target_ptr, rc=rc)
1323 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1326 print*,
"- CALL FieldGet FOR TARGET w_d."
1327 call esmf_fieldget(w_d_target_grid, &
1328 farrayptr=w_d_target_ptr, rc=rc)
1329 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1332 print*,
"- CALL FieldGet FOR TARGET w_0."
1333 call esmf_fieldget(w_0_target_grid, &
1334 farrayptr=w_0_target_ptr, rc=rc)
1335 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1338 print*,
"- CALL FieldGet FOR TARGET xs."
1339 call esmf_fieldget(xs_target_grid, &
1340 farrayptr=xs_target_ptr, rc=rc)
1341 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1344 print*,
"- CALL FieldGet FOR TARGET xt."
1345 call esmf_fieldget(xt_target_grid, &
1346 farrayptr=xt_target_ptr, rc=rc)
1347 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1350 print*,
"- CALL FieldGet FOR TARGET xu."
1351 call esmf_fieldget(xu_target_grid, &
1352 farrayptr=xu_target_ptr, rc=rc)
1353 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1356 print*,
"- CALL FieldGet FOR TARGET xv."
1357 call esmf_fieldget(xv_target_grid, &
1358 farrayptr=xv_target_ptr, rc=rc)
1359 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1362 print*,
"- CALL FieldGet FOR TARGET xz."
1363 call esmf_fieldget(xz_target_grid, &
1364 farrayptr=xz_target_ptr, rc=rc)
1365 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1368 print*,
"- CALL FieldGet FOR TARGET xtts."
1369 call esmf_fieldget(xtts_target_grid, &
1370 farrayptr=xtts_target_ptr, rc=rc)
1371 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1374 print*,
"- CALL FieldGet FOR TARGET xzts."
1375 call esmf_fieldget(xzts_target_grid, &
1376 farrayptr=xzts_target_ptr, rc=rc)
1377 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1380 print*,
"- CALL FieldGet FOR TARGET z_c."
1381 call esmf_fieldget(z_c_target_grid, &
1382 farrayptr=z_c_target_ptr, rc=rc)
1383 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1386 print*,
"- CALL FieldGet FOR TARGET zm."
1387 call esmf_fieldget(zm_target_grid, &
1388 farrayptr=zm_target_ptr, rc=rc)
1389 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1393 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1394 c_d_target_ptr(i,j) = -9999.9
1395 c_0_target_ptr(i,j) = -9999.9
1396 d_conv_target_ptr(i,j) = -9999.9
1397 dt_cool_target_ptr(i,j) = -9999.9
1398 ifd_target_ptr(i,j) = -9999.9
1399 qrain_target_ptr(i,j) = -9999.9
1400 tref_target_ptr(i,j) = -9999.9
1401 w_d_target_ptr(i,j) = -9999.9
1402 w_0_target_ptr(i,j) = -9999.9
1403 xs_target_ptr(i,j) = -9999.9
1404 xt_target_ptr(i,j) = -9999.9
1405 xu_target_ptr(i,j) = -9999.9
1406 xv_target_ptr(i,j) = -9999.9
1407 xz_target_ptr(i,j) = -9999.9
1408 xtts_target_ptr(i,j) = -9999.9
1409 xzts_target_ptr(i,j) = -9999.9
1410 z_c_target_ptr(i,j) = -9999.9
1411 zm_target_ptr(i,j) = -9999.9
1416 if (localpet == 0)
then
1417 allocate(latitude_one_tile(i_target,j_target))
1419 allocate(latitude_one_tile(0,0))
1422 do tile = 1, num_tiles_target_grid
1426 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE TILE: ", tile
1427 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1428 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1431 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1432 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1433 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1436 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
1437 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
1438 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1441 if (localpet == 0)
then
1442 allocate(water_target_one_tile(i_target,j_target))
1443 water_target_one_tile = 0
1444 where(mask_target_one_tile == 0) water_target_one_tile = 1
1445 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 11, &
1446 latitude=latitude_one_tile)
1449 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMP: ", tile
1450 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1451 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1456 print*,
"- CALL FieldGather FOR TARGET GRID Z0 TILE: ", tile
1457 call esmf_fieldgather(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1458 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1461 if (localpet == 0)
then
1462 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 83)
1465 print*,
"- CALL FieldScatter FOR TARGET GRID Z0: ", tile
1466 call esmf_fieldscatter(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1467 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1470 if (convert_nst)
then
1474 print*,
"- CALL FieldGather FOR TARGET GRID C_D TILE: ", tile
1475 call esmf_fieldgather(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1476 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1479 if (localpet == 0)
then
1480 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1483 print*,
"- CALL FieldScatter FOR TARGET GRID C_D: ", tile
1484 call esmf_fieldscatter(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1485 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1490 print*,
"- CALL FieldGather FOR TARGET GRID C_0 TILE: ", tile
1491 call esmf_fieldgather(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1492 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1495 if (localpet == 0)
then
1496 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1499 print*,
"- CALL FieldScatter FOR TARGET GRID C_0: ", tile
1500 call esmf_fieldscatter(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1501 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1506 print*,
"- CALL FieldGather FOR TARGET GRID D_CONV TILE: ", tile
1507 call esmf_fieldgather(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1508 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1511 if (localpet == 0)
then
1512 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1515 print*,
"- CALL FieldScatter FOR TARGET GRID D_CONV: ", tile
1516 call esmf_fieldscatter(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1517 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1522 print*,
"- CALL FieldGather FOR TARGET GRID DT_COOL TILE: ", tile
1523 call esmf_fieldgather(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1524 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1527 if (localpet == 0)
then
1528 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1531 print*,
"- CALL FieldScatter FOR TARGET GRID DT_COOL: ", tile
1532 call esmf_fieldscatter(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1533 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1538 print*,
"- CALL FieldGather FOR TARGET GRID IFD TILE: ", tile
1539 call esmf_fieldgather(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1540 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1543 if (localpet == 0)
then
1544 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 1)
1547 print*,
"- CALL FieldScatter FOR TARGET GRID IFD: ", tile
1548 call esmf_fieldscatter(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1549 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1554 print*,
"- CALL FieldGather FOR TARGET GRID QRAIN TILE: ", tile
1555 call esmf_fieldgather(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1556 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1559 if (localpet == 0)
then
1560 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1563 print*,
"- CALL FieldScatter FOR TARGET GRID QRAIN: ", tile
1564 call esmf_fieldscatter(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1565 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1570 print*,
"- CALL FieldGather FOR TARGET GRID TREF TILE: ", tile
1571 call esmf_fieldgather(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1572 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1575 if (localpet == 0)
then
1576 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 11, &
1577 latitude=latitude_one_tile)
1580 print*,
"- CALL FieldScatter FOR TARGET GRID TREF: ", tile
1581 call esmf_fieldscatter(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1582 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1587 print*,
"- CALL FieldGather FOR TARGET GRID W_D TILE: ", tile
1588 call esmf_fieldgather(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1589 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1592 if (localpet == 0)
then
1593 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1596 print*,
"- CALL FieldScatter FOR TARGET GRID W_D: ", tile
1597 call esmf_fieldscatter(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1598 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1603 print*,
"- CALL FieldGather FOR TARGET GRID W_0 TILE: ", tile
1604 call esmf_fieldgather(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1605 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1608 if (localpet == 0)
then
1609 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1612 print*,
"- CALL FieldScatter FOR TARGET GRID W_0: ", tile
1613 call esmf_fieldscatter(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1614 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1619 print*,
"- CALL FieldGather FOR TARGET GRID XS TILE: ", tile
1620 call esmf_fieldgather(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1621 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1624 if (localpet == 0)
then
1625 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1628 print*,
"- CALL FieldScatter FOR TARGET GRID XS: ", tile
1629 call esmf_fieldscatter(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1630 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1635 print*,
"- CALL FieldGather FOR TARGET GRID XT TILE: ", tile
1636 call esmf_fieldgather(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1637 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1640 if (localpet == 0)
then
1641 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1644 print*,
"- CALL FieldScatter FOR TARGET GRID XT: ", tile
1645 call esmf_fieldscatter(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1646 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1651 print*,
"- CALL FieldGather FOR TARGET GRID XU TILE: ", tile
1652 call esmf_fieldgather(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1653 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1656 if (localpet == 0)
then
1657 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1660 print*,
"- CALL FieldScatter FOR TARGET GRID XU: ", tile
1661 call esmf_fieldscatter(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1662 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1667 print*,
"- CALL FieldGather FOR TARGET GRID XV TILE: ", tile
1668 call esmf_fieldgather(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1669 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1672 if (localpet == 0)
then
1673 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1676 print*,
"- CALL FieldScatter FOR TARGET GRID XV: ", tile
1677 call esmf_fieldscatter(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1678 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1683 print*,
"- CALL FieldGather FOR TARGET GRID XZ TILE: ", tile
1684 call esmf_fieldgather(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1685 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1688 if (localpet == 0)
then
1689 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 30)
1692 print*,
"- CALL FieldScatter FOR TARGET GRID XZ: ", tile
1693 call esmf_fieldscatter(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1694 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1699 print*,
"- CALL FieldGather FOR TARGET GRID XTTS TILE: ", tile
1700 call esmf_fieldgather(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1701 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1704 if (localpet == 0)
then
1705 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1708 print*,
"- CALL FieldScatter FOR TARGET GRID XTTS: ", tile
1709 call esmf_fieldscatter(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1710 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1715 print*,
"- CALL FieldGather FOR TARGET GRID XZTS TILE: ", tile
1716 call esmf_fieldgather(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1717 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1720 if (localpet == 0)
then
1721 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1724 print*,
"- CALL FieldScatter FOR TARGET GRID XZTS: ", tile
1725 call esmf_fieldscatter(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1726 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1731 print*,
"- CALL FieldGather FOR TARGET GRID Z_C TILE: ", tile
1732 call esmf_fieldgather(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1733 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1736 if (localpet == 0)
then
1737 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1740 print*,
"- CALL FieldScatter FOR TARGET GRID Z_C: ", tile
1741 call esmf_fieldscatter(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1742 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1747 print*,
"- CALL FieldGather FOR TARGET GRID ZM TILE: ", tile
1748 call esmf_fieldgather(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1749 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1752 if (localpet == 0)
then
1753 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1756 print*,
"- CALL FieldScatter FOR TARGET GRID ZM: ", tile
1757 call esmf_fieldscatter(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1758 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1763 if (localpet == 0)
deallocate(water_target_one_tile)
1767 deallocate(latitude_one_tile)
1769 print*,
"- CALL FieldRegridRelease."
1770 call esmf_fieldregridrelease(routehandle=regrid_water, rc=rc)
1771 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1779 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
1782 where (landmask_target_ptr == 1) mask_target_ptr = 1
1784 method=esmf_regridmethod_conserve
1785 isrctermprocessing = 1
1787 print*,
"- CALL FieldRegridStore for land fields."
1788 call esmf_fieldregridstore(snow_depth_input_grid, &
1789 snow_depth_target_grid, &
1790 srcmaskvalues=(/0/), &
1791 dstmaskvalues=(/0/), &
1792 polemethod=esmf_polemethod_none, &
1793 srctermprocessing=isrctermprocessing, &
1794 unmappedaction=esmf_unmappedaction_ignore, &
1795 normtype=esmf_normtype_fracarea, &
1796 routehandle=regrid_all_land, &
1797 regridmethod=method, &
1798 unmappeddstlist=unmapped_ptr, rc=rc)
1799 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1802 print*,
"- CALL Field_Regrid for snow depth over land."
1803 call esmf_fieldregrid(snow_depth_input_grid, &
1804 snow_depth_target_grid, &
1805 routehandle=regrid_all_land, &
1806 termorderflag=esmf_termorder_srcseq, &
1807 zeroregion=esmf_region_select, &
1810 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1813 print*,
"- CALL Field_Regrid for snow liq equiv over land."
1814 call esmf_fieldregrid(snow_liq_equiv_input_grid, &
1815 snow_liq_equiv_target_grid, &
1816 routehandle=regrid_all_land, &
1817 termorderflag=esmf_termorder_srcseq, &
1818 zeroregion=esmf_region_select, rc=rc)
1819 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1822 print*,
"- CALL Field_Regrid for canopy mc."
1823 call esmf_fieldregrid(canopy_mc_input_grid, &
1824 canopy_mc_target_grid, &
1825 routehandle=regrid_all_land, &
1826 termorderflag=esmf_termorder_srcseq, rc=rc)
1827 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1830 print*,
"- CALL FieldGet FOR TARGET snow depth."
1831 call esmf_fieldget(snow_depth_target_grid, &
1832 farrayptr=snow_depth_target_ptr, rc=rc)
1833 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1836 print*,
"- CALL FieldGet FOR TARGET snow liq equiv."
1837 call esmf_fieldget(snow_liq_equiv_target_grid, &
1838 farrayptr=snow_liq_equiv_target_ptr, rc=rc)
1839 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1842 print*,
"- CALL FieldGet FOR TARGET canopy moisture."
1843 call esmf_fieldget(canopy_mc_target_grid, &
1844 farrayptr=canopy_mc_target_ptr, rc=rc)
1845 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1848 l = lbound(unmapped_ptr)
1849 u = ubound(unmapped_ptr)
1852 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1853 snow_depth_target_ptr(i,j) = -9999.9
1854 snow_liq_equiv_target_ptr(i,j) = -9999.9
1855 canopy_mc_target_ptr(i,j) = -9999.9
1858 do tile = 1, num_tiles_target_grid
1860 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile
1861 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1862 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1865 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1866 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1867 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1870 if (localpet == 0)
then
1871 allocate(land_target_one_tile(i_target,j_target))
1872 land_target_one_tile = 0
1873 where(mask_target_one_tile == 1) land_target_one_tile = 1
1874 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 66)
1877 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH: ", tile
1878 call esmf_fieldscatter(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1879 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1882 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQUID EQUIV: ", tile
1883 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1884 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1887 if (localpet == 0)
then
1888 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 65)
1891 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW LIQUID EQUIV: ", tile
1892 call esmf_fieldscatter(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1893 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1896 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MC: ", tile
1897 call esmf_fieldgather(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1898 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1901 if (localpet == 0)
then
1902 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 223)
1903 deallocate(land_target_one_tile)
1906 print*,
"- CALL FieldScatter FOR TARGET GRID CANOPY MC: ", tile
1907 call esmf_fieldscatter(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1908 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1913 print*,
"- CALL FieldRegridRelease."
1914 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
1915 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1922 print*,
"- CALL FieldGet FOR INPUT GRID VEG TYPE."
1923 call esmf_fieldget(veg_type_input_grid, &
1924 farrayptr=veg_type_input_ptr, rc=rc)
1925 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1928 print*,
'land ice check ',veg_type_landice_input
1931 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 1
1933 print*,
"- CALL FieldGet FOR TARGET GRID VEG TYPE."
1934 call esmf_fieldget(veg_type_target_grid, &
1935 farrayptr=veg_type_target_ptr, rc=rc)
1936 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1940 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 1
1942 method=esmf_regridmethod_nearest_stod
1943 isrctermprocessing = 1
1945 print*,
"- CALL FieldRegridStore for landice fields."
1946 call esmf_fieldregridstore(soil_temp_input_grid, &
1947 soil_temp_target_grid, &
1948 srcmaskvalues=(/0/), &
1949 dstmaskvalues=(/0/), &
1950 polemethod=esmf_polemethod_none, &
1951 srctermprocessing=isrctermprocessing, &
1952 unmappedaction=esmf_unmappedaction_ignore, &
1953 normtype=esmf_normtype_fracarea, &
1954 routehandle=regrid_landice, &
1955 regridmethod=method, &
1956 unmappeddstlist=unmapped_ptr, rc=rc)
1957 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1960 print*,
"- CALL Field_Regrid for soil temperature over landice."
1961 call esmf_fieldregrid(soil_temp_input_grid, &
1962 soil_temp_target_grid, &
1963 routehandle=regrid_landice, &
1964 termorderflag=esmf_termorder_srcseq, &
1965 zeroregion=esmf_region_select, rc=rc)
1966 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1969 print*,
"- CALL Field_Regrid for skin temperature over landice."
1970 call esmf_fieldregrid(skin_temp_input_grid, &
1971 skin_temp_target_grid, &
1972 routehandle=regrid_landice, &
1973 termorderflag=esmf_termorder_srcseq, &
1974 zeroregion=esmf_region_select, rc=rc)
1975 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1978 print*,
"- CALL Field_Regrid for terrain over landice."
1979 call esmf_fieldregrid(terrain_input_grid, &
1980 terrain_from_input_grid, &
1981 routehandle=regrid_landice, &
1982 termorderflag=esmf_termorder_srcseq, &
1983 zeroregion=esmf_region_select, rc=rc)
1984 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1987 print*,
"- CALL FieldGet FOR TARGET grid column temperature over landice."
1988 call esmf_fieldget(soil_temp_target_grid, &
1989 farrayptr=soil_temp_target_ptr, rc=rc)
1990 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1993 print*,
"- CALL FieldGet FOR TARGET skin temperature."
1994 call esmf_fieldget(skin_temp_target_grid, &
1995 farrayptr=skin_temp_target_ptr, rc=rc)
1996 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1999 print*,
"- CALL FieldGet FOR terrain from input grid."
2000 call esmf_fieldget(terrain_from_input_grid, &
2001 farrayptr=terrain_from_input_ptr, rc=rc)
2002 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2005 if (.not. sotyp_from_climo)
then
2006 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID, TILE: ", tile
2007 call esmf_fieldgather(soil_type_target_grid,soil_type_target_grid_save,rootpet=0,tile=1, rc=rc)
2008 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2011 print*,
"- CALL Field_Regrid for soil type over landice."
2012 call esmf_fieldregrid(soil_type_input_grid, &
2013 soil_type_target_grid, &
2014 routehandle=regrid_landice, &
2015 termorderflag=esmf_termorder_srcseq, &
2017 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2020 print*,
"- CALL FieldGet FOR SOIL TYPE TARGET GRID."
2021 call esmf_fieldget(soil_type_target_grid, &
2022 farrayptr=soil_type_from_input_ptr, rc=rc)
2023 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2027 l = lbound(unmapped_ptr)
2028 u = ubound(unmapped_ptr)
2031 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
2032 soil_temp_target_ptr(i,j,:) = -9999.9
2033 skin_temp_target_ptr(i,j) = -9999.9
2034 terrain_from_input_ptr(i,j) = -9999.9
2035 if (.not.sotyp_from_climo) soil_type_from_input_ptr(i,j) = -9999.9
2038 if (localpet == 0)
then
2039 allocate (veg_type_target_one_tile(i_target,j_target))
2040 allocate (land_target_one_tile(i_target,j_target))
2041 allocate (data_one_tile2(i_target,j_target))
2043 allocate (veg_type_target_one_tile(0,0))
2044 allocate (land_target_one_tile(0,0))
2045 allocate (data_one_tile2(0,0))
2048 do tile = 1, num_tiles_target_grid
2050 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP TILE: ", tile
2051 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2052 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2055 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
2056 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
2057 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2060 if (localpet == 0)
then
2061 land_target_one_tile = 0
2062 where(nint(veg_type_target_one_tile) == veg_type_landice_target) land_target_one_tile = 1
2063 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 21)
2066 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMP, TILE: ", tile
2067 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2068 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2071 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2072 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2073 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2076 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID LAND, TILE: ", tile
2077 call esmf_fieldgather(terrain_from_input_grid_land, data_one_tile2, rootpet=0, tile=tile, rc=rc)
2078 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2081 if (localpet == 0)
then
2082 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7, terrain_land=data_one_tile2)
2085 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2086 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2087 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2090 print*,
"- CALL FieldGather FOR TARGET GRID LANDICE COLUMN TEMP: ", tile
2091 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2092 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2095 if (localpet == 0)
then
2096 do j = 1, lsoil_target
2097 data_one_tile = data_one_tile_3d(:,:,j)
2098 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 21)
2099 data_one_tile_3d(:,:,j) = data_one_tile
2103 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
2104 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2105 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2108 if (.not. sotyp_from_climo)
then
2109 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID LAND, TILE: ",tile
2110 call esmf_fieldgather(soil_type_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2111 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2114 if (localpet == 0)
then
2115 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile,231)
2118 print*,
"- CALL FieldScatter FOR SOIL TYPE TARGET GRID, TILE: ", tile
2119 call esmf_fieldscatter(soil_type_target_grid,data_one_tile,rootpet=0,tile=tile,rc=rc)
2120 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2126 deallocate (veg_type_target_one_tile)
2127 deallocate (land_target_one_tile)
2129 print*,
"- CALL FieldRegridRelease."
2130 call esmf_fieldregridrelease(routehandle=regrid_landice, rc=rc)
2131 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2139 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
2140 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 0
2143 where (landmask_target_ptr == 1) mask_target_ptr = 1
2144 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 0
2146 method=esmf_regridmethod_nearest_stod
2147 isrctermprocessing = 1
2149 print*,
"- CALL FieldRegridStore for 3d land (but no land ice) fields."
2150 call esmf_fieldregridstore(soilm_tot_input_grid, &
2151 soilm_tot_target_grid, &
2152 srcmaskvalues=(/0/), &
2153 dstmaskvalues=(/0/), &
2154 polemethod=esmf_polemethod_none, &
2155 srctermprocessing=isrctermprocessing, &
2156 unmappedaction=esmf_unmappedaction_ignore, &
2157 normtype=esmf_normtype_fracarea, &
2158 routehandle=regrid_land, &
2159 regridmethod=method, &
2160 unmappeddstlist=unmapped_ptr, rc=rc)
2161 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2164 print*,
"- CALL Field_Regrid for total soil moisture over land."
2165 call esmf_fieldregrid(soilm_tot_input_grid, &
2166 soilm_tot_target_grid, &
2167 routehandle=regrid_land, &
2168 termorderflag=esmf_termorder_srcseq, rc=rc)
2169 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2172 print*,
"- CALL Field_Regrid for soil temperature over land."
2173 call esmf_fieldregrid(soil_temp_input_grid, &
2174 soil_temp_target_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 skin temperature over land."
2182 call esmf_fieldregrid(skin_temp_input_grid, &
2183 skin_temp_target_grid, &
2184 routehandle=regrid_land, &
2185 termorderflag=esmf_termorder_srcseq, &
2186 zeroregion=esmf_region_select, rc=rc)
2187 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2190 print*,
"- CALL Field_Regrid for terrain over land."
2191 call esmf_fieldregrid(terrain_input_grid, &
2192 terrain_from_input_grid, &
2193 routehandle=regrid_land, &
2194 termorderflag=esmf_termorder_srcseq, &
2195 zeroregion=esmf_region_select, rc=rc)
2196 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2199 if (.not. sotyp_from_climo)
then
2200 print*,
"- CALL Field_Regrid for soil type over land."
2201 call esmf_fieldregrid(soil_type_input_grid, &
2202 soil_type_target_grid, &
2203 routehandle=regrid_land, &
2204 zeroregion=esmf_region_select, &
2205 termorderflag=esmf_termorder_srcseq, rc=rc)
2206 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2210 print*,
"- CALL Field_Regrid for soil type over land."
2211 call esmf_fieldregrid(soil_type_input_grid, &
2212 soil_type_from_input_grid, &
2213 routehandle=regrid_land, &
2214 termorderflag=esmf_termorder_srcseq, rc=rc)
2215 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2218 if (.not. vgfrc_from_climo)
then
2219 print*,
"- CALL Field_Regrid for veg greenness over land."
2220 call esmf_fieldregrid(veg_greenness_input_grid, &
2221 veg_greenness_target_grid, &
2222 routehandle=regrid_land, &
2223 termorderflag=esmf_termorder_srcseq, rc=rc)
2224 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2228 if (.not. minmax_vgfrc_from_climo)
then
2229 print*,
"- CALL Field_Regrid for max veg greenness over land."
2230 call esmf_fieldregrid(max_veg_greenness_input_grid, &
2231 max_veg_greenness_target_grid, &
2232 routehandle=regrid_land, &
2233 termorderflag=esmf_termorder_srcseq, rc=rc)
2234 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2237 print*,
"- CALL Field_Regrid for min veg greenness over land."
2238 call esmf_fieldregrid(min_veg_greenness_input_grid, &
2239 min_veg_greenness_target_grid, &
2240 routehandle=regrid_land, &
2241 termorderflag=esmf_termorder_srcseq, rc=rc)
2242 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2246 if (.not. lai_from_climo)
then
2247 print*,
"- CALL Field_Regrid for leaf area index over land."
2248 call esmf_fieldregrid(lai_input_grid, &
2250 routehandle=regrid_land, &
2251 termorderflag=esmf_termorder_srcseq, rc=rc)
2252 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2257 print*,
"- CALL FieldGet FOR TARGET grid total soil moisture over land."
2258 call esmf_fieldget(soilm_tot_target_grid, &
2259 farrayptr=soilm_tot_target_ptr, rc=rc)
2260 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2263 print*,
"- CALL FieldGet FOR TARGET grid soil temp over ice."
2264 call esmf_fieldget(soil_temp_target_grid, &
2265 farrayptr=soil_temp_target_ptr, rc=rc)
2266 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2269 print*,
"- CALL FieldGet FOR TARGET skin temperature."
2270 call esmf_fieldget(skin_temp_target_grid, &
2271 farrayptr=skin_temp_target_ptr, rc=rc)
2272 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2275 print*,
"- CALL FieldGet FOR terrain from input grid."
2276 call esmf_fieldget(terrain_from_input_grid, &
2277 farrayptr=terrain_from_input_ptr, rc=rc)
2278 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2281 if (.not. sotyp_from_climo)
then
2282 print*,
"- CALL FieldGet FOR soil type target grid."
2283 call esmf_fieldget(soil_type_target_grid, &
2284 farrayptr=soil_type_target_ptr, rc=rc)
2285 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2289 print*,
"- CALL FieldGet FOR soil type from input grid."
2290 call esmf_fieldget(soil_type_from_input_grid, &
2291 farrayptr=soil_type_from_input_ptr, rc=rc)
2292 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2295 if (.not. vgfrc_from_climo)
then
2296 print*,
"- CALL FieldGet FOR TARGET veg greenness."
2297 call esmf_fieldget(veg_greenness_target_grid, &
2298 farrayptr=veg_greenness_target_ptr, rc=rc)
2299 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2303 if (.not. minmax_vgfrc_from_climo)
then
2304 print*,
"- CALL FieldGet FOR TARGET max veg greenness."
2305 call esmf_fieldget(max_veg_greenness_target_grid, &
2306 farrayptr=max_veg_greenness_target_ptr, rc=rc)
2307 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2310 print*,
"- CALL FieldGet FOR TARGET min veg greenness."
2311 call esmf_fieldget(min_veg_greenness_target_grid, &
2312 farrayptr=min_veg_greenness_target_ptr, rc=rc)
2313 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2317 if (.not. lai_from_climo)
then
2318 print*,
"- CALL FieldGet FOR TARGET lai."
2319 call esmf_fieldget(lai_target_grid, &
2320 farrayptr=lai_target_ptr, rc=rc)
2321 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2325 l = lbound(unmapped_ptr)
2326 u = ubound(unmapped_ptr)
2328 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
2329 soilm_tot_target_ptr(i,j,:) = -9999.9
2330 soil_temp_target_ptr(i,j,:) = -9999.9
2331 skin_temp_target_ptr(i,j) = -9999.9
2332 terrain_from_input_ptr(i,j) = -9999.9
2333 if (.not. sotyp_from_climo) soil_type_target_ptr(i,j) = -9999.9
2334 soil_type_from_input_ptr(i,j) = -9999.9
2335 veg_greenness_target_ptr(i,j) = -9999.9
2336 max_veg_greenness_target_ptr(i,j) = -9999.9
2337 min_veg_greenness_target_ptr(i,j) = -9999.9
2338 lai_target_ptr(i,j) = -9999.9
2341 if (localpet == 0)
then
2342 allocate (veg_type_target_one_tile(i_target,j_target))
2344 allocate (veg_type_target_one_tile(0,0))
2347 do tile = 1, num_tiles_target_grid
2349 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
2350 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
2351 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2354 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
2355 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
2356 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2359 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2360 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2361 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2364 if (localpet == 0)
then
2365 where(nint(veg_type_target_one_tile) == veg_type_landice_target) mask_target_one_tile = 0
2366 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 7)
2369 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2370 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2371 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2374 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile
2375 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2376 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2379 if (localpet == 0)
then
2380 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 85)
2383 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile
2384 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2385 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2388 print*,
"- CALL FieldGather FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile
2389 call esmf_fieldgather(soil_type_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2390 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2393 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID, TILE: ", tile
2394 call esmf_fieldgather(soil_type_target_grid, data_one_tile2, rootpet=0,tile=tile, rc=rc)
2395 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2404 if (.not. sotyp_from_climo)
then
2405 if (localpet==0)
then
2406 call
search(data_one_tile2, mask_target_one_tile, i_target, j_target, tile, 224,soilt_climo=soil_type_target_grid_save)
2409 if (localpet == 0 .and. maxval(data_one_tile) > 0 .and. (trim(external_model) .ne.
"GFS" .or. trim(input_type) .ne.
"grib2"))
then
2412 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224)
2413 elseif (localpet == 0)
then
2414 data_one_tile = data_one_tile2
2418 if (.not. sotyp_from_climo)
then
2419 print*,
"- CALL FieldScatter FOR SOIL TYPE TARGET GRID, TILE: ", tile
2420 call esmf_fieldscatter(soil_type_target_grid, data_one_tile2, rootpet=0, tile=tile, rc=rc)
2421 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2425 print*,
"- CALL FieldScatter FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile
2426 call esmf_fieldscatter(soil_type_from_input_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 (.not. vgfrc_from_climo)
then
2431 print*,
"- CALL FieldGather FOR TARGET GRID VEG GREENNESS, TILE: ", tile
2432 call esmf_fieldgather(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2433 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2436 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2437 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 226)
2440 print*,
"- CALL FieldScatter FOR VEG GREENNESS TARGET GRID, TILE: ", tile
2441 call esmf_fieldscatter(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2442 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2446 if (.not. minmax_vgfrc_from_climo)
then
2447 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEG GREENNESS, TILE: ", tile
2448 call esmf_fieldgather(max_veg_greenness_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2449 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2452 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2453 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 227)
2456 print*,
"- CALL FieldScatter FOR MAX VEG GREENNESS TARGET GRID, TILE: ", tile
2457 call esmf_fieldscatter(max_veg_greenness_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2458 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2461 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEG GREENNESS, TILE: ", tile
2462 call esmf_fieldgather(min_veg_greenness_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2463 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2466 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2467 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile,228)
2471 print*,
"- CALL FieldScatter FOR MIN VEG GREENNESS TARGET GRID, TILE: ",tile
2472 call esmf_fieldscatter(min_veg_greenness_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2473 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2478 if (.not. lai_from_climo)
then
2479 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX, TILE: ", tile
2480 call esmf_fieldgather(lai_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2481 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2484 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2485 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 229)
2488 print*,
"- CALL FieldScatter FOR LEAF AREA INDEX TARGET GRID, TILE: ", tile
2489 call esmf_fieldscatter(lai_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2490 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2494 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
2495 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2496 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2499 if (localpet == 0)
then
2500 do j = 1, lsoil_target
2501 data_one_tile = data_one_tile_3d(:,:,j)
2502 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 86)
2503 data_one_tile_3d(:,:,j) = data_one_tile
2507 print*,
"- CALL FieldScatter FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
2508 call esmf_fieldscatter(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2509 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2512 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
2513 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2514 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2517 if (localpet == 0)
then
2518 do j = 1, lsoil_target
2519 data_one_tile = data_one_tile_3d(:,:,j)
2520 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 85)
2521 data_one_tile_3d(:,:,j) = data_one_tile
2525 print*,
"- CALL FieldScatter FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
2526 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2527 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2530 if (tg3_from_soil)
then
2531 print*,
"- CALL FieldScatter FOR TARGET GRID SUBSTRATE TEMPERATURE, TILE: ", tile
2532 call esmf_fieldscatter(substrate_temp_target_grid, data_one_tile_3d(:,:,lsoil_target), rootpet=0, tile=tile, rc=rc)
2533 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2539 print*,
"- CALL FieldRegridRelease."
2540 call esmf_fieldregridrelease(routehandle=regrid_land, rc=rc)
2541 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2544 deallocate(veg_type_target_one_tile)
2546 deallocate(data_one_tile, data_one_tile2)
2547 deallocate(data_one_tile_3d)
2548 deallocate(mask_target_one_tile)
2568 veg_type_target_grid
2572 integer :: clb(3), cub(3), rc
2573 integer :: i, j, n, soil_type
2575 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2578 real(esmf_kind_r8),
pointer :: soilm_liq_ptr(:,:,:)
2579 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
2580 real(esmf_kind_r8),
pointer :: soil_temp_ptr(:,:,:)
2581 real(esmf_kind_r8),
pointer :: soil_type_ptr(:,:)
2582 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
2584 print*,
"- COMPUTE LIQUID PORTION OF TOTAL SOIL MOISTURE."
2586 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
2587 call esmf_fieldget(soilm_tot_target_grid, &
2588 computationallbound=clb, &
2589 computationalubound=cub, &
2590 farrayptr=soilm_tot_ptr, rc=rc)
2591 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2594 print*,
"- CALL FieldGet FOR LIQUID SOIL MOISTURE."
2595 call esmf_fieldget(soilm_liq_target_grid, &
2596 farrayptr=soilm_liq_ptr, rc=rc)
2597 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2600 print*,
"- CALL FieldGet FOR SOIL TEMPERATURE."
2601 call esmf_fieldget(soil_temp_target_grid, &
2602 farrayptr=soil_temp_ptr, rc=rc)
2603 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2606 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
2607 call esmf_fieldget(veg_type_target_grid, &
2608 farrayptr=veg_type_ptr, rc=rc)
2609 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2612 print*,
"- CALL FieldGet FOR SOIL TYPE."
2613 call esmf_fieldget(soil_type_target_grid, &
2614 farrayptr=soil_type_ptr, rc=rc)
2615 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2618 print*,
"- CALL FieldGet FOR LANDMASK."
2619 call esmf_fieldget(landmask_target_grid, &
2620 farrayptr=landmask_ptr, rc=rc)
2621 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2624 do j = clb(2), cub(2)
2625 do i = clb(1), cub(1)
2631 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
2633 soil_type = nint(soil_type_ptr(i,j))
2635 do n = clb(3), cub(3)
2637 if (soil_temp_ptr(i,j,n) < (frz_h2o-0.0001))
then
2639 bx = bb_target(soil_type)
2641 if (bx .gt. blim) bx = blim
2643 fk=(((hlice/(grav*(-satpsi_target(soil_type))))* &
2644 ((soil_temp_ptr(i,j,n)-frz_h2o)/soil_temp_ptr(i,j,n)))** &
2645 (-1/bx))*maxsmc_target(soil_type)
2647 if (fk .lt. 0.02) fk = 0.02
2649 soilm_liq_ptr(i,j,n) = min( fk, soilm_tot_ptr(i,j,n) )
2657 soilm_liq_ptr(i,j,n) =
frh2o(soil_temp_ptr(i,j,n), &
2658 soilm_tot_ptr(i,j,n), soilm_liq_ptr(i,j,n), &
2659 maxsmc_target(soil_type),bb_target(soil_type), &
2660 satpsi_target(soil_type))
2664 soilm_liq_ptr(i,j,n) = soilm_tot_ptr(i,j,n)
2701 FUNCTION frh2o (TKELV,SMC,SH2O,SMCMAX,BEXP,PSIS)
2718 REAL(esmf_kind_r8) :: sh2o
2719 REAL(esmf_kind_r8) :: smc
2723 REAL(esmf_kind_r8) :: tkelv
2725 REAL,
PARAMETER :: ck = 8.0
2726 REAL,
PARAMETER :: error = 0.005
2735 IF (bexp .GT. blim) bx = blim
2744 IF (ck .NE. 0.0)
THEN
2759 IF (swl .GT. (smc-0.02)) swl = smc-0.02
2760 IF (swl .LT. 0.) swl = 0.
2766 DO WHILE ( (nlog .LT. 10) .AND. (kcount .EQ. 0) )
2769 df = log(( psis*grav/hlice ) * ( ( 1.+ck*swl )**2. ) * &
2770 ( smcmax/(smc-swl) )**bx) - log(-(tkelv-frz_h2o)/tkelv)
2771 denom = 2. * ck / ( 1.+ck*swl ) + bx / ( smc - swl )
2772 swlk = swl - df/denom
2778 IF (swlk .GT. (smc-0.02)) swlk = smc - 0.02
2779 IF (swlk .LT. 0.) swlk = 0.
2785 dswl = abs(swlk-swl)
2793 IF ( dswl .LE. error )
THEN
2819 IF (kcount .EQ. 0)
THEN
2821 fk = (((hlice/(grav*(-psis)))* &
2822 ((tkelv-frz_h2o)/tkelv))**(-1/bx))*smcmax
2824 IF (fk .LT. 0.02) fk = 0.02
2826 frh2o = min(fk, smc)
2846 maxsmc_input, maxsmc_target, &
2847 refsmc_input, refsmc_target, &
2848 wltsmc_input, wltsmc_target
2851 veg_greenness_target_grid, &
2852 veg_type_target_grid
2856 integer :: clb(3), cub(3), i, j, k, rc
2857 integer :: soilt_input, soilt_target
2858 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2860 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
2861 real(esmf_kind_r8),
pointer :: soil_type_input_ptr(:,:)
2862 real(esmf_kind_r8),
pointer :: soil_type_target_ptr(:,:)
2863 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
2864 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
2865 real :: f1, fn, smcdir, smctra
2867 print*,
"- RESCALE SOIL MOISTURE FOR CHANGES IN SOIL TYPE."
2869 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
2870 call esmf_fieldget(soilm_tot_target_grid, &
2871 computationallbound=clb, &
2872 computationalubound=cub, &
2873 farrayptr=soilm_tot_ptr, rc=rc)
2874 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2877 print*,
"- CALL FieldGet FOR LAND MASK."
2878 call esmf_fieldget(landmask_target_grid, &
2879 farrayptr=landmask_ptr, rc=rc)
2880 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2883 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
2884 call esmf_fieldget(veg_type_target_grid, &
2885 farrayptr=veg_type_ptr, rc=rc)
2886 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2889 print*,
"- CALL FieldGet FOR VEGETATION GREENNESS."
2890 call esmf_fieldget(veg_greenness_target_grid, &
2891 farrayptr=veg_greenness_ptr, rc=rc)
2892 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2895 print*,
"- CALL FieldGet FOR TARGET GRID SOIL TYPE."
2896 call esmf_fieldget(soil_type_target_grid, &
2897 farrayptr=soil_type_target_ptr, rc=rc)
2898 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2901 print*,
"- CALL FieldGet FOR SOIL TYPE FROM INPUT GRID."
2902 call esmf_fieldget(soil_type_from_input_grid, &
2903 farrayptr=soil_type_input_ptr, rc=rc)
2904 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2907 do j = clb(2), cub(2)
2908 do i = clb(1), cub(1)
2914 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
2916 soilt_target = nint(soil_type_target_ptr(i,j))
2917 soilt_input = nint(soil_type_input_ptr(i,j))
2925 if (soilt_target /= soilt_input)
then
2930 f1=(soilm_tot_ptr(i,j,1)-drysmc_input(soilt_input)) / &
2931 (maxsmc_input(soilt_input)-drysmc_input(soilt_input))
2933 smcdir=drysmc_target(soilt_target) + f1 * &
2934 (maxsmc_target(soilt_target) - drysmc_target(soilt_target))
2940 if (soilm_tot_ptr(i,j,1) < refsmc_input(soilt_input))
then
2941 f1=(soilm_tot_ptr(i,j,1) - wltsmc_input(soilt_input)) / &
2942 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
2943 smctra=wltsmc_target(soilt_target) + f1 * &
2944 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
2946 f1=(soilm_tot_ptr(i,j,1) - refsmc_input(soilt_input)) / &
2947 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
2948 smctra=refsmc_target(soilt_target) + f1 * &
2949 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
2956 soilm_tot_ptr(i,j,1) = ((1.0 - veg_greenness_ptr(i,j)) * smcdir) + &
2957 (veg_greenness_ptr(i,j) * smctra)
2967 if (soilm_tot_ptr(i,j,k) < refsmc_input(soilt_input))
then
2968 fn = (soilm_tot_ptr(i,j,k) - wltsmc_input(soilt_input)) / &
2969 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
2970 soilm_tot_ptr(i,j,k) = wltsmc_target(soilt_target) + fn * &
2971 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
2973 fn = (soilm_tot_ptr(i,j,k) - refsmc_input(soilt_input)) / &
2974 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
2975 soilm_tot_ptr(i,j,k) = refsmc_target(soilt_target) + fn * &
2976 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
2986 soilm_tot_ptr(i,j,1)=min(soilm_tot_ptr(i,j,1),maxsmc_target(soilt_target))
2987 soilm_tot_ptr(i,j,1)=max(drysmc_target(soilt_target),soilm_tot_ptr(i,j,1))
2990 soilm_tot_ptr(i,j,k)=min(soilm_tot_ptr(i,j,k),maxsmc_target(soilt_target))
2991 soilm_tot_ptr(i,j,k)=max(wltsmc_target(soilt_target),soilm_tot_ptr(i,j,k))
3009 use model_grid, only : landmask_target_grid, &
3016 integer :: clb(3), cub(3), i, j, k, rc
3017 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3019 real,
parameter :: lapse_rate = 6.5e-03
3020 real :: terrain_diff
3021 real(esmf_kind_r8),
pointer :: terrain_input_ptr(:,:)
3022 real(esmf_kind_r8),
pointer :: terrain_target_ptr(:,:)
3023 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
3024 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
3026 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3027 call esmf_fieldget(landmask_target_grid, &
3028 farrayptr=landmask_ptr, rc=rc)
3029 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3032 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
3033 call esmf_fieldget(veg_type_target_grid, &
3034 farrayptr=veg_type_target_ptr, rc=rc)
3035 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3038 print*,
"- CALL FieldGet FOR TARGET GRID TERRAIN."
3039 call esmf_fieldget(terrain_target_grid, &
3040 farrayptr=terrain_target_ptr, rc=rc)
3041 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3044 print*,
"- CALL FieldGet FOR TERRAIN INTERP TO TARGET GRID."
3045 call esmf_fieldget(terrain_from_input_grid, &
3046 farrayptr=terrain_input_ptr, rc=rc)
3047 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3050 print*,
"- CALL FieldGet FOR SOIL TEMP TARGET GRID."
3051 call esmf_fieldget(soil_temp_target_grid, &
3052 computationallbound=clb, &
3053 computationalubound=cub, &
3054 farrayptr=soil_temp_target_ptr, rc=rc)
3055 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3058 do j = clb(2), cub(2)
3059 do i = clb(1), cub(1)
3060 if (landmask_ptr(i,j) == 1)
then
3061 terrain_diff = abs(terrain_input_ptr(i,j) - terrain_target_ptr(i,j))
3062 if (terrain_diff > 100.0)
then
3063 do k = clb(3), cub(3)
3064 soil_temp_target_ptr(i,j,k) = soil_temp_target_ptr(i,j,k) + &
3065 ((terrain_input_ptr(i,j) - terrain_target_ptr(i,j)) * lapse_rate)
3066 if (nint(veg_type_target_ptr(i,j)) == veg_type_landice_target)
then
3067 soil_temp_target_ptr(i,j,k) = min(soil_temp_target_ptr(i,j,k), 273.16)
3084 use model_grid, only : lsoil_target, i_input, j_input, input_grid
3085 use input_data, only : lsoil_input, soil_temp_input_grid, &
3086 soilm_liq_input_grid, soilm_tot_input_grid
3088 integer,
intent(in) :: localpet
3089 character(len=1000) :: msg
3091 real(esmf_kind_r8) :: tmp(i_input,j_input), &
3092 data_one_tile(i_input,j_input,lsoil_input), &
3093 tmp3d(i_input,j_input,lsoil_target)
3094 if (lsoil_input == 9 .and. lsoil_target == 4)
then
3095 print*,
"CONVERTING FROM 9 INPUT SOIL LEVELS TO 4 TARGET SOIL LEVELS"
3096 call esmf_fieldgather(soil_temp_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3097 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3100 call esmf_fielddestroy(soil_temp_input_grid,rc=rc)
3101 soil_temp_input_grid = esmf_fieldcreate(input_grid, &
3102 typekind=esmf_typekind_r8, &
3103 staggerloc=esmf_staggerloc_center, &
3104 ungriddedlbound=(/1/), &
3105 ungriddedubound=(/lsoil_target/), rc=rc)
3108 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3109 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3110 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3111 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3112 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3113 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3114 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3115 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3116 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3117 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3118 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3121 call esmf_fieldscatter(soil_temp_input_grid, tmp3d, rootpet=0, rc=rc)
3122 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3125 call esmf_fieldgather(soilm_tot_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3126 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3129 call esmf_fielddestroy(soilm_tot_input_grid,rc=rc)
3130 soilm_tot_input_grid = esmf_fieldcreate(input_grid, &
3131 typekind=esmf_typekind_r8, &
3132 staggerloc=esmf_staggerloc_center, &
3133 ungriddedlbound=(/1/), &
3134 ungriddedubound=(/lsoil_target/), rc=rc)
3136 if(localpet==0)
then
3137 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3138 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3139 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3140 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3141 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3142 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3143 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3144 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3145 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3146 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3147 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3150 call esmf_fieldscatter(soilm_tot_input_grid, tmp3d, rootpet=0, rc=rc)
3151 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3154 call esmf_fieldgather(soilm_liq_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3155 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3158 call esmf_fielddestroy(soilm_liq_input_grid,rc=rc)
3159 soilm_liq_input_grid = esmf_fieldcreate(input_grid, &
3160 typekind=esmf_typekind_r8, &
3161 staggerloc=esmf_staggerloc_center, &
3162 ungriddedlbound=(/1/), &
3163 ungriddedubound=(/lsoil_target/), rc=rc)
3164 if(localpet==0)
then
3165 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3166 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3167 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3168 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3169 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3170 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3171 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3172 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3173 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3174 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3175 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3178 call esmf_fieldscatter(soilm_liq_input_grid, tmp3d, rootpet=0, rc=rc)
3179 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3182 elseif (lsoil_input /= lsoil_target)
then
3185 write(msg,
'("NUMBER OF SOIL LEVELS IN INPUT (",I2,") and OUPUT &
3186 (",I2,") MUST EITHER BE EQUAL OR 9 AND 4, RESPECTIVELY")') &
3187 lsoil_input, lsoil_target
3206 integer :: clb(2), cub(2), i, j, rc
3207 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3210 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3211 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3213 data z0_igbp /1.089, 2.653, 0.854, 0.826, 0.800, 0.050, &
3214 0.030, 0.856, 0.856, 0.150, 0.040, 0.130, &
3215 1.000, 0.250, 0.011, 0.011, 0.001, 0.076, &
3218 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3219 call esmf_fieldget(landmask_target_grid, &
3220 computationallbound=clb, &
3221 computationalubound=cub, &
3222 farrayptr=landmask_ptr, rc=rc)
3223 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3226 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
3227 call esmf_fieldget(veg_type_target_grid, &
3228 farrayptr=veg_type_ptr, rc=rc)
3229 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3232 print*,
"- CALL FieldGet FOR TARGET GRID Z0."
3233 call esmf_fieldget(z0_target_grid, &
3234 farrayptr=data_ptr, rc=rc)
3235 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3238 do j = clb(2), cub(2)
3239 do i = clb(1), cub(1)
3240 if (landmask_ptr(i,j) == 2)
then
3242 elseif (landmask_ptr(i,j) == 1)
then
3243 data_ptr(i,j) = z0_igbp(nint(veg_type_ptr(i,j))) * 100.0
3258 alvwf_target_grid, &
3259 alnsf_target_grid, &
3260 alnwf_target_grid, &
3261 facsf_target_grid, &
3262 facwf_target_grid, &
3263 mxsno_albedo_target_grid, &
3264 max_veg_greenness_target_grid, &
3265 min_veg_greenness_target_grid, &
3266 slope_type_target_grid, &
3267 soil_type_target_grid, &
3268 substrate_temp_target_grid, &
3269 veg_greenness_target_grid, &
3270 veg_type_target_grid
3274 integer :: clb(2), cub(2), i, j, rc
3275 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3277 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3278 real(esmf_kind_r8),
pointer :: data3d_ptr(:,:,:)
3279 real(esmf_kind_r8),
pointer :: soilmt_ptr(:,:,:)
3280 real(esmf_kind_r8),
pointer :: soilml_ptr(:,:,:)
3281 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
3282 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3283 real(esmf_kind_r8),
pointer :: seaice_skint_ptr(:,:)
3284 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
3285 real(esmf_kind_r8),
pointer :: fice_ptr(:,:)
3286 real(esmf_kind_r8),
pointer :: hice_ptr(:,:)
3288 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3289 call esmf_fieldget(landmask_target_grid, &
3290 computationallbound=clb, &
3291 computationalubound=cub, &
3292 farrayptr=landmask_ptr, rc=rc)
3293 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3296 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE."
3297 call esmf_fieldget(slope_type_target_grid, &
3298 farrayptr=data_ptr, rc=rc)
3299 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3302 do j = clb(2), cub(2)
3303 do i = clb(1), cub(1)
3304 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3308 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SOIL TYPE."
3309 call esmf_fieldget(soil_type_target_grid, &
3310 farrayptr=data_ptr, rc=rc)
3311 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3314 do j = clb(2), cub(2)
3315 do i = clb(1), cub(1)
3316 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3320 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION TYPE."
3321 call esmf_fieldget(veg_type_target_grid, &
3322 farrayptr=veg_type_ptr, rc=rc)
3323 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3326 do j = clb(2), cub(2)
3327 do i = clb(1), cub(1)
3328 if (landmask_ptr(i,j) /= 1) veg_type_ptr(i,j) = 0.0
3332 print*,
"- SET TARGET GRID ALVSF AT NON-LAND."
3333 call esmf_fieldget(alvsf_target_grid, &
3334 farrayptr=data_ptr, rc=rc)
3335 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3338 do j = clb(2), cub(2)
3339 do i = clb(1), cub(1)
3340 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3344 print*,
"- SET TARGET GRID ALVWF AT NON-LAND."
3345 call esmf_fieldget(alvwf_target_grid, &
3346 farrayptr=data_ptr, rc=rc)
3347 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3350 do j = clb(2), cub(2)
3351 do i = clb(1), cub(1)
3352 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3356 print*,
"- SET TARGET GRID ALNSF AT NON-LAND."
3357 call esmf_fieldget(alnsf_target_grid, &
3358 farrayptr=data_ptr, rc=rc)
3359 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3362 do j = clb(2), cub(2)
3363 do i = clb(1), cub(1)
3364 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3368 print*,
"- SET TARGET GRID ALNWF AT NON-LAND."
3369 call esmf_fieldget(alnwf_target_grid, &
3370 farrayptr=data_ptr, rc=rc)
3371 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3374 do j = clb(2), cub(2)
3375 do i = clb(1), cub(1)
3376 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3380 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
3381 call esmf_fieldget(facsf_target_grid, &
3382 farrayptr=data_ptr, rc=rc)
3383 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3386 do j = clb(2), cub(2)
3387 do i = clb(1), cub(1)
3388 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3392 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
3393 call esmf_fieldget(facwf_target_grid, &
3394 farrayptr=data_ptr, rc=rc)
3395 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3398 do j = clb(2), cub(2)
3399 do i = clb(1), cub(1)
3400 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3404 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAXIMUM GREENNESS."
3405 call esmf_fieldget(max_veg_greenness_target_grid, &
3406 farrayptr=data_ptr, rc=rc)
3407 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3410 do j = clb(2), cub(2)
3411 do i = clb(1), cub(1)
3412 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3416 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MINIMUM GREENNESS."
3417 call esmf_fieldget(min_veg_greenness_target_grid, &
3418 farrayptr=data_ptr, rc=rc)
3419 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3422 do j = clb(2), cub(2)
3423 do i = clb(1), cub(1)
3424 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3428 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION GREENNESS."
3429 call esmf_fieldget(veg_greenness_target_grid, &
3430 farrayptr=veg_greenness_ptr, rc=rc)
3431 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3434 do j = clb(2), cub(2)
3435 do i = clb(1), cub(1)
3436 if (landmask_ptr(i,j) /= 1) veg_greenness_ptr(i,j) = 0.0
3440 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAX SNOW ALBEDO."
3441 call esmf_fieldget(mxsno_albedo_target_grid, &
3442 farrayptr=data_ptr, rc=rc)
3443 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3446 do j = clb(2), cub(2)
3447 do i = clb(1), cub(1)
3448 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3452 print*,
"- ZERO OUT TARGET GRID CANOPY MOISTURE CONTENT WHERE NO PLANTS."
3453 call esmf_fieldget(canopy_mc_target_grid, &
3454 farrayptr=data_ptr, rc=rc)
3455 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3458 do j = clb(2), cub(2)
3459 do i = clb(1), cub(1)
3460 if (veg_greenness_ptr(i,j) <= 0.01) data_ptr(i,j) = 0.0
3464 print*,
"- CALL FieldGet FOR TARGET GRID ICE SKIN TEMP."
3465 call esmf_fieldget(seaice_skin_temp_target_grid, &
3466 farrayptr=seaice_skint_ptr, rc=rc)
3467 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3470 print*,
"- SET TARGET GRID SKIN TEMP AT ICE POINTS."
3471 call esmf_fieldget(skin_temp_target_grid, &
3472 farrayptr=skint_ptr, rc=rc)
3473 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3476 print*,
"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION."
3477 call esmf_fieldget(seaice_fract_target_grid, &
3478 farrayptr=fice_ptr, rc=rc)
3479 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3482 print*,
"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS."
3483 call esmf_fieldget(seaice_depth_target_grid, &
3484 farrayptr=hice_ptr, rc=rc)
3485 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3488 do j = clb(2), cub(2)
3489 do i = clb(1), cub(1)
3490 if (fice_ptr(i,j) > 0.0)
then
3491 skint_ptr(i,j) = (fice_ptr(i,j) * seaice_skint_ptr(i,j)) + &
3492 ( (1.0 - fice_ptr(i,j)) * frz_ice )
3494 seaice_skint_ptr(i,j) = skint_ptr(i,j)
3500 print*,
"- SET TARGET GRID SUBSTRATE TEMP AT ICE."
3501 call esmf_fieldget(substrate_temp_target_grid, &
3502 farrayptr=data_ptr, rc=rc)
3503 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3506 do j = clb(2), cub(2)
3507 do i = clb(1), cub(1)
3508 if (landmask_ptr(i,j) == 2)
then
3509 data_ptr(i,j) = frz_ice
3510 elseif (landmask_ptr(i,j) == 0)
then
3511 data_ptr(i,j) = skint_ptr(i,j)
3516 print*,
"- ZERO OUT TARGET GRID SNOW DEPTH AT OPEN WATER."
3517 call esmf_fieldget(snow_depth_target_grid, &
3518 farrayptr=data_ptr, rc=rc)
3519 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3522 do j = clb(2), cub(2)
3523 do i = clb(1), cub(1)
3524 if (landmask_ptr(i,j) == 0)
then
3530 print*,
"- ZERO OUT TARGET GRID SNOW LIQ AT OPEN WATER."
3531 call esmf_fieldget(snow_liq_equiv_target_grid, &
3532 farrayptr=data_ptr, rc=rc)
3533 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3536 do j = clb(2), cub(2)
3537 do i = clb(1), cub(1)
3538 if (landmask_ptr(i,j) == 0)
then
3544 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID TOTAL SOIL MOISTURE."
3545 call esmf_fieldget(soilm_tot_target_grid, &
3546 farrayptr=soilmt_ptr, rc=rc)
3547 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3550 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE."
3551 call esmf_fieldget(soilm_liq_target_grid, &
3552 farrayptr=soilml_ptr, rc=rc)
3553 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3556 do j = clb(2), cub(2)
3557 do i = clb(1), cub(1)
3558 if (landmask_ptr(i,j) == 2 .or. landmask_ptr(i,j) == 0 .or. &
3559 nint(veg_type_ptr(i,j)) == veg_type_landice_target)
then
3560 soilmt_ptr(i,j,:) = 1.0
3561 soilml_ptr(i,j,:) = 1.0
3566 print*,
"- SET OPEN WATER FLAG FOR TARGET GRID SOIL TEMPERATURE."
3567 call esmf_fieldget(soil_temp_target_grid, &
3568 farrayptr=data3d_ptr, rc=rc)
3569 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3572 do j = clb(2), cub(2)
3573 do i = clb(1), cub(1)
3574 if (landmask_ptr(i,j) == 0)
then
3575 data3d_ptr(i,j,:) = skint_ptr(i,j)
3594 integer(esmf_kind_i8),
pointer :: mask_ptr(:,:)
3596 integer,
PARAMETER :: num_nst_fields_minus2 = 16
3597 integer,
PARAMETER :: xz_fill = 30.0
3598 integer,
PARAMETER :: nst_fill = 0.0
3600 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3601 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
3603 type(esmf_field
) :: temp_field
3604 type(esmf_fieldbundle
) :: nst_bundle
3606 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
3607 call esmf_fieldget(landmask_target_grid, &
3608 farrayptr=mask_ptr, rc=rc)
3609 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3612 nst_bundle = esmf_fieldbundlecreate(name=
"nst_bundle", rc=rc)
3613 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3616 call esmf_fieldbundleadd(nst_bundle, (/c_d_target_grid,c_0_target_grid,d_conv_target_grid, &
3617 dt_cool_target_grid,ifd_target_grid,qrain_target_grid,&
3618 w_d_target_grid,w_0_target_grid,xs_target_grid,xt_target_grid,&
3619 xu_target_grid,xv_target_grid,xtts_target_grid,xzts_target_grid, &
3620 z_c_target_grid, zm_target_grid/), rc=rc)
3621 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3624 print*,
"- CALL FieldGet FOR TREF."
3625 call esmf_fieldget(tref_target_grid, &
3626 farrayptr=data_ptr, rc=rc)
3627 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3630 print*,
"- CALL FieldGet FOR SKIN T."
3631 call esmf_fieldget(skin_temp_target_grid, &
3632 farrayptr=skint_ptr, rc=rc)
3633 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3636 where(mask_ptr /= 0) data_ptr = skint_ptr
3640 print*,
"- CALL FieldGet FOR XZ."
3641 call esmf_fieldget(xz_target_grid, &
3642 farrayptr=data_ptr, rc=rc)
3643 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3646 where(mask_ptr /= 0) data_ptr = xz_fill
3648 do i = 1,num_nst_fields_minus2
3650 call esmf_fieldbundleget(nst_bundle,i,temp_field,rc=rc)
3651 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3654 call esmf_fieldget(temp_field,farrayptr=data_ptr,rc=rc)
3655 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3658 where(mask_ptr /= 0) data_ptr = nst_fill
3662 call esmf_fieldbundledestroy(nst_bundle,rc=rc)
3663 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3673 use model_grid, only : target_grid, lsoil_target
3679 real(esmf_kind_r8),
pointer :: target_ptr(:,:), target_ptr_3d(:,:,:)
3680 real :: init_val = -999.9
3682 print*,
"- CALL FieldCreate FOR TARGET GRID T2M."
3683 t2m_target_grid = esmf_fieldcreate(target_grid, &
3684 typekind=esmf_typekind_r8, &
3685 staggerloc=esmf_staggerloc_center, rc=rc)
3686 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3689 print*,
"- INITIALIZE TARGET grid t2m."
3690 call esmf_fieldget(t2m_target_grid, &
3691 farrayptr=target_ptr, rc=rc)
3692 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3695 target_ptr = init_val
3697 print*,
"- CALL FieldCreate FOR TARGET GRID Q2M."
3698 q2m_target_grid = esmf_fieldcreate(target_grid, &
3699 typekind=esmf_typekind_r8, &
3700 staggerloc=esmf_staggerloc_center, rc=rc)
3701 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3704 print*,
"- INITIALIZE TARGET grid q2m."
3705 call esmf_fieldget(q2m_target_grid, &
3706 farrayptr=target_ptr, rc=rc)
3707 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3710 target_ptr = init_val
3712 print*,
"- CALL FieldCreate FOR TARGET GRID TPRCP."
3713 tprcp_target_grid = esmf_fieldcreate(target_grid, &
3714 typekind=esmf_typekind_r8, &
3715 staggerloc=esmf_staggerloc_center, rc=rc)
3716 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3719 print*,
"- INITIALIZE TARGET grid tprcp."
3720 call esmf_fieldget(tprcp_target_grid, &
3721 farrayptr=target_ptr, rc=rc)
3722 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3725 target_ptr = init_val
3727 print*,
"- CALL FieldCreate FOR TARGET GRID F10M."
3728 f10m_target_grid = esmf_fieldcreate(target_grid, &
3729 typekind=esmf_typekind_r8, &
3730 staggerloc=esmf_staggerloc_center, rc=rc)
3731 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3734 print*,
"- INITIALIZE TARGET grid f10m."
3735 call esmf_fieldget(f10m_target_grid, &
3736 farrayptr=target_ptr, rc=rc)
3737 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3740 target_ptr = init_val
3742 print*,
"- CALL FieldCreate FOR TARGET GRID FFMM."
3743 ffmm_target_grid = esmf_fieldcreate(target_grid, &
3744 typekind=esmf_typekind_r8, &
3745 staggerloc=esmf_staggerloc_center, rc=rc)
3746 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3749 print*,
"- INITIALIZE TARGET grid ffmm."
3750 call esmf_fieldget(ffmm_target_grid, &
3751 farrayptr=target_ptr, rc=rc)
3752 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3755 target_ptr = init_val
3757 print*,
"- CALL FieldCreate FOR TARGET GRID USTAR."
3758 ustar_target_grid = esmf_fieldcreate(target_grid, &
3759 typekind=esmf_typekind_r8, &
3760 staggerloc=esmf_staggerloc_center, rc=rc)
3761 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3764 print*,
"- INITIALIZE TARGET grid ustar."
3765 call esmf_fieldget(ustar_target_grid, &
3766 farrayptr=target_ptr, rc=rc)
3767 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3770 target_ptr = init_val
3772 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV."
3773 snow_liq_equiv_target_grid = esmf_fieldcreate(target_grid, &
3774 typekind=esmf_typekind_r8, &
3775 staggerloc=esmf_staggerloc_center, rc=rc)
3776 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3779 print*,
"- INITIALIZE TARGET grid snow liq equiv."
3780 call esmf_fieldget(snow_liq_equiv_target_grid, &
3781 farrayptr=target_ptr, rc=rc)
3782 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3785 target_ptr = init_val
3787 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH."
3788 snow_depth_target_grid = esmf_fieldcreate(target_grid, &
3789 typekind=esmf_typekind_r8, &
3790 staggerloc=esmf_staggerloc_center, rc=rc)
3791 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3794 print*,
"- INITIALIZE TARGET grid snow depth."
3795 call esmf_fieldget(snow_depth_target_grid, &
3796 farrayptr=target_ptr, rc=rc)
3797 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3800 target_ptr = init_val
3802 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE FRACTION."
3803 seaice_fract_target_grid = esmf_fieldcreate(target_grid, &
3804 typekind=esmf_typekind_r8, &
3805 staggerloc=esmf_staggerloc_center, rc=rc)
3806 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3809 print*,
"- INITIALIZE TARGET grid sea ice fraction."
3810 call esmf_fieldget(seaice_fract_target_grid, &
3811 farrayptr=target_ptr, rc=rc)
3812 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3815 target_ptr = init_val
3817 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE DEPTH."
3818 seaice_depth_target_grid = esmf_fieldcreate(target_grid, &
3819 typekind=esmf_typekind_r8, &
3820 staggerloc=esmf_staggerloc_center, rc=rc)
3821 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3824 print*,
"- INITIALIZE TARGET sea ice depth."
3825 call esmf_fieldget(seaice_depth_target_grid, &
3826 farrayptr=target_ptr, rc=rc)
3827 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3830 target_ptr = init_val
3832 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE SKIN TEMP."
3833 seaice_skin_temp_target_grid = esmf_fieldcreate(target_grid, &
3834 typekind=esmf_typekind_r8, &
3835 staggerloc=esmf_staggerloc_center, rc=rc)
3836 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3839 print*,
"- INITIALIZE TARGET sea ice skin temp."
3840 call esmf_fieldget(seaice_skin_temp_target_grid, &
3841 farrayptr=target_ptr, rc=rc)
3842 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3845 target_ptr = init_val
3847 print*,
"- CALL FieldCreate FOR TARGET GRID SRFLAG."
3848 srflag_target_grid = esmf_fieldcreate(target_grid, &
3849 typekind=esmf_typekind_r8, &
3850 staggerloc=esmf_staggerloc_center, rc=rc)
3851 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3854 print*,
"- INITIALIZE TARGET srflag."
3855 call esmf_fieldget(srflag_target_grid, &
3856 farrayptr=target_ptr, rc=rc)
3857 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3860 target_ptr = init_val
3862 print*,
"- CALL FieldCreate FOR TARGET GRID SKIN TEMPERATURE."
3863 skin_temp_target_grid = esmf_fieldcreate(target_grid, &
3864 typekind=esmf_typekind_r8, &
3865 staggerloc=esmf_staggerloc_center, rc=rc)
3866 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3869 print*,
"- INITIALIZE TARGET grid skin temp."
3870 call esmf_fieldget(skin_temp_target_grid, &
3871 farrayptr=target_ptr, rc=rc)
3872 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3875 target_ptr = init_val
3877 print*,
"- CALL FieldCreate FOR TARGET GRID CANOPY MOISTURE CONTENT."
3878 canopy_mc_target_grid = esmf_fieldcreate(target_grid, &
3879 typekind=esmf_typekind_r8, &
3880 staggerloc=esmf_staggerloc_center, rc=rc)
3881 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3884 print*,
"- INITIALIZE TARGET grid canopy moisture."
3885 call esmf_fieldget(canopy_mc_target_grid, &
3886 farrayptr=target_ptr, rc=rc)
3887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3890 target_ptr = init_val
3892 print*,
"- CALL FieldCreate FOR TARGET GRID LEAF AREA INDEX."
3893 lai_target_grid = esmf_fieldcreate(target_grid, &
3894 typekind=esmf_typekind_r8, &
3895 staggerloc=esmf_staggerloc_center, rc=rc)
3896 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3899 print*,
"- INITIALIZE TARGET leaf area index."
3900 call esmf_fieldget(lai_target_grid, &
3901 farrayptr=target_ptr, rc=rc)
3902 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3905 target_ptr = init_val
3907 print*,
"- CALL FieldCreate FOR TARGET GRID Z0."
3908 z0_target_grid = esmf_fieldcreate(target_grid, &
3909 typekind=esmf_typekind_r8, &
3910 staggerloc=esmf_staggerloc_center, rc=rc)
3911 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3914 print*,
"- INITIALIZE TARGET grid z0."
3915 call esmf_fieldget(z0_target_grid, &
3916 farrayptr=target_ptr, rc=rc)
3917 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3920 target_ptr = init_val
3922 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID TERRAIN."
3923 terrain_from_input_grid = esmf_fieldcreate(target_grid, &
3924 typekind=esmf_typekind_r8, &
3925 staggerloc=esmf_staggerloc_center, rc=rc)
3926 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3929 print*,
"- INITIALIZE TARGET grid interpolated terrain."
3930 call esmf_fieldget(terrain_from_input_grid, &
3931 farrayptr=target_ptr, rc=rc)
3932 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3935 target_ptr = init_val
3937 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID SOIL TYPE."
3938 soil_type_from_input_grid = esmf_fieldcreate(target_grid, &
3939 typekind=esmf_typekind_r8, &
3940 staggerloc=esmf_staggerloc_center, rc=rc)
3941 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3944 print*,
"- INITIALIZE TARGET grid soil type"
3945 call esmf_fieldget(soil_type_from_input_grid, &
3946 farrayptr=target_ptr, rc=rc)
3947 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3950 target_ptr = init_val
3952 print*,
"- CALL FieldCreate FOR TARGET GRID SOIL TEMPERATURE."
3953 soil_temp_target_grid = esmf_fieldcreate(target_grid, &
3954 typekind=esmf_typekind_r8, &
3955 staggerloc=esmf_staggerloc_center, &
3956 ungriddedlbound=(/1/), &
3957 ungriddedubound=(/lsoil_target/), rc=rc)
3958 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3961 print*,
"- INITIALIZE TARGET grid soil temp"
3962 call esmf_fieldget(soil_temp_target_grid, &
3963 farrayptr=target_ptr_3d, rc=rc)
3964 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3967 target_ptr_3d = init_val
3969 print*,
"- CALL FieldCreate FOR TARGET GRID TOTAL SOIL MOISTURE."
3970 soilm_tot_target_grid = esmf_fieldcreate(target_grid, &
3971 typekind=esmf_typekind_r8, &
3972 staggerloc=esmf_staggerloc_center, &
3973 ungriddedlbound=(/1/), &
3974 ungriddedubound=(/lsoil_target/), rc=rc)
3975 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3978 print*,
"- INITIALIZE TARGET grid soil moist"
3979 call esmf_fieldget(soilm_tot_target_grid, &
3980 farrayptr=target_ptr_3d, rc=rc)
3981 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3984 target_ptr_3d = init_val
3986 print*,
"- CALL FieldCreate FOR TARGET GRID LIQUID SOIL MOISTURE."
3987 soilm_liq_target_grid = esmf_fieldcreate(target_grid, &
3988 typekind=esmf_typekind_r8, &
3989 staggerloc=esmf_staggerloc_center, &
3990 ungriddedlbound=(/1/), &
3991 ungriddedubound=(/lsoil_target/), rc=rc)
3992 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3995 print*,
"- INITIALIZE TARGET grid soil liq"
3996 call esmf_fieldget(soilm_liq_target_grid, &
3997 farrayptr=target_ptr_3d, rc=rc)
3998 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4001 target_ptr_3d = init_val
4016 print*,
"- CALL FieldCreate FOR TARGET GRID C_D."
4017 c_d_target_grid = esmf_fieldcreate(target_grid, &
4018 typekind=esmf_typekind_r8, &
4020 staggerloc=esmf_staggerloc_center, rc=rc)
4021 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4024 print*,
"- CALL FieldCreate FOR TARGET GRID C_0."
4025 c_0_target_grid = esmf_fieldcreate(target_grid, &
4026 typekind=esmf_typekind_r8, &
4028 staggerloc=esmf_staggerloc_center, rc=rc)
4029 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4032 print*,
"- CALL FieldCreate FOR TARGET GRID D_CONV."
4033 d_conv_target_grid = esmf_fieldcreate(target_grid, &
4034 typekind=esmf_typekind_r8, &
4036 staggerloc=esmf_staggerloc_center, rc=rc)
4037 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4040 print*,
"- CALL FieldCreate FOR TARGET GRID DT_COOL."
4041 dt_cool_target_grid = esmf_fieldcreate(target_grid, &
4042 typekind=esmf_typekind_r8, &
4044 staggerloc=esmf_staggerloc_center, rc=rc)
4045 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4048 print*,
"- CALL FieldCreate FOR TARGET GRID IFD."
4049 ifd_target_grid = esmf_fieldcreate(target_grid, &
4050 typekind=esmf_typekind_r8, &
4052 staggerloc=esmf_staggerloc_center, rc=rc)
4053 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4056 print*,
"- CALL FieldCreate FOR TARGET GRID QRAIN."
4057 qrain_target_grid = esmf_fieldcreate(target_grid, &
4058 typekind=esmf_typekind_r8, &
4060 staggerloc=esmf_staggerloc_center, rc=rc)
4061 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4064 print*,
"- CALL FieldCreate FOR TARGET GRID TREF."
4065 tref_target_grid = esmf_fieldcreate(target_grid, &
4066 typekind=esmf_typekind_r8, &
4068 staggerloc=esmf_staggerloc_center, rc=rc)
4069 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4072 print*,
"- CALL FieldCreate FOR TARGET GRID W_D."
4073 w_d_target_grid = esmf_fieldcreate(target_grid, &
4074 typekind=esmf_typekind_r8, &
4076 staggerloc=esmf_staggerloc_center, rc=rc)
4077 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4080 print*,
"- CALL FieldCreate FOR TARGET GRID W_0."
4081 w_0_target_grid = esmf_fieldcreate(target_grid, &
4082 typekind=esmf_typekind_r8, &
4084 staggerloc=esmf_staggerloc_center, rc=rc)
4085 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4088 print*,
"- CALL FieldCreate FOR TARGET GRID XS."
4089 xs_target_grid = esmf_fieldcreate(target_grid, &
4090 typekind=esmf_typekind_r8, &
4092 staggerloc=esmf_staggerloc_center, rc=rc)
4093 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4096 print*,
"- CALL FieldCreate FOR TARGET GRID XT."
4097 xt_target_grid = esmf_fieldcreate(target_grid, &
4098 typekind=esmf_typekind_r8, &
4100 staggerloc=esmf_staggerloc_center, rc=rc)
4101 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4104 print*,
"- CALL FieldCreate FOR TARGET GRID XU."
4105 xu_target_grid = esmf_fieldcreate(target_grid, &
4106 typekind=esmf_typekind_r8, &
4108 staggerloc=esmf_staggerloc_center, rc=rc)
4109 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4112 print*,
"- CALL FieldCreate FOR TARGET GRID XV."
4113 xv_target_grid = esmf_fieldcreate(target_grid, &
4114 typekind=esmf_typekind_r8, &
4116 staggerloc=esmf_staggerloc_center, rc=rc)
4117 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4120 print*,
"- CALL FieldCreate FOR TARGET GRID XZ."
4121 xz_target_grid = esmf_fieldcreate(target_grid, &
4122 typekind=esmf_typekind_r8, &
4124 staggerloc=esmf_staggerloc_center, rc=rc)
4125 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4128 print*,
"- CALL FieldCreate FOR TARGET GRID XTTS."
4129 xtts_target_grid = esmf_fieldcreate(target_grid, &
4130 typekind=esmf_typekind_r8, &
4132 staggerloc=esmf_staggerloc_center, rc=rc)
4133 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4136 print*,
"- CALL FieldCreate FOR TARGET GRID XZTS."
4137 xzts_target_grid = esmf_fieldcreate(target_grid, &
4138 typekind=esmf_typekind_r8, &
4140 staggerloc=esmf_staggerloc_center, rc=rc)
4141 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4144 print*,
"- CALL FieldCreate FOR TARGET GRID Z_C."
4145 z_c_target_grid = esmf_fieldcreate(target_grid, &
4146 typekind=esmf_typekind_r8, &
4148 staggerloc=esmf_staggerloc_center, rc=rc)
4149 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4152 print*,
"- CALL FieldCreate FOR TARGET GRID ZM."
4153 zm_target_grid = esmf_fieldcreate(target_grid, &
4154 typekind=esmf_typekind_r8, &
4156 staggerloc=esmf_staggerloc_center, rc=rc)
4157 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4174 integer(esmf_kind_i4),
intent(in) :: ij
4175 integer ,
intent(in) :: itile, jtile
4177 integer ,
intent(out) :: i, j
4180 integer :: pt_loc_this_tile
4182 tile_num = ((ij-1) / (itile*jtile))
4183 pt_loc_this_tile = ij - (tile_num * itile * jtile)
4186 j = (pt_loc_this_tile - 1) / itile + 1
4187 i = mod(pt_loc_this_tile, itile)
4205 print*,
"- DESTROY TARGET GRID SURFACE FIELDS."
4207 call esmf_fielddestroy(t2m_target_grid, rc=rc)
4208 call esmf_fielddestroy(q2m_target_grid, rc=rc)
4209 call esmf_fielddestroy(tprcp_target_grid, rc=rc)
4210 call esmf_fielddestroy(f10m_target_grid, rc=rc)
4211 call esmf_fielddestroy(ffmm_target_grid, rc=rc)
4212 call esmf_fielddestroy(ustar_target_grid, rc=rc)
4213 call esmf_fielddestroy(snow_liq_equiv_target_grid, rc=rc)
4214 call esmf_fielddestroy(snow_depth_target_grid, rc=rc)
4215 call esmf_fielddestroy(seaice_fract_target_grid, rc=rc)
4216 call esmf_fielddestroy(seaice_depth_target_grid, rc=rc)
4217 call esmf_fielddestroy(seaice_skin_temp_target_grid, rc=rc)
4218 call esmf_fielddestroy(srflag_target_grid, rc=rc)
4219 call esmf_fielddestroy(skin_temp_target_grid, rc=rc)
4220 call esmf_fielddestroy(canopy_mc_target_grid, rc=rc)
4221 call esmf_fielddestroy(lai_target_grid,rc=rc)
4222 call esmf_fielddestroy(z0_target_grid, rc=rc)
4223 call esmf_fielddestroy(terrain_from_input_grid, rc=rc)
4224 call esmf_fielddestroy(terrain_from_input_grid_land, rc=rc)
4225 call esmf_fielddestroy(soil_type_from_input_grid, rc=rc)
4226 call esmf_fielddestroy(soil_temp_target_grid, rc=rc)
4227 call esmf_fielddestroy(soilm_tot_target_grid, rc=rc)
4228 call esmf_fielddestroy(soilm_liq_target_grid, rc=rc)
4242 print*,
"- DESTROY TARGET GRID NST DATA."
4244 call esmf_fielddestroy(c_d_target_grid, rc=rc)
4245 call esmf_fielddestroy(c_0_target_grid, rc=rc)
4246 call esmf_fielddestroy(d_conv_target_grid, rc=rc)
4247 call esmf_fielddestroy(dt_cool_target_grid, rc=rc)
4248 call esmf_fielddestroy(ifd_target_grid, rc=rc)
4249 call esmf_fielddestroy(qrain_target_grid, rc=rc)
4250 call esmf_fielddestroy(tref_target_grid, rc=rc)
4251 call esmf_fielddestroy(w_d_target_grid, rc=rc)
4252 call esmf_fielddestroy(w_0_target_grid, rc=rc)
4253 call esmf_fielddestroy(xs_target_grid, rc=rc)
4254 call esmf_fielddestroy(xt_target_grid, rc=rc)
4255 call esmf_fielddestroy(xu_target_grid, rc=rc)
4256 call esmf_fielddestroy(xv_target_grid, rc=rc)
4257 call esmf_fielddestroy(xz_target_grid, rc=rc)
4258 call esmf_fielddestroy(xtts_target_grid, rc=rc)
4259 call esmf_fielddestroy(xzts_target_grid, rc=rc)
4260 call esmf_fielddestroy(z_c_target_grid, rc=rc)
4261 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, public interp(localpet)
Horizontally interpolate surface fields from input to target FV3 grid using esmf routines.
Process surface and nst fields.
subroutine, public cleanup_target_sfc_data
Free up memory once the target grid surface fields are no longer needed.
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
subroutine, public cleanup_target_nst_data
Free up memory once the target grid nst fields are no longer needed.
subroutine, public cleanup_static_fields
Free up memory for fields in this module.
Replace undefined values with a valid value.
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.
subroutine, public create_nst_esmf_fields
Create ESMF fields for the target grid nst variables.
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 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 create_surface_esmf_fields
Create ESMF fields for the target grid surface variables.
subroutine, public nst_land_fill
nst is not active at land or sea ice points.
subroutine, public surface_driver(localpet)
Driver routine to process surface/nst data.