Skip to content

Commit

Permalink
Merge pull request #98 from grantfirl/ufs-dev-PR73
Browse files Browse the repository at this point in the history
UFS-dev PR#73
  • Loading branch information
grantfirl authored Sep 7, 2023
2 parents 0db2dca + 5a47e42 commit 730c5d9
Show file tree
Hide file tree
Showing 24 changed files with 6,277 additions and 5,755 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ add_library(fv3atm
cpl/module_block_data.F90
cpl/module_cplfields.F90
cpl/module_cap_cpl.F90
io/clm_lake_io.F90
io/FV3GFS_io.F90
io/FV3GFS_restart_io.F90
io/fv3atm_common_io.F90
io/fv3atm_clm_lake_io.F90
io/fv3atm_rrfs_sd_io.F90
io/fv3atm_sfc_io.F90
io/fv3atm_oro_io.F90
io/fv3atm_history_io.F90
io/fv3atm_restart_io.F90
io/module_write_netcdf.F90
io/module_write_restart_netcdf.F90
io/module_fv3_io_def.F90
Expand Down
29 changes: 15 additions & 14 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ module atmos_model_mod

use stochastic_physics_wrapper_mod, only: stochastic_physics_wrapper,stochastic_physics_wrapper_end

use FV3GFS_io_mod, only: FV3GFS_restart_read, FV3GFS_restart_write, &
FV3GFS_GFS_checksum, &
FV3GFS_diag_register, FV3GFS_diag_output, &
use fv3atm_history_io_mod, only: fv3atm_diag_register, fv3atm_diag_output, &
DIAG_SIZE
use FV3GFS_restart_io_mod, only: FV3GFS_restart_register, &
use fv3atm_restart_io_mod, only: fv3atm_restart_register, &
fv3atm_checksum, &
fv_phy_restart_output, &
fv_sfc_restart_output
fv_sfc_restart_output, &
fv3atm_restart_read, &
fv3atm_restart_write
use fv_ufs_restart_io_mod, only: fv_dyn_restart_register, &
fv_dyn_restart_output
use fv_iau_mod, only: iau_external_data_type,getiauforcing,iau_initialize
Expand Down Expand Up @@ -369,7 +370,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'RADIATION STEP ', GFS_control%kdt, GFS_control%fhour
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif

if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "physics driver"
Expand All @@ -383,7 +384,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'PHYSICS STEP1 ', GFS_control%kdt, GFS_control%fhour
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif

if (GFS_Control%do_sppt .or. GFS_Control%do_shum .or. GFS_Control%do_skeb .or. &
Expand All @@ -402,7 +403,7 @@ subroutine update_atmos_radiation_physics (Atmos)

if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'PHYSICS STEP2 ', GFS_control%kdt, GFS_control%fhour
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif
call getiauforcing(GFS_control,IAU_data)
if (mpp_pe() == mpp_root_pe() .and. debug) write(6,*) "end of radiation and physics step"
Expand Down Expand Up @@ -736,15 +737,15 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
!rab call atmosphere_tracer_postinit (GFS_data, Atm_block)

call atmosphere_nggps_diag (Time, init=.true.)
call FV3GFS_diag_register (GFS_Diag, Time, Atm_block, GFS_control, Atmos%lon, Atmos%lat, Atmos%axes)
call fv3atm_diag_register (GFS_Diag, Time, Atm_block, GFS_control, Atmos%lon, Atmos%lat, Atmos%axes)
call GFS_restart_populate (GFS_restart_var, GFS_control, GFS_data%Statein, GFS_data%Stateout, GFS_data%Sfcprop, &
GFS_data%Coupling, GFS_data%Grid, GFS_data%Tbd, GFS_data%Cldprop, GFS_data%Radtend, &
GFS_data%IntDiag, Init_parm, GFS_Diag)
if (quilting_restart) then
call fv_dyn_restart_register (Atm(mygrid))
call FV3GFS_restart_register (GFS_data%Sfcprop, GFS_restart_var, Atm_block, GFS_control)
call fv3atm_restart_register (GFS_data%Sfcprop, GFS_restart_var, Atm_block, GFS_control)
endif
call FV3GFS_restart_read (GFS_data, GFS_restart_var, Atm_block, GFS_control, Atmos%domain_for_read, &
call fv3atm_restart_read (GFS_data, GFS_restart_var, Atm_block, GFS_control, Atmos%domain_for_read, &
Atm(mygrid)%flagstruct%warm_start, ignore_rst_cksum)
if(GFS_control%do_ca .and. Atm(mygrid)%flagstruct%warm_start)then
call read_ca_restart (Atmos%domain,GFS_control%ncells,GFS_control%nca,GFS_control%ncells_g,GFS_control%nca_g)
Expand Down Expand Up @@ -966,7 +967,7 @@ subroutine update_atmos_model_state (Atmos, rc)
if (chksum_debug) then
if (mpp_pe() == mpp_root_pe()) print *,'UPDATE STATE ', GFS_control%kdt, GFS_control%fhour
if (mpp_pe() == mpp_root_pe()) print *,'in UPDATE STATE ', size(GFS_data(1)%SfcProp%tsfc),'nblks=',Atm_block%nblks
call FV3GFS_GFS_checksum(GFS_control, GFS_data, Atm_block)
call fv3atm_checksum(GFS_control, GFS_data, Atm_block)
endif

!--- advance time ---
Expand Down Expand Up @@ -995,7 +996,7 @@ subroutine update_atmos_model_state (Atmos, rc)
endif
if (mpp_pe() == mpp_root_pe()) write(6,*) ' gfs diags time since last bucket empty: ',time_int/3600.,'hrs'
call atmosphere_nggps_diag(Atmos%Time)
call FV3GFS_diag_output(Atmos%Time, GFS_Diag, Atm_block, GFS_control%nx, GFS_control%ny, &
call fv3atm_diag_output(Atmos%Time, GFS_Diag, Atm_block, GFS_control%nx, GFS_control%ny, &
GFS_control%levs, 1, 1, 1.0_GFS_kind_phys, time_int, time_intfull, &
GFS_control%fhswr, GFS_control%fhlwr)
endif
Expand Down Expand Up @@ -1109,7 +1110,7 @@ subroutine atmos_model_restart(Atmos, timestamp)
call fv_dyn_restart_output(Atm(mygrid), timestamp)
else
call atmosphere_restart(timestamp)
call FV3GFS_restart_write (GFS_data, GFS_restart_var, Atm_block, &
call fv3atm_restart_write (GFS_data, GFS_restart_var, Atm_block, &
GFS_control, Atmos%domain, timestamp)
endif
if(GFS_control%do_ca)then
Expand Down
6 changes: 3 additions & 3 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@
'physics/physics/cu_gf_driver_pre.F90',
'physics/physics/cu_gf_driver.F90',
'physics/physics/cu_gf_driver_post.F90',
'physics/physics/cu_unified_driver_pre.F90',
'physics/physics/cu_unified_driver.F90',
'physics/physics/cu_unified_driver_post.F90',
'physics/physics/cu_c3_driver_pre.F90',
'physics/physics/cu_c3_driver.F90',
'physics/physics/cu_c3_driver_post.F90',
'physics/physics/hedmf.f',
'physics/physics/moninshoc.f',
'physics/physics/satmedmfvdif.F',
Expand Down
48 changes: 33 additions & 15 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ module GFS_typedefs
integer :: imfshalcnv_samf = 2 !< flag for SAMF scale- & aerosol-aware mass-flux shallow convection scheme
integer :: imfshalcnv_gf = 3 !< flag for scale- & aerosol-aware Grell-Freitas scheme (GSD)
integer :: imfshalcnv_ntiedtke = 4 !< flag for new Tiedtke scheme (CAPS)
integer :: imfshalcnv_unified = 5 !< flag for the unified convection scheme
integer :: imfshalcnv_c3 = 5 !< flag for the Community Convective Cloud (C3) scheme
logical :: hwrf_samfdeep !< flag for HWRF SAMF deepcnv scheme (HWRF)
logical :: progsigma !< flag for prognostic area fraction in samf ddepcnv scheme (GFS)
integer :: imfdeepcnv !< flag for mass-flux deep convection scheme
Expand All @@ -1160,13 +1160,16 @@ module GFS_typedefs
integer :: imfdeepcnv_samf = 2 !< flag for SAMF scale- & aerosol-aware mass-flux deep convection scheme
integer :: imfdeepcnv_gf = 3 !< flag for scale- & aerosol-aware Grell-Freitas scheme (GSD)
integer :: imfdeepcnv_ntiedtke = 4 !< flag for new Tiedtke scheme (CAPS)
integer :: imfdeepcnv_unified = 5 !< flag for the unified convection scheme
integer :: imfdeepcnv_c3 = 5 !< flag for the Community Convective Cloud (C3) scheme
logical :: hwrf_samfshal !< flag for HWRF SAMF shalcnv scheme (HWRF)
integer :: isatmedmf !< flag for scale-aware TKE-based moist edmf scheme
!< 0: initial version of satmedmf (Nov. 2018)
!< 1: updated version of satmedmf (as of May 2019)
integer :: isatmedmf_vdif = 0 !< flag for initial version of satmedmf (Nov. 2018)
integer :: isatmedmf_vdifq = 1 !< flag for updated version of satmedmf (as of May 2019)
integer :: ichoice = 0 !< flag for closure of C3/GF deep convection
integer :: ichoicem = 13!< flag for closure of C3/GF mid convection
integer :: ichoice_s = 3 !< flag for closure of C3/GF shallow convection

integer :: nmtvr !< number of topographic variables such as variance etc
!< used in the GWD parameterization - 10 more added if
Expand Down Expand Up @@ -2686,7 +2689,7 @@ subroutine sfcprop_create (Sfcprop, IM, Model)
Sfcprop%cqs2 = clear_val
Sfcprop%lh = clear_val
end if
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_unified) then
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then
allocate (Sfcprop%maxupmf(IM))
allocate (Sfcprop%conv_act(IM))
allocate (Sfcprop%conv_act_m(IM))
Expand Down Expand Up @@ -3138,7 +3141,7 @@ subroutine coupling_create (Coupling, IM, Model)
Coupling%rrfs_hwp = clear_val
endif

if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_unified) then
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then
allocate (Coupling%qci_conv (IM,Model%levs))
Coupling%qci_conv = clear_val
endif
Expand Down Expand Up @@ -3802,6 +3805,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer :: spp_gwd = 0
logical :: do_spp = .false.

integer :: ichoice = 0 !< flag for closure of C3/GF deep convection
integer :: ichoicem = 13!< flag for closure of C3/GF mid convection
integer :: ichoice_s = 3 !< flag for closure of C3/GF shallow convection

!-- chem nml variables for RRFS-SD
real(kind=kind_phys) :: dust_alpha = 0.
real(kind=kind_phys) :: dust_gamma = 0.
Expand Down Expand Up @@ -3974,6 +3981,8 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
wetdep_ls_opt, smoke_forecast, aero_ind_fdb, aero_dir_fdb, &
rrfs_smoke_debug, do_plumerise, plumerisefire_frq, &
addsmoke_flag, enh_mix, mix_chem, smoke_dir_fdb_coef, &
!--- C3/GF closures
ichoice,ichoicem,ichoice_s, &
!--- (DFI) time ranges with radar-prescribed microphysics tendencies
! and (maybe) convection suppression
fh_dfi_radar, radar_tten_limits, do_cap_suppress, &
Expand Down Expand Up @@ -4090,17 +4099,17 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
write(*,*) 'NO FLAG: pbl is generic'
endif

if(imfshalcnv == Model%imfshalcnv_gf .or. imfshalcnv == Model%imfshalcnv_unified) then
if(imfshalcnv == Model%imfshalcnv_gf .or. imfshalcnv == Model%imfshalcnv_c3) then
if(me==master) &
write(*,*) 'FLAG: imfshalcnv_gf or imfshalcnv_unified so scnv not generic'
write(*,*) 'FLAG: imfshalcnv_gf or imfshalcnv_c3 so scnv not generic'
Model%flag_for_scnv_generic_tend=.false.
elseif(me==master) then
write(*,*) 'NO FLAG: scnv is generic'
endif

if(imfdeepcnv == Model%imfdeepcnv_gf .or. imfdeepcnv == Model%imfdeepcnv_unified) then
if(imfdeepcnv == Model%imfdeepcnv_gf .or. imfdeepcnv == Model%imfdeepcnv_c3) then
if(me==master) &
write(*,*) 'FLAG: imfdeepcnv_gf or imfdeepcnv_unified so dcnv not generic'
write(*,*) 'FLAG: imfdeepcnv_gf or imfdeepcnv_c3 so dcnv not generic'
Model%flag_for_dcnv_generic_tend=.false.
elseif(me==master) then
write(*,*) 'NO FLAG: dcnv is generic'
Expand Down Expand Up @@ -4207,6 +4216,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &

Model%fire_aux_data_levels = 10

Model%ichoice_s = ichoice_s
Model%ichoicem = ichoicem
Model%ichoice = ichoice

!--- integrated dynamics through earth's atmosphere
Model%lsidea = lsidea
if (Model%lsidea) then
Expand Down Expand Up @@ -5655,7 +5668,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
print *,' Grell-Freitas scale & aerosol-aware mass-flux deep conv scheme'
elseif(Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke) then
print *,' New Tiedtke cumulus scheme'
elseif(Model%imfdeepcnv == Model%imfdeepcnv_unified) then
elseif(Model%imfdeepcnv == Model%imfdeepcnv_c3) then
print *,' New unified cumulus convection scheme'
endif
endif
Expand Down Expand Up @@ -5700,7 +5713,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
print *,' Grell-Freitas scale- & aerosol-aware mass-flux shallow conv scheme (2013)'
elseif (Model%imfshalcnv == Model%imfshalcnv_ntiedtke) then
print *,' New Tiedtke cumulus scheme'
elseif (Model%imfshalcnv == Model%imfshalcnv_unified) then
elseif (Model%imfshalcnv == Model%imfshalcnv_c3) then
print *,' New unified cumulus scheme'
else
print *,' unknown mass-flux scheme in use - defaulting to no shallow convection'
Expand Down Expand Up @@ -5948,7 +5961,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
endif

if(Model%ras .or. Model%cscnv) Model%cnvcld = .false.
if(Model%do_shoc .or. Model%pdfcld .or. Model%do_mynnedmf .or. Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_unified) Model%cnvcld = .false.
if(Model%do_shoc .or. Model%pdfcld .or. Model%do_mynnedmf .or. Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) Model%cnvcld = .false.
if(Model%cnvcld) Model%ncnvcld3d = 1

!--- get cnvwind index in phy_f2d; last entry in phy_f2d array
Expand Down Expand Up @@ -6014,7 +6027,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%lmfdeep2 = (Model%imfdeepcnv == Model%imfdeepcnv_samf &
.or. Model%imfdeepcnv == Model%imfdeepcnv_gf &
.or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke &
.or. Model%imfdeepcnv == Model%imfdeepcnv_unified)
.or. Model%imfdeepcnv == Model%imfdeepcnv_c3)
!--- END CODE FROM GLOOPR

!--- BEGIN CODE FROM GLOOPB
Expand Down Expand Up @@ -6269,6 +6282,11 @@ subroutine control_print(Model)
print *, ' cpl_imp_mrg : ', Model%cpl_imp_mrg
print *, ' cpl_imp_dbg : ', Model%cpl_imp_dbg
print *, ' use_med_flux : ', Model%use_med_flux
if(Model%imfdeepcnv == Model%imfdeepcnv_gf .or.Model%imfdeepcnv == Model%imfdeepcnv_c3) then
print*,'ichoice_s : ', Model%ichoice_s
print*,'ichoicem : ', Model%ichoicem
print*,'ichoice : ', Model%ichoice
endif
if(model%rrfs_sd) then
print *, ' '
print *, 'smoke parameters'
Expand Down Expand Up @@ -6953,7 +6971,7 @@ subroutine tbd_create (Tbd, IM, Model)
allocate (Tbd%hpbl (IM))
Tbd%hpbl = clear_val

if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfdeepcnv == Model%imfdeepcnv_samf .or. Model%imfshalcnv == Model%imfshalcnv_samf .or. Model%imfdeepcnv == Model%imfdeepcnv_unified .or. Model%imfshalcnv == Model%imfshalcnv_unified) then
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfdeepcnv == Model%imfdeepcnv_samf .or. Model%imfshalcnv == Model%imfshalcnv_samf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3 .or. Model%imfshalcnv == Model%imfshalcnv_c3) then
allocate(Tbd%prevsq(IM, Model%levs))
Tbd%prevsq = clear_val
endif
Expand All @@ -6963,7 +6981,7 @@ subroutine tbd_create (Tbd, IM, Model)
Tbd%ud_mf = zero
endif

if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfdeepcnv == Model%imfdeepcnv_unified) then
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_ntiedtke .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then
allocate(Tbd%forcet(IM, Model%levs))
allocate(Tbd%forceq(IM, Model%levs))
allocate(Tbd%forcet(IM, Model%levs))
Expand All @@ -6973,7 +6991,7 @@ subroutine tbd_create (Tbd, IM, Model)
Tbd%prevst = clear_val
end if

if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_unified) then
if (Model%imfdeepcnv == Model%imfdeepcnv_gf .or. Model%imfdeepcnv == Model%imfdeepcnv_c3) then
allocate(Tbd%cactiv(IM))
allocate(Tbd%cactiv_m(IM))
allocate(Tbd%aod_gf(IM))
Expand Down
Loading

0 comments on commit 730c5d9

Please sign in to comment.