Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 131 additions & 53 deletions scm/src/GFS_typedefs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,11 @@ module GFS_typedefs
!
integer :: fire_aux_data_levels !< vertical levels of fire auxiliary data

!--- dycore control parameters
integer :: dycore_active !< Choice of dynamical core
integer :: dycore_fv3 = 1 !< Choice of FV3 dynamical core
integer :: dycore_mpas = 2 !< Choice of MPAS dynamical core

!--- coupling parameters
logical :: cplflx !< default no cplflx collection
logical :: cplice !< default no cplice collection (used together with cplflx)
Expand Down Expand Up @@ -3372,15 +3377,15 @@ end subroutine coupling_create
!----------------------
! GFS_control_type%init
!----------------------
subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
logunit, isc, jsc, nx, ny, levs, &
cnx, cny, gnx, gny, dt_dycore, &
subroutine control_initialize (Model, nlunit, fn_nml, me, &
master, logunit, levs, dt_dycore, &
dt_phys, iau_offset, idat, jdat, &
nwat, tracer_names, tracer_types, &
input_nml_file, tile_num, blksz, &
ak, bk, restart, hydrostatic, &
communicator, ntasks, nthreads)

input_nml_file, blksz, restart, &
communicator, ntasks, nthreads, &
tile_num, isc, jsc, nx, ny, cnx, &
cny, gnx, gny, ak, bk, hydrostatic)

!--- modules
use physcons, only: con_rerth, con_pi, con_p0, rhowater
use mersenne_twister, only: random_setseed, random_number
Expand All @@ -3395,16 +3400,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer, intent(in) :: me
integer, intent(in) :: master
integer, intent(in) :: logunit
integer, intent(in) :: tile_num
integer, intent(in) :: isc
integer, intent(in) :: jsc
integer, intent(in) :: nx
integer, intent(in) :: ny
integer, intent(in) :: levs
integer, intent(in) :: cnx
integer, intent(in) :: cny
integer, intent(in) :: gnx
integer, intent(in) :: gny
real(kind=kind_phys), intent(in) :: dt_dycore
real(kind=kind_phys), intent(in) :: dt_phys
integer, intent(in) :: iau_offset
Expand All @@ -3415,13 +3411,23 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer, intent(in) :: tracer_types(:)
character(len=:), intent(in), dimension(:), pointer :: input_nml_file
integer, intent(in) :: blksz(:)
real(kind=kind_phys), dimension(:), intent(in) :: ak
real(kind=kind_phys), dimension(:), intent(in) :: bk
logical, intent(in) :: restart
logical, intent(in) :: hydrostatic
type(MPI_Comm), intent(in) :: communicator
integer, intent(in) :: ntasks
integer, intent(in) :: nthreads
!--- optional variables (Dycore specific)
integer, optional, intent(in) :: tile_num
integer, optional, intent(in) :: isc
integer, optional, intent(in) :: jsc
integer, optional, intent(in) :: nx
integer, optional, intent(in) :: ny
integer, optional, intent(in) :: cnx
integer, optional, intent(in) :: cny
integer, optional, intent(in) :: gnx
integer, optional, intent(in) :: gny
logical, optional, intent(in) :: hydrostatic
real(kind_phys), optional, dimension(:), intent(in) :: ak
real(kind_phys), optional, dimension(:), intent(in) :: bk

!--- local variables
integer :: i, j, n
Expand Down Expand Up @@ -4335,6 +4341,58 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
integer :: ncid, dimID, varID, status, ntime_sim_data, nlev_sim_data, errflg
character(len=256) :: errmsg

!--- If initializing model with FV3 dynamical core.
if (Model%dycore_active == Model%dycore_fv3) then
if (.not. present(tile_num)) then
write(6,*) 'ERROR: <tile_num> is required when using FV3 dynamical core'
stop
endif
if (.not. present(isc)) then
write(6,*) 'ERROR: <isc> is required when using FV3 dynamical core'
stop
endif
if (.not. present(jsc)) then
write(6,*) 'ERROR: <jsc> is required when using FV3 dynamical core'
stop
endif
if (.not. present(nx)) then
write(6,*) 'ERROR: <nx> is required when using FV3 dynamical core'
stop
endif
if (.not. present(ny)) then
write(6,*) 'ERROR: <ny> is required when using FV3 dynamical core'
stop
endif
if (.not. present(cnx)) then
write(6,*) 'ERROR: <cnx> is required when using FV3 dynamical core'
stop
endif
if (.not. present(cny)) then
write(6,*) 'ERROR: <cny> is required when using FV3 dynamical core'
stop
endif
if (.not. present(gnx)) then
write(6,*) 'ERROR: <gnx> is required when using FV3 dynamical core'
stop
endif
if (.not. present(gny)) then
write(6,*) 'ERROR: <gny> is required when using FV3 dynamical core'
stop
endif
if (.not. present(hydrostatic)) then
write(6,*) 'ERROR: <hydrostatic> is required when using FV3 dynamical core'
stop
endif
if (.not. present(ak)) then
write(6,*) 'ERROR: <ak> is required when using FV3 dynamical core'
stop
endif
if (.not. present(bk)) then
write(6,*) 'ERROR: <bk> is required when using FV3 dynamical core'
stop
endif
endif

