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
168 integer,
intent(in) :: localpet
295 use input_data, only : canopy_mc_input_grid, &
298 landsea_mask_input_grid, &
300 seaice_depth_input_grid, &
301 seaice_fract_input_grid, &
302 seaice_skin_temp_input_grid, &
303 skin_temp_input_grid, &
304 snow_depth_input_grid, &
305 snow_liq_equiv_input_grid, &
306 soil_temp_input_grid, &
307 soil_type_input_grid, &
308 soilm_tot_input_grid, &
313 veg_type_input_grid, &
318 dt_cool_input_grid, &
332 zm_input_grid, terrain_input_grid, &
333 veg_type_landice_input, &
334 veg_greenness_input_grid, &
335 max_veg_greenness_input_grid, &
336 min_veg_greenness_input_grid, &
339 use model_grid, only : input_grid, target_grid, &
340 i_target, j_target, &
342 num_tiles_target_grid, &
343 landmask_target_grid, &
344 seamask_target_grid, &
351 minmax_vgfrc_from_climo, &
358 soil_type_target_grid, &
359 veg_greenness_target_grid, &
360 substrate_temp_target_grid,&
361 min_veg_greenness_target_grid,&
362 max_veg_greenness_target_grid
368 integer,
intent(in) :: localpet
370 integer :: l(1), u(1)
371 integer :: i, j, ij, rc, tile
372 integer :: clb_target(2), cub_target(2)
373 integer :: isrctermprocessing
374 integer(esmf_kind_i4),
pointer :: unmapped_ptr(:)
375 integer(esmf_kind_i4),
pointer :: mask_input_ptr(:,:)
376 integer(esmf_kind_i4),
pointer :: mask_target_ptr(:,:)
377 integer(esmf_kind_i8),
pointer :: landmask_target_ptr(:,:)
378 integer(esmf_kind_i8),
allocatable :: mask_target_one_tile(:,:)
379 integer(esmf_kind_i8),
allocatable :: water_target_one_tile(:,:)
380 integer(esmf_kind_i8),
allocatable :: land_target_one_tile(:,:)
381 integer(esmf_kind_i8),
pointer :: seamask_target_ptr(:,:)
383 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
384 real(esmf_kind_r8),
allocatable :: data_one_tile2(:,:)
385 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
386 real(esmf_kind_r8),
allocatable :: latitude_one_tile(:,:)
387 real(esmf_kind_r8),
pointer :: canopy_mc_target_ptr(:,:)
388 real(esmf_kind_r8),
pointer :: c_d_target_ptr(:,:)
389 real(esmf_kind_r8),
pointer :: c_0_target_ptr(:,:)
390 real(esmf_kind_r8),
pointer :: d_conv_target_ptr(:,:)
391 real(esmf_kind_r8),
pointer :: dt_cool_target_ptr(:,:)
392 real(esmf_kind_r8),
pointer :: ifd_target_ptr(:,:)
393 real(esmf_kind_r8),
pointer :: qrain_target_ptr(:,:)
394 real(esmf_kind_r8),
pointer :: tref_target_ptr(:,:)
395 real(esmf_kind_r8),
pointer :: w_d_target_ptr(:,:)
396 real(esmf_kind_r8),
pointer :: w_0_target_ptr(:,:)
397 real(esmf_kind_r8),
pointer :: xs_target_ptr(:,:)
398 real(esmf_kind_r8),
pointer :: xt_target_ptr(:,:)
399 real(esmf_kind_r8),
pointer :: xu_target_ptr(:,:)
400 real(esmf_kind_r8),
pointer :: xv_target_ptr(:,:)
401 real(esmf_kind_r8),
pointer :: xz_target_ptr(:,:)
402 real(esmf_kind_r8),
pointer :: xtts_target_ptr(:,:)
403 real(esmf_kind_r8),
pointer :: xzts_target_ptr(:,:)
404 real(esmf_kind_r8),
pointer :: z_c_target_ptr(:,:)
405 real(esmf_kind_r8),
pointer :: zm_target_ptr(:,:)
406 real(esmf_kind_r8),
pointer :: seaice_depth_target_ptr(:,:)
407 real(esmf_kind_r8),
pointer :: seaice_fract_target_ptr(:,:)
408 real(esmf_kind_r8),
pointer :: seaice_skin_temp_target_ptr(:,:)
409 real(esmf_kind_r8),
pointer :: skin_temp_target_ptr(:,:)
410 real(esmf_kind_r8),
pointer :: snow_depth_target_ptr(:,:)
411 real(esmf_kind_r8),
pointer :: snow_liq_equiv_target_ptr(:,:)
412 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
413 real(esmf_kind_r8),
pointer :: soil_type_from_input_ptr(:,:)
414 real(esmf_kind_r8),
pointer :: soilm_tot_target_ptr(:,:,:)
415 real(esmf_kind_r8),
pointer :: srflag_target_ptr(:,:)
416 real(esmf_kind_r8),
pointer :: terrain_from_input_ptr(:,:)
417 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
418 real(esmf_kind_r8),
pointer :: z0_target_ptr(:,:)
419 real(esmf_kind_r8),
pointer :: landmask_input_ptr(:,:)
420 real(esmf_kind_r8),
pointer :: veg_type_input_ptr(:,:)
421 real(esmf_kind_r8),
allocatable :: veg_type_target_one_tile(:,:)
422 real(esmf_kind_r8),
pointer :: veg_greenness_target_ptr(:,:)
423 real(esmf_kind_r8),
pointer :: min_veg_greenness_target_ptr(:,:)
424 real(esmf_kind_r8),
pointer :: max_veg_greenness_target_ptr(:,:)
425 real(esmf_kind_r8),
pointer :: lai_target_ptr(:,:)
427 type(esmf_regridmethod_flag
) :: method
428 type(esmf_routehandle
) :: regrid_bl_no_mask
429 type(esmf_routehandle
) :: regrid_all_land
430 type(esmf_routehandle
) :: regrid_land
431 type(esmf_routehandle
) :: regrid_landice
432 type(esmf_routehandle
) :: regrid_nonland
433 type(esmf_routehandle
) :: regrid_seaice
434 type(esmf_routehandle
) :: regrid_water
440 method=esmf_regridmethod_bilinear
442 isrctermprocessing = 1
444 print*,
"- CALL FieldRegridStore FOR NON-MASKED BILINEAR INTERPOLATION."
445 call esmf_fieldregridstore(t2m_input_grid, &
447 polemethod=esmf_polemethod_allavg, &
448 srctermprocessing=isrctermprocessing, &
449 routehandle=regrid_bl_no_mask, &
450 regridmethod=method, rc=rc)
451 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
454 print*,
"- CALL Field_Regrid T2M."
455 call esmf_fieldregrid(t2m_input_grid, &
457 routehandle=regrid_bl_no_mask, &
458 termorderflag=esmf_termorder_srcseq, rc=rc)
459 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
462 print*,
"- CALL Field_Regrid Q2M."
463 call esmf_fieldregrid(q2m_input_grid, &
465 routehandle=regrid_bl_no_mask, &
466 termorderflag=esmf_termorder_srcseq, rc=rc)
467 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
470 print*,
"- CALL Field_Regrid TPRCP."
471 call esmf_fieldregrid(tprcp_input_grid, &
473 routehandle=regrid_bl_no_mask, &
474 termorderflag=esmf_termorder_srcseq, rc=rc)
475 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
478 print*,
"- CALL Field_Regrid F10M."
479 call esmf_fieldregrid(f10m_input_grid, &
481 routehandle=regrid_bl_no_mask, &
482 termorderflag=esmf_termorder_srcseq, rc=rc)
483 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
486 print*,
"- CALL Field_Regrid FFMM."
487 call esmf_fieldregrid(ffmm_input_grid, &
489 routehandle=regrid_bl_no_mask, &
490 termorderflag=esmf_termorder_srcseq, rc=rc)
491 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
494 print*,
"- CALL Field_Regrid USTAR."
495 call esmf_fieldregrid(ustar_input_grid, &
497 routehandle=regrid_bl_no_mask, &
498 termorderflag=esmf_termorder_srcseq, rc=rc)
499 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
502 print*,
"- CALL Field_Regrid SRFLAG."
503 call esmf_fieldregrid(srflag_input_grid, &
504 srflag_target_grid, &
505 routehandle=regrid_bl_no_mask, &
506 termorderflag=esmf_termorder_srcseq, rc=rc)
507 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
510 print*,
"- CALL FieldGet FOR SRFLAG."
511 call esmf_fieldget(srflag_target_grid, &
512 farrayptr=srflag_target_ptr, rc=rc)
513 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
521 srflag_target_ptr = nint(srflag_target_ptr)
523 print*,
"- CALL FieldRegridRelease."
524 call esmf_fieldregridrelease(routehandle=regrid_bl_no_mask, rc=rc)
525 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
532 print*,
"- CALL GridAddItem FOR TARGET GRID."
533 call esmf_gridadditem(target_grid, &
534 itemflag=esmf_griditem_mask, &
535 staggerloc=esmf_staggerloc_center, rc=rc)
536 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
539 print*,
"- CALL GridGetItem FOR TARGET GRID."
540 call esmf_gridgetitem(target_grid, &
541 itemflag=esmf_griditem_mask, &
542 farrayptr=mask_target_ptr, rc=rc)
543 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
546 print*,
"- CALL FieldGet FOR TARGET GRID SEAMASK."
547 call esmf_fieldget(seamask_target_grid, &
548 computationallbound=clb_target, &
549 computationalubound=cub_target, &
550 farrayptr=seamask_target_ptr, rc=rc)
551 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
554 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
555 call esmf_fieldget(landmask_target_grid, &
556 farrayptr=landmask_target_ptr, rc=rc)
557 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
560 print*,
"- CALL GridAddItem FOR INPUT GRID SEAMASK."
561 call esmf_gridadditem(input_grid, &
562 itemflag=esmf_griditem_mask, &
563 staggerloc=esmf_staggerloc_center, rc=rc)
564 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
567 print*,
"- CALL FieldGet FOR INPUT GRID LANDMASK."
568 call esmf_fieldget(landsea_mask_input_grid, &
569 farrayptr=landmask_input_ptr, rc=rc)
570 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
573 print*,
"- CALL GridGetItem FOR INPUT GRID LANDMASK."
574 call esmf_gridgetitem(input_grid, &
575 itemflag=esmf_griditem_mask, &
576 farrayptr=mask_input_ptr, rc=rc)
577 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
580 if (localpet == 0)
then
581 allocate(data_one_tile(i_target,j_target))
582 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
583 allocate(mask_target_one_tile(i_target,j_target))
585 allocate(data_one_tile(0,0))
586 allocate(data_one_tile_3d(0,0,0))
587 allocate(mask_target_one_tile(0,0))
595 method=esmf_regridmethod_nearest_stod
597 isrctermprocessing = 1
600 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
603 where (landmask_target_ptr == 1) mask_target_ptr = 1
605 print*,
"- CALL FieldCreate FOR TERRAIN FROM INPUT GRID LAND."
606 terrain_from_input_grid_land = esmf_fieldcreate(target_grid, &
607 typekind=esmf_typekind_r8, &
608 staggerloc=esmf_staggerloc_center, rc=rc)
609 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
612 print*,
"- CALL FieldRegridStore for land fields."
613 call esmf_fieldregridstore(terrain_input_grid, &
614 terrain_from_input_grid_land, &
615 srcmaskvalues=(/0/), &
616 dstmaskvalues=(/0/), &
617 polemethod=esmf_polemethod_none, &
618 srctermprocessing=isrctermprocessing, &
619 unmappedaction=esmf_unmappedaction_ignore, &
620 normtype=esmf_normtype_fracarea, &
621 routehandle=regrid_all_land, &
622 regridmethod=method, &
623 unmappeddstlist=unmapped_ptr, rc=rc)
624 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
627 print*,
"- CALL Field_Regrid TERRAIN."
628 call esmf_fieldregrid(terrain_input_grid, &
629 terrain_from_input_grid_land, &
630 routehandle=regrid_all_land, &
631 termorderflag=esmf_termorder_srcseq, rc=rc)
632 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
635 print*,
"- CALL FieldGet FOR terrain from input grid at land."
636 call esmf_fieldget(terrain_from_input_grid_land, &
637 farrayptr=terrain_from_input_ptr, rc=rc)
638 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
641 l = lbound(unmapped_ptr)
642 u = ubound(unmapped_ptr)
645 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
646 terrain_from_input_ptr(i,j) = -9999.9
648 nullify(terrain_from_input_ptr)
650 do tile = 1, num_tiles_target_grid
652 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
653 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
654 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
657 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID: ", tile
658 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
659 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
662 if (localpet == 0)
then
663 allocate(land_target_one_tile(i_target,j_target))
664 land_target_one_tile = 0
665 where(mask_target_one_tile == 1) land_target_one_tile = 1
666 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7)
667 deallocate(land_target_one_tile)
670 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID: ", tile
671 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
672 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
676 if(.not. vgtyp_from_climo)
then
678 do tile = 1, num_tiles_target_grid
679 print*,
"-CALL FieldGather VEG TYPE TARGET GRID"
680 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
681 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
684 data_one_tile(:,:) = 0
687 print*,
"- CALL FieldRegrid VEG TYPE."
688 call esmf_fieldregrid(veg_type_input_grid, &
689 veg_type_target_grid, &
690 routehandle=regrid_all_land, &
691 termorderflag=esmf_termorder_srcseq, rc=rc)
692 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
695 print*,
"- CALL FieldGet FOR TARGET grid veg type."
696 call esmf_fieldget(veg_type_target_grid, &
697 farrayptr=veg_type_target_ptr, rc=rc)
698 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
701 l = lbound(unmapped_ptr)
702 u = ubound(unmapped_ptr)
705 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
706 veg_type_target_ptr(i,j) = -9999.9
709 do tile = 1, num_tiles_target_grid
710 print*,
"- CALL FieldGather FOR TARGET GRID VEG TYPE TILE: ", tile
711 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
712 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
715 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
716 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
717 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
720 if (localpet == 0)
then
721 allocate(land_target_one_tile(i_target,j_target))
722 land_target_one_tile = 0
723 where(mask_target_one_tile == 1) land_target_one_tile = 1
724 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 225)
725 deallocate(land_target_one_tile)
728 print*,
"- CALL FieldScatter FOR TARGET GRID VEG TYPE: ", tile
729 call esmf_fieldscatter(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
730 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
733 nullify(veg_type_target_ptr)
735 print*,
"- CALL FieldRegridRelease."
736 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
737 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
746 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0
748 mask_target_ptr = seamask_target_ptr
750 method=esmf_regridmethod_conserve
752 isrctermprocessing = 1
754 print*,
"- CALL FieldRegridStore for sea ice fraction."
755 call esmf_fieldregridstore(seaice_fract_input_grid, &
756 seaice_fract_target_grid, &
757 srcmaskvalues=(/0/), &
758 dstmaskvalues=(/0/), &
759 polemethod=esmf_polemethod_none, &
760 srctermprocessing=isrctermprocessing, &
761 unmappedaction=esmf_unmappedaction_ignore, &
762 normtype=esmf_normtype_fracarea, &
763 routehandle=regrid_nonland, &
764 regridmethod=method, &
765 unmappeddstlist=unmapped_ptr, rc=rc)
766 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
769 print*,
"- CALL Field_Regrid for sea ice fraction."
770 call esmf_fieldregrid(seaice_fract_input_grid, &
771 seaice_fract_target_grid, &
772 routehandle=regrid_nonland, &
773 termorderflag=esmf_termorder_srcseq, rc=rc)
774 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
777 print*,
"- CALL FieldGet FOR TARGET grid sea ice fraction."
778 call esmf_fieldget(seaice_fract_target_grid, &
779 farrayptr=seaice_fract_target_ptr, rc=rc)
780 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
783 l = lbound(unmapped_ptr)
784 u = ubound(unmapped_ptr)
787 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
788 seaice_fract_target_ptr(i,j) = -9999.9
793 if (localpet == 0)
then
794 allocate(latitude_one_tile(i_target,j_target))
796 allocate(latitude_one_tile(0,0))
799 do tile = 1, num_tiles_target_grid
801 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE FRACTION TILE: ", tile
802 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
803 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
806 print*,
"- CALL FieldGather FOR TARGET GRID MASK TILE: ", tile
807 call esmf_fieldgather(seamask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
808 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
811 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
812 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
813 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
816 if (localpet == 0)
then
817 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 91, &
818 latitude=latitude_one_tile)
821 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
822 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
823 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
827 if (localpet == 0)
then
830 if (data_one_tile(i,j) > 1.0_esmf_kind_r8)
then
831 data_one_tile(i,j) = 1.0_esmf_kind_r8
833 if (data_one_tile(i,j) < 0.15_esmf_kind_r8) data_one_tile(i,j) = 0.0_esmf_kind_r8
834 if (data_one_tile(i,j) >= 0.15_esmf_kind_r8) mask_target_one_tile(i,j) = 2
839 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE FRACTION TILE: ", tile
840 call esmf_fieldscatter(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
841 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
844 print*,
"- CALL FieldScatter FOR TARGET LANDMASK TILE: ", tile
845 call esmf_fieldscatter(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
846 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
851 deallocate(latitude_one_tile)
853 print*,
"- CALL FieldRegridRelease."
854 call esmf_fieldregridrelease(routehandle=regrid_nonland, rc=rc)
855 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
864 where (nint(landmask_input_ptr) == 2) mask_input_ptr = 1
866 print*,
"- CALL FieldGet FOR TARGET land sea mask."
867 call esmf_fieldget(landmask_target_grid, &
868 farrayptr=landmask_target_ptr, rc=rc)
869 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
873 do j = clb_target(2), cub_target(2)
874 do i = clb_target(1), cub_target(1)
875 if (landmask_target_ptr(i,j) == 2) mask_target_ptr(i,j) = 1
879 method=esmf_regridmethod_nearest_stod
880 isrctermprocessing = 1
882 print*,
"- CALL FieldRegridStore for 3d seaice fields."
883 call esmf_fieldregridstore(soil_temp_input_grid, &
884 soil_temp_target_grid, &
885 srcmaskvalues=(/0/), &
886 dstmaskvalues=(/0/), &
887 polemethod=esmf_polemethod_none, &
888 srctermprocessing=isrctermprocessing, &
889 unmappedaction=esmf_unmappedaction_ignore, &
890 normtype=esmf_normtype_fracarea, &
891 routehandle=regrid_seaice, &
892 regridmethod=method, &
893 unmappeddstlist=unmapped_ptr, rc=rc)
894 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
897 print*,
"- CALL Field_Regrid for soil temperature over seaice."
898 call esmf_fieldregrid(soil_temp_input_grid, &
899 soil_temp_target_grid, &
900 routehandle=regrid_seaice, &
901 termorderflag=esmf_termorder_srcseq, rc=rc)
902 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
905 print*,
"- CALL FieldGet FOR TARGET grid soil temperature over seaice."
906 call esmf_fieldget(soil_temp_target_grid, &
907 farrayptr=soil_temp_target_ptr, rc=rc)
908 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
911 print*,
"- CALL Field_Regrid for sea ice depth."
912 call esmf_fieldregrid(seaice_depth_input_grid, &
913 seaice_depth_target_grid, &
914 routehandle=regrid_seaice, &
915 termorderflag=esmf_termorder_srcseq, rc=rc)
916 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
919 print*,
"- CALL FieldGet FOR TARGET grid sea ice depth."
920 call esmf_fieldget(seaice_depth_target_grid, &
921 farrayptr=seaice_depth_target_ptr, rc=rc)
922 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
925 print*,
"- CALL Field_Regrid for snow depth."
926 call esmf_fieldregrid(snow_depth_input_grid, &
927 snow_depth_target_grid, &
928 routehandle=regrid_seaice, &
929 termorderflag=esmf_termorder_srcseq, rc=rc)
930 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
933 print*,
"- CALL FieldGet FOR TARGET grid snow depth."
934 call esmf_fieldget(snow_depth_target_grid, &
935 farrayptr=snow_depth_target_ptr, rc=rc)
936 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
939 print*,
"- CALL Field_Regrid for snow liq equiv."
940 call esmf_fieldregrid(snow_liq_equiv_input_grid, &
941 snow_liq_equiv_target_grid, &
942 routehandle=regrid_seaice, &
943 termorderflag=esmf_termorder_srcseq, rc=rc)
944 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
947 print*,
"- CALL FieldGet FOR TARGET grid snow liq equiv."
948 call esmf_fieldget(snow_liq_equiv_target_grid, &
949 farrayptr=snow_liq_equiv_target_ptr, rc=rc)
950 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
953 print*,
"- CALL Field_Regrid for sea ice skin temp."
954 call esmf_fieldregrid(seaice_skin_temp_input_grid, &
955 seaice_skin_temp_target_grid, &
956 routehandle=regrid_seaice, &
957 termorderflag=esmf_termorder_srcseq, rc=rc)
958 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
961 print*,
"- CALL FieldGet FOR TARGET grid sea ice skin temp."
962 call esmf_fieldget(seaice_skin_temp_target_grid, &
963 farrayptr=seaice_skin_temp_target_ptr, rc=rc)
964 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
967 l = lbound(unmapped_ptr)
968 u = ubound(unmapped_ptr)
971 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
972 seaice_depth_target_ptr(i,j) = -9999.9
973 snow_depth_target_ptr(i,j) = -9999.9
974 snow_liq_equiv_target_ptr(i,j) = -9999.9
975 seaice_skin_temp_target_ptr(i,j) = -9999.9
976 soil_temp_target_ptr(i,j,:) = -9999.9
979 do tile = 1, num_tiles_target_grid
981 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE DEPTH TILE: ", tile
982 call esmf_fieldgather(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
983 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
986 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
987 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
988 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
991 if (localpet == 0)
then
995 where(mask_target_one_tile == 1) mask_target_one_tile = 0
996 where(mask_target_one_tile == 2) mask_target_one_tile = 1
997 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 92)
1000 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE DEPTH TILE: ", tile
1001 call esmf_fieldscatter(seaice_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1002 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1005 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile
1006 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1007 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1010 if (localpet == 0)
then
1011 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 66)
1014 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH TILE: ", tile
1015 call esmf_fieldscatter(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1016 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1019 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile
1020 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1021 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1024 if (localpet == 0)
then
1025 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 65)
1028 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile
1029 call esmf_fieldscatter(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1030 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1033 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE SKIN TEMP: ", tile
1034 call esmf_fieldgather(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1035 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1038 if (localpet == 0)
then
1039 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 21)
1042 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE SKIN TEMP: ", tile
1043 call esmf_fieldscatter(seaice_skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1044 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1047 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
1048 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1049 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1052 if (localpet == 0)
then
1053 do j = 1, lsoil_target
1054 data_one_tile = data_one_tile_3d(:,:,j)
1055 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 21)
1056 data_one_tile_3d(:,:,j) = data_one_tile
1060 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
1061 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1062 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1067 print*,
"- CALL FieldRegridRelease."
1068 call esmf_fieldregridrelease(routehandle=regrid_seaice, rc=rc)
1069 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1077 where (nint(landmask_input_ptr) == 0) mask_input_ptr = 1
1080 where (landmask_target_ptr == 0) mask_target_ptr = 1
1082 method=esmf_regridmethod_conserve
1083 isrctermprocessing = 1
1085 print*,
"- CALL FieldRegridStore for water fields."
1086 call esmf_fieldregridstore(skin_temp_input_grid, &
1087 skin_temp_target_grid, &
1088 srcmaskvalues=(/0/), &
1089 dstmaskvalues=(/0/), &
1090 polemethod=esmf_polemethod_none, &
1091 srctermprocessing=isrctermprocessing, &
1092 unmappedaction=esmf_unmappedaction_ignore, &
1093 normtype=esmf_normtype_fracarea, &
1094 routehandle=regrid_water, &
1095 regridmethod=method, &
1096 unmappeddstlist=unmapped_ptr, rc=rc)
1097 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1100 print*,
"- CALL Field_Regrid for skin temperature over water."
1101 call esmf_fieldregrid(skin_temp_input_grid, &
1102 skin_temp_target_grid, &
1103 routehandle=regrid_water, &
1104 termorderflag=esmf_termorder_srcseq, rc=rc)
1105 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1108 print*,
"- CALL FieldGet FOR TARGET skin temperature."
1109 call esmf_fieldget(skin_temp_target_grid, &
1110 farrayptr=skin_temp_target_ptr, rc=rc)
1111 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1114 print*,
"- CALL Field_Regrid for z0 over water."
1115 call esmf_fieldregrid(z0_input_grid, &
1117 routehandle=regrid_water, &
1118 termorderflag=esmf_termorder_srcseq, rc=rc)
1119 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1122 print*,
"- CALL FieldGet FOR TARGET z0."
1123 call esmf_fieldget(z0_target_grid, &
1124 farrayptr=z0_target_ptr, rc=rc)
1125 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1128 l = lbound(unmapped_ptr)
1129 u = ubound(unmapped_ptr)
1132 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1133 skin_temp_target_ptr(i,j) = -9999.9
1134 z0_target_ptr(i,j) = -9999.9
1137 if (convert_nst)
then
1139 print*,
"- CALL Field_Regrid for c_d over water."
1140 call esmf_fieldregrid(c_d_input_grid, &
1142 routehandle=regrid_water, &
1143 termorderflag=esmf_termorder_srcseq, rc=rc)
1144 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1147 print*,
"- CALL Field_Regrid for c_0 over water."
1148 call esmf_fieldregrid(c_0_input_grid, &
1150 routehandle=regrid_water, &
1151 termorderflag=esmf_termorder_srcseq, rc=rc)
1152 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1155 print*,
"- CALL Field_Regrid for d_conv over water."
1156 call esmf_fieldregrid(d_conv_input_grid, &
1157 d_conv_target_grid, &
1158 routehandle=regrid_water, &
1159 termorderflag=esmf_termorder_srcseq, rc=rc)
1160 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1163 print*,
"- CALL Field_Regrid for dt_cool over water."
1164 call esmf_fieldregrid(dt_cool_input_grid, &
1165 dt_cool_target_grid, &
1166 routehandle=regrid_water, &
1167 termorderflag=esmf_termorder_srcseq, rc=rc)
1168 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1171 print*,
"- CALL Field_Regrid for ifd over water."
1172 call esmf_fieldregrid(ifd_input_grid, &
1174 routehandle=regrid_water, &
1175 termorderflag=esmf_termorder_srcseq, rc=rc)
1176 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1179 print*,
"- CALL Field_Regrid for qrain over water."
1180 call esmf_fieldregrid(qrain_input_grid, &
1181 qrain_target_grid, &
1182 routehandle=regrid_water, &
1183 termorderflag=esmf_termorder_srcseq, rc=rc)
1184 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1187 print*,
"- CALL Field_Regrid for tref over water."
1188 call esmf_fieldregrid(tref_input_grid, &
1190 routehandle=regrid_water, &
1191 termorderflag=esmf_termorder_srcseq, rc=rc)
1192 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1195 print*,
"- CALL Field_Regrid for w_d over water."
1196 call esmf_fieldregrid(w_d_input_grid, &
1198 routehandle=regrid_water, &
1199 termorderflag=esmf_termorder_srcseq, rc=rc)
1200 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1203 print*,
"- CALL Field_Regrid for w_0 over water."
1204 call esmf_fieldregrid(w_0_input_grid, &
1206 routehandle=regrid_water, &
1207 termorderflag=esmf_termorder_srcseq, rc=rc)
1208 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1211 print*,
"- CALL Field_Regrid for xs over water."
1212 call esmf_fieldregrid(xs_input_grid, &
1214 routehandle=regrid_water, &
1215 termorderflag=esmf_termorder_srcseq, rc=rc)
1216 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1219 print*,
"- CALL Field_Regrid for xt over water."
1220 call esmf_fieldregrid(xt_input_grid, &
1222 routehandle=regrid_water, &
1223 termorderflag=esmf_termorder_srcseq, rc=rc)
1224 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1227 print*,
"- CALL Field_Regrid for xu over water."
1228 call esmf_fieldregrid(xu_input_grid, &
1230 routehandle=regrid_water, &
1231 termorderflag=esmf_termorder_srcseq, rc=rc)
1232 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1235 print*,
"- CALL Field_Regrid for xv over water."
1236 call esmf_fieldregrid(xv_input_grid, &
1238 routehandle=regrid_water, &
1239 termorderflag=esmf_termorder_srcseq, rc=rc)
1240 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1243 print*,
"- CALL Field_Regrid for xz over water."
1244 call esmf_fieldregrid(xz_input_grid, &
1246 routehandle=regrid_water, &
1247 termorderflag=esmf_termorder_srcseq, rc=rc)
1248 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1251 print*,
"- CALL Field_Regrid for xtts over water."
1252 call esmf_fieldregrid(xtts_input_grid, &
1254 routehandle=regrid_water, &
1255 termorderflag=esmf_termorder_srcseq, rc=rc)
1256 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1259 print*,
"- CALL Field_Regrid for xzts over water."
1260 call esmf_fieldregrid(xzts_input_grid, &
1262 routehandle=regrid_water, &
1263 termorderflag=esmf_termorder_srcseq, rc=rc)
1264 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1267 print*,
"- CALL Field_Regrid for z_c over water."
1268 call esmf_fieldregrid(z_c_input_grid, &
1270 routehandle=regrid_water, &
1271 termorderflag=esmf_termorder_srcseq, rc=rc)
1272 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1275 print*,
"- CALL Field_Regrid for zm over water."
1276 call esmf_fieldregrid(zm_input_grid, &
1278 routehandle=regrid_water, &
1279 termorderflag=esmf_termorder_srcseq, rc=rc)
1280 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1285 print*,
"- CALL FieldGet FOR TARGET c_d."
1286 call esmf_fieldget(c_d_target_grid, &
1287 farrayptr=c_d_target_ptr, rc=rc)
1288 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1291 print*,
"- CALL FieldGet FOR TARGET c_0."
1292 call esmf_fieldget(c_0_target_grid, &
1293 farrayptr=c_0_target_ptr, rc=rc)
1294 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1297 print*,
"- CALL FieldGet FOR TARGET d_conv."
1298 call esmf_fieldget(d_conv_target_grid, &
1299 farrayptr=d_conv_target_ptr, rc=rc)
1300 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1303 print*,
"- CALL FieldGet FOR TARGET dt_cool."
1304 call esmf_fieldget(dt_cool_target_grid, &
1305 farrayptr=dt_cool_target_ptr, rc=rc)
1306 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1309 print*,
"- CALL FieldGet FOR TARGET ifd."
1310 call esmf_fieldget(ifd_target_grid, &
1311 farrayptr=ifd_target_ptr, rc=rc)
1312 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1315 ifd_target_ptr = float(nint(ifd_target_ptr))
1317 print*,
"- CALL FieldGet FOR TARGET qrain."
1318 call esmf_fieldget(qrain_target_grid, &
1319 farrayptr=qrain_target_ptr, rc=rc)
1320 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1323 print*,
"- CALL FieldGet FOR TARGET tref."
1324 call esmf_fieldget(tref_target_grid, &
1325 farrayptr=tref_target_ptr, rc=rc)
1326 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1329 print*,
"- CALL FieldGet FOR TARGET w_d."
1330 call esmf_fieldget(w_d_target_grid, &
1331 farrayptr=w_d_target_ptr, rc=rc)
1332 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1335 print*,
"- CALL FieldGet FOR TARGET w_0."
1336 call esmf_fieldget(w_0_target_grid, &
1337 farrayptr=w_0_target_ptr, rc=rc)
1338 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1341 print*,
"- CALL FieldGet FOR TARGET xs."
1342 call esmf_fieldget(xs_target_grid, &
1343 farrayptr=xs_target_ptr, rc=rc)
1344 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1347 print*,
"- CALL FieldGet FOR TARGET xt."
1348 call esmf_fieldget(xt_target_grid, &
1349 farrayptr=xt_target_ptr, rc=rc)
1350 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1353 print*,
"- CALL FieldGet FOR TARGET xu."
1354 call esmf_fieldget(xu_target_grid, &
1355 farrayptr=xu_target_ptr, rc=rc)
1356 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1359 print*,
"- CALL FieldGet FOR TARGET xv."
1360 call esmf_fieldget(xv_target_grid, &
1361 farrayptr=xv_target_ptr, rc=rc)
1362 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1365 print*,
"- CALL FieldGet FOR TARGET xz."
1366 call esmf_fieldget(xz_target_grid, &
1367 farrayptr=xz_target_ptr, rc=rc)
1368 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1371 print*,
"- CALL FieldGet FOR TARGET xtts."
1372 call esmf_fieldget(xtts_target_grid, &
1373 farrayptr=xtts_target_ptr, rc=rc)
1374 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1377 print*,
"- CALL FieldGet FOR TARGET xzts."
1378 call esmf_fieldget(xzts_target_grid, &
1379 farrayptr=xzts_target_ptr, rc=rc)
1380 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1383 print*,
"- CALL FieldGet FOR TARGET z_c."
1384 call esmf_fieldget(z_c_target_grid, &
1385 farrayptr=z_c_target_ptr, rc=rc)
1386 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1389 print*,
"- CALL FieldGet FOR TARGET zm."
1390 call esmf_fieldget(zm_target_grid, &
1391 farrayptr=zm_target_ptr, rc=rc)
1392 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1396 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1397 c_d_target_ptr(i,j) = -9999.9
1398 c_0_target_ptr(i,j) = -9999.9
1399 d_conv_target_ptr(i,j) = -9999.9
1400 dt_cool_target_ptr(i,j) = -9999.9
1401 ifd_target_ptr(i,j) = -9999.9
1402 qrain_target_ptr(i,j) = -9999.9
1403 tref_target_ptr(i,j) = -9999.9
1404 w_d_target_ptr(i,j) = -9999.9
1405 w_0_target_ptr(i,j) = -9999.9
1406 xs_target_ptr(i,j) = -9999.9
1407 xt_target_ptr(i,j) = -9999.9
1408 xu_target_ptr(i,j) = -9999.9
1409 xv_target_ptr(i,j) = -9999.9
1410 xz_target_ptr(i,j) = -9999.9
1411 xtts_target_ptr(i,j) = -9999.9
1412 xzts_target_ptr(i,j) = -9999.9
1413 z_c_target_ptr(i,j) = -9999.9
1414 zm_target_ptr(i,j) = -9999.9
1419 if (localpet == 0)
then
1420 allocate(latitude_one_tile(i_target,j_target))
1422 allocate(latitude_one_tile(0,0))
1425 do tile = 1, num_tiles_target_grid
1429 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE TILE: ", tile
1430 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1431 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1434 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1435 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1436 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1439 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
1440 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
1441 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1444 if (localpet == 0)
then
1445 allocate(water_target_one_tile(i_target,j_target))
1446 water_target_one_tile = 0
1447 where(mask_target_one_tile == 0) water_target_one_tile = 1
1448 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 11, &
1449 latitude=latitude_one_tile)
1452 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMP: ", tile
1453 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1454 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1459 print*,
"- CALL FieldGather FOR TARGET GRID Z0 TILE: ", tile
1460 call esmf_fieldgather(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1461 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1464 if (localpet == 0)
then
1465 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 83)
1468 print*,
"- CALL FieldScatter FOR TARGET GRID Z0: ", tile
1469 call esmf_fieldscatter(z0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1470 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1473 if (convert_nst)
then
1477 print*,
"- CALL FieldGather FOR TARGET GRID C_D TILE: ", tile
1478 call esmf_fieldgather(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1479 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1482 if (localpet == 0)
then
1483 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1486 print*,
"- CALL FieldScatter FOR TARGET GRID C_D: ", tile
1487 call esmf_fieldscatter(c_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1488 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1493 print*,
"- CALL FieldGather FOR TARGET GRID C_0 TILE: ", tile
1494 call esmf_fieldgather(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1495 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1498 if (localpet == 0)
then
1499 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1502 print*,
"- CALL FieldScatter FOR TARGET GRID C_0: ", tile
1503 call esmf_fieldscatter(c_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1504 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1509 print*,
"- CALL FieldGather FOR TARGET GRID D_CONV TILE: ", tile
1510 call esmf_fieldgather(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1511 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1514 if (localpet == 0)
then
1515 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1518 print*,
"- CALL FieldScatter FOR TARGET GRID D_CONV: ", tile
1519 call esmf_fieldscatter(d_conv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1520 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1525 print*,
"- CALL FieldGather FOR TARGET GRID DT_COOL TILE: ", tile
1526 call esmf_fieldgather(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1527 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1530 if (localpet == 0)
then
1531 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1534 print*,
"- CALL FieldScatter FOR TARGET GRID DT_COOL: ", tile
1535 call esmf_fieldscatter(dt_cool_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1536 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1541 print*,
"- CALL FieldGather FOR TARGET GRID IFD TILE: ", tile
1542 call esmf_fieldgather(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1543 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1546 if (localpet == 0)
then
1547 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 1)
1550 print*,
"- CALL FieldScatter FOR TARGET GRID IFD: ", tile
1551 call esmf_fieldscatter(ifd_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1552 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1557 print*,
"- CALL FieldGather FOR TARGET GRID QRAIN TILE: ", tile
1558 call esmf_fieldgather(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1559 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1562 if (localpet == 0)
then
1563 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1566 print*,
"- CALL FieldScatter FOR TARGET GRID QRAIN: ", tile
1567 call esmf_fieldscatter(qrain_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1568 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1573 print*,
"- CALL FieldGather FOR TARGET GRID TREF TILE: ", tile
1574 call esmf_fieldgather(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1575 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1578 if (localpet == 0)
then
1579 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 11, &
1580 latitude=latitude_one_tile)
1583 print*,
"- CALL FieldScatter FOR TARGET GRID TREF: ", tile
1584 call esmf_fieldscatter(tref_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1585 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1590 print*,
"- CALL FieldGather FOR TARGET GRID W_D TILE: ", tile
1591 call esmf_fieldgather(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1592 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1595 if (localpet == 0)
then
1596 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1599 print*,
"- CALL FieldScatter FOR TARGET GRID W_D: ", tile
1600 call esmf_fieldscatter(w_d_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1601 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1606 print*,
"- CALL FieldGather FOR TARGET GRID W_0 TILE: ", tile
1607 call esmf_fieldgather(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1608 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1611 if (localpet == 0)
then
1612 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1615 print*,
"- CALL FieldScatter FOR TARGET GRID W_0: ", tile
1616 call esmf_fieldscatter(w_0_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1617 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1622 print*,
"- CALL FieldGather FOR TARGET GRID XS TILE: ", tile
1623 call esmf_fieldgather(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1624 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1627 if (localpet == 0)
then
1628 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1631 print*,
"- CALL FieldScatter FOR TARGET GRID XS: ", tile
1632 call esmf_fieldscatter(xs_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1633 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1638 print*,
"- CALL FieldGather FOR TARGET GRID XT TILE: ", tile
1639 call esmf_fieldgather(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1640 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1643 if (localpet == 0)
then
1644 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1647 print*,
"- CALL FieldScatter FOR TARGET GRID XT: ", tile
1648 call esmf_fieldscatter(xt_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1649 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1654 print*,
"- CALL FieldGather FOR TARGET GRID XU TILE: ", tile
1655 call esmf_fieldgather(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1656 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1659 if (localpet == 0)
then
1660 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1663 print*,
"- CALL FieldScatter FOR TARGET GRID XU: ", tile
1664 call esmf_fieldscatter(xu_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1665 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1670 print*,
"- CALL FieldGather FOR TARGET GRID XV TILE: ", tile
1671 call esmf_fieldgather(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1672 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1675 if (localpet == 0)
then
1676 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1679 print*,
"- CALL FieldScatter FOR TARGET GRID XV: ", tile
1680 call esmf_fieldscatter(xv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1681 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1686 print*,
"- CALL FieldGather FOR TARGET GRID XZ TILE: ", tile
1687 call esmf_fieldgather(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1688 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1691 if (localpet == 0)
then
1692 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 30)
1695 print*,
"- CALL FieldScatter FOR TARGET GRID XZ: ", tile
1696 call esmf_fieldscatter(xz_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1697 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1702 print*,
"- CALL FieldGather FOR TARGET GRID XTTS TILE: ", tile
1703 call esmf_fieldgather(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1704 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1707 if (localpet == 0)
then
1708 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1711 print*,
"- CALL FieldScatter FOR TARGET GRID XTTS: ", tile
1712 call esmf_fieldscatter(xtts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1713 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1718 print*,
"- CALL FieldGather FOR TARGET GRID XZTS TILE: ", tile
1719 call esmf_fieldgather(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1720 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1723 if (localpet == 0)
then
1724 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1727 print*,
"- CALL FieldScatter FOR TARGET GRID XZTS: ", tile
1728 call esmf_fieldscatter(xzts_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1729 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1734 print*,
"- CALL FieldGather FOR TARGET GRID Z_C TILE: ", tile
1735 call esmf_fieldgather(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1736 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1739 if (localpet == 0)
then
1740 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1743 print*,
"- CALL FieldScatter FOR TARGET GRID Z_C: ", tile
1744 call esmf_fieldscatter(z_c_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1745 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1750 print*,
"- CALL FieldGather FOR TARGET GRID ZM TILE: ", tile
1751 call esmf_fieldgather(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1752 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1755 if (localpet == 0)
then
1756 call
search(data_one_tile, water_target_one_tile, i_target, j_target, tile, 0)
1759 print*,
"- CALL FieldScatter FOR TARGET GRID ZM: ", tile
1760 call esmf_fieldscatter(zm_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1761 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1766 if (localpet == 0)
deallocate(water_target_one_tile)
1770 deallocate(latitude_one_tile)
1772 print*,
"- CALL FieldRegridRelease."
1773 call esmf_fieldregridrelease(routehandle=regrid_water, rc=rc)
1774 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1782 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
1785 where (landmask_target_ptr == 1) mask_target_ptr = 1
1787 method=esmf_regridmethod_conserve
1788 isrctermprocessing = 1
1790 print*,
"- CALL FieldRegridStore for land fields."
1791 call esmf_fieldregridstore(snow_depth_input_grid, &
1792 snow_depth_target_grid, &
1793 srcmaskvalues=(/0/), &
1794 dstmaskvalues=(/0/), &
1795 polemethod=esmf_polemethod_none, &
1796 srctermprocessing=isrctermprocessing, &
1797 unmappedaction=esmf_unmappedaction_ignore, &
1798 normtype=esmf_normtype_fracarea, &
1799 routehandle=regrid_all_land, &
1800 regridmethod=method, &
1801 unmappeddstlist=unmapped_ptr, rc=rc)
1802 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1805 print*,
"- CALL Field_Regrid for snow depth over land."
1806 call esmf_fieldregrid(snow_depth_input_grid, &
1807 snow_depth_target_grid, &
1808 routehandle=regrid_all_land, &
1809 termorderflag=esmf_termorder_srcseq, &
1810 zeroregion=esmf_region_select, &
1813 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1816 print*,
"- CALL Field_Regrid for snow liq equiv over land."
1817 call esmf_fieldregrid(snow_liq_equiv_input_grid, &
1818 snow_liq_equiv_target_grid, &
1819 routehandle=regrid_all_land, &
1820 termorderflag=esmf_termorder_srcseq, &
1821 zeroregion=esmf_region_select, rc=rc)
1822 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1825 print*,
"- CALL Field_Regrid for canopy mc."
1826 call esmf_fieldregrid(canopy_mc_input_grid, &
1827 canopy_mc_target_grid, &
1828 routehandle=regrid_all_land, &
1829 termorderflag=esmf_termorder_srcseq, rc=rc)
1830 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1833 print*,
"- CALL FieldGet FOR TARGET snow depth."
1834 call esmf_fieldget(snow_depth_target_grid, &
1835 farrayptr=snow_depth_target_ptr, rc=rc)
1836 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1839 print*,
"- CALL FieldGet FOR TARGET snow liq equiv."
1840 call esmf_fieldget(snow_liq_equiv_target_grid, &
1841 farrayptr=snow_liq_equiv_target_ptr, rc=rc)
1842 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1845 print*,
"- CALL FieldGet FOR TARGET canopy moisture."
1846 call esmf_fieldget(canopy_mc_target_grid, &
1847 farrayptr=canopy_mc_target_ptr, rc=rc)
1848 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1851 l = lbound(unmapped_ptr)
1852 u = ubound(unmapped_ptr)
1855 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1856 snow_depth_target_ptr(i,j) = -9999.9
1857 snow_liq_equiv_target_ptr(i,j) = -9999.9
1858 canopy_mc_target_ptr(i,j) = -9999.9
1861 do tile = 1, num_tiles_target_grid
1863 print*,
"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile
1864 call esmf_fieldgather(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1865 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1868 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1869 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1870 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1873 if (localpet == 0)
then
1874 allocate(land_target_one_tile(i_target,j_target))
1875 land_target_one_tile = 0
1876 where(mask_target_one_tile == 1) land_target_one_tile = 1
1877 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 66)
1880 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH: ", tile
1881 call esmf_fieldscatter(snow_depth_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1882 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1885 print*,
"- CALL FieldGather FOR TARGET GRID SNOW LIQUID EQUIV: ", tile
1886 call esmf_fieldgather(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1890 if (localpet == 0)
then
1891 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 65)
1894 print*,
"- CALL FieldScatter FOR TARGET GRID SNOW LIQUID EQUIV: ", tile
1895 call esmf_fieldscatter(snow_liq_equiv_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1896 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1899 print*,
"- CALL FieldGather FOR TARGET GRID CANOPY MC: ", tile
1900 call esmf_fieldgather(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1901 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1904 if (localpet == 0)
then
1905 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 223)
1906 deallocate(land_target_one_tile)
1909 print*,
"- CALL FieldScatter FOR TARGET GRID CANOPY MC: ", tile
1910 call esmf_fieldscatter(canopy_mc_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
1911 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1916 print*,
"- CALL FieldRegridRelease."
1917 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
1918 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1925 print*,
"- CALL FieldGet FOR INPUT GRID VEG TYPE."
1926 call esmf_fieldget(veg_type_input_grid, &
1927 farrayptr=veg_type_input_ptr, rc=rc)
1928 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1931 print*,
'land ice check ',veg_type_landice_input
1934 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 1
1936 print*,
"- CALL FieldGet FOR TARGET GRID VEG TYPE."
1937 call esmf_fieldget(veg_type_target_grid, &
1938 farrayptr=veg_type_target_ptr, rc=rc)
1939 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1943 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 1
1945 method=esmf_regridmethod_nearest_stod
1946 isrctermprocessing = 1
1948 print*,
"- CALL FieldRegridStore for landice fields."
1949 call esmf_fieldregridstore(soil_temp_input_grid, &
1950 soil_temp_target_grid, &
1951 srcmaskvalues=(/0/), &
1952 dstmaskvalues=(/0/), &
1953 polemethod=esmf_polemethod_none, &
1954 srctermprocessing=isrctermprocessing, &
1955 unmappedaction=esmf_unmappedaction_ignore, &
1956 normtype=esmf_normtype_fracarea, &
1957 routehandle=regrid_landice, &
1958 regridmethod=method, &
1959 unmappeddstlist=unmapped_ptr, rc=rc)
1960 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1963 print*,
"- CALL Field_Regrid for soil temperature over landice."
1964 call esmf_fieldregrid(soil_temp_input_grid, &
1965 soil_temp_target_grid, &
1966 routehandle=regrid_landice, &
1967 termorderflag=esmf_termorder_srcseq, &
1968 zeroregion=esmf_region_select, rc=rc)
1969 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1972 print*,
"- CALL Field_Regrid for skin temperature over landice."
1973 call esmf_fieldregrid(skin_temp_input_grid, &
1974 skin_temp_target_grid, &
1975 routehandle=regrid_landice, &
1976 termorderflag=esmf_termorder_srcseq, &
1977 zeroregion=esmf_region_select, rc=rc)
1978 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1981 print*,
"- CALL Field_Regrid for terrain over landice."
1982 call esmf_fieldregrid(terrain_input_grid, &
1983 terrain_from_input_grid, &
1984 routehandle=regrid_landice, &
1985 termorderflag=esmf_termorder_srcseq, &
1986 zeroregion=esmf_region_select, rc=rc)
1987 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1990 print*,
"- CALL FieldGet FOR TARGET grid column temperature over landice."
1991 call esmf_fieldget(soil_temp_target_grid, &
1992 farrayptr=soil_temp_target_ptr, rc=rc)
1993 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1996 print*,
"- CALL FieldGet FOR TARGET skin temperature."
1997 call esmf_fieldget(skin_temp_target_grid, &
1998 farrayptr=skin_temp_target_ptr, rc=rc)
1999 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2002 print*,
"- CALL FieldGet FOR terrain from input grid."
2003 call esmf_fieldget(terrain_from_input_grid, &
2004 farrayptr=terrain_from_input_ptr, rc=rc)
2005 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2008 l = lbound(unmapped_ptr)
2009 u = ubound(unmapped_ptr)
2012 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
2013 soil_temp_target_ptr(i,j,:) = -9999.9
2014 skin_temp_target_ptr(i,j) = -9999.9
2015 terrain_from_input_ptr(i,j) = -9999.9
2018 if (localpet == 0)
then
2019 allocate (veg_type_target_one_tile(i_target,j_target))
2020 allocate (land_target_one_tile(i_target,j_target))
2021 allocate (data_one_tile2(i_target,j_target))
2023 allocate (veg_type_target_one_tile(0,0))
2024 allocate (land_target_one_tile(0,0))
2025 allocate (data_one_tile2(0,0))
2028 do tile = 1, num_tiles_target_grid
2030 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMP TILE: ", tile
2031 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2032 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2035 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
2036 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
2037 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2040 if (localpet == 0)
then
2041 land_target_one_tile = 0
2042 where(nint(veg_type_target_one_tile) == veg_type_landice_target) land_target_one_tile = 1
2043 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 21)
2046 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMP, TILE: ", tile
2047 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2048 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2051 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2052 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2053 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2056 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID LAND, TILE: ", tile
2057 call esmf_fieldgather(terrain_from_input_grid_land, data_one_tile2, rootpet=0, tile=tile, rc=rc)
2058 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2061 if (localpet == 0)
then
2062 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7, terrain_land=data_one_tile2)
2065 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2066 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2067 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2070 print*,
"- CALL FieldGather FOR TARGET GRID LANDICE COLUMN TEMP: ", tile
2071 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2072 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2075 if (localpet == 0)
then
2076 do j = 1, lsoil_target
2077 data_one_tile = data_one_tile_3d(:,:,j)
2078 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 21)
2079 data_one_tile_3d(:,:,j) = data_one_tile
2083 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile
2084 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2085 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2090 deallocate (veg_type_target_one_tile)
2091 deallocate (land_target_one_tile)
2093 print*,
"- CALL FieldRegridRelease."
2094 call esmf_fieldregridrelease(routehandle=regrid_landice, rc=rc)
2095 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2103 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
2104 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 0
2107 where (landmask_target_ptr == 1) mask_target_ptr = 1
2108 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 0
2110 method=esmf_regridmethod_nearest_stod
2111 isrctermprocessing = 1
2113 print*,
"- CALL FieldRegridStore for 3d land (but no land ice) fields."
2114 call esmf_fieldregridstore(soilm_tot_input_grid, &
2115 soilm_tot_target_grid, &
2116 srcmaskvalues=(/0/), &
2117 dstmaskvalues=(/0/), &
2118 polemethod=esmf_polemethod_none, &
2119 srctermprocessing=isrctermprocessing, &
2120 unmappedaction=esmf_unmappedaction_ignore, &
2121 normtype=esmf_normtype_fracarea, &
2122 routehandle=regrid_land, &
2123 regridmethod=method, &
2124 unmappeddstlist=unmapped_ptr, rc=rc)
2125 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2128 print*,
"- CALL Field_Regrid for total soil moisture over land."
2129 call esmf_fieldregrid(soilm_tot_input_grid, &
2130 soilm_tot_target_grid, &
2131 routehandle=regrid_land, &
2132 termorderflag=esmf_termorder_srcseq, rc=rc)
2133 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2136 print*,
"- CALL Field_Regrid for soil temperature over land."
2137 call esmf_fieldregrid(soil_temp_input_grid, &
2138 soil_temp_target_grid, &
2139 routehandle=regrid_land, &
2140 termorderflag=esmf_termorder_srcseq, &
2141 zeroregion=esmf_region_select, rc=rc)
2142 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2145 print*,
"- CALL Field_Regrid for skin temperature over land."
2146 call esmf_fieldregrid(skin_temp_input_grid, &
2147 skin_temp_target_grid, &
2148 routehandle=regrid_land, &
2149 termorderflag=esmf_termorder_srcseq, &
2150 zeroregion=esmf_region_select, rc=rc)
2151 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2154 print*,
"- CALL Field_Regrid for terrain over land."
2155 call esmf_fieldregrid(terrain_input_grid, &
2156 terrain_from_input_grid, &
2157 routehandle=regrid_land, &
2158 termorderflag=esmf_termorder_srcseq, &
2159 zeroregion=esmf_region_select, rc=rc)
2160 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2163 print*,
"- CALL Field_Regrid for soil type over land."
2164 call esmf_fieldregrid(soil_type_input_grid, &
2165 soil_type_from_input_grid, &
2166 routehandle=regrid_land, &
2167 termorderflag=esmf_termorder_srcseq, rc=rc)
2168 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2171 if (.not. vgfrc_from_climo)
then
2172 print*,
"- CALL Field_Regrid for veg greenness over land."
2173 call esmf_fieldregrid(veg_greenness_input_grid, &
2174 veg_greenness_target_grid, &
2175 routehandle=regrid_land, &
2176 termorderflag=esmf_termorder_srcseq, rc=rc)
2177 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2181 if (.not. minmax_vgfrc_from_climo)
then
2182 print*,
"- CALL Field_Regrid for max veg greenness over land."
2183 call esmf_fieldregrid(max_veg_greenness_input_grid, &
2184 max_veg_greenness_target_grid, &
2185 routehandle=regrid_land, &
2186 termorderflag=esmf_termorder_srcseq, rc=rc)
2187 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2190 print*,
"- CALL Field_Regrid for min veg greenness over land."
2191 call esmf_fieldregrid(min_veg_greenness_input_grid, &
2192 min_veg_greenness_target_grid, &
2193 routehandle=regrid_land, &
2194 termorderflag=esmf_termorder_srcseq, rc=rc)
2195 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2199 if (.not. lai_from_climo)
then
2200 print*,
"- CALL Field_Regrid for leaf area index over land."
2201 call esmf_fieldregrid(lai_input_grid, &
2203 routehandle=regrid_land, &
2204 termorderflag=esmf_termorder_srcseq, rc=rc)
2205 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2210 print*,
"- CALL FieldGet FOR TARGET grid total soil moisture over land."
2211 call esmf_fieldget(soilm_tot_target_grid, &
2212 farrayptr=soilm_tot_target_ptr, rc=rc)
2213 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2216 print*,
"- CALL FieldGet FOR TARGET grid soil temp over ice."
2217 call esmf_fieldget(soil_temp_target_grid, &
2218 farrayptr=soil_temp_target_ptr, rc=rc)
2219 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2222 print*,
"- CALL FieldGet FOR TARGET skin temperature."
2223 call esmf_fieldget(skin_temp_target_grid, &
2224 farrayptr=skin_temp_target_ptr, rc=rc)
2225 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2228 print*,
"- CALL FieldGet FOR terrain from input grid."
2229 call esmf_fieldget(terrain_from_input_grid, &
2230 farrayptr=terrain_from_input_ptr, rc=rc)
2231 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2234 print*,
"- CALL FieldGet FOR soil type from input grid."
2235 call esmf_fieldget(soil_type_from_input_grid, &
2236 farrayptr=soil_type_from_input_ptr, rc=rc)
2237 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2240 if (.not. vgfrc_from_climo)
then
2241 print*,
"- CALL FieldGet FOR TARGET veg greenness."
2242 call esmf_fieldget(veg_greenness_target_grid, &
2243 farrayptr=veg_greenness_target_ptr, rc=rc)
2244 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2248 if (.not. minmax_vgfrc_from_climo)
then
2249 print*,
"- CALL FieldGet FOR TARGET max veg greenness."
2250 call esmf_fieldget(max_veg_greenness_target_grid, &
2251 farrayptr=max_veg_greenness_target_ptr, rc=rc)
2252 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2255 print*,
"- CALL FieldGet FOR TARGET min veg greenness."
2256 call esmf_fieldget(min_veg_greenness_target_grid, &
2257 farrayptr=min_veg_greenness_target_ptr, rc=rc)
2258 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2262 if (.not. lai_from_climo)
then
2263 print*,
"- CALL FieldGet FOR TARGET lai."
2264 call esmf_fieldget(lai_target_grid, &
2265 farrayptr=lai_target_ptr, rc=rc)
2266 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2270 l = lbound(unmapped_ptr)
2271 u = ubound(unmapped_ptr)
2273 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
2274 soilm_tot_target_ptr(i,j,:) = -9999.9
2275 soil_temp_target_ptr(i,j,:) = -9999.9
2276 skin_temp_target_ptr(i,j) = -9999.9
2277 terrain_from_input_ptr(i,j) = -9999.9
2278 soil_type_from_input_ptr(i,j) = -9999.9
2279 veg_greenness_target_ptr(i,j) = -9999.9
2280 max_veg_greenness_target_ptr(i,j) = -9999.9
2281 min_veg_greenness_target_ptr(i,j) = -9999.9
2282 lai_target_ptr(i,j) = -9999.9
2285 if (localpet == 0)
then
2286 allocate (veg_type_target_one_tile(i_target,j_target))
2288 allocate (veg_type_target_one_tile(0,0))
2291 do tile = 1, num_tiles_target_grid
2293 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
2294 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
2295 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2298 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
2299 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
2300 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2303 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2304 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2305 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2308 if (localpet == 0)
then
2309 where(nint(veg_type_target_one_tile) == veg_type_landice_target) mask_target_one_tile = 0
2310 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 7)
2313 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile
2314 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2315 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2318 print*,
"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile
2319 call esmf_fieldgather(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2320 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2323 if (localpet == 0)
then
2324 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 85)
2327 print*,
"- CALL FieldScatter FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile
2328 call esmf_fieldscatter(skin_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2329 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2332 print*,
"- CALL FieldGather FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile
2333 call esmf_fieldgather(soil_type_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2334 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2337 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID, TILE: ", tile
2338 call esmf_fieldgather(soil_type_target_grid, data_one_tile2, rootpet=0,tile=tile, rc=rc)
2339 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2348 if (.not. sotyp_from_climo)
then
2349 if (localpet==0)
then
2350 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224,soilt_climo=data_one_tile2)
2353 if (localpet == 0 .and. maxval(data_one_tile) > 0 .and. (trim(external_model) .ne.
"GFS" .or. trim(input_type) .ne.
"grib2"))
then
2356 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224)
2357 elseif (localpet == 0)
then
2358 data_one_tile = data_one_tile2
2362 if (.not. sotyp_from_climo)
then
2363 print*,
"- CALL FieldScatter FOR SOIL TYPE TARGET GRID, TILE: ", tile
2364 call esmf_fieldscatter(soil_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2365 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2369 print*,
"- CALL FieldScatter FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile
2370 call esmf_fieldscatter(soil_type_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__)) &
2376 if (.not. vgfrc_from_climo)
then
2377 print*,
"- CALL FieldGather FOR TARGET GRID VEG GREENNESS, TILE: ", tile
2378 call esmf_fieldgather(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2379 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2382 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2383 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 226)
2386 print*,
"- CALL FieldScatter FOR VEG GREENNESS TARGET GRID, TILE: ", tile
2387 call esmf_fieldscatter(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
2388 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2392 if (.not. minmax_vgfrc_from_climo)
then
2393 print*,
"- CALL FieldGather FOR TARGET GRID MAX VEG GREENNESS, TILE: ", tile
2394 call esmf_fieldgather(max_veg_greenness_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2395 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2398 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2399 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 227)
2402 print*,
"- CALL FieldScatter FOR MAX VEG GREENNESS TARGET GRID, TILE: ", tile
2403 call esmf_fieldscatter(max_veg_greenness_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2404 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2407 print*,
"- CALL FieldGather FOR TARGET GRID MIN VEG GREENNESS, TILE: ", tile
2408 call esmf_fieldgather(min_veg_greenness_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2409 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2412 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2413 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile,228)
2417 print*,
"- CALL FieldScatter FOR MIN VEG GREENNESS TARGET GRID, TILE: ",tile
2418 call esmf_fieldscatter(min_veg_greenness_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
2419 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2424 if (.not. lai_from_climo)
then
2425 print*,
"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX, TILE: ", tile
2426 call esmf_fieldgather(lai_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2427 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2430 if (localpet == 0 .and. maxval(data_one_tile) > 0.0)
then
2431 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 229)
2434 print*,
"- CALL FieldScatter FOR LEAF AREA INDEX TARGET GRID, TILE: ", tile
2435 call esmf_fieldscatter(lai_target_grid, data_one_tile, rootpet=0,tile=tile, rc=rc)
2436 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2440 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
2441 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2442 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2445 if (localpet == 0)
then
2446 do j = 1, lsoil_target
2447 data_one_tile = data_one_tile_3d(:,:,j)
2448 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 86)
2449 data_one_tile_3d(:,:,j) = data_one_tile
2453 print*,
"- CALL FieldScatter FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
2454 call esmf_fieldscatter(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2455 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2458 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
2459 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2460 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2463 if (localpet == 0)
then
2464 do j = 1, lsoil_target
2465 data_one_tile = data_one_tile_3d(:,:,j)
2466 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 85)
2467 data_one_tile_3d(:,:,j) = data_one_tile
2471 print*,
"- CALL FieldScatter FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
2472 call esmf_fieldscatter(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
2473 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2476 if (tg3_from_soil)
then
2477 print*,
"- CALL FieldScatter FOR TARGET GRID SUBSTRATE TEMPERATURE, TILE: ", tile
2478 call esmf_fieldscatter(substrate_temp_target_grid, data_one_tile_3d(:,:,lsoil_target), rootpet=0, tile=tile, rc=rc)
2479 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2485 print*,
"- CALL FieldRegridRelease."
2486 call esmf_fieldregridrelease(routehandle=regrid_land, rc=rc)
2487 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2490 deallocate(veg_type_target_one_tile)
2492 deallocate(data_one_tile, data_one_tile2)
2493 deallocate(data_one_tile_3d)
2494 deallocate(mask_target_one_tile)
2514 veg_type_target_grid
2518 integer :: clb(3), cub(3), rc
2519 integer :: i, j, n, soil_type
2521 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2524 real(esmf_kind_r8),
pointer :: soilm_liq_ptr(:,:,:)
2525 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
2526 real(esmf_kind_r8),
pointer :: soil_temp_ptr(:,:,:)
2527 real(esmf_kind_r8),
pointer :: soil_type_ptr(:,:)
2528 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
2530 print*,
"- COMPUTE LIQUID PORTION OF TOTAL SOIL MOISTURE."
2532 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
2533 call esmf_fieldget(soilm_tot_target_grid, &
2534 computationallbound=clb, &
2535 computationalubound=cub, &
2536 farrayptr=soilm_tot_ptr, rc=rc)
2537 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2540 print*,
"- CALL FieldGet FOR LIQUID SOIL MOISTURE."
2541 call esmf_fieldget(soilm_liq_target_grid, &
2542 farrayptr=soilm_liq_ptr, rc=rc)
2543 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2546 print*,
"- CALL FieldGet FOR SOIL TEMPERATURE."
2547 call esmf_fieldget(soil_temp_target_grid, &
2548 farrayptr=soil_temp_ptr, rc=rc)
2549 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2552 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
2553 call esmf_fieldget(veg_type_target_grid, &
2554 farrayptr=veg_type_ptr, rc=rc)
2555 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2558 print*,
"- CALL FieldGet FOR SOIL TYPE."
2559 call esmf_fieldget(soil_type_target_grid, &
2560 farrayptr=soil_type_ptr, rc=rc)
2561 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2564 print*,
"- CALL FieldGet FOR LANDMASK."
2565 call esmf_fieldget(landmask_target_grid, &
2566 farrayptr=landmask_ptr, rc=rc)
2567 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2570 do j = clb(2), cub(2)
2571 do i = clb(1), cub(1)
2577 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
2579 soil_type = nint(soil_type_ptr(i,j))
2581 do n = clb(3), cub(3)
2583 if (soil_temp_ptr(i,j,n) < (frz_h2o-0.0001))
then
2585 bx = bb_target(soil_type)
2587 if (bx .gt. blim) bx = blim
2589 fk=(((hlice/(grav*(-satpsi_target(soil_type))))* &
2590 ((soil_temp_ptr(i,j,n)-frz_h2o)/soil_temp_ptr(i,j,n)))** &
2591 (-1/bx))*maxsmc_target(soil_type)
2593 if (fk .lt. 0.02) fk = 0.02
2595 soilm_liq_ptr(i,j,n) = min( fk, soilm_tot_ptr(i,j,n) )
2603 soilm_liq_ptr(i,j,n) =
frh2o(soil_temp_ptr(i,j,n), &
2604 soilm_tot_ptr(i,j,n), soilm_liq_ptr(i,j,n), &
2605 maxsmc_target(soil_type),bb_target(soil_type), &
2606 satpsi_target(soil_type))
2610 soilm_liq_ptr(i,j,n) = soilm_tot_ptr(i,j,n)
2647 FUNCTION frh2o (TKELV,SMC,SH2O,SMCMAX,BEXP,PSIS)
2664 REAL(esmf_kind_r8) :: sh2o
2665 REAL(esmf_kind_r8) :: smc
2669 REAL(esmf_kind_r8) :: tkelv
2671 REAL,
PARAMETER :: ck = 8.0
2672 REAL,
PARAMETER :: error = 0.005
2681 IF (bexp .GT. blim) bx = blim
2690 IF (ck .NE. 0.0)
THEN
2705 IF (swl .GT. (smc-0.02)) swl = smc-0.02
2706 IF (swl .LT. 0.) swl = 0.
2712 DO WHILE ( (nlog .LT. 10) .AND. (kcount .EQ. 0) )
2715 df = log(( psis*grav/hlice ) * ( ( 1.+ck*swl )**2. ) * &
2716 ( smcmax/(smc-swl) )**bx) - log(-(tkelv-frz_h2o)/tkelv)
2717 denom = 2. * ck / ( 1.+ck*swl ) + bx / ( smc - swl )
2718 swlk = swl - df/denom
2724 IF (swlk .GT. (smc-0.02)) swlk = smc - 0.02
2725 IF (swlk .LT. 0.) swlk = 0.
2731 dswl = abs(swlk-swl)
2739 IF ( dswl .LE. error )
THEN
2765 IF (kcount .EQ. 0)
THEN
2767 fk = (((hlice/(grav*(-psis)))* &
2768 ((tkelv-frz_h2o)/tkelv))**(-1/bx))*smcmax
2770 IF (fk .LT. 0.02) fk = 0.02
2772 frh2o = min(fk, smc)
2792 maxsmc_input, maxsmc_target, &
2793 refsmc_input, refsmc_target, &
2794 wltsmc_input, wltsmc_target
2797 veg_greenness_target_grid, &
2798 veg_type_target_grid
2802 integer :: clb(3), cub(3), i, j, k, rc
2803 integer :: soilt_input, soilt_target
2804 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2806 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
2807 real(esmf_kind_r8),
pointer :: soil_type_input_ptr(:,:)
2808 real(esmf_kind_r8),
pointer :: soil_type_target_ptr(:,:)
2809 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
2810 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
2811 real :: f1, fn, smcdir, smctra
2813 print*,
"- RESCALE SOIL MOISTURE FOR CHANGES IN SOIL TYPE."
2815 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
2816 call esmf_fieldget(soilm_tot_target_grid, &
2817 computationallbound=clb, &
2818 computationalubound=cub, &
2819 farrayptr=soilm_tot_ptr, rc=rc)
2820 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2823 print*,
"- CALL FieldGet FOR LAND MASK."
2824 call esmf_fieldget(landmask_target_grid, &
2825 farrayptr=landmask_ptr, rc=rc)
2826 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2829 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
2830 call esmf_fieldget(veg_type_target_grid, &
2831 farrayptr=veg_type_ptr, rc=rc)
2832 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2835 print*,
"- CALL FieldGet FOR VEGETATION GREENNESS."
2836 call esmf_fieldget(veg_greenness_target_grid, &
2837 farrayptr=veg_greenness_ptr, rc=rc)
2838 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2841 print*,
"- CALL FieldGet FOR TARGET GRID SOIL TYPE."
2842 call esmf_fieldget(soil_type_target_grid, &
2843 farrayptr=soil_type_target_ptr, rc=rc)
2844 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2847 print*,
"- CALL FieldGet FOR SOIL TYPE FROM INPUT GRID."
2848 call esmf_fieldget(soil_type_from_input_grid, &
2849 farrayptr=soil_type_input_ptr, rc=rc)
2850 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2853 do j = clb(2), cub(2)
2854 do i = clb(1), cub(1)
2860 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
2862 soilt_target = nint(soil_type_target_ptr(i,j))
2863 soilt_input = nint(soil_type_input_ptr(i,j))
2871 if (soilt_target /= soilt_input)
then
2876 f1=(soilm_tot_ptr(i,j,1)-drysmc_input(soilt_input)) / &
2877 (maxsmc_input(soilt_input)-drysmc_input(soilt_input))
2879 smcdir=drysmc_target(soilt_target) + f1 * &
2880 (maxsmc_target(soilt_target) - drysmc_target(soilt_target))
2886 if (soilm_tot_ptr(i,j,1) < refsmc_input(soilt_input))
then
2887 f1=(soilm_tot_ptr(i,j,1) - wltsmc_input(soilt_input)) / &
2888 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
2889 smctra=wltsmc_target(soilt_target) + f1 * &
2890 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
2892 f1=(soilm_tot_ptr(i,j,1) - refsmc_input(soilt_input)) / &
2893 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
2894 smctra=refsmc_target(soilt_target) + f1 * &
2895 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
2902 soilm_tot_ptr(i,j,1) = ((1.0 - veg_greenness_ptr(i,j)) * smcdir) + &
2903 (veg_greenness_ptr(i,j) * smctra)
2913 if (soilm_tot_ptr(i,j,k) < refsmc_input(soilt_input))
then
2914 fn = (soilm_tot_ptr(i,j,k) - wltsmc_input(soilt_input)) / &
2915 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
2916 soilm_tot_ptr(i,j,k) = wltsmc_target(soilt_target) + fn * &
2917 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
2919 fn = (soilm_tot_ptr(i,j,k) - refsmc_input(soilt_input)) / &
2920 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
2921 soilm_tot_ptr(i,j,k) = refsmc_target(soilt_target) + fn * &
2922 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
2932 soilm_tot_ptr(i,j,1)=min(soilm_tot_ptr(i,j,1),maxsmc_target(soilt_target))
2933 soilm_tot_ptr(i,j,1)=max(drysmc_target(soilt_target),soilm_tot_ptr(i,j,1))
2936 soilm_tot_ptr(i,j,k)=min(soilm_tot_ptr(i,j,k),maxsmc_target(soilt_target))
2937 soilm_tot_ptr(i,j,k)=max(wltsmc_target(soilt_target),soilm_tot_ptr(i,j,k))
2955 use model_grid, only : landmask_target_grid, &
2962 integer :: clb(3), cub(3), i, j, k, rc
2963 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2965 real,
parameter :: lapse_rate = 6.5e-03
2966 real :: terrain_diff
2967 real(esmf_kind_r8),
pointer :: terrain_input_ptr(:,:)
2968 real(esmf_kind_r8),
pointer :: terrain_target_ptr(:,:)
2969 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
2970 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
2972 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
2973 call esmf_fieldget(landmask_target_grid, &
2974 farrayptr=landmask_ptr, rc=rc)
2975 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2978 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
2979 call esmf_fieldget(veg_type_target_grid, &
2980 farrayptr=veg_type_target_ptr, rc=rc)
2981 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2984 print*,
"- CALL FieldGet FOR TARGET GRID TERRAIN."
2985 call esmf_fieldget(terrain_target_grid, &
2986 farrayptr=terrain_target_ptr, rc=rc)
2987 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2990 print*,
"- CALL FieldGet FOR TERRAIN INTERP TO TARGET GRID."
2991 call esmf_fieldget(terrain_from_input_grid, &
2992 farrayptr=terrain_input_ptr, rc=rc)
2993 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2996 print*,
"- CALL FieldGet FOR SOIL TEMP TARGET GRID."
2997 call esmf_fieldget(soil_temp_target_grid, &
2998 computationallbound=clb, &
2999 computationalubound=cub, &
3000 farrayptr=soil_temp_target_ptr, rc=rc)
3001 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3004 do j = clb(2), cub(2)
3005 do i = clb(1), cub(1)
3006 if (landmask_ptr(i,j) == 1)
then
3007 terrain_diff = abs(terrain_input_ptr(i,j) - terrain_target_ptr(i,j))
3008 if (terrain_diff > 100.0)
then
3009 do k = clb(3), cub(3)
3010 soil_temp_target_ptr(i,j,k) = soil_temp_target_ptr(i,j,k) + &
3011 ((terrain_input_ptr(i,j) - terrain_target_ptr(i,j)) * lapse_rate)
3012 if (nint(veg_type_target_ptr(i,j)) == veg_type_landice_target)
then
3013 soil_temp_target_ptr(i,j,k) = min(soil_temp_target_ptr(i,j,k), 273.16)
3030 use model_grid, only : lsoil_target, i_input, j_input, input_grid
3031 use input_data, only : lsoil_input, soil_temp_input_grid, &
3032 soilm_liq_input_grid, soilm_tot_input_grid
3034 integer,
intent(in) :: localpet
3035 character(len=1000) :: msg
3037 real(esmf_kind_r8) :: tmp(i_input,j_input), &
3038 data_one_tile(i_input,j_input,lsoil_input), &
3039 tmp3d(i_input,j_input,lsoil_target)
3040 if (lsoil_input == 9 .and. lsoil_target == 4)
then
3041 print*,
"CONVERTING FROM 9 INPUT SOIL LEVELS TO 4 TARGET SOIL LEVELS"
3042 call esmf_fieldgather(soil_temp_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3043 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3046 call esmf_fielddestroy(soil_temp_input_grid,rc=rc)
3047 soil_temp_input_grid = esmf_fieldcreate(input_grid, &
3048 typekind=esmf_typekind_r8, &
3049 staggerloc=esmf_staggerloc_center, &
3050 ungriddedlbound=(/1/), &
3051 ungriddedubound=(/lsoil_target/), rc=rc)
3054 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3055 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3056 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3057 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3058 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3059 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3060 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3061 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3062 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3063 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3064 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3067 call esmf_fieldscatter(soil_temp_input_grid, tmp3d, rootpet=0, rc=rc)
3068 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3071 call esmf_fieldgather(soilm_tot_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3072 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3075 call esmf_fielddestroy(soilm_tot_input_grid,rc=rc)
3076 soilm_tot_input_grid = esmf_fieldcreate(input_grid, &
3077 typekind=esmf_typekind_r8, &
3078 staggerloc=esmf_staggerloc_center, &
3079 ungriddedlbound=(/1/), &
3080 ungriddedubound=(/lsoil_target/), rc=rc)
3082 if(localpet==0)
then
3083 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3084 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3085 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3086 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3087 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3088 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3089 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3090 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3091 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3092 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3093 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3096 call esmf_fieldscatter(soilm_tot_input_grid, tmp3d, rootpet=0, rc=rc)
3097 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3100 call esmf_fieldgather(soilm_liq_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
3101 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3104 call esmf_fielddestroy(soilm_liq_input_grid,rc=rc)
3105 soilm_liq_input_grid = esmf_fieldcreate(input_grid, &
3106 typekind=esmf_typekind_r8, &
3107 staggerloc=esmf_staggerloc_center, &
3108 ungriddedlbound=(/1/), &
3109 ungriddedubound=(/lsoil_target/), rc=rc)
3110 if(localpet==0)
then
3111 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
3112 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
3113 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
3114 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
3115 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
3116 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
3117 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
3118 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
3119 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
3120 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
3121 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
3124 call esmf_fieldscatter(soilm_liq_input_grid, tmp3d, rootpet=0, rc=rc)
3125 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3128 elseif (lsoil_input /= lsoil_target)
then
3131 write(msg,
'("NUMBER OF SOIL LEVELS IN INPUT (",I2,") and OUPUT &
3132 (",I2,") MUST EITHER BE EQUAL OR 9 AND 4, RESPECTIVELY")') &
3133 lsoil_input, lsoil_target
3152 integer :: clb(2), cub(2), i, j, rc
3153 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3156 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3157 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3159 data z0_igbp /1.089, 2.653, 0.854, 0.826, 0.800, 0.050, &
3160 0.030, 0.856, 0.856, 0.150, 0.040, 0.130, &
3161 1.000, 0.250, 0.011, 0.011, 0.001, 0.076, &
3164 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3165 call esmf_fieldget(landmask_target_grid, &
3166 computationallbound=clb, &
3167 computationalubound=cub, &
3168 farrayptr=landmask_ptr, rc=rc)
3169 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3172 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
3173 call esmf_fieldget(veg_type_target_grid, &
3174 farrayptr=veg_type_ptr, rc=rc)
3175 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3178 print*,
"- CALL FieldGet FOR TARGET GRID Z0."
3179 call esmf_fieldget(z0_target_grid, &
3180 farrayptr=data_ptr, rc=rc)
3181 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3184 do j = clb(2), cub(2)
3185 do i = clb(1), cub(1)
3186 if (landmask_ptr(i,j) == 2)
then
3188 elseif (landmask_ptr(i,j) == 1)
then
3189 data_ptr(i,j) = z0_igbp(nint(veg_type_ptr(i,j))) * 100.0
3204 alvwf_target_grid, &
3205 alnsf_target_grid, &
3206 alnwf_target_grid, &
3207 facsf_target_grid, &
3208 facwf_target_grid, &
3209 mxsno_albedo_target_grid, &
3210 max_veg_greenness_target_grid, &
3211 min_veg_greenness_target_grid, &
3212 slope_type_target_grid, &
3213 soil_type_target_grid, &
3214 substrate_temp_target_grid, &
3215 veg_greenness_target_grid, &
3216 veg_type_target_grid
3220 integer :: clb(2), cub(2), i, j, rc
3221 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
3223 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3224 real(esmf_kind_r8),
pointer :: data3d_ptr(:,:,:)
3225 real(esmf_kind_r8),
pointer :: soilmt_ptr(:,:,:)
3226 real(esmf_kind_r8),
pointer :: soilml_ptr(:,:,:)
3227 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
3228 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
3229 real(esmf_kind_r8),
pointer :: seaice_skint_ptr(:,:)
3230 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
3231 real(esmf_kind_r8),
pointer :: fice_ptr(:,:)
3232 real(esmf_kind_r8),
pointer :: hice_ptr(:,:)
3234 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
3235 call esmf_fieldget(landmask_target_grid, &
3236 computationallbound=clb, &
3237 computationalubound=cub, &
3238 farrayptr=landmask_ptr, rc=rc)
3239 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3242 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE."
3243 call esmf_fieldget(slope_type_target_grid, &
3244 farrayptr=data_ptr, rc=rc)
3245 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3248 do j = clb(2), cub(2)
3249 do i = clb(1), cub(1)
3250 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3254 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SOIL TYPE."
3255 call esmf_fieldget(soil_type_target_grid, &
3256 farrayptr=data_ptr, rc=rc)
3257 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3260 do j = clb(2), cub(2)
3261 do i = clb(1), cub(1)
3262 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3266 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION TYPE."
3267 call esmf_fieldget(veg_type_target_grid, &
3268 farrayptr=veg_type_ptr, rc=rc)
3269 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3272 do j = clb(2), cub(2)
3273 do i = clb(1), cub(1)
3274 if (landmask_ptr(i,j) /= 1) veg_type_ptr(i,j) = 0.0
3278 print*,
"- SET TARGET GRID ALVSF AT NON-LAND."
3279 call esmf_fieldget(alvsf_target_grid, &
3280 farrayptr=data_ptr, rc=rc)
3281 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3284 do j = clb(2), cub(2)
3285 do i = clb(1), cub(1)
3286 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3290 print*,
"- SET TARGET GRID ALVWF AT NON-LAND."
3291 call esmf_fieldget(alvwf_target_grid, &
3292 farrayptr=data_ptr, rc=rc)
3293 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3296 do j = clb(2), cub(2)
3297 do i = clb(1), cub(1)
3298 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3302 print*,
"- SET TARGET GRID ALNSF AT NON-LAND."
3303 call esmf_fieldget(alnsf_target_grid, &
3304 farrayptr=data_ptr, rc=rc)
3305 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3308 do j = clb(2), cub(2)
3309 do i = clb(1), cub(1)
3310 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3314 print*,
"- SET TARGET GRID ALNWF AT NON-LAND."
3315 call esmf_fieldget(alnwf_target_grid, &
3316 farrayptr=data_ptr, rc=rc)
3317 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3320 do j = clb(2), cub(2)
3321 do i = clb(1), cub(1)
3322 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06
3326 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
3327 call esmf_fieldget(facsf_target_grid, &
3328 farrayptr=data_ptr, rc=rc)
3329 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3332 do j = clb(2), cub(2)
3333 do i = clb(1), cub(1)
3334 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3338 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
3339 call esmf_fieldget(facwf_target_grid, &
3340 farrayptr=data_ptr, rc=rc)
3341 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3344 do j = clb(2), cub(2)
3345 do i = clb(1), cub(1)
3346 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3350 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAXIMUM GREENNESS."
3351 call esmf_fieldget(max_veg_greenness_target_grid, &
3352 farrayptr=data_ptr, rc=rc)
3353 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3356 do j = clb(2), cub(2)
3357 do i = clb(1), cub(1)
3358 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3362 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MINIMUM GREENNESS."
3363 call esmf_fieldget(min_veg_greenness_target_grid, &
3364 farrayptr=data_ptr, rc=rc)
3365 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3368 do j = clb(2), cub(2)
3369 do i = clb(1), cub(1)
3370 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3374 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION GREENNESS."
3375 call esmf_fieldget(veg_greenness_target_grid, &
3376 farrayptr=veg_greenness_ptr, rc=rc)
3377 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3380 do j = clb(2), cub(2)
3381 do i = clb(1), cub(1)
3382 if (landmask_ptr(i,j) /= 1) veg_greenness_ptr(i,j) = 0.0
3386 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAX SNOW ALBEDO."
3387 call esmf_fieldget(mxsno_albedo_target_grid, &
3388 farrayptr=data_ptr, rc=rc)
3389 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3392 do j = clb(2), cub(2)
3393 do i = clb(1), cub(1)
3394 if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0
3398 print*,
"- ZERO OUT TARGET GRID CANOPY MOISTURE CONTENT WHERE NO PLANTS."
3399 call esmf_fieldget(canopy_mc_target_grid, &
3400 farrayptr=data_ptr, rc=rc)
3401 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3404 do j = clb(2), cub(2)
3405 do i = clb(1), cub(1)
3406 if (veg_greenness_ptr(i,j) <= 0.01) data_ptr(i,j) = 0.0
3410 print*,
"- CALL FieldGet FOR TARGET GRID ICE SKIN TEMP."
3411 call esmf_fieldget(seaice_skin_temp_target_grid, &
3412 farrayptr=seaice_skint_ptr, rc=rc)
3413 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3416 print*,
"- SET TARGET GRID SKIN TEMP AT ICE POINTS."
3417 call esmf_fieldget(skin_temp_target_grid, &
3418 farrayptr=skint_ptr, rc=rc)
3419 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3422 print*,
"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION."
3423 call esmf_fieldget(seaice_fract_target_grid, &
3424 farrayptr=fice_ptr, rc=rc)
3425 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3428 print*,
"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS."
3429 call esmf_fieldget(seaice_depth_target_grid, &
3430 farrayptr=hice_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 (fice_ptr(i,j) > 0.0)
then
3437 skint_ptr(i,j) = (fice_ptr(i,j) * seaice_skint_ptr(i,j)) + &
3438 ( (1.0 - fice_ptr(i,j)) * frz_ice )
3440 seaice_skint_ptr(i,j) = skint_ptr(i,j)
3446 print*,
"- SET TARGET GRID SUBSTRATE TEMP AT ICE."
3447 call esmf_fieldget(substrate_temp_target_grid, &
3448 farrayptr=data_ptr, rc=rc)
3449 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3452 do j = clb(2), cub(2)
3453 do i = clb(1), cub(1)
3454 if (landmask_ptr(i,j) == 2)
then
3455 data_ptr(i,j) = frz_ice
3456 elseif (landmask_ptr(i,j) == 0)
then
3457 data_ptr(i,j) = skint_ptr(i,j)
3462 print*,
"- ZERO OUT TARGET GRID SNOW DEPTH AT OPEN WATER."
3463 call esmf_fieldget(snow_depth_target_grid, &
3464 farrayptr=data_ptr, rc=rc)
3465 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3468 do j = clb(2), cub(2)
3469 do i = clb(1), cub(1)
3470 if (landmask_ptr(i,j) == 0)
then
3476 print*,
"- ZERO OUT TARGET GRID SNOW LIQ AT OPEN WATER."
3477 call esmf_fieldget(snow_liq_equiv_target_grid, &
3478 farrayptr=data_ptr, rc=rc)
3479 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3482 do j = clb(2), cub(2)
3483 do i = clb(1), cub(1)
3484 if (landmask_ptr(i,j) == 0)
then
3490 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID TOTAL SOIL MOISTURE."
3491 call esmf_fieldget(soilm_tot_target_grid, &
3492 farrayptr=soilmt_ptr, rc=rc)
3493 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3496 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE."
3497 call esmf_fieldget(soilm_liq_target_grid, &
3498 farrayptr=soilml_ptr, rc=rc)
3499 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3502 do j = clb(2), cub(2)
3503 do i = clb(1), cub(1)
3504 if (landmask_ptr(i,j) == 2 .or. landmask_ptr(i,j) == 0 .or. &
3505 nint(veg_type_ptr(i,j)) == veg_type_landice_target)
then
3506 soilmt_ptr(i,j,:) = 1.0
3507 soilml_ptr(i,j,:) = 1.0
3512 print*,
"- SET OPEN WATER FLAG FOR TARGET GRID SOIL TEMPERATURE."
3513 call esmf_fieldget(soil_temp_target_grid, &
3514 farrayptr=data3d_ptr, rc=rc)
3515 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3518 do j = clb(2), cub(2)
3519 do i = clb(1), cub(1)
3520 if (landmask_ptr(i,j) == 0)
then
3521 data3d_ptr(i,j,:) = skint_ptr(i,j)
3540 integer(esmf_kind_i8),
pointer :: mask_ptr(:,:)
3542 integer,
PARAMETER :: num_nst_fields_minus2 = 16
3543 integer,
PARAMETER :: xz_fill = 30.0
3544 integer,
PARAMETER :: nst_fill = 0.0
3546 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
3547 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
3549 type(esmf_field
) :: temp_field
3550 type(esmf_fieldbundle
) :: nst_bundle
3552 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
3553 call esmf_fieldget(landmask_target_grid, &
3554 farrayptr=mask_ptr, rc=rc)
3555 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3558 nst_bundle = esmf_fieldbundlecreate(name=
"nst_bundle", rc=rc)
3559 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3562 call esmf_fieldbundleadd(nst_bundle, (/c_d_target_grid,c_0_target_grid,d_conv_target_grid, &
3563 dt_cool_target_grid,ifd_target_grid,qrain_target_grid,&
3564 w_d_target_grid,w_0_target_grid,xs_target_grid,xt_target_grid,&
3565 xu_target_grid,xv_target_grid,xtts_target_grid,xzts_target_grid, &
3566 z_c_target_grid, zm_target_grid/), rc=rc)
3567 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3570 print*,
"- CALL FieldGet FOR TREF."
3571 call esmf_fieldget(tref_target_grid, &
3572 farrayptr=data_ptr, rc=rc)
3573 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3576 print*,
"- CALL FieldGet FOR SKIN T."
3577 call esmf_fieldget(skin_temp_target_grid, &
3578 farrayptr=skint_ptr, rc=rc)
3579 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3582 where(mask_ptr /= 0) data_ptr = skint_ptr
3586 print*,
"- CALL FieldGet FOR XZ."
3587 call esmf_fieldget(xz_target_grid, &
3588 farrayptr=data_ptr, rc=rc)
3589 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3592 where(mask_ptr /= 0) data_ptr = xz_fill
3594 do i = 1,num_nst_fields_minus2
3596 call esmf_fieldbundleget(nst_bundle,i,temp_field,rc=rc)
3597 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3600 call esmf_fieldget(temp_field,farrayptr=data_ptr,rc=rc)
3601 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3604 where(mask_ptr /= 0) data_ptr = nst_fill
3608 call esmf_fieldbundledestroy(nst_bundle,rc=rc)
3609 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3619 use model_grid, only : target_grid, lsoil_target
3625 real(esmf_kind_r8),
pointer :: target_ptr(:,:), target_ptr_3d(:,:,:)
3626 real :: init_val = -999.9
3628 print*,
"- CALL FieldCreate FOR TARGET GRID T2M."
3629 t2m_target_grid = esmf_fieldcreate(target_grid, &
3630 typekind=esmf_typekind_r8, &
3631 staggerloc=esmf_staggerloc_center, rc=rc)
3632 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3635 print*,
"- INITIALIZE TARGET grid t2m."
3636 call esmf_fieldget(t2m_target_grid, &
3637 farrayptr=target_ptr, rc=rc)
3638 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3641 target_ptr = init_val
3643 print*,
"- CALL FieldCreate FOR TARGET GRID Q2M."
3644 q2m_target_grid = esmf_fieldcreate(target_grid, &
3645 typekind=esmf_typekind_r8, &
3646 staggerloc=esmf_staggerloc_center, rc=rc)
3647 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3650 print*,
"- INITIALIZE TARGET grid q2m."
3651 call esmf_fieldget(q2m_target_grid, &
3652 farrayptr=target_ptr, rc=rc)
3653 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3656 target_ptr = init_val
3658 print*,
"- CALL FieldCreate FOR TARGET GRID TPRCP."
3659 tprcp_target_grid = esmf_fieldcreate(target_grid, &
3660 typekind=esmf_typekind_r8, &
3661 staggerloc=esmf_staggerloc_center, rc=rc)
3662 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3665 print*,
"- INITIALIZE TARGET grid tprcp."
3666 call esmf_fieldget(tprcp_target_grid, &
3667 farrayptr=target_ptr, rc=rc)
3668 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3671 target_ptr = init_val
3673 print*,
"- CALL FieldCreate FOR TARGET GRID F10M."
3674 f10m_target_grid = esmf_fieldcreate(target_grid, &
3675 typekind=esmf_typekind_r8, &
3676 staggerloc=esmf_staggerloc_center, rc=rc)
3677 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3680 print*,
"- INITIALIZE TARGET grid f10m."
3681 call esmf_fieldget(f10m_target_grid, &
3682 farrayptr=target_ptr, rc=rc)
3683 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3686 target_ptr = init_val
3688 print*,
"- CALL FieldCreate FOR TARGET GRID FFMM."
3689 ffmm_target_grid = esmf_fieldcreate(target_grid, &
3690 typekind=esmf_typekind_r8, &
3691 staggerloc=esmf_staggerloc_center, rc=rc)
3692 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3695 print*,
"- INITIALIZE TARGET grid ffmm."
3696 call esmf_fieldget(ffmm_target_grid, &
3697 farrayptr=target_ptr, rc=rc)
3698 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3701 target_ptr = init_val
3703 print*,
"- CALL FieldCreate FOR TARGET GRID USTAR."
3704 ustar_target_grid = esmf_fieldcreate(target_grid, &
3705 typekind=esmf_typekind_r8, &
3706 staggerloc=esmf_staggerloc_center, rc=rc)
3707 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3710 print*,
"- INITIALIZE TARGET grid ustar."
3711 call esmf_fieldget(ustar_target_grid, &
3712 farrayptr=target_ptr, rc=rc)
3713 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3716 target_ptr = init_val
3718 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV."
3719 snow_liq_equiv_target_grid = esmf_fieldcreate(target_grid, &
3720 typekind=esmf_typekind_r8, &
3721 staggerloc=esmf_staggerloc_center, rc=rc)
3722 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3725 print*,
"- INITIALIZE TARGET grid snow liq equiv."
3726 call esmf_fieldget(snow_liq_equiv_target_grid, &
3727 farrayptr=target_ptr, rc=rc)
3728 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3731 target_ptr = init_val
3733 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH."
3734 snow_depth_target_grid = esmf_fieldcreate(target_grid, &
3735 typekind=esmf_typekind_r8, &
3736 staggerloc=esmf_staggerloc_center, rc=rc)
3737 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3740 print*,
"- INITIALIZE TARGET grid snow depth."
3741 call esmf_fieldget(snow_depth_target_grid, &
3742 farrayptr=target_ptr, rc=rc)
3743 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3746 target_ptr = init_val
3748 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE FRACTION."
3749 seaice_fract_target_grid = esmf_fieldcreate(target_grid, &
3750 typekind=esmf_typekind_r8, &
3751 staggerloc=esmf_staggerloc_center, rc=rc)
3752 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3755 print*,
"- INITIALIZE TARGET grid sea ice fraction."
3756 call esmf_fieldget(seaice_fract_target_grid, &
3757 farrayptr=target_ptr, rc=rc)
3758 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3761 target_ptr = init_val
3763 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE DEPTH."
3764 seaice_depth_target_grid = esmf_fieldcreate(target_grid, &
3765 typekind=esmf_typekind_r8, &
3766 staggerloc=esmf_staggerloc_center, rc=rc)
3767 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3770 print*,
"- INITIALIZE TARGET sea ice depth."
3771 call esmf_fieldget(seaice_depth_target_grid, &
3772 farrayptr=target_ptr, rc=rc)
3773 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3776 target_ptr = init_val
3778 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE SKIN TEMP."
3779 seaice_skin_temp_target_grid = esmf_fieldcreate(target_grid, &
3780 typekind=esmf_typekind_r8, &
3781 staggerloc=esmf_staggerloc_center, rc=rc)
3782 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3785 print*,
"- INITIALIZE TARGET sea ice skin temp."
3786 call esmf_fieldget(seaice_skin_temp_target_grid, &
3787 farrayptr=target_ptr, rc=rc)
3788 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3791 target_ptr = init_val
3793 print*,
"- CALL FieldCreate FOR TARGET GRID SRFLAG."
3794 srflag_target_grid = esmf_fieldcreate(target_grid, &
3795 typekind=esmf_typekind_r8, &
3796 staggerloc=esmf_staggerloc_center, rc=rc)
3797 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3800 print*,
"- INITIALIZE TARGET srflag."
3801 call esmf_fieldget(srflag_target_grid, &
3802 farrayptr=target_ptr, rc=rc)
3803 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3806 target_ptr = init_val
3808 print*,
"- CALL FieldCreate FOR TARGET GRID SKIN TEMPERATURE."
3809 skin_temp_target_grid = esmf_fieldcreate(target_grid, &
3810 typekind=esmf_typekind_r8, &
3811 staggerloc=esmf_staggerloc_center, rc=rc)
3812 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3815 print*,
"- INITIALIZE TARGET grid skin temp."
3816 call esmf_fieldget(skin_temp_target_grid, &
3817 farrayptr=target_ptr, rc=rc)
3818 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3821 target_ptr = init_val
3823 print*,
"- CALL FieldCreate FOR TARGET GRID CANOPY MOISTURE CONTENT."
3824 canopy_mc_target_grid = esmf_fieldcreate(target_grid, &
3825 typekind=esmf_typekind_r8, &
3826 staggerloc=esmf_staggerloc_center, rc=rc)
3827 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3830 print*,
"- INITIALIZE TARGET grid canopy moisture."
3831 call esmf_fieldget(canopy_mc_target_grid, &
3832 farrayptr=target_ptr, rc=rc)
3833 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3836 target_ptr = init_val
3838 print*,
"- CALL FieldCreate FOR TARGET GRID LEAF AREA INDEX."
3839 lai_target_grid = esmf_fieldcreate(target_grid, &
3840 typekind=esmf_typekind_r8, &
3841 staggerloc=esmf_staggerloc_center, rc=rc)
3842 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3845 print*,
"- INITIALIZE TARGET leaf area index."
3846 call esmf_fieldget(lai_target_grid, &
3847 farrayptr=target_ptr, rc=rc)
3848 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3851 target_ptr = init_val
3853 print*,
"- CALL FieldCreate FOR TARGET GRID Z0."
3854 z0_target_grid = esmf_fieldcreate(target_grid, &
3855 typekind=esmf_typekind_r8, &
3856 staggerloc=esmf_staggerloc_center, rc=rc)
3857 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3860 print*,
"- INITIALIZE TARGET grid z0."
3861 call esmf_fieldget(z0_target_grid, &
3862 farrayptr=target_ptr, rc=rc)
3863 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3866 target_ptr = init_val
3868 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID TERRAIN."
3869 terrain_from_input_grid = esmf_fieldcreate(target_grid, &
3870 typekind=esmf_typekind_r8, &
3871 staggerloc=esmf_staggerloc_center, rc=rc)
3872 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3875 print*,
"- INITIALIZE TARGET grid interpolated terrain."
3876 call esmf_fieldget(terrain_from_input_grid, &
3877 farrayptr=target_ptr, rc=rc)
3878 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3881 target_ptr = init_val
3883 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID SOIL TYPE."
3884 soil_type_from_input_grid = esmf_fieldcreate(target_grid, &
3885 typekind=esmf_typekind_r8, &
3886 staggerloc=esmf_staggerloc_center, rc=rc)
3887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3890 print*,
"- INITIALIZE TARGET grid soil type"
3891 call esmf_fieldget(soil_type_from_input_grid, &
3892 farrayptr=target_ptr, rc=rc)
3893 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3896 target_ptr = init_val
3898 print*,
"- CALL FieldCreate FOR TARGET GRID SOIL TEMPERATURE."
3899 soil_temp_target_grid = esmf_fieldcreate(target_grid, &
3900 typekind=esmf_typekind_r8, &
3901 staggerloc=esmf_staggerloc_center, &
3902 ungriddedlbound=(/1/), &
3903 ungriddedubound=(/lsoil_target/), rc=rc)
3904 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3907 print*,
"- INITIALIZE TARGET grid soil temp"
3908 call esmf_fieldget(soil_temp_target_grid, &
3909 farrayptr=target_ptr_3d, rc=rc)
3910 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3913 target_ptr_3d = init_val
3915 print*,
"- CALL FieldCreate FOR TARGET GRID TOTAL SOIL MOISTURE."
3916 soilm_tot_target_grid = esmf_fieldcreate(target_grid, &
3917 typekind=esmf_typekind_r8, &
3918 staggerloc=esmf_staggerloc_center, &
3919 ungriddedlbound=(/1/), &
3920 ungriddedubound=(/lsoil_target/), rc=rc)
3921 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3924 print*,
"- INITIALIZE TARGET grid soil moist"
3925 call esmf_fieldget(soilm_tot_target_grid, &
3926 farrayptr=target_ptr_3d, rc=rc)
3927 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3930 target_ptr_3d = init_val
3932 print*,
"- CALL FieldCreate FOR TARGET GRID LIQUID SOIL MOISTURE."
3933 soilm_liq_target_grid = esmf_fieldcreate(target_grid, &
3934 typekind=esmf_typekind_r8, &
3935 staggerloc=esmf_staggerloc_center, &
3936 ungriddedlbound=(/1/), &
3937 ungriddedubound=(/lsoil_target/), rc=rc)
3938 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3941 print*,
"- INITIALIZE TARGET grid soil liq"
3942 call esmf_fieldget(soilm_liq_target_grid, &
3943 farrayptr=target_ptr_3d, rc=rc)
3944 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3947 target_ptr_3d = init_val
3962 print*,
"- CALL FieldCreate FOR TARGET GRID C_D."
3963 c_d_target_grid = esmf_fieldcreate(target_grid, &
3964 typekind=esmf_typekind_r8, &
3966 staggerloc=esmf_staggerloc_center, rc=rc)
3967 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3970 print*,
"- CALL FieldCreate FOR TARGET GRID C_0."
3971 c_0_target_grid = esmf_fieldcreate(target_grid, &
3972 typekind=esmf_typekind_r8, &
3974 staggerloc=esmf_staggerloc_center, rc=rc)
3975 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3978 print*,
"- CALL FieldCreate FOR TARGET GRID D_CONV."
3979 d_conv_target_grid = esmf_fieldcreate(target_grid, &
3980 typekind=esmf_typekind_r8, &
3982 staggerloc=esmf_staggerloc_center, rc=rc)
3983 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3986 print*,
"- CALL FieldCreate FOR TARGET GRID DT_COOL."
3987 dt_cool_target_grid = esmf_fieldcreate(target_grid, &
3988 typekind=esmf_typekind_r8, &
3990 staggerloc=esmf_staggerloc_center, rc=rc)
3991 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3994 print*,
"- CALL FieldCreate FOR TARGET GRID IFD."
3995 ifd_target_grid = esmf_fieldcreate(target_grid, &
3996 typekind=esmf_typekind_r8, &
3998 staggerloc=esmf_staggerloc_center, rc=rc)
3999 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4002 print*,
"- CALL FieldCreate FOR TARGET GRID QRAIN."
4003 qrain_target_grid = esmf_fieldcreate(target_grid, &
4004 typekind=esmf_typekind_r8, &
4006 staggerloc=esmf_staggerloc_center, rc=rc)
4007 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4010 print*,
"- CALL FieldCreate FOR TARGET GRID TREF."
4011 tref_target_grid = esmf_fieldcreate(target_grid, &
4012 typekind=esmf_typekind_r8, &
4014 staggerloc=esmf_staggerloc_center, rc=rc)
4015 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4018 print*,
"- CALL FieldCreate FOR TARGET GRID W_D."
4019 w_d_target_grid = esmf_fieldcreate(target_grid, &
4020 typekind=esmf_typekind_r8, &
4022 staggerloc=esmf_staggerloc_center, rc=rc)
4023 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4026 print*,
"- CALL FieldCreate FOR TARGET GRID W_0."
4027 w_0_target_grid = esmf_fieldcreate(target_grid, &
4028 typekind=esmf_typekind_r8, &
4030 staggerloc=esmf_staggerloc_center, rc=rc)
4031 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4034 print*,
"- CALL FieldCreate FOR TARGET GRID XS."
4035 xs_target_grid = esmf_fieldcreate(target_grid, &
4036 typekind=esmf_typekind_r8, &
4038 staggerloc=esmf_staggerloc_center, rc=rc)
4039 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4042 print*,
"- CALL FieldCreate FOR TARGET GRID XT."
4043 xt_target_grid = esmf_fieldcreate(target_grid, &
4044 typekind=esmf_typekind_r8, &
4046 staggerloc=esmf_staggerloc_center, rc=rc)
4047 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4050 print*,
"- CALL FieldCreate FOR TARGET GRID XU."
4051 xu_target_grid = esmf_fieldcreate(target_grid, &
4052 typekind=esmf_typekind_r8, &
4054 staggerloc=esmf_staggerloc_center, rc=rc)
4055 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4058 print*,
"- CALL FieldCreate FOR TARGET GRID XV."
4059 xv_target_grid = esmf_fieldcreate(target_grid, &
4060 typekind=esmf_typekind_r8, &
4062 staggerloc=esmf_staggerloc_center, rc=rc)
4063 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4066 print*,
"- CALL FieldCreate FOR TARGET GRID XZ."
4067 xz_target_grid = esmf_fieldcreate(target_grid, &
4068 typekind=esmf_typekind_r8, &
4070 staggerloc=esmf_staggerloc_center, rc=rc)
4071 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4074 print*,
"- CALL FieldCreate FOR TARGET GRID XTTS."
4075 xtts_target_grid = esmf_fieldcreate(target_grid, &
4076 typekind=esmf_typekind_r8, &
4078 staggerloc=esmf_staggerloc_center, rc=rc)
4079 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4082 print*,
"- CALL FieldCreate FOR TARGET GRID XZTS."
4083 xzts_target_grid = esmf_fieldcreate(target_grid, &
4084 typekind=esmf_typekind_r8, &
4086 staggerloc=esmf_staggerloc_center, rc=rc)
4087 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4090 print*,
"- CALL FieldCreate FOR TARGET GRID Z_C."
4091 z_c_target_grid = esmf_fieldcreate(target_grid, &
4092 typekind=esmf_typekind_r8, &
4094 staggerloc=esmf_staggerloc_center, rc=rc)
4095 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4098 print*,
"- CALL FieldCreate FOR TARGET GRID ZM."
4099 zm_target_grid = esmf_fieldcreate(target_grid, &
4100 typekind=esmf_typekind_r8, &
4102 staggerloc=esmf_staggerloc_center, rc=rc)
4103 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
4120 integer(esmf_kind_i4),
intent(in) :: ij
4121 integer ,
intent(in) :: itile, jtile
4123 integer ,
intent(out) :: i, j
4126 integer :: pt_loc_this_tile
4128 tile_num = ((ij-1) / (itile*jtile))
4129 pt_loc_this_tile = ij - (tile_num * itile * jtile)
4132 j = (pt_loc_this_tile - 1) / itile + 1
4133 i = mod(pt_loc_this_tile, itile)
4151 print*,
"- DESTROY TARGET GRID SURFACE FIELDS."
4153 call esmf_fielddestroy(t2m_target_grid, rc=rc)
4154 call esmf_fielddestroy(q2m_target_grid, rc=rc)
4155 call esmf_fielddestroy(tprcp_target_grid, rc=rc)
4156 call esmf_fielddestroy(f10m_target_grid, rc=rc)
4157 call esmf_fielddestroy(ffmm_target_grid, rc=rc)
4158 call esmf_fielddestroy(ustar_target_grid, rc=rc)
4159 call esmf_fielddestroy(snow_liq_equiv_target_grid, rc=rc)
4160 call esmf_fielddestroy(snow_depth_target_grid, rc=rc)
4161 call esmf_fielddestroy(seaice_fract_target_grid, rc=rc)
4162 call esmf_fielddestroy(seaice_depth_target_grid, rc=rc)
4163 call esmf_fielddestroy(seaice_skin_temp_target_grid, rc=rc)
4164 call esmf_fielddestroy(srflag_target_grid, rc=rc)
4165 call esmf_fielddestroy(skin_temp_target_grid, rc=rc)
4166 call esmf_fielddestroy(canopy_mc_target_grid, rc=rc)
4167 call esmf_fielddestroy(z0_target_grid, rc=rc)
4168 call esmf_fielddestroy(terrain_from_input_grid, rc=rc)
4169 call esmf_fielddestroy(terrain_from_input_grid_land, rc=rc)
4170 call esmf_fielddestroy(soil_type_from_input_grid, rc=rc)
4171 call esmf_fielddestroy(soil_temp_target_grid, rc=rc)
4172 call esmf_fielddestroy(soilm_tot_target_grid, rc=rc)
4173 call esmf_fielddestroy(soilm_liq_target_grid, rc=rc)
4187 print*,
"- DESTROY TARGET GRID NST DATA."
4189 call esmf_fielddestroy(c_d_target_grid, rc=rc)
4190 call esmf_fielddestroy(c_0_target_grid, rc=rc)
4191 call esmf_fielddestroy(d_conv_target_grid, rc=rc)
4192 call esmf_fielddestroy(dt_cool_target_grid, rc=rc)
4193 call esmf_fielddestroy(ifd_target_grid, rc=rc)
4194 call esmf_fielddestroy(qrain_target_grid, rc=rc)
4195 call esmf_fielddestroy(tref_target_grid, rc=rc)
4196 call esmf_fielddestroy(w_d_target_grid, rc=rc)
4197 call esmf_fielddestroy(w_0_target_grid, rc=rc)
4198 call esmf_fielddestroy(xs_target_grid, rc=rc)
4199 call esmf_fielddestroy(xt_target_grid, rc=rc)
4200 call esmf_fielddestroy(xu_target_grid, rc=rc)
4201 call esmf_fielddestroy(xv_target_grid, rc=rc)
4202 call esmf_fielddestroy(xz_target_grid, rc=rc)
4203 call esmf_fielddestroy(xtts_target_grid, rc=rc)
4204 call esmf_fielddestroy(xzts_target_grid, rc=rc)
4205 call esmf_fielddestroy(z_c_target_grid, rc=rc)
4206 call esmf_fielddestroy(zm_target_grid, rc=rc)
subroutine, public calc_soil_params_driver(localpet)
Driver routine to compute soil parameters for each soil type.
subroutine qc_check
Perform some quality control checks before output.
subroutine write_fv3_sfc_data_netcdf(localpet)
Writes surface and nst data into a 'coldstart' file (netcdf).
subroutine, public get_static_fields(localpet)
Driver routine to read/time interpolate static/climo fields on the fv3 target grid.
subroutine create_surface_esmf_fields
Create ESMF fields for the target grid surface variables.
Process surface and nst fields.
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 interp(localpet)
Horizontally interpolate surface fields from input to target FV3 grid using esmf routines.
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 cleanup_target_sfc_data
Free up memory once the target grid surface fields are no longer needed.
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 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.