Skip to content

Commit

Permalink
Renamed scheme simulator suite simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Jul 19, 2023
1 parent 8e5646e commit e3c00d3
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
! ########################################################################################
!
! Description: Interstitial CCPP scheme to couple UFS physics to ccpp_scheme_simulator.
! Description: Interstitial CCPP suite to couple UFS physics to ccpp_suite_simulator.
!
! Contains:
! - load_ccpp_scheme_sim(): read and load data into type used by ccpp_scheme_simulator.
! - load_ccpp_suite_sim(): read and load data into type used by ccpp_suite_simulator.
! called once during model initialization
! - GFS_ccpp_scheme_sim_pre_run(): prepare GFS diagnostic physics tendencies for
! ccpp_scheme_simulator.
! - GFS_ccpp_suite_sim_pre_run(): prepare GFS diagnostic physics tendencies for
! ccpp_suite_simulator.
!
! ########################################################################################
module GFS_ccpp_scheme_sim_pre
module GFS_ccpp_suite_sim_pre
use machine, only: kind_phys
use module_ccpp_scheme_simulator, only: base_physics_process
use module_ccpp_suite_simulator, only: base_physics_process
use netcdf
implicit none
public GFS_ccpp_scheme_sim_pre_run, load_ccpp_scheme_sim
public GFS_ccpp_suite_sim_pre_run, load_ccpp_suite_sim
contains