! dtend selection: default is to match all variables:
dtend_select(1)='*'
do ipat=2,pat_count
Expand Down Expand Up @@ -4526,23 +4584,28 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%sfcpress_id = sfcpress_id
Model%gen_coord_hybrid = gen_coord_hybrid

!--- set some grid extent parameters
Model%tile_num = tile_num
Model%isc = isc
Model%jsc = jsc
Model%nx = nx
Model%ny = ny
!--- set some grid extent parameters (dycore specific)
if (Model%dycore_active == Model%dycore_fv3) then
Model%tile_num = tile_num
Model%isc = isc
Model%jsc = jsc
Model%nx = nx
Model%ny = ny
allocate (Model%ak(1:size(ak)))
allocate (Model%bk(1:size(bk)))
Model%ak = ak
Model%bk = bk
Model%cnx = cnx
Model%cny = cny
Model%lonr = gnx ! number longitudinal points
Model%latr = gny ! number of latitudinal points from pole to pole
endif
if (Model%dycore_active == Model%dycore_mpas) then

end if
Model%levs = levs
allocate (Model%ak(1:size(ak)))
allocate (Model%bk(1:size(bk)))
Model%ak = ak
Model%bk = bk
Model%levsp1 = Model%levs + 1
Model%levsm1 = Model%levs - 1
Model%cnx = cnx
Model%cny = cny
Model%lonr = gnx ! number longitudinal points
Model%latr = gny ! number of latitudinal points from pole to pole
Model%nblks = size(blksz)
allocate (Model%blksz(1:Model%nblks))
Model%blksz = blksz
Expand Down Expand Up @@ -5904,28 +5967,38 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, &
Model%first_time_step = .true.
Model%restart = restart
Model%lsm_cold_start = .not. restart
Model%hydrostatic = hydrostatic
if (Model%me == Model%master) then
print *,'in atm phys init, phour=',Model%phour,'fhour=',Model%fhour,'zhour=',Model%zhour,'kdt=',Model%kdt
endif


if(Model%hydrostatic .and. Model%lightning_threat) then
write(0,*) 'Turning off lightning threat index for hydrostatic run.'
Model%lightning_threat = .false.
lightning_threat = .false.
if (Model%dycore_active == Model%dycore_fv3) then
Model%hydrostatic = hydrostatic
if(Model%hydrostatic .and. Model%lightning_threat) then
write(0,*) 'Turning off lightning threat index for hydrostatic run.'
Model%lightning_threat = .false.
lightning_threat = .false.
endif
endif

Model%jdat(1:8) = jdat(1:8)
allocate (Model%si(Model%levs+1))
!--- Define sigma level for radiation initialization
!--- Define sigma level for radiation initialization (FV3)
!--- The formula converting hybrid sigma pressure coefficients to sigma coefficients follows Eckermann (2009, MWR)
!--- ps is replaced with p0. The value of p0 uses that in http://www.emc.ncep.noaa.gov/officenotes/newernotes/on461.pdf
!--- ak/bk have been flipped from their original FV3 orientation and are defined sfc -> toa
Model%si(1:Model%levs+1) = (ak(1:Model%levs+1) + bk(1:Model%levs+1) * con_p0 - ak(Model%levs+1)) / (con_p0 - ak(Model%levs+1))
allocate (Model%si(Model%levs+1))
if (Model%dycore_active == Model%dycore_fv3) then
Model%si(1:Model%levs+1) = (ak(1:Model%levs+1) + bk(1:Model%levs+1) * con_p0 - ak(Model%levs+1)) / (con_p0 - ak(Model%levs+1))
end if
! DJS2025: NOT YET IMPLEMENTED
if (Model%dycore_active == Model%dycore_mpas) then
Model%si(1:Model%levs+1) = 1._kind_phys
endif

