Skip to content

Commit c2a0fbc

Browse files
peverwheeCourtney Peverleynusbaumehplin-ucarjimmielin
authored
Bring in new RRTMPG suite via atmos_phys and mods to get it to work (#439)
Tag name (required for release branches): TBD Originator(s): peverwhee Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): * initialize needed host model variables * modify runtime_obj to include name of dycore * calculate coszrs to be used by radiation (and add namelist variables needed for this) - only calculate if we're not using snapshots * update registry generation code to check initial values vs use statements * add test Describe any changes made to build system: Describe any changes made to the namelist: List any changes to the defaults for the input datasets (e.g. boundary datasets): List all files eliminated and why: List all files added and what they do: A cime_config/testdefs/testmods_dirs/cam/outfrq_rrtmgp_derecho/shell_commands A cime_config/testdefs/testmods_dirs/cam/outfrq_rrtmgp_derecho/user_nl_cam A cime_config/testdefs/testmods_dirs/cam/outfrq_rrtmgp_derecho/user_nl_cpl - rrtmgp test mods List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) M .gitmodules - update framework tag and atmospheric physics hash M ccpp_framework M src/physics/ncar_ccpp - update submodules M cime_config/namelist_definition_cam.xml M src/control/runtime_opts.F90 M src/physics/utils/radiation_namelist.F90 M src/physics/utils/radiation_namelist.meta - add radiation NL M cime_config/testdefs/testlist_cam.xml - add rrtmgp cpu test M src/control/cam_comp.F90 M src/control/cam_control_mod.F90 - initialize host-model variables needed by rrtmgp M src/control/runtime_obj.F90 M src/control/runtime_obj.meta M src/dynamics/mpas/dyn_comp_impl.F90 M src/dynamics/none/dyn_comp.F90 M src/dynamics/se/dyn_comp.F90 - Modify runtime obj to include dycore name; add unset definition & metadata M src/data/generate_registry_data.py - check initial value vs use statements M src/data/registry.xml - add necessary host model variables M src/data/registry_v1_0.xsd - allow capital letters in std name (constituent names) M src/physics/utils/orbital_data.F90 - conditionally calculate coszrs for radiation M test/unit/python/sample_files/* - update tests If there are new failures (compared to the `test/existing-test-failures.txt` file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: All tests NLFAIL due to new radiation namelist fields derecho/gnu/aux_sima: SMS_Ln2.ne3pg3_ne3pg3_mg37.FPHYStest.derecho_gnu.cam-outfrq_rrtmgp_derecho (Overall: DIFF) - new test/baseline All other tests NLFAIL due to new radiation namelist fields If this changes climate describe any run(s) done to evaluate the new climate in enough detail that it(they) could be reproduced: n/a CAM-SIMA date used for the baseline comparison tests if different than latest: --------- Co-authored-by: Courtney Peverley <courtneyp@izumi.cgd.ucar.edu> Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu> Co-authored-by: Haipeng Lin <hplin@ucar.edu> Co-authored-by: Haipeng Lin <myself@jimmielin.me>
1 parent 8f55723 commit c2a0fbc

22 files changed

Lines changed: 622 additions & 28 deletions

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "ccpp-framework"]
22
path = ccpp_framework
33
url = https://github.com/NCAR/ccpp-framework
4-
fxtag = 2025-10-01-dev
4+
fxtag = 2025-10-15-dev
55
fxrequired = AlwaysRequired
66
fxDONOTUSEurl = https://github.com/NCAR/ccpp-framework
77
[submodule "history"]

cime_config/namelist_definition_cam.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,69 @@
377377
</values>
378378
</entry>
379379

380+
<!-- Radiation -->
381+
382+
<entry id="iradsw">
383+
<type>integer</type>
384+
<category>radiation</category>
385+
<group>radiation_nl</group>
386+
<desc>
387+
The frequency at which shortwave radiative
388+
transfer calculations are performed.
389+
positive: time steps; negative: hours
390+
</desc>
391+
<values>
392+
<value>-1</value>
393+
</values>
394+
</entry>
395+
<entry id="iradlw">
396+
<type>integer</type>
397+
<category>radiation</category>
398+
<group>radiation_nl</group>
399+
<desc>
400+
The frequency at which longwave radiative
401+
calculations are performed.
402+
positive: time steps; negative: hours
403+
</desc>
404+
<values>
405+
<value>-1</value>
406+
</values>
407+
</entry>
408+
<entry id="irad_always">
409+
<type>integer</type>
410+
<category>radiation</category>
411+
<group>radiation_nl</group>
412+
<desc>
413+
The amount of time that radiation (both SW and LW) is run continuously from the start of an initial or restart run
414+
positive: time steps; negative: hours
415+
</desc>
416+
<values>
417+
<value>-1</value>
418+
</values>
419+
</entry>
420+
<entry id="use_rad_uniform_angle">
421+
<type>logical</type>
422+
<category>radiation</category>
423+
<group>radiation_nl</group>
424+
<desc>
425+
If true, use the namelist-defined, globally-uniform solar zenith angle.
426+
</desc>
427+
<values>
428+
<value>.false.</value>
429+
</values>
430+
</entry>
431+
<entry id="rad_uniform_angle">
432+
<type>real</type>
433+
<kind>kind_phys</kind>
434+
<category>radiation</category>
435+
<group>radiation_nl</group>
436+
<desc>
437+
The value of the uniform solar zenith angle (in radians) if 'use_rad_uniform_angle' is true.
438+
</desc>
439+
<values>
440+
<value>-99</value>
441+
</values>
442+
</entry>
380443
<!-- Gravity wave ridge parameterization inputs -->
381444
<entry id="bnd_rdggm">
382445
<type>char*256</type>

