Skip to content

Commit

Permalink
Ensure consistency between model namelist and CCPP suite definition f…
Browse files Browse the repository at this point in the history
…ile UPDATED with head of DEVELOP (#302)

- Add compatibility/consistency checks for namelists in different CCPP schemes. For example, `do_ysu` needs to set to `true` when `ysudif` scheme is used in the suite definition files.
- Fix a typo in GFS_typedefs.meta: imfshalcnv_ntiedtke is typed as imfshalcnv_gf.
- Integer options for PBL and surface layer schemes are not implemented.

Co-authored-by: XiaSun-NOAA <[email protected]>
  • Loading branch information
climbfuji and XiaSun-Atmos authored May 19, 2021
1 parent 4279a1f commit e911a8e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 18 deletions.
1 change: 1 addition & 0 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
Init_parm%xlon => Atmos%lon
Init_parm%xlat => Atmos%lat
Init_parm%area => Atmos%area
Init_parm%nwat = Atm(mygrid)%flagstruct%nwat
Init_parm%tracer_names => tracer_names
Init_parm%restart = Atm(mygrid)%flagstruct%warm_start
Init_parm%hydrostatic = Atm(mygrid)%flagstruct%hydrostatic
Expand Down
75 changes: 60 additions & 15 deletions ccpp/data/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ module GFS_typedefs
real(kind=kind_phys), pointer :: xlat(:,:) !< column latitude for MPI rank
real(kind=kind_phys), pointer :: area(:,:) !< column area for length scale calculations

integer :: nwat !< number of hydrometeors in dcyore (including water vapor)
character(len=32), pointer :: tracer_names(:) !< tracers names to dereference tracer id
!< based on name location in array
character(len=64) :: fn_nml !< namelist filename
Expand Down Expand Up @@ -2907,7 +2908,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
logunit, isc, jsc, nx, ny, levs, &
cnx, cny, gnx, gny, dt_dycore, &
dt_phys, iau_offset, idat, jdat, &
tracer_names, &
nwat, tracer_names, &
input_nml_file, tile_num, blksz, &
ak, bk, restart, hydrostatic, &
communicator, ntasks, nthreads)
Expand Down Expand Up @@ -2941,6 +2942,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer, intent(in) :: iau_offset
integer, intent(in) :: idat(8)
integer, intent(in) :: jdat(8)
integer, intent(in) :: nwat
character(len=32), intent(in) :: tracer_names(:)
character(len=256), intent(in), pointer :: input_nml_file(:)
integer, intent(in) :: blksz(:)
Expand Down Expand Up @@ -3923,9 +3925,33 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
end if
! *DH

if (Model%lsm==Model%lsm_noah_wrfv4) then
if (Model%lsoil_lsm/=4) then
write(0,*) 'Error in GFS_typedefs.F90, number of soil layers must be 4 for Noah_WRFv4'
stop
end if
elseif (Model%lsm==Model%lsm_ruc) then
if (Model%lsoil_lsm/=9) then
write(0,*) 'Error in GFS_typedefs.F90, number of soil layers must be 9 for RUC'
stop
end if
end if

! Set number of ice model layers
Model%kice = kice

if (Model%lsm==Model%lsm_noah .or. Model%lsm==Model%lsm_noahmp .or. Model%lsm==Model%lsm_noah_wrfv4) then
if (kice/=2) then
write(0,*) 'Error in GFS_typedefs.F90, number of ice model layers must be 2 for Noah/NoahMP/Noah_WRFv4'
stop
end if
elseif (Model%lsm==Model%lsm_ruc) then
if (kice/=9) then
write(0,*) 'Error in GFS_typedefs.F90, number of ice model layers must be 9 for RUC'
stop
end if
end if

! Allocate variable for min/max soil moisture for a given soil type
allocate (Model%pores(30))
allocate (Model%resid(30))
Expand Down Expand Up @@ -4642,6 +4668,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%nqvdelt = 4
Model%nps2delt = 1
Model%npsdelt = 2
if (nwat /= 2) then
print *,' Zhao-Carr MP requires nwat to be set to 2 - job aborted'
stop
end if
if (Model%me == Model%master) print *,' Using Zhao/Carr/Sundqvist Microphysics'

elseif (Model%imp_physics == Model%imp_physics_zhao_carr_pdf) then !Zhao Microphysics with PDF cloud
Expand All @@ -4651,9 +4681,6 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%ncnd = 1
if (Model%me == Model%master) print *,'Using Zhao/Carr/Sundqvist Microphysics with PDF Cloud'

!else if (Model%imp_physics == 5) then ! F-A goes here
! print *,' Ferrier Microphysics scheme has been deprecated - job aborted'
! stop
else if (Model%imp_physics == Model%imp_physics_fer_hires) then ! Ferrier-Aligo scheme
Model%npdf3d = 0
Model%num_p3d = 3
Expand All @@ -4665,22 +4692,27 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%nleffr = 1
Model%nieffr = 2
Model%nseffr = 3
if (nwat /= 4) then
print *,' Ferrier-Aligo MP requires nwat to be set to 4 - job aborted'
stop
end if
if (Model%me == Model%master) print *,' Using Ferrier-Aligo MP scheme', &
' microphysics', &
' lradar =',Model%lradar


elseif (Model%imp_physics == Model%imp_physics_wsm6) then !WSM6 microphysics
Model%npdf3d = 0
Model%num_p3d = 3
Model%num_p2d = 1
Model%pdfcld = .false.
Model%shcnvcw = .false.
Model%ncnd = 5
Model%nleffr = 1
Model%nieffr = 2
Model%nseffr = 3
if (Model%me == Model%master) print *,' Using wsm6 microphysics'
print *,' Error, WSM6 no longer supported - job aborted'
stop
!Model%npdf3d = 0
!Model%num_p3d = 3
!Model%num_p2d = 1
!Model%pdfcld = .false.
!Model%shcnvcw = .false.
!Model%ncnd = 5
!Model%nleffr = 1
!Model%nieffr = 2
!Model%nseffr = 3
!if (Model%me == Model%master) print *,' Using wsm6 microphysics'

