Skip to content

Commit e4acacc

Browse files
authored
Merge pull request #1245 from Katetc/RFccpp_updates_1224
cam6_4_086: Rayleigh Friction to CCPP Here's the PR for Rayleigh Friction to CCPP! Fixes #1153
2 parents ab9c0e6 + b2572e3 commit e4acacc

File tree

11 files changed

+269
-203
lines changed

11 files changed

+269
-203
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[submodule "atmos_phys"]
3737
path = src/atmos_phys
3838
url = https://github.com/ESCOMP/atmospheric_physics
39-
fxtag = atmos_phys0_12_000
39+
fxtag = atmos_phys0_13_000
4040
fxrequired = AlwaysRequired
4141
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
4242

bld/build-namelist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5262,6 +5262,7 @@ sub check_snapshot_settings {
52625262
"'qbo_relax'", "'iondrag_calc_section'",
52635263
"'physics_dme_adjust'"));
52645264
push (@validList_bc, ("'dadadj_tend'", "'convect_deep_tend'",
5265+
"'rayleigh_friction_tend'",
52655266
"'convect_diagnostics_calc'"));
52665267
} else {
52675268
# CAM physpkg
@@ -5276,6 +5277,7 @@ sub check_snapshot_settings {
52765277
"'qbo_relax'", "'iondrag_calc_section'",
52775278
"'physics_dme_adjust'"));
52785279
push (@validList_bc, ("'dadadj_tend'", "'convect_deep_tend'",
5280+
"'rayleigh_friction_tend'",
52795281
"'convect_shallow_tend'"));
52805282
if ($microphys =~ /^mg/) {
52815283
if ($clubb_sgs =~ /$TRUE/io) {

bld/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,7 @@ sub write_filepath
21772177
print $fh "$camsrcdir/src/atmos_phys/schemes/hack_shallow\n";
21782178
print $fh "$camsrcdir/src/atmos_phys/schemes/rasch_kristjansson\n";
21792179
print $fh "$camsrcdir/src/atmos_phys/schemes/utilities\n";
2180+
print $fh "$camsrcdir/src/atmos_phys/schemes/rayleigh_friction\n";
21802181

21812182
print $fh "$camsrcdir/src/atmos_phys/schemes/cloud_fraction\n";
21822183

bld/namelist_files/namelist_definition.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5665,15 +5665,15 @@ Default:
56655665
</entry>
56665666

56675667
<entry id="cam_take_snapshot_before" type="char*32" category="diagnostics"
5668-
group="phys_ctl_nl" valid_values="chem_emissions,aoa_tracers_timestep_tend,co2_cycle_set_ptend,chem_timestep_tend,vertical_diffusion_section,aero_model_drydep,gw_tend,qbo_relax,iondrag_calc_section,physics_dme_adjust,physics_dme_adjust,dadadj_tend,convect_deep_tend,convect_shallow_tend,convect_diagnostics_calc,macrop_driver_tend,clubb_tend_cam,microp_section,microp_driver_tend_subcol,aero_model_wetdep,radiation_tend,held_suarez_tend,kessler_tend,thatcher_jablonowski_precip_tend,rk_stratiform_tend,user_set" >
5668+
group="phys_ctl_nl" valid_values="chem_emissions,aoa_tracers_timestep_tend,co2_cycle_set_ptend,chem_timestep_tend,vertical_diffusion_section,aero_model_drydep,gw_tend,qbo_relax,iondrag_calc_section,physics_dme_adjust,physics_dme_adjust,dadadj_tend,convect_deep_tend,convect_shallow_tend,convect_diagnostics_calc,macrop_driver_tend,clubb_tend_cam,microp_section,microp_driver_tend_subcol,aero_model_wetdep,radiation_tend,held_suarez_tend,kessler_tend,thatcher_jablonowski_precip_tend,rk_stratiform_tend,rayleigh_friction_tend,user_set" >
56695669
Name of parameterization to take snapshot before running
56705670
user_set is used when a user inserts a call to cam_snapshot_all_outfld
56715671
using cam_snapshot_before_num as the first argument.
56725672
Default: Unused
56735673
</entry>
56745674

56755675
<entry id="cam_take_snapshot_after" type="char*32" category="diagnostics"
5676-
group="phys_ctl_nl" valid_values="chem_emissions,aoa_tracers_timestep_tend,co2_cycle_set_ptend,chem_timestep_tend,vertical_diffusion_section,aero_model_drydep,gw_tend,qbo_relax,iondrag_calc_section,physics_dme_adjust,physics_dme_adjust,dadadj_tend,convect_deep_tend,convect_shallow_tend,convect_diagnostics_calc,macrop_driver_tend,clubb_tend_cam,microp_section,microp_driver_tend_subcol,aero_model_wetdep,radiation_tend,held_suarez_tend,kessler_tend,thatcher_jablonowski_precip_tend,rk_stratiform_tend,user_set" >
5676+
group="phys_ctl_nl" valid_values="chem_emissions,aoa_tracers_timestep_tend,co2_cycle_set_ptend,chem_timestep_tend,vertical_diffusion_section,aero_model_drydep,gw_tend,qbo_relax,iondrag_calc_section,physics_dme_adjust,physics_dme_adjust,dadadj_tend,convect_deep_tend,convect_shallow_tend,convect_diagnostics_calc,macrop_driver_tend,clubb_tend_cam,microp_section,microp_driver_tend_subcol,aero_model_wetdep,radiation_tend,held_suarez_tend,kessler_tend,thatcher_jablonowski_precip_tend,rk_stratiform_tend,rayleigh_friction_tend,user_set" >
56775677
Name of parameterization to take snapshot after running
56785678
user_set is used when a user inserts a call to cam_snapshot_all_outfld
56795679
using cam_snapshot_after_num as the first argument.

doc/ChangeLog

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,88 @@
11
===============================================================
22

3+
Tag name: cam6_4_086
4+
Originator(s): katetc
5+
Date: 18 April 2025
6+
One-line Summary: CCPP-ize Rayleigh Friction
7+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1245
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
- Brings in new atmospheric_physics external and changes Rayleigh Friction code to use CCPP compatible interfaces
11+
- Closes #1153 - Conversion of Rayleigh Friction to CCPP
12+
13+
Describe any changes made to build system:
14+
bld/configure
15+
- Add src/atmos_phys/schemes/rayleigh_friction to the build tree
16+
17+
Describe any changes made to the namelist:
18+
bld/build-namelist
19+
bld/namelist_files/namelist_definition.xml
20+
- Changes to add rayleigh_friction_tend snapshot capability
21+
22+
List any changes to the defaults for the boundary datasets: N/A
23+
24+
Describe any substantial timing or memory changes: N/A
25+
26+
Code reviewed by: nusbaume, cacraig
27+
28+
List all files eliminated:
29+
D src/physics/cam/rayleigh_friction.F90
30+
- moved to atmospheric_physics: rayleigh_friction scheme
31+
32+
List all files added and what they do:
33+
A src/physics/cam/rayleigh_friction_cam.F90
34+
- Contains the read_nl code and namelist parameters for ccppized Rayleigh Friction scheme
35+
36+
List all existing files that have been modified, and describe the changes:
37+
M .gitmodules
38+
M src/atmos_phys
39+
- New atmospheric_physics external tag atmos_phys0_13_000 and updated submodule
40+
41+
M bld/build-namelist
42+
M bld/namelist_files/namelist_definition.xml
43+
- Add snapshot cpability for rayleigh_friction_tend
44+
45+
M bld/configure
46+
- Add src/atmos_phys/schemes/rayleigh_friction to the build tree
47+
48+
M src/control/runtime_opts.F90
49+
- Change module for rayleigh_friction_readnl from rayleigh_friction to rayleigh_friction_cam
50+
51+
M src/physics/cam/physpkg.F90
52+
M src/physics/cam7/physpkg.F90
53+
- Non-Answer changing modifications to use the CCPP version of Rayleigh Friction
54+
55+
If there were any failures reported from running test_driver.sh on any test
56+
platform, and checkin with these failures has been OK'd by the gatekeeper,
57+
then copy the lines from the td.*.status files for the failed tests to the
58+
appropriate machine below. All failed tests must be justified.
59+
60+
derecho/intel/aux_cam:
61+
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
62+
SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details:
63+
- pre-existing failures due to HEMCO not having reproducible results (issues #1018 and #856)
64+
65+
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
66+
- pre-existing failures due to build-namelist error requiring CLM/CTSM external update
67+
68+
derecho/nvhpc/aux_cam:
69+
ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: PASS) details:
70+
- Compare against cam6_4_082_nvhpc baselines due to machine error preventing the test from running for the last few tags.
71+
72+
izumi/nag/aux_cam:
73+
- All pass
74+
75+
izumi/gnu/aux_cam:
76+
- All pass
77+
78+
CAM tag used for the baseline comparison tests if different than previous
79+
tag: Nvhpc baseline comapare against cam6_4_082_nvhpc due to machine problems between tags
80+
81+
Summarize any changes to answers:
82+
No answer changes, all b4b
83+
84+
===============================================================
85+
386
Tag name: cam6_4_085
487
Originator(s): jimmielin
588
Date: 11 April 2025

src/control/runtime_opts.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
7777
use aircraft_emit, only: aircraft_emit_readnl
7878
use cospsimulator_intr, only: cospsimulator_intr_readnl
7979
use vertical_diffusion, only: vd_readnl
80-
use rayleigh_friction, only: rayleigh_friction_readnl
80+
use rayleigh_friction_cam, only: rayleigh_friction_readnl
8181

8282
use cam_diagnostics, only: diag_readnl
8383
use radheat, only: radheat_readnl

src/physics/cam/physpkg.F90

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
743743
use tracers, only: tracers_init
744744
use aoa_tracers, only: aoa_tracers_init
745745
use rayleigh_friction, only: rayleigh_friction_init
746+
use rayleigh_friction_cam, only: rf_nl_k0, rf_nl_krange, rf_nl_tau0
746747
use vertical_diffusion, only: vertical_diffusion_init
747748
use phys_debug_util, only: phys_debug_init
748749
use rad_constituents, only: rad_cnst_init
@@ -791,6 +792,11 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
791792
! temperature, water vapor, cloud
792793
! ice, cloud liquid, U, V
793794
integer :: history_budget_histfile_num ! output history file number for budget fields
795+
796+
! Needed for rayleigh friction
797+
character(len=512) errmsg
798+
integer errflg
799+
794800
!-----------------------------------------------------------------------
795801

796802
call physics_type_alloc(phys_state, phys_tend, begchunk, endchunk, pcols)
@@ -879,7 +885,9 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out )
879885

880886
call gw_init()
881887

882-
call rayleigh_friction_init()
888+
call rayleigh_friction_init(pver, rf_nl_tau0, rf_nl_krange, rf_nl_k0, masterproc, &
889+
iulog, errmsg, errflg)
890+
if (errflg /= 0) call endrun(errmsg)
883891

884892
call vertical_diffusion_init(pbuf2d)
885893

@@ -1360,11 +1368,11 @@ subroutine tphysac (ztodt, cam_in, &
13601368
use cam_diagnostics, only: diag_phys_tend_writeout
13611369
use gw_drag, only: gw_tend
13621370
use vertical_diffusion, only: vertical_diffusion_tend
1363-
use rayleigh_friction, only: rayleigh_friction_tend
1371+
use rayleigh_friction, only: rayleigh_friction_run
13641372
use constituents, only: cnst_get_ind
13651373
use physics_types, only: physics_state, physics_tend, physics_ptend, physics_update, &
13661374
physics_dme_adjust, set_dry_to_wet, physics_state_check, &
1367-
dyn_te_idx
1375+
dyn_te_idx, physics_ptend_init
13681376
use waccmx_phys_intr, only: waccmx_phys_mspd_tend ! WACCM-X major diffusion
13691377
use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_tend ! WACCM-X
13701378
use aoa_tracers, only: aoa_tracers_timestep_tend
@@ -1456,6 +1464,10 @@ subroutine tphysac (ztodt, cam_in, &
14561464
! For aerosol budget diagnostics
14571465
type(carma_diags_t), pointer :: carma_diags_obj
14581466

1467+
! For rayleigh friction CCPP calls
1468+
character(len=512) errmsg
1469+
integer errflg
1470+
14591471
!-----------------------------------------------------------------------
14601472
carma_diags_obj => carma_diags_t()
14611473
if (.not.associated(carma_diags_obj)) then
@@ -1676,14 +1688,39 @@ subroutine tphysac (ztodt, cam_in, &
16761688
! Rayleigh friction calculation
16771689
!===================================================
16781690
call t_startf('rayleigh_friction')
1679-
call rayleigh_friction_tend( ztodt, state, ptend)
1691+
if (trim(cam_take_snapshot_before) == "rayleigh_friction_tend") then
1692+
call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,&
1693+
fh2o, surfric, obklen, flx_heat)
1694+
end if
1695+
1696+
call physics_ptend_init(ptend, state%psetcols, 'rayleigh friction', ls=.true., lu=.true., lv=.true.)
1697+
1698+
! Initialize ptend variables to zero
1699+
!REMOVECAM - no longer need these when CAM is retired and pcols no longer exists
1700+
ptend%u(:,:) = 0._r8
1701+
ptend%v(:,:) = 0._r8
1702+
ptend%s(:,:) = 0._r8
1703+
!REMOVECAM_END
1704+
1705+
call rayleigh_friction_run(pver, ztodt, state%u(:ncol,:), state%v(:ncol,:), ptend%u(:ncol,:),&
1706+
ptend%v(:ncol,:), ptend%s(:ncol,:), errmsg, errflg)
1707+
if (errflg /= 0) call endrun(errmsg)
1708+
1709+
if ( (trim(cam_take_snapshot_after) == "rayleigh_friction_tend") .and. &
1710+
(trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then
1711+
call cam_snapshot_ptend_outfld(ptend, lchnk)
1712+
end if
16801713
if ( ptend%lu ) then
16811714
call outfld( 'UTEND_RAYLEIGH', ptend%u, pcols, lchnk)
16821715
end if
16831716
if ( ptend%lv ) then
16841717
call outfld( 'VTEND_RAYLEIGH', ptend%v, pcols, lchnk)
16851718
end if
16861719
call physics_update(state, ptend, ztodt, tend)
1720+
if (trim(cam_take_snapshot_after) == "rayleigh_friction_tend") then
1721+
call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,&
1722+
fh2o, surfric, obklen, flx_heat)
1723+
end if
16871724
call t_stopf('rayleigh_friction')
16881725

16891726
if (do_clubb_sgs) then

0 commit comments

Comments
 (0)