! --- Set default time
Model%jdat(1:8) = jdat(1:8)
Model%sec = 0
Model%yearlen = 365
Model%julian = -9999.

!--- Set vertical flag used by radiation schemes
Model%top_at_1 = .false.
if (Model%do_RRTMGP) then
Expand Down Expand Up @@ -6730,18 +6803,23 @@ subroutine control_print(Model)
print *, ' thermodyn_id : ', Model%thermodyn_id
print *, ' sfcpress_id : ', Model%sfcpress_id
print *, ' gen_coord_hybrid : ', Model%gen_coord_hybrid
print *, ' hydrostatic : ', Model%hydrostatic
if (Model%dycore_active == Model%dycore_fv3) then
print *, ' hydrostatic : ', Model%hydrostatic
endif
print *, ' '
print *, 'grid extent parameters'
print *, ' isc : ', Model%isc
print *, ' jsc : ', Model%jsc
print *, ' nx : ', Model%nx
print *, ' ny : ', Model%ny
print *, ' levs : ', Model%levs
print *, ' cnx : ', Model%cnx
print *, ' cny : ', Model%cny
print *, ' lonr : ', Model%lonr
print *, ' latr : ', Model%latr
if (Model%dycore_active == Model%dycore_fv3) then
print *, ' isc : ', Model%isc
print *, ' jsc : ', Model%jsc
print *, ' nx : ', Model%nx
print *, ' ny : ', Model%ny
print *, ' levs : ', Model%levs
print *, ' cnx : ', Model%cnx
print *, ' cny : ', Model%cny
print *, ' lonr : ', Model%lonr
print *, ' latr : ', Model%latr
end if
print *, ' nblks : ', Model%nblks
print *, ' blksz(1) : ', Model%blksz(1)
print *, ' blksz(nblks) : ', Model%blksz(Model%nblks)
print *, ' Model%ncols : ', Model%ncols
Expand Down
18 changes: 18 additions & 0 deletions scm/src/GFS_typedefs.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3699,6 +3699,24 @@
units = index
dimensions = ()
type = integer
[dycore_active]
standard_name = control_for_dynamical_core
long_name = choice of dynamical core
units = flag
dimensions = ()
type = integer
[dycore_fv3]
standard_name = identifier_for_fv3_dynamical_core
long_name = identifier for FV3 dynamical core
units = flag
dimensions = ()
type = integer
[dycore_mpas]
standard_name = identifier_for_mpas_dynamical_core
long_name = identifier for MPAS dynamical core
units = flag
dimensions = ()
type = integer
[tile_num]
standard_name = index_of_cubed_sphere_tile
long_name = tile number
Expand Down
25 changes: 15 additions & 10 deletions scm/src/scm_setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,25 @@ subroutine GFS_suite_setup (Model, Statein, Stateout, Sfcprop,
integer :: i

!--- set control properties (including namelist read)
Model%dycore_active = Model%dycore_fv3
call Model%init (Init_parm%nlunit, Init_parm%fn_nml, &
Init_parm%me, Init_parm%master, &
Init_parm%logunit, Init_parm%isc, &
Init_parm%jsc, Init_parm%nx, Init_parm%ny, &
Init_parm%levs, Init_parm%cnx, Init_parm%cny, &
Init_parm%gnx, Init_parm%gny, &
Init_parm%logunit, Init_parm%levs, &
Init_parm%dt_dycore, Init_parm%dt_phys, &
Init_parm%iau_offset, &
Init_parm%bdat, Init_parm%cdat, Init_parm%nwat, &
Init_parm%iau_offset, Init_parm%bdat, &
Init_parm%cdat, Init_parm%nwat, &
Init_parm%tracer_names, Init_parm%tracer_types, &
Init_parm%input_nml_file, Init_parm%tile_num, &
Init_parm%blksz, Init_parm%ak, Init_parm%bk, &
Init_parm%restart, Init_parm%hydrostatic, &
Init_parm%fcst_mpi_comm, ntasks, nthreads)
Init_parm%input_nml_file, Init_parm%blksz, &
Init_parm%restart, Init_parm%fcst_mpi_comm, &
ntasks, nthreads, &
! Below only needed for FV3 dynamical core.
Init_parm%tile_num, &
Init_parm%isc, Init_parm%jsc, &
Init_parm%nx, Init_parm%ny, &
Init_parm%cnx, Init_parm%cny, &
Init_parm%gnx, Init_parm%gny, &
Init_parm%ak, Init_parm%bk, &
Init_parm%hydrostatic)

!--- initialize DDTs

Expand Down
Loading