elseif (Model%imp_physics == Model%imp_physics_thompson) then !Thompson microphysics
Model%npdf3d = 0
Expand All @@ -4692,6 +4724,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%nleffr = 1
Model%nieffr = 2
Model%nseffr = 3
if (nwat /= 6) then
print *,' Thompson MP requires nwat to be set to 6 - job aborted'
stop
end if
if (.not. Model%effr_in) then
print *,' Thompson MP requires effr_in to be set to .true. - job aborted'
stop
Expand All @@ -4716,6 +4752,10 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%nieffr = 3
Model%nreffr = 4
Model%nseffr = 5
if (nwat /= 6) then
print *,' Morrison-Gettelman MP requires nwat to be set to 6 - job aborted'
stop
end if
if (abs(Model%fprcp) == 1) then
Model%ncnd = 4
elseif (Model%fprcp >= 2) then
Expand Down Expand Up @@ -4763,8 +4803,13 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%pdfcld = .false.
Model%shcnvcw = .false.
Model%ncnd = 5
if (nwat /= 6) then
print *,' GFDL MP requires nwat to be set to 6 - job aborted'
stop
end if
if (Model%me == Model%master) print *,' avg_max_length=',Model%avg_max_length
if (Model%me == Model%master) print *,' Using GFDL Cloud Microphysics'

else
if (Model%me == Model%master) print *,'Wrong imp_physics value. Job abort.'
stop
Expand Down
2 changes: 1 addition & 1 deletion ccpp/data/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3806,7 +3806,7 @@
units = flag
dimensions = ()
type = integer
[imfshalcnv_gf]
[imfshalcnv_ntiedtke]
standard_name = flag_for_ntiedtke_shallow_convection_scheme
long_name = flag for new Tiedtke shallow convection scheme
units = flag
Expand Down
3 changes: 2 additions & 1 deletion ccpp/driver/GFS_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ subroutine GFS_initialize (Model, Statein, Stateout, Sfcprop, &
Init_parm%gnx, Init_parm%gny, &
Init_parm%dt_dycore, Init_parm%dt_phys, &
Init_parm%iau_offset, Init_parm%bdat, &
Init_parm%cdat, Init_parm%tracer_names, &
Init_parm%cdat, Init_parm%nwat, &
Init_parm%tracer_names, &
Init_parm%input_nml_file, Init_parm%tile_num, &
Init_parm%blksz, Init_parm%ak, Init_parm%bk, &
Init_parm%restart, Init_parm%hydrostatic, &
Expand Down
2 changes: 1 addition & 1 deletion ccpp/physics
Submodule physics updated 51 files
+9 −1 physics/GFS_rrtmg_setup.F90
+8 −0 physics/GFS_rrtmg_setup.meta
+11 −3 physics/GFS_rrtmgp_setup.F90
+8 −0 physics/GFS_rrtmgp_setup.meta
+10 −1 physics/cires_ugwp.F90
+8 −0 physics/cires_ugwp.meta
+14 −2 physics/cu_gf_driver.F90
+32 −0 physics/cu_gf_driver.meta
+19 −1 physics/cu_ntiedtke.F90
+32 −0 physics/cu_ntiedtke.meta
+18 −1 physics/drag_suite.F90
+30 −0 physics/drag_suite.meta
+16 −1 physics/gcm_shoc.F90
+30 −0 physics/gcm_shoc.meta
+38 −2 physics/gscond.f
+41 −0 physics/gscond.meta
+16 −1 physics/h2ophys.f
+30 −0 physics/h2ophys.meta
+16 −1 physics/module_MYJPBL_wrapper.F90
+30 −0 physics/module_MYJPBL_wrapper.meta
+17 −1 physics/module_MYJSFC_wrapper.F90
+30 −0 physics/module_MYJSFC_wrapper.meta
+10 −2 physics/module_MYNNPBL_wrapper.F90
+8 −0 physics/module_MYNNPBL_wrapper.meta
+10 −1 physics/module_MYNNSFC_wrapper.F90
+8 −0 physics/module_MYNNSFC_wrapper.meta
+12 −2 physics/moninedmf.f
+8 −0 physics/moninedmf.meta
+18 −1 physics/moninshoc.f
+30 −0 physics/moninshoc.meta
+36 −1 physics/precpd.f
+46 −0 physics/precpd.meta
+17 −1 physics/samfdeepcnv.f
+38 −0 physics/samfdeepcnv.meta
+17 −1 physics/samfshalcnv.f
+38 −0 physics/samfshalcnv.meta
+10 −1 physics/satmedmfvdif.F
+10 −0 physics/satmedmfvdif.meta
+11 −1 physics/satmedmfvdifq.F
+8 −0 physics/satmedmfvdifq.meta
+11 −1 physics/sfc_drv.f
+16 −0 physics/sfc_drv.meta
+8 −0 physics/sfc_drv_ruc.F90
+12 −2 physics/sfc_noahmp_drv.F90
+16 −0 physics/sfc_noahmp_drv.meta
+16 −1 physics/shinhongvdif.F90
+30 −0 physics/shinhongvdif.meta
+10 −2 physics/unified_ugwp.F90
+8 −0 physics/unified_ugwp.meta
+16 −1 physics/ysuvdif.F90
+30 −0 physics/ysuvdif.meta

0 comments on commit e911a8e

Please sign in to comment.