cime_config/testdefs/testlist_cam.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@
8888
<option name="comment">Test for Holtslag-Boville boundary layer scheme and vertical diffusion</option>
8989
</options>
9090
</test>
91+
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_rrtmgp_derecho">
92+
<machines>
93+
<machine name="derecho" compiler="gnu" category="aux_sima"/>
94+
</machines>
95+
<options>
96+
<option name="wallclock">00:10:00</option>
97+
<option name="comment">Snapshot test for RRTMGP</option>
98+
</options>
99+
</test>
91100
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_gw_cam4_derecho">
92101
<machines>
93102
<machine name="derecho" compiler="gnu" category="aux_sima"/>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites rrtmgp"
2+
./xmlchange RUN_STARTDATE=1979-01-01
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
! these are FHISTC_LTso snapshots
2+
ncdata = '/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_fhistc_ltso_rrtmgp_derecho_gnu_before_c20251013.nc'
3+
ncdata_check = '/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_fhistc_ltso_rrtmgp_derecho_gnu_after_c20251013.nc'
4+
5+
! tolerances for testing
6+
ncdata_check_err = .true.
7+
min_difference = 1e-15
8+
9+
! vertical levels in snapshot
10+
pver = 58
11+
12+
! Do radiation on every timestep we're testing
13+
irad_always=3
14+
15+
! diagnostic output
16+
hist_output_frequency;h1: 1*nsteps
17+
hist_precision;h1: REAL64
18+
hist_add_inst_fields;h1: HR
19+
! Cloud output
20+
hist_add_inst_fields;h1: TOT_CLD_VISTAU,TOT_ICLD_VISTAU,ICE_ICLD_VISTAU,LIQ_ICLD_VISTAU
21+
! Longwave diagnostic output
22+
hist_add_inst_fields;h1: QRL,QRLC,FLNT,FLNTC,FLUT,FLUTC,LWCF,FLN200,FLN200C,FLNR,FLNS,FLNSC,FLDS,FLDSC,FUL,FDL,FULC,FDLC
23+
! Shortwave diagnostic fields
24+
hist_add_inst_fields;h1: SOLIN,QRS,QRSC,FSNT,FSNTC,FSNTOA,FSNTOAC,SWCF,FSUTOA,FSN200,FSN200C,FSNR,SOLL,SOLS,SOLLD,SOLSD
25+
hist_add_inst_fields;h1: FSNS,FSNSC,FSDS,FSDSC,FUS,FDS,FUSC,FDSC
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
! Set fixed orbital parameters to match CAM snapshot
2+
orb_mode='fixed_parameters'
3+
orb_eccen = 0.
4+
orb_obliq = 0.
5+
orb_mvelp = 0.

src/control/cam_comp.F90

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ module cam_comp
2727

2828
use physics_types, only: phys_state, phys_tend
2929
use physics_types, only: dtime_phys
30-
use physics_types, only: calday
30+
use physics_types, only: calday, next_calday, radiation_offset, nextsw_cday
3131
use physics_types, only: is_first_timestep, nstep
32+
use physics_types, only: is_first_restart_timestep
3233
use dyn_comp, only: dyn_import_t, dyn_export_t
3334

