Skip to content

Commit

Permalink
Merge HAFS coupling (NOAA-EMC#355)
Browse files Browse the repository at this point in the history
Add HAFS HYCOM/WW3/CDEPS coupling

A. More details about the HAFS coupling related changes (from @danrosen25)
- gfs_physics_nml namelist modification (inpunt.nml file)
  - added cpl_imp_mrg used in assign_importdata
  - added cpl_imp_dbg used in assign_importdata
- assign_importdata subroutine modification
  - added argument jdat, which is used to timestamp cpl_imp_dbg output
  - if cpl_imp_mrg then assign_importdata will compare import data to missing_value (9.99e20). If import data equals missing value and import field is 'sea_surface_temperature' then Sfcprop%tsfco is set to Sfcprop%tsfc instead of import data. merged data is then stored in datar8, which is a local copy of the import data.
  - if cpl_imp_dbg then the merged data stored in datar8 is written out to netcdf files
- realizeConnectedCplFields
  - added optional argument fill_value, which is used to fill completed ESMF_Field, defaults to 0.0
- fv3_cap
  - import data realized with 9.99e20 fill_value
- module_fcst_grid_comp
  - removed commented out code in regional grid creation
  - fixed grid alignment for regional fcstGrid
  - added corner coordinates (edges) to regional fcstGrid, using internal ATM%lon_bnd and ATM%lat_bnd
  - writes forecast grid to NetCDF if DumpFields = true in nems.configure

B. Added the following HAFS development related namelist options: cplice, rlmx, elmax, sfc_rlm (more details can be seen from NCAR/ccpp-physics/pull/701)

C. Renamed and added HAFS related ccpp suites

Co-authored-by: Jun.Wang <Jun.Wang@noaa.gov>
Co-authored-by: Jili Dong <Jili.Dong@noaa.gov>
Co-authored-by: Chunxi.Zhang-NOAA <Chunxi.Zhang@noaa.gov>
Co-authored-by: andrew.hazelton <andrew.hazelton@noaa.gov>
Co-authored-by: ZhanZhang-NOAA <zhan.zhang@noaa.gov>
Co-authored-by: Daniel Rosen <daniel.rosen@noaa.gov>
Co-authored-by: Grant Firl <grantf@ucar.edu>
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
Co-authored-by: Man.Zhang <Man.Zhang@noaa.gov>
Co-authored-by: Ufuk Turuncoglu <ufuk.turuncoglu@noaa.gov>
  • Loading branch information
11 people authored Aug 5, 2021
1 parent fca8282 commit c52bb0b
Show file tree
Hide file tree
Showing 12 changed files with 524 additions and 28 deletions.
49 changes: 44 additions & 5 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ subroutine update_atmos_radiation_physics (Atmos)
!--- if coupled, assign coupled fields

if (.not. GFS_control%cplchm) then
call assign_importdata(rc)
call assign_importdata(jdat(:),rc)
endif

! Calculate total non-physics tendencies by substracting old GFS Stateout
Expand Down Expand Up @@ -1621,13 +1621,14 @@ subroutine dealloc_atmos_data_type (Atmos)
Atmos%lat )
end subroutine dealloc_atmos_data_type

subroutine assign_importdata(rc)
subroutine assign_importdata(jdat, rc)

use module_cplfields, only: importFields, nImportFields, queryImportFields, &
importFieldsValid
use ESMF
!
implicit none
integer, intent(in) :: jdat(8)
integer, intent(out) :: rc

!--- local variables
Expand All @@ -1639,9 +1640,15 @@ subroutine assign_importdata(rc)
real(kind=ESMF_KIND_R8), dimension(:,:), pointer :: datar82d
real(kind=ESMF_KIND_R8), dimension(:,:,:), pointer:: datar83d
real(kind=GFS_kind_phys), dimension(:,:), pointer :: datar8
logical, dimension(:,:), pointer :: mergeflg
real(kind=GFS_kind_phys) :: tem, ofrac
logical found, isFieldCreated, lcpl_fice
real(ESMF_KIND_R8), parameter :: missing_value = 9.99e20_ESMF_KIND_R8
type(ESMF_Grid) :: grid
type(ESMF_Field) :: dbgField
character(19) :: currtimestring
real (kind=GFS_kind_phys), parameter :: z0ice=1.1 ! (in cm)

