26 q2m_target_grid, tprcp_target_grid, &
27 f10m_target_grid, seaice_fract_target_grid, &
28 ffmm_target_grid, ustar_target_grid, &
29 srflag_target_grid, soil_temp_target_grid, &
30 seaice_depth_target_grid, snow_liq_equiv_target_grid, &
31 seaice_skin_temp_target_grid, skin_temp_target_grid, &
32 snow_depth_target_grid, &
33 c_d_target_grid, c_0_target_grid, &
34 d_conv_target_grid, dt_cool_target_grid, &
35 ifd_target_grid, qrain_target_grid, &
36 tref_target_grid, w_d_target_grid, &
37 w_0_target_grid, xs_target_grid, &
38 xt_target_grid, xu_target_grid, &
39 xv_target_grid, xz_target_grid, &
40 xtts_target_grid, xzts_target_grid, &
41 z_c_target_grid, zm_target_grid, &
42 soilm_tot_target_grid, lai_target_grid, &
43 soilm_liq_target_grid, ice_temp_target_grid, &
44 snow_depth_at_ice_target_grid, &
45 z0_water_target_grid, &
46 z0_ice_target_grid, sst_target_grid, &
47 snow_liq_equiv_at_ice_target_grid
57 integer,
parameter :: veg_type_landice_target = 15
63 type(esmf_field
) :: soil_type_from_input_grid
66 type(esmf_field
) :: terrain_from_input_grid
69 type(esmf_field
) :: terrain_from_input_grid_land
73 real,
parameter,
private :: blim = 5.5
75 real,
parameter,
private :: frz_h2o = 273.15
77 real,
parameter,
private :: frz_ice = 271.21
79 real,
parameter,
private :: grav = 9.81
81 real,
parameter,
private :: hlice = 3.335E5
84 real(esmf_kind_r8),
parameter,
private :: missing = -1.e20_esmf_kind_r8
89 real(esmf_kind_r8),
pointer :: p(:,:)
94 real(esmf_kind_r8),
pointer :: p(:,:,:)
134 integer,
intent(in) :: localpet
269 landsea_mask_input_grid, &
271 seaice_depth_input_grid, &
272 seaice_fract_input_grid, &
273 seaice_skin_temp_input_grid, &
274 skin_temp_input_grid, &
275 snow_depth_input_grid, &
276 snow_liq_equiv_input_grid, &
277 soil_temp_input_grid, &
278 soil_type_input_grid, &
279 soilm_tot_input_grid, &
284 veg_type_input_grid, &
286 veg_type_landice_input, &
287 veg_greenness_input_grid, &
288 max_veg_greenness_input_grid, &
289 min_veg_greenness_input_grid, &
295 dt_cool_input_grid, &
313 use model_grid, only : input_grid, target_grid, &
314 i_target, j_target, &
316 num_tiles_target_grid, &
317 landmask_target_grid, &
318 seamask_target_grid, &
325 minmax_vgfrc_from_climo, &
330 soil_type_target_grid, &
331 veg_greenness_target_grid, &
332 substrate_temp_target_grid,&
333 min_veg_greenness_target_grid,&
334 max_veg_greenness_target_grid
340 integer,
intent(in) :: localpet
342 integer :: l(1), u(1)
343 integer :: i, j, ij, rc, tile
344 integer :: clb_target(2), cub_target(2)
345 integer :: isrctermprocessing
346 integer :: num_fields
347 integer :: vgfrc_ind, mmvg_ind, lai_ind
348 integer,
allocatable :: search_nums(:)
349 integer(esmf_kind_i4),
pointer :: unmapped_ptr(:)
350 integer(esmf_kind_i4),
pointer :: mask_input_ptr(:,:)
351 integer(esmf_kind_i4),
pointer :: mask_target_ptr(:,:)
352 integer(esmf_kind_i8),
pointer :: landmask_target_ptr(:,:)
353 integer(esmf_kind_i8),
allocatable :: mask_target_one_tile(:,:)
354 integer(esmf_kind_i8),
allocatable :: water_target_one_tile(:,:)
355 integer(esmf_kind_i8),
allocatable :: land_target_one_tile(:,:)
356 integer(esmf_kind_i8),
pointer :: seamask_target_ptr(:,:)
358 real(esmf_kind_r8),
allocatable :: data_one_tile(:,:)
359 real(esmf_kind_r8),
allocatable :: data_one_tile2(:,:)
360 real(esmf_kind_r8),
allocatable :: data_one_tile_3d(:,:,:)
361 real(esmf_kind_r8),
allocatable :: latitude_one_tile(:,:)
362 real(esmf_kind_r8),
allocatable :: fice_target_one_tile(:,:)
363 real(esmf_kind_r8),
pointer :: seaice_fract_target_ptr(:,:)
364 real(esmf_kind_r8),
pointer :: srflag_target_ptr(:,:)
365 real(esmf_kind_r8),
pointer :: terrain_from_input_ptr(:,:)
366 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
367 real(esmf_kind_r8),
pointer :: soil_type_target_ptr(:,:)
368 real(esmf_kind_r8),
pointer :: landmask_input_ptr(:,:)
369 real(esmf_kind_r8),
pointer :: veg_type_input_ptr(:,:)
370 real(esmf_kind_r8),
allocatable :: veg_type_target_one_tile(:,:)
371 real(esmf_kind_r8) :: ice_lim
373 type(esmf_regridmethod_flag
) :: method
374 type(esmf_routehandle
) :: regrid_bl_no_mask
375 type(esmf_routehandle
) :: regrid_all_land
376 type(esmf_routehandle
) :: regrid_land
377 type(esmf_routehandle
) :: regrid_landice
378 type(esmf_routehandle
) :: regrid_nonland
379 type(esmf_routehandle
) :: regrid_seaice
380 type(esmf_routehandle
) :: regrid_water
382 type(esmf_fieldbundle
) :: bundle_all_target, bundle_all_input
383 type(esmf_fieldbundle
) :: bundle_seaice_target, bundle_seaice_input
384 type(esmf_fieldbundle
) :: bundle_water_target, bundle_water_input
385 type(esmf_fieldbundle
) :: bundle_allland_target, bundle_allland_input
386 type(esmf_fieldbundle
) :: bundle_landice_target, bundle_landice_input
387 type(esmf_fieldbundle
) :: bundle_nolandice_target, bundle_nolandice_input
389 logical,
allocatable :: dozero(:)
395 method=esmf_regridmethod_bilinear
397 isrctermprocessing = 1
399 print*,
"- CALL FieldRegridStore FOR NON-MASKED BILINEAR INTERPOLATION."
400 call esmf_fieldregridstore(t2m_input_grid, &
402 polemethod=esmf_polemethod_allavg, &
403 srctermprocessing=isrctermprocessing, &
404 routehandle=regrid_bl_no_mask, &
405 regridmethod=method, rc=rc)
406 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
409 bundle_all_target = esmf_fieldbundlecreate(name=
"all points target", rc=rc)
410 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
412 bundle_all_input = esmf_fieldbundlecreate(name=
"all points input", rc=rc)
413 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
416 call esmf_fieldbundleadd(bundle_all_target, (/t2m_target_grid,q2m_target_grid,tprcp_target_grid, &
417 f10m_target_grid,ffmm_target_grid,ustar_target_grid,srflag_target_grid/), &
419 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
421 call esmf_fieldbundleadd(bundle_all_input, (/t2m_input_grid,q2m_input_grid,tprcp_input_grid, &
422 f10m_input_grid,ffmm_input_grid,ustar_input_grid,srflag_input_grid/), &
424 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
427 call esmf_fieldbundleget(bundle_all_target,fieldcount=num_fields,rc=rc)
428 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
431 allocate(dozero(num_fields))
434 call
regrid_many(bundle_all_input,bundle_all_target,num_fields,regrid_bl_no_mask,dozero)
437 call esmf_fieldbundledestroy(bundle_all_target,rc=rc)
438 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
440 call esmf_fieldbundledestroy(bundle_all_input,rc=rc)
441 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
444 print*,
"- CALL FieldGet FOR SRFLAG."
445 call esmf_fieldget(srflag_target_grid, &
446 farrayptr=srflag_target_ptr, rc=rc)
447 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
455 srflag_target_ptr = nint(srflag_target_ptr)
457 print*,
"- CALL FieldRegridRelease."
458 call esmf_fieldregridrelease(routehandle=regrid_bl_no_mask, rc=rc)
459 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
466 print*,
"- CALL GridAddItem FOR TARGET GRID."
467 call esmf_gridadditem(target_grid, &
468 itemflag=esmf_griditem_mask, &
469 staggerloc=esmf_staggerloc_center, rc=rc)
470 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
473 print*,
"- CALL GridGetItem FOR TARGET GRID."
474 call esmf_gridgetitem(target_grid, &
475 itemflag=esmf_griditem_mask, &
476 farrayptr=mask_target_ptr, rc=rc)
477 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
480 print*,
"- CALL FieldGet FOR TARGET GRID SEAMASK."
481 call esmf_fieldget(seamask_target_grid, &
482 computationallbound=clb_target, &
483 computationalubound=cub_target, &
484 farrayptr=seamask_target_ptr, rc=rc)
485 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
488 print*,
"- CALL FieldGet FOR TARGET GRID LANDMASK."
489 call esmf_fieldget(landmask_target_grid, &
490 farrayptr=landmask_target_ptr, rc=rc)
491 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
494 print*,
"- CALL GridAddItem FOR INPUT GRID SEAMASK."
495 call esmf_gridadditem(input_grid, &
496 itemflag=esmf_griditem_mask, &
497 staggerloc=esmf_staggerloc_center, rc=rc)
498 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
501 print*,
"- CALL FieldGet FOR INPUT GRID LANDMASK."
502 call esmf_fieldget(landsea_mask_input_grid, &
503 farrayptr=landmask_input_ptr, rc=rc)
504 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
507 print*,
"- CALL GridGetItem FOR INPUT GRID LANDMASK."
508 call esmf_gridgetitem(input_grid, &
509 itemflag=esmf_griditem_mask, &
510 farrayptr=mask_input_ptr, rc=rc)
511 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
514 if (localpet == 0)
then
515 allocate(data_one_tile(i_target,j_target))
516 allocate(data_one_tile_3d(i_target,j_target,lsoil_target))
517 allocate(mask_target_one_tile(i_target,j_target))
519 allocate(data_one_tile(0,0))
520 allocate(data_one_tile_3d(0,0,0))
521 allocate(mask_target_one_tile(0,0))
529 method=esmf_regridmethod_nearest_stod
531 isrctermprocessing = 1
534 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
537 where (landmask_target_ptr == 1) mask_target_ptr = 1
539 print*,
"- CALL FieldCreate FOR TERRAIN FROM INPUT GRID LAND."
540 terrain_from_input_grid_land = esmf_fieldcreate(target_grid, &
541 typekind=esmf_typekind_r8, &
542 staggerloc=esmf_staggerloc_center, rc=rc)
543 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
546 print*,
"- CALL FieldRegridStore for land fields."
547 call esmf_fieldregridstore(terrain_input_grid, &
548 terrain_from_input_grid_land, &
549 srcmaskvalues=(/0/), &
550 dstmaskvalues=(/0/), &
551 polemethod=esmf_polemethod_none, &
552 srctermprocessing=isrctermprocessing, &
553 unmappedaction=esmf_unmappedaction_ignore, &
554 normtype=esmf_normtype_fracarea, &
555 routehandle=regrid_all_land, &
556 regridmethod=method, &
557 unmappeddstlist=unmapped_ptr, rc=rc)
558 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
561 print*,
"- CALL Field_Regrid TERRAIN."
562 call esmf_fieldregrid(terrain_input_grid, &
563 terrain_from_input_grid_land, &
564 routehandle=regrid_all_land, &
565 termorderflag=esmf_termorder_srcseq, rc=rc)
566 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
569 print*,
"- CALL FieldGet FOR terrain from input grid at land."
570 call esmf_fieldget(terrain_from_input_grid_land, &
571 farrayptr=terrain_from_input_ptr, rc=rc)
572 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
575 l = lbound(unmapped_ptr)
576 u = ubound(unmapped_ptr)
579 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
580 terrain_from_input_ptr(i,j) = -9999.9
582 nullify(terrain_from_input_ptr)
584 do tile = 1, num_tiles_target_grid
586 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
587 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
588 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
591 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID: ", tile
592 call esmf_fieldgather(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
593 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
596 if (localpet == 0)
then
597 allocate(land_target_one_tile(i_target,j_target))
598 land_target_one_tile = 0
599 where(mask_target_one_tile == 1) land_target_one_tile = 1
600 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7)
601 deallocate(land_target_one_tile)
604 print*,
"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID: ", tile
605 call esmf_fieldscatter(terrain_from_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
606 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
610 if(.not. vgtyp_from_climo)
then
612 print*,
"- CALL FieldRegrid VEG TYPE."
613 call esmf_fieldregrid(veg_type_input_grid, &
614 veg_type_target_grid, &
615 routehandle=regrid_all_land, &
616 termorderflag=esmf_termorder_srcseq, rc=rc)
617 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
620 print*,
"- CALL FieldGet FOR TARGET grid veg type."
621 call esmf_fieldget(veg_type_target_grid, &
622 farrayptr=veg_type_target_ptr, rc=rc)
623 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
626 l = lbound(unmapped_ptr)
627 u = ubound(unmapped_ptr)
630 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
631 veg_type_target_ptr(i,j) = -9999.9
634 do tile = 1, num_tiles_target_grid
635 print*,
"- CALL FieldGather FOR TARGET GRID VEG TYPE TILE: ", tile
636 call esmf_fieldgather(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
637 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
640 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
641 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
642 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
645 if (localpet == 0)
then
646 allocate(land_target_one_tile(i_target,j_target))
647 land_target_one_tile = 0
648 where(mask_target_one_tile == 1) land_target_one_tile = 1
649 call
search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 225)
650 deallocate(land_target_one_tile)
653 print*,
"- CALL FieldScatter FOR TARGET GRID VEG TYPE: ", tile
654 call esmf_fieldscatter(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
655 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
658 nullify(veg_type_target_ptr)
661 print*,
"- CALL FieldRegridRelease."
662 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
663 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
674 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0
681 mask_target_ptr = int(seamask_target_ptr,kind=esmf_kind_i4)
683 method=esmf_regridmethod_conserve
685 isrctermprocessing = 1
687 print*,
"- CALL FieldRegridStore for sea ice fraction."
688 call esmf_fieldregridstore(seaice_fract_input_grid, &
689 seaice_fract_target_grid, &
690 srcmaskvalues=(/0/), &
691 dstmaskvalues=(/0/), &
692 polemethod=esmf_polemethod_none, &
693 srctermprocessing=isrctermprocessing, &
694 unmappedaction=esmf_unmappedaction_ignore, &
695 normtype=esmf_normtype_fracarea, &
696 routehandle=regrid_nonland, &
697 regridmethod=method, &
698 unmappeddstlist=unmapped_ptr, rc=rc)
699 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
702 print*,
"- CALL Field_Regrid for sea ice fraction."
703 call esmf_fieldregrid(seaice_fract_input_grid, &
704 seaice_fract_target_grid, &
705 routehandle=regrid_nonland, &
706 termorderflag=esmf_termorder_srcseq, rc=rc)
707 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
710 print*,
"- CALL FieldGet FOR TARGET grid sea ice fraction."
711 call esmf_fieldget(seaice_fract_target_grid, &
712 farrayptr=seaice_fract_target_ptr, rc=rc)
713 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
716 l = lbound(unmapped_ptr)
717 u = ubound(unmapped_ptr)
720 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
721 seaice_fract_target_ptr(i,j) = -9999.9
726 if (localpet == 0)
then
727 allocate(latitude_one_tile(i_target,j_target))
729 allocate(latitude_one_tile(0,0))
732 do tile = 1, num_tiles_target_grid
734 print*,
"- CALL FieldGather FOR TARGET GRID SEAICE FRACTION TILE: ", tile
735 call esmf_fieldgather(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
736 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
739 print*,
"- CALL FieldGather FOR TARGET GRID MASK TILE: ", tile
740 call esmf_fieldgather(seamask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
741 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
744 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
745 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
746 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
749 if (localpet == 0)
then
750 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 91, &
751 latitude=latitude_one_tile)
759 ice_lim = 0.95_esmf_kind_r8
761 if (localpet == 0)
then
764 if (data_one_tile(i,j) > ice_lim)
then
765 data_one_tile(i,j) = 1.0_esmf_kind_r8
767 if (data_one_tile(i,j) < 0.15_esmf_kind_r8) data_one_tile(i,j) = 0.0_esmf_kind_r8
772 print*,
"- CALL FieldScatter FOR TARGET GRID SEAICE FRACTION TILE: ", tile
773 call esmf_fieldscatter(seaice_fract_target_grid, data_one_tile, rootpet=0, tile=tile, rc=rc)
774 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
779 deallocate(latitude_one_tile)
781 print*,
"- CALL FieldRegridRelease."
782 call esmf_fieldregridrelease(routehandle=regrid_nonland, rc=rc)
783 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
792 where (nint(landmask_input_ptr) == 2) mask_input_ptr = 1
795 do j = clb_target(2), cub_target(2)
796 do i = clb_target(1), cub_target(1)
797 if (seaice_fract_target_ptr(i,j) > 0.0) mask_target_ptr(i,j) = 1
801 method=esmf_regridmethod_nearest_stod
802 isrctermprocessing = 1
804 print*,
"- CALL FieldRegridStore for 3d seaice fields."
805 call esmf_fieldregridstore(soil_temp_input_grid, &
806 ice_temp_target_grid, &
807 srcmaskvalues=(/0/), &
808 dstmaskvalues=(/0/), &
809 polemethod=esmf_polemethod_none, &
810 srctermprocessing=isrctermprocessing, &
811 unmappedaction=esmf_unmappedaction_ignore, &
812 normtype=esmf_normtype_fracarea, &
813 routehandle=regrid_seaice, &
814 regridmethod=method, &
815 unmappeddstlist=unmapped_ptr, rc=rc)
817 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
820 bundle_seaice_target = esmf_fieldbundlecreate(name=
"sea ice target", rc=rc)
821 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
823 bundle_seaice_input = esmf_fieldbundlecreate(name=
"sea ice input", rc=rc)
824 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
827 call esmf_fieldbundleadd(bundle_seaice_target, (/seaice_depth_target_grid, snow_depth_at_ice_target_grid, &
828 snow_liq_equiv_at_ice_target_grid, seaice_skin_temp_target_grid, &
829 ice_temp_target_grid/), rc=rc)
831 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
834 call esmf_fieldbundleadd(bundle_seaice_input, (/seaice_depth_input_grid, snow_depth_input_grid, &
835 snow_liq_equiv_input_grid, seaice_skin_temp_input_grid, &
836 soil_temp_input_grid/), rc=rc)
837 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
840 call esmf_fieldbundleget(bundle_seaice_target,fieldcount=num_fields,rc=rc)
841 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
844 allocate(search_nums(num_fields))
845 allocate(dozero(num_fields))
847 search_nums = (/92,66,65,21,21/)
850 l = lbound(unmapped_ptr)
851 u = ubound(unmapped_ptr)
853 call
regrid_many(bundle_seaice_input,bundle_seaice_target,num_fields,regrid_seaice,dozero, &
854 unmapped_ptr=unmapped_ptr )
856 call esmf_fieldbundledestroy(bundle_seaice_input,rc=rc)
857 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
860 if (localpet == 0)
then
861 allocate(fice_target_one_tile(i_target,j_target))
863 allocate(fice_target_one_tile(0,0))
866 do tile = 1, num_tiles_target_grid
868 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
869 call esmf_fieldgather(seaice_fract_target_grid, fice_target_one_tile, rootpet=0, tile=tile, rc=rc)
870 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
873 if (localpet == 0)
then
874 mask_target_one_tile = 0
875 where(fice_target_one_tile > 0.0) mask_target_one_tile = 1
876 call
search_many(num_fields,bundle_seaice_target,tile, search_nums,localpet, &
877 mask=mask_target_one_tile)
879 call
search_many(num_fields,bundle_seaice_target, tile,search_nums,localpet)
884 deallocate(search_nums)
886 call esmf_fieldbundledestroy(bundle_seaice_target,rc=rc)
887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
890 print*,
"- CALL FieldRegridRelease."
891 call esmf_fieldregridrelease(routehandle=regrid_seaice, rc=rc)
892 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
900 where (nint(landmask_input_ptr) == 0) mask_input_ptr = 1
907 where (seamask_target_ptr == 1) mask_target_ptr = 1
908 where (seaice_fract_target_ptr == 1.0_esmf_kind_r8) mask_target_ptr = 0
910 method=esmf_regridmethod_conserve
911 isrctermprocessing = 1
913 print*,
"- CALL FieldRegridStore for water fields."
914 call esmf_fieldregridstore(skin_temp_input_grid, &
916 srcmaskvalues=(/0/), &
917 dstmaskvalues=(/0/), &
918 polemethod=esmf_polemethod_none, &
919 srctermprocessing=isrctermprocessing, &
920 unmappedaction=esmf_unmappedaction_ignore, &
921 normtype=esmf_normtype_fracarea, &
922 routehandle=regrid_water, &
923 regridmethod=method, &
924 unmappeddstlist=unmapped_ptr, rc=rc)
925 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
928 bundle_water_target = esmf_fieldbundlecreate(name=
"water target", rc=rc)
929 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
931 bundle_water_input = esmf_fieldbundlecreate(name=
"water input", rc=rc)
932 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
935 call esmf_fieldbundleadd(bundle_water_target, (/sst_target_grid, z0_water_target_grid/), rc=rc)
937 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
940 call esmf_fieldbundleadd(bundle_water_input, (/skin_temp_input_grid, z0_input_grid/), rc=rc)
941 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
944 if (convert_nst)
then
946 call esmf_fieldbundleadd(bundle_water_target, (/c_d_target_grid,c_0_target_grid,d_conv_target_grid, &
947 dt_cool_target_grid,ifd_target_grid,qrain_target_grid,tref_target_grid, &
948 w_d_target_grid,w_0_target_grid,xs_target_grid,xt_target_grid,xu_target_grid, &
949 xv_target_grid,xz_target_grid,xtts_target_grid,xzts_target_grid, &
950 z_c_target_grid,zm_target_grid/), rc=rc)
951 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
954 call esmf_fieldbundleadd(bundle_water_input, (/c_d_input_grid,c_0_input_grid,d_conv_input_grid, &
955 dt_cool_input_grid,ifd_input_grid,qrain_input_grid,tref_input_grid, &
956 w_d_input_grid,w_0_input_grid,xs_input_grid,xt_input_grid,xu_input_grid, &
957 xv_input_grid,xz_input_grid,xtts_input_grid,xzts_input_grid, &
958 z_c_input_grid,zm_input_grid/), rc=rc)
959 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
961 call esmf_fieldbundleget(bundle_water_target,fieldcount=num_fields,rc=rc)
962 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
965 allocate(search_nums(num_fields))
966 allocate(dozero(num_fields))
968 search_nums(:)=(/11,83,0,0,0,0,1,0,11,0,0,0,0,0,0,30,0,0,0,0/)
972 call esmf_fieldbundleget(bundle_water_target,fieldcount=num_fields,rc=rc)
973 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
976 allocate(search_nums(num_fields))
977 allocate(dozero(num_fields))
978 search_nums(:)=(/11,83/)
982 call
regrid_many(bundle_water_input,bundle_water_target,num_fields,regrid_water,dozero, &
983 unmapped_ptr=unmapped_ptr, resetifd=.true.)
985 call esmf_fieldbundledestroy(bundle_water_input,rc=rc)
986 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
990 if (localpet == 0)
then
991 allocate(latitude_one_tile(i_target,j_target))
993 allocate(latitude_one_tile(0,0))
996 do tile = 1, num_tiles_target_grid
998 print*,
"- CALL FieldGather FOR TARGET SEAMASK TILE: ", tile
999 call esmf_fieldgather(seamask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1000 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1003 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1004 call esmf_fieldgather(seaice_fract_target_grid, fice_target_one_tile, rootpet=0, tile=tile, rc=rc)
1005 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1008 print*,
"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile
1009 call esmf_fieldgather(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=rc)
1010 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1014 if (localpet == 0)
then
1015 allocate(water_target_one_tile(i_target,j_target))
1016 water_target_one_tile = 0
1017 where(mask_target_one_tile == 1) water_target_one_tile = 1
1018 where(fice_target_one_tile == 1.0_esmf_kind_r8) water_target_one_tile = 0
1019 call
search_many(num_fields,bundle_water_target, tile,search_nums,localpet, &
1020 latitude=latitude_one_tile,mask=water_target_one_tile)
1022 call
search_many(num_fields,bundle_water_target, tile,search_nums,localpet)
1025 if (localpet == 0)
deallocate(water_target_one_tile)
1029 deallocate(latitude_one_tile,search_nums,fice_target_one_tile)
1031 call esmf_fieldbundledestroy(bundle_water_target,rc=rc)
1032 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1035 print*,
"- CALL FieldRegridRelease."
1036 call esmf_fieldregridrelease(routehandle=regrid_water, rc=rc)
1037 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1045 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
1048 where (landmask_target_ptr == 1) mask_target_ptr = 1
1050 method=esmf_regridmethod_conserve
1051 isrctermprocessing = 1
1053 print*,
"- CALL FieldRegridStore for land fields."
1054 call esmf_fieldregridstore(snow_depth_input_grid, &
1055 snow_depth_target_grid, &
1056 srcmaskvalues=(/0/), &
1057 dstmaskvalues=(/0/), &
1058 polemethod=esmf_polemethod_none, &
1059 srctermprocessing=isrctermprocessing, &
1060 unmappedaction=esmf_unmappedaction_ignore, &
1061 normtype=esmf_normtype_fracarea, &
1062 routehandle=regrid_all_land, &
1063 regridmethod=method, &
1064 unmappeddstlist=unmapped_ptr, rc=rc)
1065 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1068 bundle_allland_target = esmf_fieldbundlecreate(name=
"all land target", rc=rc)
1069 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1071 bundle_allland_input = esmf_fieldbundlecreate(name=
"all land input", rc=rc)
1072 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1074 call esmf_fieldbundleadd(bundle_allland_target, (/canopy_mc_target_grid, snow_depth_target_grid, &
1075 snow_liq_equiv_target_grid/), rc=rc)
1076 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1078 call esmf_fieldbundleadd(bundle_allland_input, (/canopy_mc_input_grid, snow_depth_input_grid, &
1079 snow_liq_equiv_input_grid/), rc=rc)
1080 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1082 call esmf_fieldbundleget(bundle_allland_target,fieldcount=num_fields,rc=rc)
1083 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1086 allocate(search_nums(num_fields))
1087 allocate(dozero(num_fields))
1089 search_nums = (/223,66,65/)
1090 dozero=(/.true.,.false.,.false./)
1092 call
regrid_many(bundle_allland_input,bundle_allland_target,num_fields,regrid_all_land,dozero, &
1093 unmapped_ptr=unmapped_ptr)
1095 call esmf_fieldbundledestroy(bundle_allland_input,rc=rc)
1096 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1099 do tile = 1, num_tiles_target_grid
1101 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1102 call esmf_fieldgather(landmask_target_grid, mask_target_one_tile, rootpet=0, tile=tile, rc=rc)
1103 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1106 if (localpet == 0)
then
1107 allocate(land_target_one_tile(i_target,j_target))
1108 land_target_one_tile = 0
1109 where(mask_target_one_tile == 1) land_target_one_tile = 1
1111 call
search_many(num_fields,bundle_allland_target, &
1112 tile,search_nums,localpet, mask=land_target_one_tile)
1114 call
search_many(num_fields,bundle_allland_target, tile,search_nums,localpet)
1117 if (localpet == 0)
deallocate(land_target_one_tile)
1120 deallocate(search_nums)
1121 call esmf_fieldbundledestroy(bundle_allland_target,rc=rc)
1122 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1125 print*,
"- CALL FieldRegridRelease."
1126 call esmf_fieldregridrelease(routehandle=regrid_all_land, rc=rc)
1127 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1134 print*,
"- CALL FieldGet FOR INPUT GRID VEG TYPE."
1135 call esmf_fieldget(veg_type_input_grid, &
1136 farrayptr=veg_type_input_ptr, rc=rc)
1137 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1141 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 1
1143 print*,
"- CALL FieldGet FOR TARGET GRID VEG TYPE."
1144 call esmf_fieldget(veg_type_target_grid, &
1145 farrayptr=veg_type_target_ptr, rc=rc)
1146 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1150 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 1
1152 method=esmf_regridmethod_nearest_stod
1153 isrctermprocessing = 1
1155 print*,
"- CALL FieldRegridStore for landice fields."
1156 call esmf_fieldregridstore(soil_temp_input_grid, &
1157 soil_temp_target_grid, &
1158 srcmaskvalues=(/0/), &
1159 dstmaskvalues=(/0/), &
1160 polemethod=esmf_polemethod_none, &
1161 srctermprocessing=isrctermprocessing, &
1162 unmappedaction=esmf_unmappedaction_ignore, &
1163 normtype=esmf_normtype_fracarea, &
1164 routehandle=regrid_landice, &
1165 regridmethod=method, &
1166 unmappeddstlist=unmapped_ptr, rc=rc)
1167 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1170 bundle_landice_target = esmf_fieldbundlecreate(name=
"landice target", rc=rc)
1171 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1173 bundle_landice_input = esmf_fieldbundlecreate(name=
"landice input", rc=rc)
1174 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1176 call esmf_fieldbundleadd(bundle_landice_target, (/skin_temp_target_grid, terrain_from_input_grid,&
1177 soil_temp_target_grid/), rc=rc)
1178 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1180 call esmf_fieldbundleadd(bundle_landice_input, (/skin_temp_input_grid, terrain_input_grid,&
1181 soil_temp_input_grid/), rc=rc)
1182 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
1185 if (.not. sotyp_from_climo)
then
1186 call esmf_fieldbundleadd(bundle_landice_input, (/soil_type_input_grid/),rc=rc)
1187 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
1189 call esmf_fieldbundleadd(bundle_landice_target,(/soil_type_target_grid/),rc=rc)
1190 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
1194 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1196 call esmf_fieldbundleget(bundle_landice_target,fieldcount=num_fields,rc=rc)
1197 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1200 allocate(search_nums(num_fields))
1201 allocate(dozero(num_fields))
1203 if (sotyp_from_climo)
then
1204 search_nums = (/21,7,21/)
1207 search_nums = (/21,7,21,231/)
1208 dozero(:)=(/.false.,.false.,.false.,.true./)
1211 call
regrid_many(bundle_landice_input,bundle_landice_target,num_fields,regrid_landice,dozero, &
1212 unmapped_ptr=unmapped_ptr )
1214 call esmf_fieldbundledestroy(bundle_landice_input,rc=rc)
1215 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1218 if (localpet == 0)
then
1219 allocate (veg_type_target_one_tile(i_target,j_target))
1220 allocate (land_target_one_tile(i_target,j_target))
1221 allocate (data_one_tile2(i_target,j_target))
1223 allocate (veg_type_target_one_tile(0,0))
1224 allocate (land_target_one_tile(0,0))
1225 allocate (data_one_tile2(0,0))
1228 do tile = 1, num_tiles_target_grid
1229 print*,
"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile
1230 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
1231 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1234 if (localpet == 0)
then
1235 land_target_one_tile = 0
1236 where(nint(veg_type_target_one_tile) == veg_type_landice_target) land_target_one_tile = 1
1239 print*,
"- CALL FieldGather FOR TERRAIN FROM INPUT GRID LAND, TILE: ", tile
1240 call esmf_fieldgather(terrain_from_input_grid_land, data_one_tile2, rootpet=0, tile=tile, rc=rc)
1241 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1244 if (localpet==0)
then
1245 call
search_many(num_fields,bundle_landice_target,tile,search_nums,localpet,&
1246 terrain_land=data_one_tile2,mask=land_target_one_tile)
1248 call
search_many(num_fields,bundle_landice_target,tile,search_nums,localpet)
1252 deallocate (veg_type_target_one_tile)
1253 deallocate (land_target_one_tile)
1254 deallocate(search_nums)
1256 call esmf_fieldbundledestroy(bundle_landice_target,rc=rc)
1257 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1260 print*,
"- CALL FieldRegridRelease."
1261 call esmf_fieldregridrelease(routehandle=regrid_landice, rc=rc)
1262 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1270 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1
1271 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 0
1274 where (landmask_target_ptr == 1) mask_target_ptr = 1
1275 where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 0
1277 method=esmf_regridmethod_nearest_stod
1278 isrctermprocessing = 1
1280 print*,
"- CALL FieldRegridStore for 3d land (but no land ice) fields."
1281 call esmf_fieldregridstore(soilm_tot_input_grid, &
1282 soilm_tot_target_grid, &
1283 srcmaskvalues=(/0/), &
1284 dstmaskvalues=(/0/), &
1285 polemethod=esmf_polemethod_none, &
1286 srctermprocessing=isrctermprocessing, &
1287 unmappedaction=esmf_unmappedaction_ignore, &
1288 normtype=esmf_normtype_fracarea, &
1289 routehandle=regrid_land, &
1290 regridmethod=method, &
1291 unmappeddstlist=unmapped_ptr, rc=rc)
1292 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1295 bundle_nolandice_target = esmf_fieldbundlecreate(name=
"land no landice target", rc=rc)
1296 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1299 bundle_nolandice_input = esmf_fieldbundlecreate(name=
"land no landice input", rc=rc)
1300 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1303 call esmf_fieldbundleadd(bundle_nolandice_target, (/skin_temp_target_grid, terrain_from_input_grid,&
1304 soil_type_from_input_grid,soilm_tot_target_grid,soil_temp_target_grid/), rc=rc)
1305 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1308 call esmf_fieldbundleadd(bundle_nolandice_input, (/skin_temp_input_grid, terrain_input_grid,&
1309 soil_type_input_grid,soilm_tot_input_grid,soil_temp_input_grid/), rc=rc)
1310 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1314 if (.not. sotyp_from_climo)
then
1315 print*,
"- CALL Field_Regrid ."
1316 call esmf_fieldregrid(soil_type_input_grid, &
1317 soil_type_target_grid, &
1318 routehandle=regrid_land, &
1319 zeroregion=esmf_region_select, &
1320 termorderflag=esmf_termorder_srcseq, rc=rc)
1321 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1324 call esmf_fieldget(soil_type_target_grid, &
1325 farrayptr=soil_type_target_ptr, rc=rc)
1326 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1329 l = lbound(unmapped_ptr)
1330 u = ubound(unmapped_ptr)
1333 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
1334 soil_type_target_ptr(i,j) = -9999.9
1338 if (.not. vgfrc_from_climo)
then
1339 call esmf_fieldbundleadd(bundle_nolandice_target, (/veg_greenness_target_grid/), rc=rc)
1340 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1342 call esmf_fieldbundleadd(bundle_nolandice_input, (/veg_greenness_input_grid/), rc=rc)
1343 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1345 call esmf_fieldbundleget(bundle_nolandice_target,fieldcount=num_fields,rc=rc)
1346 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1348 vgfrc_ind = num_fields
1351 if (.not. lai_from_climo)
then
1352 call esmf_fieldbundleadd(bundle_nolandice_target, (/lai_target_grid/), rc=rc)
1353 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1355 call esmf_fieldbundleadd(bundle_nolandice_input, (/lai_input_grid/), rc=rc)
1356 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1358 call esmf_fieldbundleget(bundle_nolandice_target,fieldcount=num_fields,rc=rc)
1359 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1361 lai_ind = num_fields
1364 if (.not. minmax_vgfrc_from_climo)
then
1365 call esmf_fieldbundleadd(bundle_nolandice_target, (/max_veg_greenness_target_grid/), rc=rc)
1366 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1368 call esmf_fieldbundleadd(bundle_nolandice_input, (/max_veg_greenness_input_grid/), rc=rc)
1369 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1372 call esmf_fieldbundleadd(bundle_nolandice_target, (/min_veg_greenness_target_grid/), rc=rc)
1373 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1375 call esmf_fieldbundleadd(bundle_nolandice_input, (/min_veg_greenness_input_grid/), rc=rc)
1376 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1379 call esmf_fieldbundleget(bundle_nolandice_target,fieldcount=num_fields,rc=rc)
1380 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1383 mmvg_ind = num_fields-1
1386 call esmf_fieldbundleget(bundle_nolandice_target,fieldcount=num_fields,rc=rc)
1387 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1390 allocate(search_nums(num_fields))
1391 allocate(dozero(num_fields))
1393 search_nums(1:5) = (/85,7,224,85,86/)
1394 dozero(1:5) = (/.false.,.false.,.true.,.true.,.false./)
1396 if (.not. vgfrc_from_climo)
then
1397 search_nums(vgfrc_ind) = 224
1398 dozero(vgfrc_ind) = .true.
1401 if (.not. lai_from_climo)
then
1402 search_nums(lai_ind) = 229
1403 dozero(lai_ind) = .true.
1406 if (.not. minmax_vgfrc_from_climo)
then
1407 search_nums(mmvg_ind) = 227
1408 dozero(mmvg_ind) = .true.
1410 search_nums(mmvg_ind+1) = 228
1411 dozero(mmvg_ind+1) = .true.
1414 call
regrid_many(bundle_nolandice_input,bundle_nolandice_target,num_fields,regrid_land,dozero, &
1415 unmapped_ptr=unmapped_ptr)
1417 call esmf_fieldbundledestroy(bundle_nolandice_input,rc=rc)
1418 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1421 if (localpet == 0)
then
1422 allocate (veg_type_target_one_tile(i_target,j_target))
1424 allocate (veg_type_target_one_tile(0,0))
1427 do tile = 1, num_tiles_target_grid
1429 print*,
"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile
1430 call esmf_fieldgather(landmask_target_grid, mask_target_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 VEG TYPE TILE: ", tile
1435 call esmf_fieldgather(veg_type_target_grid, veg_type_target_one_tile, rootpet=0, tile=tile, rc=rc)
1436 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1439 if (localpet == 0)
then
1440 where(nint(veg_type_target_one_tile) == veg_type_landice_target) mask_target_one_tile = 0
1443 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID, TILE: ", tile
1444 call esmf_fieldgather(soil_type_target_grid, data_one_tile2, rootpet=0,tile=tile, rc=rc)
1445 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
1447 if (localpet==0)
then
1448 call
search_many(num_fields,bundle_nolandice_target,tile,search_nums,localpet, &
1449 soilt_climo=data_one_tile2, mask=mask_target_one_tile)
1451 call
search_many(num_fields,bundle_nolandice_target, tile,search_nums,localpet)
1454 print*,
"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile
1455 call esmf_fieldgather(soilm_tot_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1456 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1459 if (localpet == 0)
then
1460 do j = 1, lsoil_target
1461 data_one_tile = data_one_tile_3d(:,:,j)
1462 call
search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 86)
1463 data_one_tile_3d(:,:,j) = data_one_tile
1467 print*,
"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile
1468 call esmf_fieldgather(soil_temp_target_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc)
1469 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1472 if (tg3_from_soil)
then
1473 print*,
"- CALL FieldScatter FOR TARGET GRID SUBSTRATE TEMPERATURE, TILE: ", tile
1474 call esmf_fieldscatter(substrate_temp_target_grid, data_one_tile_3d(:,:,lsoil_target), rootpet=0, tile=tile, rc=rc)
1475 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1479 if (.not. sotyp_from_climo)
then
1480 print*,
"- CALL FieldGather FOR SOIL TYPE TARGET GRID LAND, TILE: ",tile
1481 call esmf_fieldgather(soil_type_target_grid, data_one_tile,rootpet=0,tile=tile, rc=rc)
1482 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
1485 if (localpet == 0)
then
1486 call
search(data_one_tile, mask_target_one_tile, i_target, j_target,tile,226)
1489 print*,
"- CALL FieldScatter FOR SOIL TYPE TARGET GRID, TILE: ", tile
1490 call esmf_fieldscatter(soil_type_target_grid,data_one_tile,rootpet=0,tile=tile,rc=rc)
1491 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
1497 deallocate(search_nums)
1498 call esmf_fieldbundledestroy(bundle_nolandice_target,rc=rc)
1499 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1502 print*,
"- CALL FieldRegridRelease."
1503 call esmf_fieldregridrelease(routehandle=regrid_land, rc=rc)
1504 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1507 deallocate(veg_type_target_one_tile)
1509 deallocate(data_one_tile, data_one_tile2)
1510 deallocate(data_one_tile_3d)
1511 deallocate(mask_target_one_tile)
1531 veg_type_target_grid
1535 integer :: clb(3), cub(3), rc
1536 integer :: i, j, n, soil_type
1538 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
1541 real(esmf_kind_r8),
pointer :: soilm_liq_ptr(:,:,:)
1542 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
1543 real(esmf_kind_r8),
pointer :: soil_temp_ptr(:,:,:)
1544 real(esmf_kind_r8),
pointer :: soil_type_ptr(:,:)
1545 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
1547 print*,
"- COMPUTE LIQUID PORTION OF TOTAL SOIL MOISTURE."
1549 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
1550 call esmf_fieldget(soilm_tot_target_grid, &
1551 computationallbound=clb, &
1552 computationalubound=cub, &
1553 farrayptr=soilm_tot_ptr, rc=rc)
1554 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1557 print*,
"- CALL FieldGet FOR LIQUID SOIL MOISTURE."
1558 call esmf_fieldget(soilm_liq_target_grid, &
1559 farrayptr=soilm_liq_ptr, rc=rc)
1560 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1563 print*,
"- CALL FieldGet FOR SOIL TEMPERATURE."
1564 call esmf_fieldget(soil_temp_target_grid, &
1565 farrayptr=soil_temp_ptr, rc=rc)
1566 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1569 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
1570 call esmf_fieldget(veg_type_target_grid, &
1571 farrayptr=veg_type_ptr, rc=rc)
1572 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1575 print*,
"- CALL FieldGet FOR SOIL TYPE."
1576 call esmf_fieldget(soil_type_target_grid, &
1577 farrayptr=soil_type_ptr, rc=rc)
1578 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1581 print*,
"- CALL FieldGet FOR LANDMASK."
1582 call esmf_fieldget(landmask_target_grid, &
1583 farrayptr=landmask_ptr, rc=rc)
1584 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1587 do j = clb(2), cub(2)
1588 do i = clb(1), cub(1)
1594 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
1596 soil_type = nint(soil_type_ptr(i,j))
1598 do n = clb(3), cub(3)
1600 if (soil_temp_ptr(i,j,n) < (frz_h2o-0.0001))
then
1602 bx = bb_target(soil_type)
1604 if (bx .gt. blim) bx = blim
1606 fk=(((hlice/(grav*(-satpsi_target(soil_type))))* &
1607 ((soil_temp_ptr(i,j,n)-frz_h2o)/soil_temp_ptr(i,j,n)))** &
1608 (-1/bx))*maxsmc_target(soil_type)
1610 if (fk .lt. 0.02) fk = 0.02
1612 soilm_liq_ptr(i,j,n) = min( fk, soilm_tot_ptr(i,j,n) )
1620 soilm_liq_ptr(i,j,n) =
frh2o(soil_temp_ptr(i,j,n), &
1621 soilm_tot_ptr(i,j,n), soilm_liq_ptr(i,j,n), &
1622 maxsmc_target(soil_type),bb_target(soil_type), &
1623 satpsi_target(soil_type))
1627 soilm_liq_ptr(i,j,n) = soilm_tot_ptr(i,j,n)
1664 FUNCTION frh2o (TKELV,SMC,SH2O,SMCMAX,BEXP,PSIS)
1681 REAL(esmf_kind_r8) :: sh2o
1682 REAL(esmf_kind_r8) :: smc
1686 REAL(esmf_kind_r8) :: tkelv
1688 REAL,
PARAMETER :: ck = 8.0
1689 REAL,
PARAMETER :: error = 0.005
1698 IF (bexp .GT. blim) bx = blim
1707 IF (ck .NE. 0.0)
THEN
1722 IF (swl .GT. (smc-0.02)) swl = smc-0.02
1723 IF (swl .LT. 0.) swl = 0.
1729 DO WHILE ( (nlog .LT. 10) .AND. (kcount .EQ. 0) )
1732 df = log(( psis*grav/hlice ) * ( ( 1.+ck*swl )**2. ) * &
1733 ( smcmax/(smc-swl) )**bx) - log(-(tkelv-frz_h2o)/tkelv)
1734 denom = 2. * ck / ( 1.+ck*swl ) + bx / ( smc - swl )
1735 swlk = swl - df/denom
1741 IF (swlk .GT. (smc-0.02)) swlk = smc - 0.02
1742 IF (swlk .LT. 0.) swlk = 0.
1748 dswl = abs(swlk-swl)
1756 IF ( dswl .LE. error )
THEN
1782 IF (kcount .EQ. 0)
THEN
1784 fk = (((hlice/(grav*(-psis)))* &
1785 ((tkelv-frz_h2o)/tkelv))**(-1/bx))*smcmax
1787 IF (fk .LT. 0.02) fk = 0.02
1789 frh2o = min(fk, smc)
1809 maxsmc_input, maxsmc_target, &
1810 refsmc_input, refsmc_target, &
1811 wltsmc_input, wltsmc_target
1814 veg_greenness_target_grid, &
1815 veg_type_target_grid
1819 integer :: clb(3), cub(3), i, j, k, rc
1820 integer :: soilt_input, soilt_target
1821 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
1823 real(esmf_kind_r8),
pointer :: soilm_tot_ptr(:,:,:)
1824 real(esmf_kind_r8),
pointer :: soil_type_input_ptr(:,:)
1825 real(esmf_kind_r8),
pointer :: soil_type_target_ptr(:,:)
1826 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
1827 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
1828 real :: f1, fn, smcdir, smctra
1830 print*,
"- RESCALE SOIL MOISTURE FOR CHANGES IN SOIL TYPE."
1832 print*,
"- CALL FieldGet FOR TOTAL SOIL MOISTURE."
1833 call esmf_fieldget(soilm_tot_target_grid, &
1834 computationallbound=clb, &
1835 computationalubound=cub, &
1836 farrayptr=soilm_tot_ptr, rc=rc)
1837 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1840 print*,
"- CALL FieldGet FOR LAND MASK."
1841 call esmf_fieldget(landmask_target_grid, &
1842 farrayptr=landmask_ptr, rc=rc)
1843 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1846 print*,
"- CALL FieldGet FOR VEGETATION TYPE."
1847 call esmf_fieldget(veg_type_target_grid, &
1848 farrayptr=veg_type_ptr, rc=rc)
1849 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1852 print*,
"- CALL FieldGet FOR VEGETATION GREENNESS."
1853 call esmf_fieldget(veg_greenness_target_grid, &
1854 farrayptr=veg_greenness_ptr, rc=rc)
1855 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1858 print*,
"- CALL FieldGet FOR TARGET GRID SOIL TYPE."
1859 call esmf_fieldget(soil_type_target_grid, &
1860 farrayptr=soil_type_target_ptr, rc=rc)
1861 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1864 print*,
"- CALL FieldGet FOR SOIL TYPE FROM INPUT GRID."
1865 call esmf_fieldget(soil_type_from_input_grid, &
1866 farrayptr=soil_type_input_ptr, rc=rc)
1867 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1870 do j = clb(2), cub(2)
1871 do i = clb(1), cub(1)
1877 if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target)
then
1879 soilt_target = nint(soil_type_target_ptr(i,j))
1880 soilt_input = nint(soil_type_input_ptr(i,j))
1888 if (soilt_target /= soilt_input)
then
1893 f1=(soilm_tot_ptr(i,j,1)-drysmc_input(soilt_input)) / &
1894 (maxsmc_input(soilt_input)-drysmc_input(soilt_input))
1896 smcdir=drysmc_target(soilt_target) + f1 * &
1897 (maxsmc_target(soilt_target) - drysmc_target(soilt_target))
1903 if (soilm_tot_ptr(i,j,1) < refsmc_input(soilt_input))
then
1904 f1=(soilm_tot_ptr(i,j,1) - wltsmc_input(soilt_input)) / &
1905 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
1906 smctra=wltsmc_target(soilt_target) + f1 * &
1907 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
1909 f1=(soilm_tot_ptr(i,j,1) - refsmc_input(soilt_input)) / &
1910 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
1911 smctra=refsmc_target(soilt_target) + f1 * &
1912 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
1919 soilm_tot_ptr(i,j,1) = ((1.0 - veg_greenness_ptr(i,j)) * smcdir) + &
1920 (veg_greenness_ptr(i,j) * smctra)
1930 if (soilm_tot_ptr(i,j,k) < refsmc_input(soilt_input))
then
1931 fn = (soilm_tot_ptr(i,j,k) - wltsmc_input(soilt_input)) / &
1932 (refsmc_input(soilt_input) - wltsmc_input(soilt_input))
1933 soilm_tot_ptr(i,j,k) = wltsmc_target(soilt_target) + fn * &
1934 (refsmc_target(soilt_target) - wltsmc_target(soilt_target))
1936 fn = (soilm_tot_ptr(i,j,k) - refsmc_input(soilt_input)) / &
1937 (maxsmc_input(soilt_input) - refsmc_input(soilt_input))
1938 soilm_tot_ptr(i,j,k) = refsmc_target(soilt_target) + fn * &
1939 (maxsmc_target(soilt_target) - refsmc_target(soilt_target))
1949 soilm_tot_ptr(i,j,1)=min(soilm_tot_ptr(i,j,1),maxsmc_target(soilt_target))
1950 soilm_tot_ptr(i,j,1)=max(drysmc_target(soilt_target),soilm_tot_ptr(i,j,1))
1953 soilm_tot_ptr(i,j,k)=min(soilm_tot_ptr(i,j,k),maxsmc_target(soilt_target))
1954 soilm_tot_ptr(i,j,k)=max(wltsmc_target(soilt_target),soilm_tot_ptr(i,j,k))
1972 use model_grid, only : landmask_target_grid, &
1979 integer :: clb(3), cub(3), i, j, k, rc
1980 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
1982 real,
parameter :: lapse_rate = 6.5e-03
1983 real :: terrain_diff
1984 real(esmf_kind_r8),
pointer :: terrain_input_ptr(:,:)
1985 real(esmf_kind_r8),
pointer :: terrain_target_ptr(:,:)
1986 real(esmf_kind_r8),
pointer :: veg_type_target_ptr(:,:)
1987 real(esmf_kind_r8),
pointer :: soil_temp_target_ptr(:,:,:)
1989 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
1990 call esmf_fieldget(landmask_target_grid, &
1991 farrayptr=landmask_ptr, rc=rc)
1992 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
1995 print*,
"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE."
1996 call esmf_fieldget(veg_type_target_grid, &
1997 farrayptr=veg_type_target_ptr, rc=rc)
1998 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2001 print*,
"- CALL FieldGet FOR TARGET GRID TERRAIN."
2002 call esmf_fieldget(terrain_target_grid, &
2003 farrayptr=terrain_target_ptr, rc=rc)
2004 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2007 print*,
"- CALL FieldGet FOR TERRAIN INTERP TO TARGET GRID."
2008 call esmf_fieldget(terrain_from_input_grid, &
2009 farrayptr=terrain_input_ptr, rc=rc)
2010 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2013 print*,
"- CALL FieldGet FOR SOIL TEMP TARGET GRID."
2014 call esmf_fieldget(soil_temp_target_grid, &
2015 computationallbound=clb, &
2016 computationalubound=cub, &
2017 farrayptr=soil_temp_target_ptr, rc=rc)
2018 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2021 do j = clb(2), cub(2)
2022 do i = clb(1), cub(1)
2023 if (landmask_ptr(i,j) == 1)
then
2024 terrain_diff = abs(terrain_input_ptr(i,j) - terrain_target_ptr(i,j))
2025 if (terrain_diff > 100.0)
then
2026 do k = clb(3), cub(3)
2027 soil_temp_target_ptr(i,j,k) = soil_temp_target_ptr(i,j,k) + &
2028 ((terrain_input_ptr(i,j) - terrain_target_ptr(i,j)) * lapse_rate)
2029 if (nint(veg_type_target_ptr(i,j)) == veg_type_landice_target)
then
2030 soil_temp_target_ptr(i,j,k) = min(soil_temp_target_ptr(i,j,k), 273.16)
2047 use model_grid, only : lsoil_target, i_input, j_input, input_grid
2049 soilm_liq_input_grid, soilm_tot_input_grid
2051 integer,
intent(in) :: localpet
2052 character(len=500) :: msg
2053 character(len=2) :: lsoil_input_ch, lsoil_target_ch
2055 real(esmf_kind_r8) :: tmp(i_input,j_input), &
2056 data_one_tile(i_input,j_input,lsoil_input), &
2057 tmp3d(i_input,j_input,lsoil_target)
2058 if (lsoil_input == 9 .and. lsoil_target == 4)
then
2059 print*,
"CONVERTING FROM 9 INPUT SOIL LEVELS TO 4 TARGET SOIL LEVELS"
2060 call esmf_fieldgather(soil_temp_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
2061 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2064 call esmf_fielddestroy(soil_temp_input_grid,rc=rc)
2065 soil_temp_input_grid = esmf_fieldcreate(input_grid, &
2066 typekind=esmf_typekind_r8, &
2067 staggerloc=esmf_staggerloc_center, &
2068 ungriddedlbound=(/1/), &
2069 ungriddedubound=(/lsoil_target/), rc=rc)
2072 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
2073 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
2074 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
2075 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
2076 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
2077 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
2078 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
2079 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
2080 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
2081 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
2082 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
2085 call esmf_fieldscatter(soil_temp_input_grid, tmp3d, rootpet=0, rc=rc)
2086 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2089 call esmf_fieldgather(soilm_tot_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
2090 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2093 call esmf_fielddestroy(soilm_tot_input_grid,rc=rc)
2094 soilm_tot_input_grid = esmf_fieldcreate(input_grid, &
2095 typekind=esmf_typekind_r8, &
2096 staggerloc=esmf_staggerloc_center, &
2097 ungriddedlbound=(/1/), &
2098 ungriddedubound=(/lsoil_target/), rc=rc)
2100 if(localpet==0)
then
2101 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
2102 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
2103 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
2104 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
2105 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
2106 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
2107 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
2108 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
2109 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
2110 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
2111 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
2114 call esmf_fieldscatter(soilm_tot_input_grid, tmp3d, rootpet=0, rc=rc)
2115 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2118 call esmf_fieldgather(soilm_liq_input_grid, data_one_tile, rootpet=0, tile=1, rc=rc)
2119 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2122 call esmf_fielddestroy(soilm_liq_input_grid,rc=rc)
2123 soilm_liq_input_grid = esmf_fieldcreate(input_grid, &
2124 typekind=esmf_typekind_r8, &
2125 staggerloc=esmf_staggerloc_center, &
2126 ungriddedlbound=(/1/), &
2127 ungriddedubound=(/lsoil_target/), rc=rc)
2128 if(localpet==0)
then
2129 tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + &
2130 (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + &
2131 (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6
2132 tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5)
2133 tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + &
2134 (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25
2135 tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + &
2136 (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0)
2137 tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8)
2138 tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + &
2139 (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4
2142 call esmf_fieldscatter(soilm_liq_input_grid, tmp3d, rootpet=0, rc=rc)
2143 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2146 elseif (lsoil_input /= lsoil_target)
then
2148 write(lsoil_input_ch,
'(i2)') lsoil_input
2149 write(lsoil_target_ch,
'(i2)') lsoil_target
2150 msg=
"NUMBER OF SOIL LEVELS IN INPUT " // lsoil_input_ch //
" AND OUTPUT " &
2151 // lsoil_target_ch //
" MUST EITHER BE EQUAL OR 9 AND 4 RESPECTIVELY."
2163 use model_grid, only : landmask_target_grid, &
2168 integer :: clb(2), cub(2), i, j, rc
2169 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2170 integer(esmf_kind_i8),
pointer :: seamask_ptr(:,:)
2172 real(esmf_kind_r8),
pointer :: data_ptr2(:,:)
2173 real(esmf_kind_r8),
pointer :: data_ptr3(:,:)
2174 real(esmf_kind_r8),
pointer :: fice_ptr(:,:)
2176 print*,
"- SET ROUGHNESS."
2178 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
2179 call esmf_fieldget(landmask_target_grid, &
2180 computationallbound=clb, &
2181 computationalubound=cub, &
2182 farrayptr=landmask_ptr, rc=rc)
2183 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2186 print*,
"- CALL FieldGet FOR TARGET GRID SEA ICE."
2187 call esmf_fieldget(seaice_fract_target_grid, &
2188 farrayptr=fice_ptr, rc=rc)
2189 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2192 print*,
"- CALL FieldGet FOR TARGET GRID Z0 WATER."
2193 call esmf_fieldget(z0_water_target_grid, &
2194 farrayptr=data_ptr3, rc=rc)
2195 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2198 print*,
"- CALL FieldGet FOR TARGET SEA MASK."
2199 call esmf_fieldget(seamask_target_grid, &
2200 farrayptr=seamask_ptr, rc=rc)
2201 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2204 print*,
"- CALL FieldGet FOR TARGET GRID Z0 ICE."
2205 call esmf_fieldget(z0_ice_target_grid, &
2206 farrayptr=data_ptr2, rc=rc)
2207 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2212 do j = clb(2), cub(2)
2213 do i = clb(1), cub(1)
2214 if (fice_ptr(i,j) > 0.0)
then
2215 data_ptr2(i,j) = 1.0
2217 data_ptr2(i,j) = missing
2225 do j = clb(2), cub(2)
2226 do i = clb(1), cub(1)
2227 if (fice_ptr(i,j) == 1.0_esmf_kind_r8 .or. seamask_ptr(i,j) == 0)
then
2228 data_ptr3(i,j) = missing
2241 use model_grid, only : landmask_target_grid, &
2245 alvwf_target_grid, &
2246 alnsf_target_grid, &
2247 alnwf_target_grid, &
2248 facsf_target_grid, &
2249 facwf_target_grid, &
2250 mxsno_albedo_target_grid, &
2251 max_veg_greenness_target_grid, &
2252 min_veg_greenness_target_grid, &
2253 slope_type_target_grid, &
2254 soil_type_target_grid, &
2255 substrate_temp_target_grid, &
2256 veg_greenness_target_grid, &
2257 veg_type_target_grid
2261 integer :: clb(2), cub(2), i, j, rc
2262 integer(esmf_kind_i8),
pointer :: landmask_ptr(:,:)
2263 integer(esmf_kind_i8),
pointer :: seamask_ptr(:,:)
2265 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
2266 real(esmf_kind_r8),
pointer :: data3d_ptr(:,:,:)
2267 real(esmf_kind_r8),
pointer :: ice_ptr(:,:,:)
2268 real(esmf_kind_r8),
pointer :: soilmt_ptr(:,:,:)
2269 real(esmf_kind_r8),
pointer :: soilml_ptr(:,:,:)
2270 real(esmf_kind_r8),
pointer :: veg_greenness_ptr(:,:)
2271 real(esmf_kind_r8),
pointer :: veg_type_ptr(:,:)
2272 real(esmf_kind_r8),
pointer :: seaice_skint_ptr(:,:)
2273 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
2274 real(esmf_kind_r8),
pointer :: fice_ptr(:,:)
2275 real(esmf_kind_r8),
pointer :: hice_ptr(:,:)
2276 real(esmf_kind_r8),
pointer :: tg3_ptr(:,:)
2277 real(esmf_kind_r8),
pointer :: snod_ptr(:,:)
2278 real(esmf_kind_r8),
pointer :: snol_ptr(:,:)
2280 print*,
'- PERFORM QC CHECK'
2282 print*,
"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK."
2283 call esmf_fieldget(landmask_target_grid, &
2284 computationallbound=clb, &
2285 computationalubound=cub, &
2286 farrayptr=landmask_ptr, rc=rc)
2287 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2290 print*,
"- CALL FieldGet FOR TARGET GRID SEA MASK."
2291 call esmf_fieldget(seamask_target_grid, &
2292 farrayptr=seamask_ptr, rc=rc)
2293 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2296 print*,
"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION."
2297 call esmf_fieldget(seaice_fract_target_grid, &
2298 farrayptr=fice_ptr, rc=rc)
2299 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2302 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE."
2303 call esmf_fieldget(slope_type_target_grid, &
2304 farrayptr=data_ptr, rc=rc)
2305 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2308 do j = clb(2), cub(2)
2309 do i = clb(1), cub(1)
2310 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2314 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SOIL TYPE."
2315 call esmf_fieldget(soil_type_target_grid, &
2316 farrayptr=data_ptr, rc=rc)
2317 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2320 do j = clb(2), cub(2)
2321 do i = clb(1), cub(1)
2322 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2326 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION TYPE."
2327 call esmf_fieldget(veg_type_target_grid, &
2328 farrayptr=veg_type_ptr, rc=rc)
2329 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2332 do j = clb(2), cub(2)
2333 do i = clb(1), cub(1)
2334 if (landmask_ptr(i,j) == 0) veg_type_ptr(i,j) = 0.0
2338 print*,
"- SET TARGET GRID ALVSF FLAG AT NON-LAND."
2339 call esmf_fieldget(alvsf_target_grid, &
2340 farrayptr=data_ptr, rc=rc)
2341 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2344 do j = clb(2), cub(2)
2345 do i = clb(1), cub(1)
2346 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing
2350 print*,
"- SET TARGET GRID ALVWF FLAG AT NON-LAND."
2351 call esmf_fieldget(alvwf_target_grid, &
2352 farrayptr=data_ptr, rc=rc)
2353 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2356 do j = clb(2), cub(2)
2357 do i = clb(1), cub(1)
2358 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing
2362 print*,
"- SET TARGET GRID ALNSF FLAG AT NON-LAND."
2363 call esmf_fieldget(alnsf_target_grid, &
2364 farrayptr=data_ptr, rc=rc)
2365 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2368 do j = clb(2), cub(2)
2369 do i = clb(1), cub(1)
2370 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing
2374 print*,
"- SET TARGET GRID ALNWF FLAG AT NON-LAND."
2375 call esmf_fieldget(alnwf_target_grid, &
2376 farrayptr=data_ptr, rc=rc)
2377 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2380 do j = clb(2), cub(2)
2381 do i = clb(1), cub(1)
2382 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing
2386 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACSF."
2387 call esmf_fieldget(facsf_target_grid, &
2388 farrayptr=data_ptr, rc=rc)
2389 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2392 do j = clb(2), cub(2)
2393 do i = clb(1), cub(1)
2394 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2398 print*,
"- SET NON-LAND FLAG FOR TARGET GRID FACWF."
2399 call esmf_fieldget(facwf_target_grid, &
2400 farrayptr=data_ptr, rc=rc)
2401 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2404 do j = clb(2), cub(2)
2405 do i = clb(1), cub(1)
2406 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2410 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAXIMUM GREENNESS."
2411 call esmf_fieldget(max_veg_greenness_target_grid, &
2412 farrayptr=data_ptr, rc=rc)
2413 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2416 do j = clb(2), cub(2)
2417 do i = clb(1), cub(1)
2418 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2422 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MINIMUM GREENNESS."
2423 call esmf_fieldget(min_veg_greenness_target_grid, &
2424 farrayptr=data_ptr, rc=rc)
2425 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2428 do j = clb(2), cub(2)
2429 do i = clb(1), cub(1)
2430 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2434 print*,
"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION GREENNESS."
2435 call esmf_fieldget(veg_greenness_target_grid, &
2436 farrayptr=veg_greenness_ptr, rc=rc)
2437 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2440 do j = clb(2), cub(2)
2441 do i = clb(1), cub(1)
2442 if (landmask_ptr(i,j) == 0) veg_greenness_ptr(i,j) = 0.0
2446 print*,
"- SET NON-LAND FLAG FOR TARGET GRID MAX SNOW ALBEDO."
2447 call esmf_fieldget(mxsno_albedo_target_grid, &
2448 farrayptr=data_ptr, rc=rc)
2449 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2452 do j = clb(2), cub(2)
2453 do i = clb(1), cub(1)
2454 if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0
2458 print*,
"- ZERO OUT TARGET GRID CANOPY MOISTURE CONTENT WHERE NO PLANTS."
2459 call esmf_fieldget(canopy_mc_target_grid, &
2460 farrayptr=data_ptr, rc=rc)
2461 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2466 do j = clb(2), cub(2)
2467 do i = clb(1), cub(1)
2468 if (veg_greenness_ptr(i,j) <= 0.01) data_ptr(i,j) = 0.0
2472 print*,
"- CALL FieldGet FOR TARGET GRID ICE SKIN TEMP."
2473 call esmf_fieldget(seaice_skin_temp_target_grid, &
2474 farrayptr=seaice_skint_ptr, rc=rc)
2475 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2478 print*,
"- CALL FieldGet FOR TARGET GRID SKIN TEMP."
2479 call esmf_fieldget(skin_temp_target_grid, &
2480 farrayptr=skint_ptr, rc=rc)
2481 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2484 print*,
"- CALL FieldGet FOR TARGET GRID ICE DEPTH."
2485 call esmf_fieldget(seaice_depth_target_grid, &
2486 farrayptr=hice_ptr, rc=rc)
2487 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2494 print*,
"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS."
2496 do j = clb(2), cub(2)
2497 do i = clb(1), cub(1)
2498 if (fice_ptr(i,j) == 0.0)
then
2499 if (seamask_ptr(i,j) == 0)
then
2500 seaice_skint_ptr(i,j) = missing
2502 seaice_skint_ptr(i,j) = frz_ice
2509 print*,
"- SET TARGET GRID SST FLAG VALUE."
2510 call esmf_fieldget(sst_target_grid, &
2511 farrayptr=data_ptr, rc=rc)
2512 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2517 do j = clb(2), cub(2)
2518 do i = clb(1), cub(1)
2519 if (fice_ptr(i,j) == 1.0_esmf_kind_r8 .or. seamask_ptr(i,j) == 0.0)
then
2520 data_ptr(i,j) = missing
2525 print*,
"- SET MISSING FLAG AT TARGET GRID SUBSTRATE TEMP."
2526 call esmf_fieldget(substrate_temp_target_grid, &
2527 farrayptr=tg3_ptr, rc=rc)
2528 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2531 do j = clb(2), cub(2)
2532 do i = clb(1), cub(1)
2533 if (landmask_ptr(i,j) == 0.0)
then
2534 tg3_ptr(i,j) = missing
2539 print*,
"- SET MISSING FLAG AT TARGET GRID SNOW FIELDS AT ICE."
2541 print*,
"- CALL FieldGet FOR TARGET GRID SNOW DEPTH AT ICE."
2542 call esmf_fieldget(snow_depth_at_ice_target_grid, &
2543 farrayptr=snod_ptr, rc=rc)
2544 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2547 print*,
"- CALL FieldGet FOR TARGET GRID SNOW LIQ EQUIV AT ICE."
2548 call esmf_fieldget(snow_liq_equiv_at_ice_target_grid, &
2549 farrayptr=snol_ptr, rc=rc)
2550 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2553 do j = clb(2), cub(2)
2554 do i = clb(1), cub(1)
2555 if (fice_ptr(i,j) == 0.0)
then
2556 snol_ptr(i,j) = missing
2557 snod_ptr(i,j) = missing
2562 print*,
"- SET NON-LAND FLAG AT TARGET GRID SNOW DEPTH."
2563 call esmf_fieldget(snow_depth_target_grid, &
2564 farrayptr=data_ptr, rc=rc)
2565 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2568 do j = clb(2), cub(2)
2569 do i = clb(1), cub(1)
2570 if (landmask_ptr(i,j) == 0)
then
2571 data_ptr(i,j) = missing
2576 print*,
"- SET NON-LAND FLAG AT TARGET GRID SNOW LIQ."
2577 call esmf_fieldget(snow_liq_equiv_target_grid, &
2578 farrayptr=data_ptr, rc=rc)
2579 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2582 do j = clb(2), cub(2)
2583 do i = clb(1), cub(1)
2584 if (landmask_ptr(i,j) == 0)
then
2585 data_ptr(i,j) = missing
2590 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID TOTAL SOIL MOISTURE."
2591 call esmf_fieldget(soilm_tot_target_grid, &
2592 farrayptr=soilmt_ptr, rc=rc)
2593 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2596 print*,
"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE."
2597 call esmf_fieldget(soilm_liq_target_grid, &
2598 farrayptr=soilml_ptr, rc=rc)
2599 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2602 do j = clb(2), cub(2)
2603 do i = clb(1), cub(1)
2604 if (landmask_ptr(i,j) == 0 .or. &
2605 nint(veg_type_ptr(i,j)) == veg_type_landice_target)
then
2606 soilmt_ptr(i,j,:) = 1.0
2607 soilml_ptr(i,j,:) = 1.0
2612 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SOIL TEMPERATURE."
2613 call esmf_fieldget(soil_temp_target_grid, &
2614 farrayptr=data3d_ptr, rc=rc)
2615 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2618 do j = clb(2), cub(2)
2619 do i = clb(1), cub(1)
2620 if (landmask_ptr(i,j) == 0)
then
2621 data3d_ptr(i,j,:) = missing
2626 print*,
"- SET NON-ICE FLAG FOR TARGET GRID ICE COLUMN TEMPERATURE."
2627 call esmf_fieldget(ice_temp_target_grid, &
2628 farrayptr=ice_ptr, rc=rc)
2629 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2636 do j = clb(2), cub(2)
2637 do i = clb(1), cub(1)
2638 if (fice_ptr(i,j) == 0.0)
then
2639 if (seamask_ptr(i,j) == 0)
then
2640 ice_ptr(i,j,:) = missing
2642 ice_ptr(i,j,:) = frz_ice
2648 print*,
"- SET NON-LAND FLAG FOR TARGET GRID SKIN TEMPERATURE."
2650 do j = clb(2), cub(2)
2651 do i = clb(1), cub(1)
2652 if (landmask_ptr(i,j) == 0)
then
2653 skint_ptr(i,j) = missing
2672 integer(esmf_kind_i8),
pointer :: mask_ptr(:,:)
2674 integer,
PARAMETER :: num_nst_fields_minus2 = 16
2675 integer,
PARAMETER :: xz_fill = 30.0
2676 integer,
PARAMETER :: nst_fill = 0.0
2678 real(esmf_kind_r8),
pointer :: data_ptr(:,:)
2679 real(esmf_kind_r8),
pointer :: fice_ptr(:,:)
2680 real(esmf_kind_r8),
pointer :: skint_ptr(:,:)
2682 type(esmf_field
) :: temp_field
2683 type(esmf_fieldbundle
) :: nst_bundle
2685 print*,
"- CALL FieldGet FOR TARGET GRID SEAMASK."
2686 call esmf_fieldget(seamask_target_grid, &
2687 farrayptr=mask_ptr, rc=rc)
2688 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2691 print*,
"- CALL FieldGet FOR TARGET GRID SEAICE FRACT."
2692 call esmf_fieldget(seaice_fract_target_grid, &
2693 farrayptr=fice_ptr, rc=rc)
2694 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2697 nst_bundle = esmf_fieldbundlecreate(name=
"nst_bundle", rc=rc)
2698 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2701 call esmf_fieldbundleadd(nst_bundle, (/c_d_target_grid,c_0_target_grid,d_conv_target_grid, &
2702 dt_cool_target_grid,ifd_target_grid,qrain_target_grid,&
2703 w_d_target_grid,w_0_target_grid,xs_target_grid,xt_target_grid,&
2704 xu_target_grid,xv_target_grid,xtts_target_grid,xzts_target_grid, &
2705 z_c_target_grid, zm_target_grid/), rc=rc)
2706 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2709 print*,
"- CALL FieldGet FOR TREF."
2710 call esmf_fieldget(tref_target_grid, &
2711 farrayptr=data_ptr, rc=rc)
2712 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2715 print*,
"- CALL FieldGet FOR SKIN T."
2716 call esmf_fieldget(skin_temp_target_grid, &
2717 farrayptr=skint_ptr, rc=rc)
2718 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2721 where(mask_ptr == 0) data_ptr = skint_ptr
2722 where(fice_ptr > 0.0) data_ptr = frz_ice
2726 print*,
"- CALL FieldGet FOR XZ."
2727 call esmf_fieldget(xz_target_grid, &
2728 farrayptr=data_ptr, rc=rc)
2729 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2732 where(mask_ptr == 0) data_ptr = xz_fill
2733 where(fice_ptr > 0.0) data_ptr = xz_fill
2735 do i = 1,num_nst_fields_minus2
2737 call esmf_fieldbundleget(nst_bundle,i,temp_field,rc=rc)
2738 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2741 call esmf_fieldget(temp_field,farrayptr=data_ptr,rc=rc)
2742 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2745 where(mask_ptr == 0) data_ptr = nst_fill
2746 where(fice_ptr > 0.0) data_ptr = nst_fill
2750 call esmf_fieldbundledestroy(nst_bundle,rc=rc)
2751 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
2761 use model_grid, only : target_grid, lsoil_target
2767 real(esmf_kind_r8),
pointer :: target_ptr(:,:), target_ptr_3d(:,:,:)
2768 real :: init_val = -999.9
2770 print*,
"- CALL FieldCreate FOR TARGET GRID T2M."
2771 t2m_target_grid = esmf_fieldcreate(target_grid, &
2772 typekind=esmf_typekind_r8, &
2773 name=
"t2m_target_grid", &
2774 staggerloc=esmf_staggerloc_center, rc=rc)
2775 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2778 print*,
"- INITIALIZE TARGET grid t2m."
2779 call esmf_fieldget(t2m_target_grid, &
2780 farrayptr=target_ptr, rc=rc)
2781 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2784 target_ptr = init_val
2786 print*,
"- CALL FieldCreate FOR TARGET GRID Q2M."
2787 q2m_target_grid = esmf_fieldcreate(target_grid, &
2788 typekind=esmf_typekind_r8, &
2789 name=
"q2m_target_grid", &
2790 staggerloc=esmf_staggerloc_center, rc=rc)
2791 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2794 print*,
"- INITIALIZE TARGET grid q2m."
2795 call esmf_fieldget(q2m_target_grid, &
2796 farrayptr=target_ptr, rc=rc)
2797 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2800 target_ptr = init_val
2802 print*,
"- CALL FieldCreate FOR TARGET GRID TPRCP."
2803 tprcp_target_grid = esmf_fieldcreate(target_grid, &
2804 typekind=esmf_typekind_r8, &
2805 name=
"tprcp_target_grid", &
2806 staggerloc=esmf_staggerloc_center, rc=rc)
2807 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2810 print*,
"- INITIALIZE TARGET grid tprcp."
2811 call esmf_fieldget(tprcp_target_grid, &
2812 farrayptr=target_ptr, rc=rc)
2813 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2816 target_ptr = init_val
2818 print*,
"- CALL FieldCreate FOR TARGET GRID F10M."
2819 f10m_target_grid = esmf_fieldcreate(target_grid, &
2820 typekind=esmf_typekind_r8, &
2821 name=
"f10m_target_grid", &
2822 staggerloc=esmf_staggerloc_center, rc=rc)
2823 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2826 print*,
"- INITIALIZE TARGET grid f10m."
2827 call esmf_fieldget(f10m_target_grid, &
2828 farrayptr=target_ptr, rc=rc)
2829 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2832 target_ptr = init_val
2834 print*,
"- CALL FieldCreate FOR TARGET GRID FFMM."
2835 ffmm_target_grid = esmf_fieldcreate(target_grid, &
2836 typekind=esmf_typekind_r8, &
2837 name=
"ffmm_target_grid", &
2838 staggerloc=esmf_staggerloc_center, rc=rc)
2839 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2842 print*,
"- INITIALIZE TARGET grid ffmm."
2843 call esmf_fieldget(ffmm_target_grid, &
2844 farrayptr=target_ptr, rc=rc)
2845 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2848 target_ptr = init_val
2850 print*,
"- CALL FieldCreate FOR TARGET GRID USTAR."
2851 ustar_target_grid = esmf_fieldcreate(target_grid, &
2852 typekind=esmf_typekind_r8, &
2853 name=
"ustar_target_grid", &
2854 staggerloc=esmf_staggerloc_center, rc=rc)
2855 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2858 print*,
"- INITIALIZE TARGET grid ustar."
2859 call esmf_fieldget(ustar_target_grid, &
2860 farrayptr=target_ptr, rc=rc)
2861 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2864 target_ptr = init_val
2866 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV."
2867 snow_liq_equiv_target_grid = esmf_fieldcreate(target_grid, &
2868 typekind=esmf_typekind_r8, &
2869 name=
"snow_liq_equiv_target_grid", &
2870 staggerloc=esmf_staggerloc_center, rc=rc)
2871 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2874 print*,
"- INITIALIZE TARGET grid snow liq equiv."
2875 call esmf_fieldget(snow_liq_equiv_target_grid, &
2876 farrayptr=target_ptr, rc=rc)
2877 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2880 target_ptr = init_val
2882 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV AT SEA ICE."
2883 snow_liq_equiv_at_ice_target_grid = esmf_fieldcreate(target_grid, &
2884 typekind=esmf_typekind_r8, &
2885 name=
"snow_liq_equiv_at_ice_target_grid", &
2886 staggerloc=esmf_staggerloc_center, rc=rc)
2887 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2890 print*,
"- INITIALIZE TARGET grid snow liq equiv at sea ice."
2891 call esmf_fieldget(snow_liq_equiv_at_ice_target_grid, &
2892 farrayptr=target_ptr, rc=rc)
2893 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2896 target_ptr = init_val
2898 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH."
2899 snow_depth_target_grid = esmf_fieldcreate(target_grid, &
2900 typekind=esmf_typekind_r8, &
2901 name=
"snow_depth_target_grid", &
2902 staggerloc=esmf_staggerloc_center, rc=rc)
2903 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2906 print*,
"- INITIALIZE TARGET grid snow depth."
2907 call esmf_fieldget(snow_depth_target_grid, &
2908 farrayptr=target_ptr, rc=rc)
2909 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2912 target_ptr = init_val
2914 print*,
"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH AT SEA ICE."
2915 snow_depth_at_ice_target_grid = esmf_fieldcreate(target_grid, &
2916 typekind=esmf_typekind_r8, &
2917 name=
"snow_depth_at_ice_target_grid", &
2918 staggerloc=esmf_staggerloc_center, rc=rc)
2919 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2922 print*,
"- INITIALIZE TARGET grid snow depth at sea ice."
2923 call esmf_fieldget(snow_depth_at_ice_target_grid, &
2924 farrayptr=target_ptr, rc=rc)
2925 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2928 target_ptr = init_val
2930 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE FRACTION."
2931 seaice_fract_target_grid = esmf_fieldcreate(target_grid, &
2932 typekind=esmf_typekind_r8, &
2933 name=
"seaice_fract_target_grid", &
2934 staggerloc=esmf_staggerloc_center, rc=rc)
2935 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2938 print*,
"- INITIALIZE TARGET grid sea ice fraction."
2939 call esmf_fieldget(seaice_fract_target_grid, &
2940 farrayptr=target_ptr, rc=rc)
2941 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2944 target_ptr = init_val
2946 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE DEPTH."
2947 seaice_depth_target_grid = esmf_fieldcreate(target_grid, &
2948 typekind=esmf_typekind_r8, &
2949 name=
"seaice_depth_target_grid", &
2950 staggerloc=esmf_staggerloc_center, rc=rc)
2951 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2954 print*,
"- INITIALIZE TARGET sea ice depth."
2955 call esmf_fieldget(seaice_depth_target_grid, &
2956 farrayptr=target_ptr, rc=rc)
2957 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2960 target_ptr = init_val
2962 print*,
"- CALL FieldCreate FOR TARGET GRID sst."
2963 sst_target_grid = esmf_fieldcreate(target_grid, &
2964 typekind=esmf_typekind_r8, &
2965 name=
"sst_target_grid", &
2966 staggerloc=esmf_staggerloc_center, rc=rc)
2967 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2970 print*,
"- INITIALIZE TARGET sst."
2971 call esmf_fieldget(sst_target_grid, &
2972 farrayptr=target_ptr, rc=rc)
2973 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2976 target_ptr = init_val
2978 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE SKIN TEMP."
2979 seaice_skin_temp_target_grid = esmf_fieldcreate(target_grid, &
2980 typekind=esmf_typekind_r8, &
2981 name=
"seaice_skin_temp_target_grid", &
2982 staggerloc=esmf_staggerloc_center, rc=rc)
2983 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2986 print*,
"- INITIALIZE TARGET sea ice skin temp."
2987 call esmf_fieldget(seaice_skin_temp_target_grid, &
2988 farrayptr=target_ptr, rc=rc)
2989 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
2992 target_ptr = init_val
2994 print*,
"- CALL FieldCreate FOR TARGET GRID SRFLAG."
2995 srflag_target_grid = esmf_fieldcreate(target_grid, &
2996 typekind=esmf_typekind_r8, &
2997 name=
"srflag_target_grid", &
2998 staggerloc=esmf_staggerloc_center, rc=rc)
2999 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3002 print*,
"- INITIALIZE TARGET srflag."
3003 call esmf_fieldget(srflag_target_grid, &
3004 farrayptr=target_ptr, rc=rc)
3005 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3008 target_ptr = init_val
3010 print*,
"- CALL FieldCreate FOR TARGET GRID SKIN TEMPERATURE."
3011 skin_temp_target_grid = esmf_fieldcreate(target_grid, &
3012 typekind=esmf_typekind_r8, &
3013 name=
"skin_temp_target_grid", &
3014 staggerloc=esmf_staggerloc_center, rc=rc)
3015 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3018 print*,
"- INITIALIZE TARGET grid skin temp."
3019 call esmf_fieldget(skin_temp_target_grid, &
3020 farrayptr=target_ptr, rc=rc)
3021 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3024 target_ptr = init_val
3026 print*,
"- CALL FieldCreate FOR TARGET GRID CANOPY MOISTURE CONTENT."
3027 canopy_mc_target_grid = esmf_fieldcreate(target_grid, &
3028 typekind=esmf_typekind_r8, &
3029 name=
"canopy_mc_target_grid", &
3030 staggerloc=esmf_staggerloc_center, rc=rc)
3031 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3034 print*,
"- INITIALIZE TARGET grid canopy moisture."
3035 call esmf_fieldget(canopy_mc_target_grid, &
3036 farrayptr=target_ptr, rc=rc)
3037 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3040 target_ptr = init_val
3042 print*,
"- CALL FieldCreate FOR TARGET GRID LEAF AREA INDEX."
3043 lai_target_grid = esmf_fieldcreate(target_grid, &
3044 typekind=esmf_typekind_r8, &
3045 name=
"lai_target_grid",&
3046 staggerloc=esmf_staggerloc_center, rc=rc)
3047 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3050 print*,
"- INITIALIZE TARGET leaf area index."
3051 call esmf_fieldget(lai_target_grid, &
3052 farrayptr=target_ptr, rc=rc)
3053 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3056 target_ptr = init_val
3058 print*,
"- CALL FieldCreate FOR TARGET GRID Z0_ICE."
3059 z0_ice_target_grid = esmf_fieldcreate(target_grid, &
3060 typekind=esmf_typekind_r8, &
3061 name=
"z0_ice_target_grid", &
3062 staggerloc=esmf_staggerloc_center, rc=rc)
3063 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3066 print*,
"- INITIALIZE TARGET grid z0_ice."
3067 call esmf_fieldget(z0_ice_target_grid, &
3068 farrayptr=target_ptr, rc=rc)
3069 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3072 target_ptr = init_val
3074 print*,
"- CALL FieldCreate FOR TARGET GRID Z0_WATER."
3075 z0_water_target_grid = esmf_fieldcreate(target_grid, &
3076 typekind=esmf_typekind_r8, &
3077 name=
"z0_water_target_grid", &
3078 staggerloc=esmf_staggerloc_center, rc=rc)
3079 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3082 print*,
"- INITIALIZE TARGET grid z0_water."
3083 call esmf_fieldget(z0_water_target_grid, &
3084 farrayptr=target_ptr, rc=rc)
3085 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3088 target_ptr = init_val
3090 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID TERRAIN."
3091 terrain_from_input_grid = esmf_fieldcreate(target_grid, &
3092 typekind=esmf_typekind_r8, &
3093 name=
"terrain_from_input_grid", &
3094 staggerloc=esmf_staggerloc_center, rc=rc)
3095 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3098 print*,
"- INITIALIZE TARGET grid interpolated terrain."
3099 call esmf_fieldget(terrain_from_input_grid, &
3100 farrayptr=target_ptr, rc=rc)
3101 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3104 target_ptr = init_val
3106 print*,
"- CALL FieldCreate FOR INTERPOLATED TARGET GRID SOIL TYPE."
3107 soil_type_from_input_grid = esmf_fieldcreate(target_grid, &
3108 typekind=esmf_typekind_r8, &
3109 staggerloc=esmf_staggerloc_center, &
3110 name=
"soil_type_from_input_grid", rc=rc)
3111 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3114 print*,
"- INITIALIZE TARGET grid soil type"
3115 call esmf_fieldget(soil_type_from_input_grid, &
3116 farrayptr=target_ptr, rc=rc)
3117 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3120 target_ptr = init_val
3122 print*,
"- CALL FieldCreate FOR TARGET GRID SEA ICE COLUMN TEMPERATURE."
3123 ice_temp_target_grid = esmf_fieldcreate(target_grid, &
3124 typekind=esmf_typekind_r8, &
3125 staggerloc=esmf_staggerloc_center, &
3126 name=
"ice_temp_target_grid", &
3127 ungriddedlbound=(/1/), &
3128 ungriddedubound=(/lsoil_target/), rc=rc)
3129 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3132 print*,
"- INITIALIZE TARGET grid ice temp"
3133 call esmf_fieldget(ice_temp_target_grid, &
3134 farrayptr=target_ptr_3d, rc=rc)
3135 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3138 target_ptr_3d = init_val
3140 print*,
"- CALL FieldCreate FOR TARGET GRID SOIL TEMPERATURE."
3141 soil_temp_target_grid = esmf_fieldcreate(target_grid, &
3142 typekind=esmf_typekind_r8, &
3143 staggerloc=esmf_staggerloc_center, &
3144 name=
"soil_temp_target_grid", &
3145 ungriddedlbound=(/1/), &
3146 ungriddedubound=(/lsoil_target/), rc=rc)
3147 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3150 print*,
"- INITIALIZE TARGET grid soil temp"
3151 call esmf_fieldget(soil_temp_target_grid, &
3152 farrayptr=target_ptr_3d, rc=rc)
3153 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3156 target_ptr_3d = init_val
3158 print*,
"- CALL FieldCreate FOR TARGET GRID TOTAL SOIL MOISTURE."
3159 soilm_tot_target_grid = esmf_fieldcreate(target_grid, &
3160 typekind=esmf_typekind_r8, &
3161 staggerloc=esmf_staggerloc_center, &
3162 name=
"soilm_tot_target_grid", &
3163 ungriddedlbound=(/1/), &
3164 ungriddedubound=(/lsoil_target/), rc=rc)
3165 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3168 print*,
"- INITIALIZE TARGET grid soil moist"
3169 call esmf_fieldget(soilm_tot_target_grid, &
3170 farrayptr=target_ptr_3d, rc=rc)
3171 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3174 target_ptr_3d = init_val
3176 print*,
"- CALL FieldCreate FOR TARGET GRID LIQUID SOIL MOISTURE."
3177 soilm_liq_target_grid = esmf_fieldcreate(target_grid, &
3178 typekind=esmf_typekind_r8, &
3179 staggerloc=esmf_staggerloc_center, &
3180 name=
"soilm_liq_target_grid", &
3181 ungriddedlbound=(/1/), &
3182 ungriddedubound=(/lsoil_target/), rc=rc)
3183 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3186 print*,
"- INITIALIZE TARGET grid soil liq"
3187 call esmf_fieldget(soilm_liq_target_grid, &
3188 farrayptr=target_ptr_3d, rc=rc)
3189 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3192 target_ptr_3d = init_val
3207 print*,
"- CALL FieldCreate FOR TARGET GRID C_D."
3208 c_d_target_grid = esmf_fieldcreate(target_grid, &
3209 typekind=esmf_typekind_r8, &
3211 staggerloc=esmf_staggerloc_center, rc=rc)
3212 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3215 print*,
"- CALL FieldCreate FOR TARGET GRID C_0."
3216 c_0_target_grid = esmf_fieldcreate(target_grid, &
3217 typekind=esmf_typekind_r8, &
3219 staggerloc=esmf_staggerloc_center, rc=rc)
3220 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3223 print*,
"- CALL FieldCreate FOR TARGET GRID D_CONV."
3224 d_conv_target_grid = esmf_fieldcreate(target_grid, &
3225 typekind=esmf_typekind_r8, &
3227 staggerloc=esmf_staggerloc_center, rc=rc)
3228 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3231 print*,
"- CALL FieldCreate FOR TARGET GRID DT_COOL."
3232 dt_cool_target_grid = esmf_fieldcreate(target_grid, &
3233 typekind=esmf_typekind_r8, &
3235 staggerloc=esmf_staggerloc_center, rc=rc)
3236 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3239 print*,
"- CALL FieldCreate FOR TARGET GRID IFD."
3240 ifd_target_grid = esmf_fieldcreate(target_grid, &
3241 typekind=esmf_typekind_r8, &
3243 staggerloc=esmf_staggerloc_center, rc=rc)
3244 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3247 print*,
"- CALL FieldCreate FOR TARGET GRID QRAIN."
3248 qrain_target_grid = esmf_fieldcreate(target_grid, &
3249 typekind=esmf_typekind_r8, &
3251 staggerloc=esmf_staggerloc_center, rc=rc)
3252 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3255 print*,
"- CALL FieldCreate FOR TARGET GRID TREF."
3256 tref_target_grid = esmf_fieldcreate(target_grid, &
3257 typekind=esmf_typekind_r8, &
3259 staggerloc=esmf_staggerloc_center, rc=rc)
3260 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3263 print*,
"- CALL FieldCreate FOR TARGET GRID W_D."
3264 w_d_target_grid = esmf_fieldcreate(target_grid, &
3265 typekind=esmf_typekind_r8, &
3267 staggerloc=esmf_staggerloc_center, rc=rc)
3268 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3271 print*,
"- CALL FieldCreate FOR TARGET GRID W_0."
3272 w_0_target_grid = esmf_fieldcreate(target_grid, &
3273 typekind=esmf_typekind_r8, &
3275 staggerloc=esmf_staggerloc_center, rc=rc)
3276 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3279 print*,
"- CALL FieldCreate FOR TARGET GRID XS."
3280 xs_target_grid = esmf_fieldcreate(target_grid, &
3281 typekind=esmf_typekind_r8, &
3283 staggerloc=esmf_staggerloc_center, rc=rc)
3284 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3287 print*,
"- CALL FieldCreate FOR TARGET GRID XT."
3288 xt_target_grid = esmf_fieldcreate(target_grid, &
3289 typekind=esmf_typekind_r8, &
3291 staggerloc=esmf_staggerloc_center, rc=rc)
3292 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3295 print*,
"- CALL FieldCreate FOR TARGET GRID XU."
3296 xu_target_grid = esmf_fieldcreate(target_grid, &
3297 typekind=esmf_typekind_r8, &
3299 staggerloc=esmf_staggerloc_center, rc=rc)
3300 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3303 print*,
"- CALL FieldCreate FOR TARGET GRID XV."
3304 xv_target_grid = esmf_fieldcreate(target_grid, &
3305 typekind=esmf_typekind_r8, &
3307 staggerloc=esmf_staggerloc_center, rc=rc)
3308 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3311 print*,
"- CALL FieldCreate FOR TARGET GRID XZ."
3312 xz_target_grid = esmf_fieldcreate(target_grid, &
3313 typekind=esmf_typekind_r8, &
3315 staggerloc=esmf_staggerloc_center, rc=rc)
3316 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3319 print*,
"- CALL FieldCreate FOR TARGET GRID XTTS."
3320 xtts_target_grid = esmf_fieldcreate(target_grid, &
3321 typekind=esmf_typekind_r8, &
3323 staggerloc=esmf_staggerloc_center, rc=rc)
3324 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3327 print*,
"- CALL FieldCreate FOR TARGET GRID XZTS."
3328 xzts_target_grid = esmf_fieldcreate(target_grid, &
3329 typekind=esmf_typekind_r8, &
3331 staggerloc=esmf_staggerloc_center, rc=rc)
3332 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3335 print*,
"- CALL FieldCreate FOR TARGET GRID Z_C."
3336 z_c_target_grid = esmf_fieldcreate(target_grid, &
3337 typekind=esmf_typekind_r8, &
3339 staggerloc=esmf_staggerloc_center, rc=rc)
3340 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3343 print*,
"- CALL FieldCreate FOR TARGET GRID ZM."
3344 zm_target_grid = esmf_fieldcreate(target_grid, &
3345 typekind=esmf_typekind_r8, &
3347 staggerloc=esmf_staggerloc_center, rc=rc)
3348 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3363 use model_grid, only : landmask_target_grid, land_frac_target_grid
3367 integer :: i, j, rc, clb(2), cub(2)
3368 integer(esmf_kind_i8),
pointer :: mask_ptr(:,:)
3370 real(esmf_kind_r8),
pointer :: ice_ptr(:,:)
3371 real(esmf_kind_r8),
pointer :: land_frac_ptr(:,:)
3373 print*,
"- UPDATE TARGET LANDMASK WITH ICE RECORD."
3375 print*,
"- GET TARGET grid sea ice fraction."
3376 call esmf_fieldget(seaice_fract_target_grid, &
3377 farrayptr=ice_ptr, rc=rc)
3378 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3381 print*,
"- GET TARGET landmask."
3382 call esmf_fieldget(landmask_target_grid, &
3383 farrayptr=mask_ptr, rc=rc)
3384 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3387 print*,
"- GET TARGET land fraction."
3388 call esmf_fieldget(land_frac_target_grid, &
3389 computationallbound=clb, &
3390 computationalubound=cub, &
3391 farrayptr=land_frac_ptr, rc=rc)
3392 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3395 do j = clb(2), cub(2)
3396 do i = clb(1), cub(1)
3398 mask_ptr(i,j) = ceiling(land_frac_ptr(i,j))
3399 if (mask_ptr(i,j) /= 1)
then
3400 if(ice_ptr(i,j) > 0.0)
then
3424 integer(esmf_kind_i4),
intent(in) :: ij
3425 integer ,
intent(in) :: itile, jtile
3427 integer ,
intent(out) :: i, j
3430 integer :: pt_loc_this_tile
3432 tile_num = ((ij-1) / (itile*jtile))
3433 pt_loc_this_tile = ij - (tile_num * itile * jtile)
3436 j = (pt_loc_this_tile - 1) / itile + 1
3437 i = mod(pt_loc_this_tile, itile)
3455 subroutine regrid_many(bundle_pre,bundle_post, num_field,route,dozero, &
3456 unmapped_ptr,resetifd)
3464 integer,
intent(in) :: num_field
3465 type(esmf_routehandle
),
intent(inout) :: route
3466 type(esmf_fieldbundle
),
intent(in) :: bundle_pre, bundle_post
3467 logical,
intent(in) :: dozero(num_field)
3468 logical,
intent(in),
optional :: resetifd
3469 integer(esmf_kind_i4),
intent(inout),
optional :: unmapped_ptr(:)
3471 type(esmf_field
) :: field_pre,field_post
3472 real(esmf_kind_r8),
pointer :: tmp_ptr(:,:)
3475 logical :: is2d(num_field)
3476 character(len=50) :: fname
3477 integer :: i, j, k, ij, ind_2d, ind_3d, rc, ndims,n2d, n3d,localpet, l(1), u(1)
3483 if(present(unmapped_ptr))
then
3484 l = lbound(unmapped_ptr)
3485 u = ubound(unmapped_ptr)
3489 call esmf_fieldbundleget(bundle_pre,i,field_pre,rc=rc)
3490 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3493 call esmf_fieldbundleget(bundle_post,i,field_post,rc=rc)
3494 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3497 call esmf_fieldget(field_post,dimcount=ndims,name=fname,rc=rc)
3498 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3501 call esmf_vmgetglobal(vm, rc=rc)
3502 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3504 call esmf_vmget(vm, localpet=localpet, rc=rc)
3505 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3507 if(localpet==0) print*,
"in regrid_many fname = ", fname, ndims
3508 if (ndims == 2) is2d(i) = .true.
3509 if (ndims == 3) is2d(i) = .false.
3512 call esmf_fieldregrid(field_pre, &
3514 routehandle=route, &
3515 termorderflag=esmf_termorder_srcseq, rc=rc)
3516 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3519 call esmf_fieldregrid(field_pre, &
3521 routehandle=route, &
3522 zeroregion=esmf_region_select, &
3523 termorderflag=esmf_termorder_srcseq, rc=rc)
3524 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3529 if (present(resetifd))
then
3530 if( resetifd .and. convert_nst)
then
3531 call esmf_fieldget(ifd_target_grid,farrayptr=tmp_ptr,rc=rc)
3532 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3534 tmp_ptr = float(nint(tmp_ptr))
3538 n2d = count(is2d(:))
3539 n3d = count(.not.is2d(:))
3540 if(localpet==0) print*, is2d(:)
3541 if (present(unmapped_ptr))
then
3542 allocate(ptr_2d(n2d))
3543 if (n3d .ne. 0)
allocate(ptr_3d(n3d))
3547 call esmf_fieldbundleget(bundle_post,i,field_post,rc=rc)
3548 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3550 call esmf_fieldget(field_post, farrayptr=ptr_2d(ind_2d)%p, rc=rc)
3551 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3553 call esmf_fieldget(field_post,name=fname,rc=rc)
3554 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3556 if (localpet==0) print*,
"in doreplace loop, 2d field = ", trim(fname)
3559 call esmf_fieldbundleget(bundle_post,i,field_post,rc=rc)
3560 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3562 call esmf_fieldget(field_post,name=fname,rc=rc)
3563 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3565 if (localpet==0) print*,
"in doreplace loop, 3d field = ", trim(fname)
3566 call esmf_fieldget(field_post, farrayptr=ptr_3d(ind_3d)%p, rc=rc)
3567 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__)) &
3573 call
ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j)
3575 ptr_2d(k)%p(i,j) = -9999.9
3578 ptr_3d(k)%p(i,j,:) = -9999.9
3582 if(n3d .ne. 0)
deallocate(ptr_3d)
3600 subroutine search_many(num_field,bundle_target,tile,search_nums,localpet,latitude, &
3601 terrain_land,soilt_climo, mask)
3603 use model_grid, only : i_target,j_target, lsoil_target
3609 integer,
intent(in) :: num_field
3610 type(esmf_fieldbundle
),
intent(inout) :: bundle_target
3612 real(esmf_kind_r8),
intent(inout),
optional :: latitude(i_target,j_target)
3613 real(esmf_kind_r8),
intent(inout),
optional :: terrain_land(i_target,j_target)
3614 real(esmf_kind_r8),
intent(inout),
optional :: soilt_climo(i_target,j_target)
3615 integer(esmf_kind_i8),
intent(inout),
optional :: mask(i_target,j_target)
3617 real(esmf_kind_r8),
allocatable :: field_data_2d(:,:)
3618 real(esmf_kind_r8),
allocatable :: field_data_3d(:,:,:)
3619 integer,
intent(in) :: tile,localpet
3620 integer,
intent(inout) :: search_nums(num_field)
3622 type(esmf_field
) :: temp_field
3623 character(len=50) :: fname
3624 integer,
parameter :: sotyp_land_field_num = 224
3625 integer,
parameter :: sst_field_num = 11
3626 integer,
parameter :: terrain_field_num= 7
3627 integer :: j,k, rc, ndims
3631 call esmf_fieldbundleget(bundle_target,k,temp_field, rc=rc)
3632 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3634 call esmf_fieldget(temp_field, name=fname, dimcount=ndims,rc=rc)
3635 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3637 if (localpet==0)
then
3638 allocate(field_data_2d(i_target,j_target))
3640 allocate(field_data_2d(0,0))
3642 if (ndims .eq. 2)
then
3643 call esmf_fieldgather(temp_field,field_data_2d,rootpet=0,tile=tile, rc=rc)
3644 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3646 if (localpet == 0)
then
3647 if (present(latitude) .and. search_nums(k).eq.sst_field_num)
then
3649 call
search(field_data_2d, mask, i_target, j_target, tile,search_nums(k),latitude=latitude)
3650 elseif (present(terrain_land) .and. search_nums(k) .eq. terrain_field_num)
then
3652 call
search(field_data_2d, mask, i_target, j_target, tile,search_nums(k),terrain_land=terrain_land)
3653 elseif (search_nums(k) .eq. sotyp_land_field_num)
then
3655 if (fname .eq.
"soil_type_target_grid")
then
3658 call
search(field_data_2d, mask, i_target, j_target, tile,search_nums(k),soilt_climo=soilt_climo)
3659 elseif (present(soilt_climo))
then
3660 if (maxval(field_data_2d) > 0 .and. (trim(external_model) .ne.
"GFS" .or. trim(input_type) .ne.
"grib2"))
then
3663 call
search(field_data_2d, mask, i_target, j_target, tile, search_nums(k))
3668 field_data_2d = soilt_climo
3674 call
search(field_data_2d, mask, i_target, j_target, tile,search_nums(k))
3677 call esmf_fieldscatter(temp_field, field_data_2d, rootpet=0, tile=tile,rc=rc)
3678 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3681 if (localpet==0)
then
3682 allocate(field_data_3d(i_target,j_target,lsoil_target))
3684 allocate(field_data_3d(0,0,0))
3688 call esmf_fieldgather(temp_field,field_data_3d,rootpet=0,tile=tile,rc=rc)
3689 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3692 if (localpet==0)
then
3693 do j = 1, lsoil_target
3694 field_data_2d = field_data_3d(:,:,j)
3695 call
search(field_data_2d, mask, i_target, j_target, tile, 21)
3696 field_data_3d(:,:,j) = field_data_2d
3699 call esmf_fieldscatter(temp_field, field_data_3d, rootpet=0, tile=tile,rc=rc)
3700 if(esmf_logfounderror(rctocheck=rc,msg=esmf_logerr_passthru,line=__line__,file=__file__))&
3702 deallocate(field_data_3d)
3704 deallocate(field_data_2d)
3721 print*,
"- DESTROY LOCAL TARGET GRID SURFACE FIELDS."
3723 call esmf_fielddestroy(terrain_from_input_grid, rc=rc)
3724 call esmf_fielddestroy(terrain_from_input_grid_land, rc=rc)
3725 call esmf_fielddestroy(soil_type_from_input_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 and set flag values at non-active points.
subroutine, public write_fv3_sfc_data_netcdf(localpet)
Writes surface and nst data into a 'coldstart' file (netcdf).
subroutine, public get_static_fields(localpet)
Driver routine to read/time interpolate static/climo fields on the fv3 target grid.
subroutine, public interp(localpet)
Horizontally interpolate surface fields from input to target FV3 grid using esmf routines.
subroutine cleanup_all_target_sfc_data
Free up memory once the target grid surface fields are no longer needed.
subroutine, public search_many(num_field, bundle_target, tile, search_nums, localpet, latitude, terrain_land, soilt_climo, mask)
Execute the search function for multple fields.
Process surface and nst fields.
subroutine, public cleanup_target_sfc_data
Free up memory once the target grid surface fields are no longer needed.
Sets up the ESMF grid objects for the input data grid and target FV3 grid.
subroutine, public cleanup_target_nst_data
Free up memory once the target grid nst fields are no longer needed.
subroutine, public cleanup_static_fields
Free up memory for fields in this module.
Replace undefined values with a valid value.
subroutine error_handler(string, rc)
General error handler.
subroutine, public regrid_many(bundle_pre, bundle_post, num_field, route, dozero, unmapped_ptr, resetifd)
Regrid multiple ESMF fields from input to target grid.
Module to hold ESMF fields associated with the target grid surface data.
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, 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...
subroutine update_landmask
Update landmask for sea ice.
real function frh2o(TKELV, SMC, SH2O, SMCMAX, BEXP, PSIS)
Calculate supercooled soil moisture.
subroutine ij_to_i_j(ij, itile, jtile, i, j)
Convert 1d index to 2d indices.
subroutine adjust_soilt_for_terrain
Adjust soil temperature for changes in terrain height between the input and target grids...
subroutine roughness
Set roughness length at points with some sea ice to 1 cm.
Reads static surface climatological data for the target FV3 grid (such as soil type and vegetation ty...
subroutine, public search(field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo)
Replace undefined surface values.
subroutine calc_liq_soil_moisture
Compute liquid portion of the total soil moisture.
subroutine, public create_surface_esmf_fields
Create ESMF fields for the target grid surface variables.
subroutine, public nst_land_fill
nst is not active at land or sea ice points.
subroutine, public surface_driver(localpet)
Driver routine to process surface/nst data.