3435
use perf_mod, only: t_barrierf, t_startf, t_stopf
@@ -178,12 +179,21 @@ subroutine cam_init(caseid, ctitle, model_doi_url, &
178179
is_first_timestep = .true.
179180
call mark_as_initialized('is_first_timestep')
180181

182+
is_first_restart_timestep = .false.
183+
call mark_as_initialized('is_first_restart_timestep')
184+
181185
nstep = get_nstep()
182186
call mark_as_initialized('current_timestep_number')
183187

184188
! Get current fractional calendar day. Needs to be updated at every timestep.
185189
calday = get_curr_calday()
190+
next_calday = get_curr_calday(offset=int(get_step_size()))
191+
radiation_offset = 0
192+
nextsw_cday = next_calday
186193
call mark_as_initialized('fractional_calendar_days_on_end_of_current_timestep')
194+
call mark_as_initialized('fractional_calendar_days_on_end_of_next_timestep')
195+
call mark_as_initialized('number_of_seconds_until_next_shortwave_radiation_timestep')
196+
call mark_as_initialized('next_calendar_day_to_perform_shortwave_radiation_for_surface_models')
187197

188198
! Read CAM namelists.
189199
filein = "atm_in" // trim(inst_suffix)
@@ -288,11 +298,13 @@ subroutine cam_timestep_init()
288298
use physics_grid, only: lat_rad, lon_rad
289299
use orbital_data, only: orbital_data_advance
290300
use stepon, only: stepon_timestep_init
301+
use physics_types, only: dt_avg
291302
use cam_ccpp_cap, only: cam_constituents_array
292303
use cam_ccpp_cap, only: cam_model_const_properties
293304
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
294305
use ccpp_kinds, only: kind_phys
295306
use musica_ccpp_dependencies, only: set_initial_musica_concentrations
307+
use radiation_namelist, only: use_rad_uniform_angle, rad_uniform_angle
296308

297309
real(kind_phys), pointer :: constituents_array(:,:,:)
298310
type(ccpp_constituent_prop_ptr_t), pointer :: constituent_properties(:)
@@ -301,7 +313,8 @@ subroutine cam_timestep_init()
301313
calday = get_curr_calday()
302314

303315
! Update the orbital data
304-
call orbital_data_advance(calday, lat_rad, lon_rad)
316+
call orbital_data_advance(calday, lat_rad, lon_rad, use_rad_uniform_angle, &
317+
rad_uniform_angle, dt_avg)
305318

306319
! Update timestep flags in physics state
307320
is_first_timestep = is_first_step()
@@ -340,6 +353,10 @@ subroutine cam_timestep_init()
340353
!
341354
call phys_timestep_init()
342355

356+
! Call share code to get relevant calendar days
357+
nextsw_cday = get_curr_calday(offset=radiation_offset)
358+
next_calday = get_curr_calday(offset=int(get_step_size()))
359+
343360
end subroutine cam_timestep_init
344361
!
345362
!-----------------------------------------------------------------------

src/control/cam_control_mod.F90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ end subroutine cam_ctrl_init
101101
!---------------------------------------------------------------------------
102102

103103
subroutine cam_ctrl_set_orbit(eccen_in, obliqr_in, lambm0_in, mvelpp_in)
104+
use phys_vars_init_check, only: mark_as_initialized
104105

105106
real(r8), intent(in) :: eccen_in
106107
real(r8), intent(in) :: obliqr_in

src/control/runtime_obj.F90

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,41 @@ module runtime_obj
22

33
use shr_kind_mod, only: CS => SHR_KIND_CS
44
use shr_kind_mod, only: r8=>shr_kind_r8
5+
use ccpp_kinds, only: kind_phys
56
implicit none
67
private
78

9+
!> \section arg_table_runtime_obj Argument Table
10+
!! \htmlinclude arg_table_runtime_obj.html
11+
!!
12+
real(kind_phys), public, parameter :: unset_real = huge(1.0_r8)
13+
814
character(len=*), public, parameter :: unset_str = 'UNSET'
915
integer, public, parameter :: unset_int = huge(1)
10-
real(r8), public, parameter :: unset_real = huge(1.0_r8)
1116

1217
! Water vapor constituent standard name
1318
character(len=*), public, parameter :: wv_stdname = 'water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water'
1419

1520
! Public interfaces and data
16-
17-
!> \section arg_table_runtime_options Argument Table
18-
!! \htmlinclude arg_table_runtime_options.html
19-
!!
2021
type, public :: runtime_options
2122
character(len=CS), private :: phys_suite = unset_str
23+
character(len=CS), private :: dycore = unset_str
2224
character(len=16), private :: waccmx_opt = unset_str
2325
! update_thermo_variables: update thermo "constants" to composition-dependent thermo variables
2426
logical, private :: update_thermo_variables = .false.
2527
contains
2628
! General runtime access
2729
procedure, public :: physics_suite
30+
procedure, public :: get_dycore
31+
procedure, public :: set_dycore
2832
procedure, public :: suite_as_list
2933
! Runtime parameters of interest to dycore
3034
procedure, public :: waccmx_on
3135
procedure, public :: waccmx_option
3236
procedure, public :: update_thermodynamic_variables
3337
end type runtime_options
3438

35-
type(runtime_options), public, protected :: cam_runtime_opts
39+
type(runtime_options), public :: cam_runtime_opts
3640

3741
public :: cam_set_runtime_opts
3842

@@ -47,6 +51,20 @@ pure character(len=CS) function physics_suite(self)
4751
physics_suite = trim(self%phys_suite)
4852
end function physics_suite
4953

54+
pure character(len=CS) function get_dycore(self)
55+
class(runtime_options), intent(in) :: self
56+
57+
get_dycore = trim(self%dycore)
58+
end function get_dycore
59+
60+
subroutine set_dycore(self, dycore_in)
61+
class(runtime_options), intent(inout) :: self
62+
character(len=*), intent(in) :: dycore_in
63+
64+
self%dycore = trim(dycore_in)
65+
66+
end subroutine set_dycore
67+
5068
pure function suite_as_list(self) result(slist)
5169
class(runtime_options), intent(in) :: self
5270
character(len=CS) :: slist(1)

0 commit comments

Comments
 (0)