!
real(kind=GFS_kind_phys), parameter :: himax = 8.0 !< maximum ice thickness allowed
! real(kind=GFS_kind_phys), parameter :: himin = 0.1 !< minimum ice thickness required
Expand All @@ -1660,6 +1667,7 @@ subroutine assign_importdata(rc)
lcpl_fice = .false.

allocate(datar8(isc:iec,jsc:jec))
allocate(mergeflg(isc:iec,jsc:jec))

! if (mpp_pe() == mpp_root_pe() .and. debug) print *,'in cplImp,dim=',isc,iec,jsc,jec
! if (mpp_pe() == mpp_root_pe() .and. debug) print *,'in cplImp,GFS_data, size', size(GFS_data)
Expand All @@ -1676,6 +1684,7 @@ subroutine assign_importdata(rc)
if (isFieldCreated) then ! put the data from local cubed sphere grid to column grid for phys

datar8 = -99999.0
mergeflg = .false.
call ESMF_FieldGet(importFields(n), dimCount=dimCount ,typekind=datatype, &
name=impfield_name, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
Expand All @@ -1685,6 +1694,9 @@ subroutine assign_importdata(rc)
call ESMF_FieldGet(importFields(n),farrayPtr=datar82d,localDE=0, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
datar8 = datar82d
if (GFS_control%cpl_imp_mrg) then
mergeflg(:,:) = datar82d(:,:).eq.missing_value
endif
if (mpp_pe() == mpp_root_pe() .and. debug) print *,'in cplIMP,atmos gets ',trim(impfield_name),' datar8=', &
datar8(isc,jsc), maxval(datar8), minval(datar8)
found = .true.
Expand Down Expand Up @@ -1779,9 +1791,17 @@ subroutine assign_importdata(rc)
do i=isc,iec
nb = Atm_block%blkno(i,j)
ix = Atm_block%ixp(i,j)
if (GFS_data(nb)%Sfcprop%oceanfrac(ix) > zero .and. datar8(i,j) > 150.0) then
! GFS_data(nb)%Coupling%tseain_cpl(ix) = datar8(i,j)
GFS_data(nb)%Sfcprop%tsfco(ix) = datar8(i,j)
if (GFS_Data(nb)%Sfcprop%oceanfrac(ix) > zero .and. datar8(i,j) > 150.0) then
if(mergeflg(i,j)) then
! GFS_Data(nb)%Coupling%tseain_cpl(ix) = &
! GFS_Data(nb)%Sfcprop%tsfc(ix)
GFS_Data(nb)%Sfcprop%tsfco(ix) = &
GFS_Data(nb)%Sfcprop%tsfc(ix)
datar8(i,j) = GFS_Data(nb)%Sfcprop%tsfc(ix)
else
! GFS_Data(nb)%Coupling%tseain_cpl(ix) = datar8(i,j)
GFS_Data(nb)%Sfcprop%tsfco(ix) = datar8(i,j)
endif
endif
enddo
enddo
Expand Down Expand Up @@ -2436,10 +2456,29 @@ subroutine assign_importdata(rc)
endif
endif

! write post merge import data to NetCDF file.
if (GFS_control%cpl_imp_dbg) then
call ESMF_FieldGet(importFields(n), grid=grid, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

dbgField = ESMF_FieldCreate(grid=grid, farrayPtr=datar8, name=impfield_name, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

write (currtimestring, "(I4.4,'-',I2.2,'-',I2.2,'T',I2.2,':',I2.2,':',I2.2)") &
jdat(1), jdat(2), jdat(3), jdat(5), jdat(6), jdat(7)
call ESMF_FieldWrite(dbgField, fileName='fv3_merge_'//trim(impfield_name)//'_'// &
trim(currtimestring)//'.nc', rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

call ESMF_FieldDestroy(dbgField, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
endif

endif ! if (found) then
endif ! if (isFieldCreated) then
enddo
!
deallocate(mergeflg)
deallocate(datar8)

! update sea ice related fields:
Expand Down
30 changes: 28 additions & 2 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,12 @@ module GFS_typedefs

!--- coupling parameters
logical :: cplflx !< default no cplflx collection
logical :: cplice !< default yes cplice collection (used together with cplflx)
logical :: cplwav !< default no cplwav collection
logical :: cplwav2atm !< default no wav->atm coupling
logical :: cplchm !< default no cplchm collection
logical :: cpl_imp_mrg !< default no merge import with internal forcings
logical :: cpl_imp_dbg !< default no write import data to file post merge

!--- integrated dynamics through earth's atmosphere
logical :: lsidea
Expand Down Expand Up @@ -1093,6 +1096,9 @@ module GFS_typedefs
real(kind=kind_phys) :: dspfac !< tke dissipative heating factor
real(kind=kind_phys) :: bl_upfr !< updraft fraction in boundary layer mass flux scheme
real(kind=kind_phys) :: bl_dnfr !< downdraft fraction in boundary layer mass flux scheme
real(kind=kind_phys) :: rlmx !< maximum allowed mixing length in boundary layer mass flux scheme
real(kind=kind_phys) :: elmx !< maximum allowed dissipation mixing length in boundary layer mass flux scheme
integer :: sfc_rlm !< choice of near surface mixing length in boundary layer mass flux scheme

!--- parameters for canopy heat storage (CHS) parameterization
real(kind=kind_phys) :: h0facu !< CHS factor for sensible heat flux in unstable surface layer
Expand Down Expand Up @@ -3103,9 +3109,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &

!--- coupling parameters
logical :: cplflx = .false. !< default no cplflx collection
logical :: cplice = .true. !< default yes cplice collection (used together with cplflx)
logical :: cplwav = .false. !< default no cplwav collection
logical :: cplwav2atm = .false. !< default no cplwav2atm coupling
logical :: cplchm = .false. !< default no cplchm collection
logical :: cpl_imp_mrg = .false. !< default no merge import with internal forcings
logical :: cpl_imp_dbg = .false. !< default no write import data to file post merge

!--- integrated dynamics through earth's atmosphere
logical :: lsidea = .false.
Expand Down Expand Up @@ -3496,6 +3505,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
real(kind=kind_phys) :: dspfac = 1.0 !< tke dissipative heating factor
real(kind=kind_phys) :: bl_upfr = 0.13 !< updraft fraction in boundary layer mass flux scheme
real(kind=kind_phys) :: bl_dnfr = 0.1 !< downdraft fraction in boundary layer mass flux scheme
real(kind=kind_phys) :: rlmx = 300. !< maximum allowed mixing length in boundary layer mass flux scheme
real(kind=kind_phys) :: elmx = 300. !< maximum allowed dissipation mixing length in boundary layer mass flux scheme
integer :: sfc_rlm = 0 !< choice of near surface mixing length in boundary layer mass flux scheme

!--- parameters for canopy heat storage (CHS) parameterization
real(kind=kind_phys) :: h0facu = 0.25
Expand Down Expand Up @@ -3565,7 +3577,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
naux3d, aux2d_time_avg, aux3d_time_avg, fhcyc, &
thermodyn_id, sfcpress_id, &
!--- coupling parameters
cplflx, cplwav, cplwav2atm, cplchm, lsidea, &
cplflx, cplice, cplwav, cplwav2atm, cplchm, &
cpl_imp_mrg, cpl_imp_dbg, &
lsidea, &
!--- radiation parameters
fhswr, fhlwr, levr, nfxr, iaerclm, iflip, isol, ico2, ialb, &
isot, iems, iaer, icliq_sw, iovr, ictm, isubc_sw, &
Expand Down Expand Up @@ -3650,7 +3664,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
thsfc_loc, &
! vertical diffusion
xkzm_m, xkzm_h, xkzm_s, xkzminv, moninq_fac, dspfac, &
bl_upfr, bl_dnfr, &
bl_upfr, bl_dnfr, rlmx, elmx, sfc_rlm, &
!--- canopy heat storage parameterization
h0facu, h0facs, &
!--- cellular automata
Expand Down Expand Up @@ -3840,9 +3854,12 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &

!--- coupling parameters
Model%cplflx = cplflx
Model%cplice = cplice
Model%cplwav = cplwav
Model%cplwav2atm = cplwav2atm
Model%cplchm = cplchm
Model%cpl_imp_mrg = cpl_imp_mrg
Model%cpl_imp_dbg = cpl_imp_dbg

!--- integrated dynamics through earth's atmosphere
Model%lsidea = lsidea
Expand Down Expand Up @@ -4360,6 +4377,9 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%dspfac = dspfac
Model%bl_upfr = bl_upfr
Model%bl_dnfr = bl_dnfr
Model%rlmx = rlmx
Model%elmx = elmx
Model%sfc_rlm = sfc_rlm

!--- canopy heat storage parametrization
Model%h0facu = h0facu
Expand Down Expand Up @@ -5423,9 +5443,12 @@ subroutine control_print(Model)
print *, ' '
print *, 'coupling parameters'
print *, ' cplflx : ', Model%cplflx
print *, ' cplice : ', Model%cplice
print *, ' cplwav : ', Model%cplwav
print *, ' cplwav2atm : ', Model%cplwav2atm
print *, ' cplchm : ', Model%cplchm
print *, ' cpl_imp_mrg : ', Model%cpl_imp_mrg
print *, ' cpl_imp_dbg : ', Model%cpl_imp_dbg
print *, ' '
print *, 'integrated dynamics through earth atmosphere'
print *, ' lsidea : ', Model%lsidea
Expand Down Expand Up @@ -5712,6 +5735,9 @@ subroutine control_print(Model)
print *, ' dspfac : ', Model%dspfac
print *, ' bl_upfr : ', Model%bl_upfr
print *, ' bl_dnfr : ', Model%bl_dnfr
print *, ' rlmx : ', Model%rlmx
print *, ' elmx : ', Model%elmx
print *, ' sfc_rlm : ', Model%sfc_rlm
print *, ' '
print *, 'parameters for canopy heat storage parametrization'
print *, ' h0facu : ', Model%h0facu
Expand Down
38 changes: 38 additions & 0 deletions ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -2588,6 +2588,12 @@
units = flag
dimensions = ()
type = logical
[cplice]
standard_name = flag_for_sea_ice_coupling
long_name = flag controlling cplice collection (default on)
units = flag
dimensions = ()
type = logical
[cplwav]
standard_name = flag_for_ocean_wave_coupling
long_name = flag controlling cplwav collection (default off)
Expand All @@ -2606,6 +2612,18 @@
units = flag
dimensions = ()
type = logical
[cpl_imp_mrg]
standard_name = flag_for_merging_imported_data
long_name = flag controlling cpl_imp_mrg for imported data (default off)
units = flag
dimensions = ()
type = logical
[cpl_imp_dbg]
standard_name = flag_for_debugging_merged_imported_data
long_name = flag controlling cpl_imp_dbg for imported data (default off)
units = flag
dimensions = ()
type = logical
[lsidea]
standard_name = flag_for_integrated_dynamics_through_earths_atmosphere
long_name = flag for idealized physics
Expand Down Expand Up @@ -4371,6 +4389,26 @@
dimensions = ()
type = real
kind = kind_phys
[rlmx]
standard_name = maximum_allowed_mixing_length_in_boundary_layer_mass_flux_scheme
long_name = maximum allowed mixing length in boundary layer mass flux scheme
units = m
dimensions = ()
type = real
kind = kind_phys
[elmx]
standard_name = maximum_allowed_dissipation_mixing_length_in_boundary_layer_mass_flux_scheme
long_name = maximum allowed dissipation mixing length in boundary layer mass flux scheme
units = m
dimensions = ()
type = real
kind = kind_phys
[sfc_rlm]
standard_name = choice_of_near_surface_mixing_length_in_boundary_layer_mass_flux_scheme
long_name = choice of near surface mixing length in boundary layer mass flux scheme
units = none
dimensions = ()
type = integer
[h0facu]
standard_name = multiplicative_tuning_parameter_for_reduced_surface_heat_fluxes_due_to_canopy_heat_storage
long_name = canopy heat storage factor for sensible heat flux in unstable surface layer
Expand Down
95 changes: 95 additions & 0 deletions ccpp/suites/suite_FV3_HAFS_v0_gfdlmp_tedmf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="FV3_HAFS_v0_gfdlmp_tedmf" version="1">
<!-- <init></init> -->
<group name="fast_physics">
<subcycle loop="1">
<scheme>fv_sat_adj</scheme>
</subcycle>
</group>
<group name="time_vary">
<subcycle loop="1">
<scheme>GFS_time_vary_pre</scheme>
<scheme>GFS_rrtmg_setup</scheme>
<scheme>GFS_rad_time_vary</scheme>
<scheme>GFS_phys_time_vary</scheme>
</subcycle>
</group>
<group name="radiation">
<subcycle loop="1">
<scheme>GFS_suite_interstitial_rad_reset</scheme>
<scheme>GFS_rrtmg_pre</scheme>
<scheme>GFS_radiation_surface</scheme>
<scheme>rrtmg_sw_pre</scheme>
<scheme>rrtmg_sw</scheme>
<scheme>rrtmg_sw_post</scheme>
<scheme>rrtmg_lw_pre</scheme>
<scheme>rrtmg_lw</scheme>
<scheme>rrtmg_lw_post</scheme>
<scheme>GFS_rrtmg_post</scheme>
</subcycle>
</group>
<group name="physics">
<subcycle loop="1">
<scheme>GFS_suite_interstitial_phys_reset</scheme>
<scheme>GFS_suite_stateout_reset</scheme>
<scheme>get_prs_fv3</scheme>
<scheme>GFS_suite_interstitial_1</scheme>
<scheme>GFS_surface_generic_pre</scheme>
<scheme>GFS_surface_composites_pre</scheme>
<scheme>dcyc2t3</scheme>
<scheme>GFS_surface_composites_inter</scheme>
<scheme>GFS_suite_interstitial_2</scheme>
</subcycle>
<!-- Surface iteration loop -->
<subcycle loop="2">
<scheme>sfc_diff</scheme>
<scheme>GFS_surface_loop_control_part1</scheme>
<scheme>sfc_nst_pre</scheme>
<scheme>sfc_nst</scheme>
<scheme>sfc_nst_post</scheme>
<scheme>lsm_noah</scheme>
<scheme>sfc_sice</scheme>
<scheme>GFS_surface_loop_control_part2</scheme>
</subcycle>
<!-- End of surface iteration loop -->
<subcycle loop="1">
<scheme>GFS_surface_composites_post</scheme>
<scheme>sfc_diag</scheme>
<scheme>sfc_diag_post</scheme>
<scheme>GFS_surface_generic_post</scheme>
<scheme>GFS_PBL_generic_pre</scheme>
<scheme>satmedmfvdifq</scheme>
<scheme>GFS_PBL_generic_post</scheme>
<scheme>GFS_GWD_generic_pre</scheme>
<scheme>cires_ugwp</scheme>
<scheme>cires_ugwp_post</scheme>
<scheme>GFS_GWD_generic_post</scheme>
<scheme>rayleigh_damp</scheme>
<scheme>GFS_suite_stateout_update</scheme>
<scheme>ozphys_2015</scheme>
<scheme>h2ophys</scheme>
<scheme>get_phi_fv3</scheme>
<scheme>GFS_suite_interstitial_3</scheme>
<scheme>GFS_DCNV_generic_pre</scheme>
<scheme>samfdeepcnv</scheme>
<scheme>GFS_DCNV_generic_post</scheme>
<scheme>GFS_SCNV_generic_pre</scheme>
<scheme>samfshalcnv</scheme>
<scheme>GFS_SCNV_generic_post</scheme>
<scheme>GFS_suite_interstitial_4</scheme>
<scheme>cnvc90</scheme>
<scheme>GFS_MP_generic_pre</scheme>
<scheme>gfdl_cloud_microphys</scheme>
<scheme>GFS_MP_generic_post</scheme>
<scheme>maximum_hourly_diagnostics</scheme>
<scheme>phys_tend</scheme>
</subcycle>
</group>
<group name="stochastics">
<subcycle loop="1">
<scheme>GFS_stochastics</scheme>
</subcycle>
</group>
<!-- <finalize></finalize> -->
</suite>
Loading

0 comments on commit c52bb0b

Please sign in to comment.