! ######################################################################################
!
! SUBROUTINE GFS_ccpp_scheme_sim_pre_run
! SUBROUTINE GFS_ccpp_suite_sim_pre_run
!
! ######################################################################################
!! \section arg_table_GFS_ccpp_scheme_sim_pre_run
!! \htmlinclude GFS_ccpp_scheme_sim_pre_run.html
!! \section arg_table_GFS_ccpp_suite_sim_pre_run
!! \htmlinclude GFS_ccpp_suite_sim_pre_run.html
!!
subroutine GFS_ccpp_scheme_sim_pre_run(do_ccpp_scheme_sim, dtend, ntqv, dtidx, dtp, &
subroutine GFS_ccpp_suite_sim_pre_run(do_ccpp_suite_sim, dtend, ntqv, dtidx, dtp, &
index_of_process_dcnv, index_of_process_longwave, index_of_process_shortwave, &
index_of_process_scnv, index_of_process_orographic_gwd, index_of_process_pbl, &
index_of_process_mp, index_of_temperature, index_of_x_wind, index_of_y_wind, &
physics_process, iactive_T, iactive_u, iactive_v, iactive_q, active_phys_tend, &
errmsg, errflg)

! Inputs
logical, intent(in) :: do_ccpp_scheme_sim
logical, intent(in) :: do_ccpp_suite_sim
integer, intent(in) :: ntqv, index_of_process_dcnv, index_of_process_longwave, &
index_of_process_shortwave, index_of_process_scnv, &
index_of_process_orographic_gwd, index_of_process_pbl, index_of_process_mp, &
Expand All @@ -56,15 +56,15 @@ subroutine GFS_ccpp_scheme_sim_pre_run(do_ccpp_scheme_sim, dtend, ntqv, dtidx, d
errmsg = ''
errflg = 0

if (.not. do_ccpp_scheme_sim) return
if (.not. do_ccpp_suite_sim) return

! Get tendency for "active" process.

! ######################################################################################
! DJS2023: For the UFS and SCM, the physics tendencies are stored in a multi-dimensional
! array, CCPP standard_name = cumulative_change_of_state_variables.
! These are not the instantaneous physics tendencies that are applied to the state by
! the physics schemes. Not all schemes output physics tendencies...
! the physics suites. Not all suites output physics tendencies...
! Rather these are intended for diagnostic puposes and are accumulated over some
! interval.
! In the UFS/SCM this is controlled by the diagnostic bucket interval, namelist option
Expand Down Expand Up @@ -107,10 +107,10 @@ subroutine GFS_ccpp_scheme_sim_pre_run(do_ccpp_scheme_sim, dtend, ntqv, dtidx, d
active_phys_tend(:,:,iactive_q) = dtend(:,:,idtend)/dtp
endif

end subroutine GFS_ccpp_scheme_sim_pre_run
end subroutine GFS_ccpp_suite_sim_pre_run

! ######################################################################################
subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T, &
subroutine load_ccpp_suite_sim(nlunit, nml_file, physics_process, iactive_T, &
iactive_u, iactive_v, iactive_q, errmsg, errflg)

! Inputs
Expand All @@ -125,13 +125,13 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,

! Local variables
integer :: ncid, dimID, varID, status, ios, iprc, nlev_data, ntime_data
character(len=256) :: scheme_sim_file
logical :: exists, do_ccpp_scheme_sim
character(len=256) :: suite_sim_file
logical :: exists, do_ccpp_suite_sim
integer :: nprc_sim

! For each process there is a corresponding namelist entry, which is constructed as
! follows:
! {use_scheme_sim[0(no)/1(yes)], time_split[0(no)/1(yes)], order[1:nPhysProcess]}
! {use_suite_sim[0(no)/1(yes)], time_split[0(no)/1(yes)], order[1:nPhysProcess]}
integer, dimension(3) :: &
prc_LWRAD_cfg = (/0,0,0/), &
prc_SWRAD_cfg = (/0,0,0/), &
Expand All @@ -142,7 +142,7 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
prc_cldMP_cfg = (/0,0,0/)

! Namelist
namelist / ccpp_scheme_sim_nml / do_ccpp_scheme_sim, scheme_sim_file, nprc_sim, &
namelist / ccpp_suite_sim_nml / do_ccpp_suite_sim, suite_sim_file, nprc_sim, &
prc_LWRAD_cfg, prc_SWRAD_cfg, prc_PBL_cfg, prc_GWD_cfg, prc_SCNV_cfg, &
prc_DCNV_cfg, prc_cldMP_cfg

Expand All @@ -152,17 +152,17 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
! Read in namelist
inquire (file = trim (nml_file), exist = exists)
if (.not. exists) then
errmsg = 'CCPP scheme simulator namelist file: '//trim(nml_file)//' does not exist.'
errmsg = 'CCPP suite simulator namelist file: '//trim(nml_file)//' does not exist.'
errflg = 1
return
else
open (unit = nlunit, file = nml_file, action = 'read', status = 'old', iostat = ios)
endif
rewind (nlunit)
read (nlunit, nml = ccpp_scheme_sim_nml, iostat=status)
read (nlunit, nml = ccpp_suite_sim_nml, iostat=status)
close (nlunit)

! Only proceed if scheme simulator requested.
! Only proceed if suite simulator requested.
if (prc_SWRAD_cfg(1) == 1 .or. prc_LWRAD_cfg(1) == 1 .or. prc_PBL_cfg(1) == 1 .or. &
prc_GWD_cfg(1) == 1 .or. prc_SCNV_cfg(1) == 1 .or. prc_DCNV_cfg(1) == 1 .or. &
prc_cldMP_cfg(1) == 1 ) then
Expand All @@ -171,9 +171,9 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
endif

! Check that input data file exists.
inquire (file = trim (scheme_sim_file), exist = exists)
inquire (file = trim (suite_sim_file), exist = exists)
if (.not. exists) then
errmsg = 'CCPP scheme simulator file: '//trim(scheme_sim_file)//' does not exist'
errmsg = 'CCPP suite simulator file: '//trim(suite_sim_file)//' does not exist'
errflg = 1
return
endif
Expand All @@ -183,9 +183,9 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
!

! Open file
status = nf90_open(trim(scheme_sim_file), NF90_NOWRITE, ncid)
status = nf90_open(trim(suite_sim_file), NF90_NOWRITE, ncid)
if (status /= nf90_noerr) then
errmsg = 'Error reading in CCPP scheme simulator file: '//trim(scheme_sim_file)
errmsg = 'Error reading in CCPP suite simulator file: '//trim(suite_sim_file)
errflg = 1
return
endif
Expand All @@ -195,7 +195,7 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
if (status == nf90_noerr) then
status = nf90_inquire_dimension(ncid, dimid, len = ntime_data)
else
errmsg = 'CCPP scheme simulator file: '//trim(scheme_sim_file)//' does not contain [time] dimension'
errmsg = 'CCPP suite simulator file: '//trim(suite_sim_file)//' does not contain [time] dimension'
errflg = 1
return
endif
Expand All @@ -204,7 +204,7 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
if (status == nf90_noerr) then
status = nf90_inquire_dimension(ncid, dimid, len = nlev_data)
else
errmsg = 'CCPP scheme simulator file: '//trim(scheme_sim_file)//' does not contain [lev] dimension'
errmsg = 'CCPP suite simulator file: '//trim(suite_sim_file)//' does not contain [lev] dimension'
errflg = 1
return
endif
Expand All @@ -230,7 +230,7 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
if (status == nf90_noerr) then
status = nf90_get_var( ncid, varID, physics_process(iprc)%tend2d%time)
else
errmsg = 'SCM data tendency file: '//trim(scheme_sim_file)//' does not contain times variable'
errmsg = 'SCM data tendency file: '//trim(suite_sim_file)//' does not contain times variable'
errflg = 1
return
endif
Expand Down Expand Up @@ -403,7 +403,7 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,
if (status == nf90_noerr) status = nf90_get_var( ncid, varID, physics_process(iprc)%tend2d%q)
endif

! Which process-scheme is "active"? Is process time-split?
! Which process-suite is "active"? Is process time-split?
if (.not. physics_process(iprc)%use_sim) then
physics_process(1)%iactive_scheme = iprc
physics_process(1)%active_name = physics_process(iprc)%name
Expand All @@ -416,27 +416,27 @@ subroutine load_ccpp_scheme_sim(nlunit, nml_file, physics_process, iactive_T,

if (physics_process(1)%iactive_scheme == 0) then
errflg = 1
errmsg = "ERROR: No active scheme set for CCPP scheme simulator"
errmsg = "ERROR: No active suite set for CCPP suite simulator"
return
endif

print*, "-----------------------------------"
print*, "--- Using CCPP scheme simulator ---"
print*, "--- Using CCPP suite simulator ---"
print*, "-----------------------------------"
do iprc = 1,nprc_sim
if (physics_process(iprc)%use_sim) then
print*," simulate_scheme: ", trim(physics_process(iprc)%name)
print*," simulate_suite: ", trim(physics_process(iprc)%name)
print*," order: ", physics_process(iprc)%order
print*," time_split: ", physics_process(iprc)%time_split
else
print*, " active_scheme: ", trim(physics_process(1)%active_name)
print*, " active_suite: ", trim(physics_process(1)%active_name)
print*, " order: ", physics_process(physics_process(1)%iactive_scheme)%order
print*, " time_split : ", physics_process(1)%active_tsp
endif
enddo
print*, "-----------------------------------"
print*, "-----------------------------------"

end subroutine load_ccpp_scheme_sim
end subroutine load_ccpp_suite_sim

end module GFS_ccpp_scheme_sim_pre
end module GFS_ccpp_suite_sim_pre
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[ccpp-table-properties]
name = GFS_ccpp_scheme_sim_pre
name = GFS_ccpp_suite_sim_pre
type = scheme
dependencies = machine.F,module_ccpp_scheme_simulator.F90
dependencies = machine.F,module_ccpp_suite_simulator.F90

########################################################################
[ccpp-arg-table]
name = GFS_ccpp_scheme_sim_pre_run
name = GFS_ccpp_suite_sim_pre_run
type = scheme
[do_ccpp_scheme_sim]
standard_name = flag_for_ccpp_scheme_simulator
long_name = flag for ccpp scheme simulator
[do_ccpp_suite_sim]
standard_name = flag_for_ccpp_suite_simulator
long_name = flag for ccpp suite simulator
units = flag
dimensions = ()
type = logical
intent = in
[physics_process]
standard_name = physics_process_type_for_CCPP_scheme_simulator
long_name = physics process type for CCPP scheme simulator
standard_name = physics_process_type_for_CCPP_suite_simulator
long_name = physics process type for CCPP suite simulator
units = mixed
dimensions = (number_of_physics_process_in_CCPP_scheme_simulator)
dimensions = (number_of_physics_process_in_CCPP_suite_simulator)
type = base_physics_process
intent = in
[dtend]
Expand Down Expand Up @@ -122,37 +122,37 @@
type = integer
intent = in
[active_phys_tend]
standard_name = tendencies_for_active_process_in_ccpp_scheme_simulator
long_name = tendencies for active physics process in ccpp scheme simulator
standard_name = tendencies_for_active_process_in_ccpp_suite_simulator
long_name = tendencies for active physics process in ccpp suite simulator
units = mixed
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_prognostics_varaibles_in_CCPP_scheme_simulator)
dimensions = (horizontal_loop_extent,vertical_layer_dimension,number_of_prognostics_varaibles_in_CCPP_suite_simulator)
type = real
kind = kind_phys
intent = out
[iactive_T]
standard_name = index_for_active_T_in_CCPP_scheme_simulator
long_name = index into active process tracer array for temperature in CCPP scheme simulator
standard_name = index_for_active_T_in_CCPP_suite_simulator
long_name = index into active process tracer array for temperature in CCPP suite simulator
units = count
dimensions = ()
type = integer
intent = in
[iactive_u]
standard_name = index_for_active_u_in_CCPP_scheme_simulator
long_name = index into active process tracer array for zonal wind in CCPP scheme simulator
standard_name = index_for_active_u_in_CCPP_suite_simulator
long_name = index into active process tracer array for zonal wind in CCPP suite simulator
units = count
dimensions = ()
type = integer
intent = in
[iactive_v]
standard_name = index_for_active_v_in_CCPP_scheme_simulator
long_name = index into active process tracer array for meridional wind in CCPP scheme simulator
standard_name = index_for_active_v_in_CCPP_suite_simulator
long_name = index into active process tracer array for meridional wind in CCPP suite simulator
units = count
dimensions = ()
type = integer
intent = in
[iactive_q]
standard_name = index_for_active_q_in_CCPP_scheme_simulator
long_name = index into active process tracer array for moisture in CCPP scheme simulator
standard_name = index_for_active_q_in_CCPP_suite_simulator
long_name = index into active process tracer array for moisture in CCPP suite simulator
units = count
dimensions = ()
type = integer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
! ########################################################################################
!
! Description: This scheme simulates the evolution of the internal physics state
! Description: This suite simulates the evolution of the internal physics state
! represented by a CCPP Suite Definition File (SDF).
!
! To activate this scheme it must be a) embedded within the SDF and b) activated through
! To activate this suite it must be a) embedded within the SDF and b) activated through
! the physics namelist.
! The derived-data type "base_physics_process" contains the metadata needed to reconstruct
! the temporal evolution of the state. An array of base_physics_process, physics_process,
! is populated by the host during initialization and passed to the physics. Additionally,
! this type holds any data, or type-bound procedures, required by the scheme simulator(s).
! this type holds any data, or type-bound procedures, required by the suite simulator(s).
!
! For this initial demonstration we are using 2-dimensional (height, time) forcing data,
! which is on the same native vertical grid as the SCM. The dataset has a temporal
Expand All @@ -17,29 +17,29 @@
! (constant) diurnal cycle.
!
! ########################################################################################
module ccpp_scheme_simulator
module ccpp_suite_simulator
use machine, only: kind_phys
use module_ccpp_scheme_simulator, only: base_physics_process, sim_LWRAD, sim_SWRAD, &
use module_ccpp_suite_simulator, only: base_physics_process, sim_LWRAD, sim_SWRAD, &
sim_PBL, sim_GWD, sim_DCNV, sim_SCNV, sim_cldMP
implicit none
public ccpp_scheme_simulator_run
public ccpp_suite_simulator_run
contains

! ######################################################################################
!
! SUBROUTINE ccpp_scheme_simulator_run
! SUBROUTINE ccpp_suite_simulator_run
!
! ######################################################################################
!! \section arg_table_ccpp_scheme_simulator_run
!! \htmlinclude ccpp_scheme_simulator_run.html
!! \section arg_table_ccpp_suite_simulator_run
!! \htmlinclude ccpp_suite_simulator_run.html
!!
subroutine ccpp_scheme_simulator_run(do_ccpp_scheme_sim, kdt, nCol, nLay, dtp, jdat, &
subroutine ccpp_suite_simulator_run(do_ccpp_suite_sim, kdt, nCol, nLay, dtp, jdat, &
iactive_T, iactive_u, iactive_v, iactive_q, proc_start, proc_end, physics_process,&
in_pre_active, in_post_active, tgrs, ugrs, vgrs, qgrs, active_phys_tend, gt0, gu0,&
gv0, gq0, errmsg, errflg)

! Inputs
logical, intent(in) :: do_ccpp_scheme_sim
logical, intent(in) :: do_ccpp_suite_sim
integer, intent(in) :: kdt, nCol, nLay, jdat(8), iactive_T, iactive_u, &
iactive_v, iactive_q
real(kind_phys), intent(in) :: dtp, tgrs(:,:), ugrs(:,:), vgrs(:,:), qgrs(:,:,:), &
Expand All @@ -60,7 +60,7 @@ subroutine ccpp_scheme_simulator_run(do_ccpp_scheme_sim, kdt, nCol, nLay, dtp, j
errmsg = ''
errflg = 0

if (.not. do_ccpp_scheme_sim) return
if (.not. do_ccpp_suite_sim) return

! Current forecast time (Data-format specific)
year = jdat(1)
Expand Down Expand Up @@ -207,6 +207,6 @@ subroutine ccpp_scheme_simulator_run(do_ccpp_scheme_sim, kdt, nCol, nLay, dtp, j
in_post_active = .false.
endif

end subroutine ccpp_scheme_simulator_run
end subroutine ccpp_suite_simulator_run

end module ccpp_scheme_simulator
end module ccpp_suite_simulator
Loading

0 comments on commit e3c00d3

Please sign in to comment.