Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cam6_4_062: Phase 2 of GW development #1117

Merged
merged 25 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dd84fa1
phase 2 of gw devel
JulioTBacmeister Aug 5, 2024
176bbd3
add template for two namelist variables for gw_drag
cacraigucar Aug 23, 2024
9e2267c
commiting changes with residual orogrpahy. may not be 'perfect'
JulioTBacmeister Dec 20, 2024
3068bad
minor mods to gw_drag
JulioTBacmeister Dec 23, 2024
c4a80f2
Merge tag 'cam6_4_048' into gw_devel_b00
JulioTBacmeister Dec 23, 2024
04f41af
added vorticity coupling from SE dycore to GW param
JulioTBacmeister Jan 9, 2025
f998687
Latest movmtn mods - vorticity source
JulioTBacmeister Jan 15, 2025
e63673e
Merge tag 'cam6_4_055' into gw_devel_b00
JulioTBacmeister Jan 15, 2025
4fb29df
mods to gw movmtn infrastructure
JulioTBacmeister Jan 22, 2025
2e7db43
added movtn_source to nml
JulioTBacmeister Jan 23, 2025
1825587
adding more namelist params for movmtn
JulioTBacmeister Jan 28, 2025
ea056d2
first stage of clean up for PR
JulioTBacmeister Jan 29, 2025
5f7ac9c
Remove comments and move check for use_gw_movmtn_pbl using the SE dyc…
cacraigucar Jan 29, 2025
88084c5
fix gnu compilation error
cacraigucar Jan 30, 2025
65baa71
update topo file
cacraigucar Jan 31, 2025
4da5455
temporary fix for topo
cacraigucar Jan 31, 2025
dd33c5b
Workaround for one more missing variable in topo files
cacraigucar Feb 1, 2025
a69d053
Fix failing restart test
cacraigucar Feb 4, 2025
668c9a3
Address first round of review comments
cacraigucar Feb 4, 2025
2c4796d
Fix typos
cacraigucar Feb 4, 2025
9f93b9e
Fix compiler issue
cacraigucar Feb 4, 2025
85efadc
Change scope of variable from inout to in
cacraigucar Feb 5, 2025
c67f137
Address final reviewer comments
cacraigucar Feb 5, 2025
27d456d
Merge tag 'cam6_4_061' into gw_devel_b00
cacraigucar Feb 6, 2025
56c909d
Update ChangeLog for cam6_4_062
cacraigucar Feb 7, 2025
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
17 changes: 17 additions & 0 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -3775,6 +3775,14 @@ if (!$simple_phys) {
add_default($nl, 'use_gw_movmtn_pbl', 'val'=>'.true.');
}

my $use_gw_movmtn_pbl = $nl->get_value('use_gw_movmtn_pbl');
if ($use_gw_movmtn_pbl =~ /$TRUE/io) {
if ( ! ($dyn =~ /se/) ) {
die "$ProgName - ERROR: use_gw_movmtn_pbl is only available with the SE dycore \n";

}
}

add_default($nl, 'use_gw_rdg_gamma' , 'val'=>'.false.');
add_default($nl, 'use_gw_front_igw' , 'val'=>'.false.');
add_default($nl, 'use_gw_convect_sh', 'val'=>'.false.');
Expand Down Expand Up @@ -3836,6 +3844,7 @@ my $do_gw_convect_sh = ($nl->get_value('use_gw_convect_sh') =~ /$TRUE/io);
my $do_gw_movmtn_pbl = ($nl->get_value('use_gw_movmtn_pbl') =~ /$TRUE/io);
my $do_gw_rdg_beta = ($nl->get_value('use_gw_rdg_beta') =~ /$TRUE/io);
my $do_gw_rdg_gamma = ($nl->get_value('use_gw_rdg_gamma') =~ /$TRUE/io);
my $do_gw_rdg_resid = ($nl->get_value('use_gw_rdg_resid') =~ /$TRUE/io);

my $do_divstream = ($nl->get_value('gw_rdg_do_divstream') =~ /$TRUE/io);

Expand Down Expand Up @@ -3890,6 +3899,10 @@ if ($do_gw_convect_sh) {
if ($do_gw_movmtn_pbl) {
add_default($nl, 'gw_drag_file_mm');
add_default($nl, 'alpha_gw_movmtn');
add_default($nl, 'effgw_movmtn_pbl');
add_default($nl, 'movmtn_source');
add_default($nl, 'movmtn_psteer');
add_default($nl, 'movmtn_plaunch');
}

if ($do_gw_rdg_beta) {
Expand All @@ -3909,6 +3922,10 @@ if ($do_gw_rdg_beta) {
add_default($nl, 'gw_prndl');
}

if ($do_gw_rdg_resid) {
add_default($nl, 'effgw_rdg_resid' );
}

if ($do_gw_rdg_gamma) {
add_default($nl, 'n_rdg_gamma', 'val'=>'-1');
add_default($nl, 'effgw_rdg_gamma', 'val'=>'1.0D0');
Expand Down
9 changes: 8 additions & 1 deletion bld/namelist_files/namelist_defaults_cam.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
<bnd_topo hgrid="ne3np4" npg="3">atm/cam/topo/se/ne3pg3_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230209.nc</bnd_topo>
<bnd_topo hgrid="ne5np4" npg="3">atm/cam/topo/se/ne5pg3_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170516.nc</bnd_topo>
<bnd_topo hgrid="ne16np4" npg="3">atm/cam/topo/se/ne16pg3_nc3000_Co120_Fi001_PF_nullRR_Nsw084_20171012.nc</bnd_topo>
<bnd_topo hgrid="ne30np4" npg="3">atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_20240117.nc</bnd_topo>
<bnd_topo hgrid="ne30np4" npg="3">atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_20240720.nc</bnd_topo>
<bnd_topo hgrid="ne60np4" npg="3">atm/cam/topo/se/ne60pg3_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171012.nc</bnd_topo>
<bnd_topo hgrid="ne120np4" npg="3">atm/cam/topo/se/ne120pg3_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171014.nc</bnd_topo>
<bnd_topo hgrid="ne240np4" npg="3">atm/cam/topo/se/ne240pg3_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171015.nc</bnd_topo>
Expand Down Expand Up @@ -827,6 +827,8 @@

<effgw_oro nlev="60" >0.0625D0</effgw_oro>

<effgw_rdg_resid >1.0D0</effgw_rdg_resid>

<effgw_rdg_beta >1.0D0</effgw_rdg_beta>
<effgw_rdg_beta model_top="lt" >0.5D0</effgw_rdg_beta>
<effgw_rdg_beta model_top="mt" >0.5D0</effgw_rdg_beta>
Expand Down Expand Up @@ -893,6 +895,11 @@
<gw_rdg_orostratmin > 0.002d0</gw_rdg_orostratmin>
<gw_rdg_orom2min > 0.1d0 </gw_rdg_orom2min>
<alpha_gw_movmtn > 0.01d0 </alpha_gw_movmtn>
<effgw_movmtn_pbl > 1.0d0 </effgw_movmtn_pbl>
<movmtn_psteer > 65000.0d0 </movmtn_psteer>
<movmtn_plaunch > 32500.0d0 </movmtn_plaunch>
<movmtn_source > 1 </movmtn_source>


<!-- Dry Convective Adjustment options -->
<dadadj_niter>15</dadadj_niter>
Expand Down
37 changes: 37 additions & 0 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,13 @@ Whether or not to enable gravity waves from PBL moving mountains source.
Default: .false.
</entry>

<entry id="use_gw_rdg_resid" type="logical" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Whether or not to enable gravity waves from residual (non-ridge)
orography
Default: set by build-namelist.
</entry>

<entry id="pgwv" type="integer" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Gravity wave spectrum dimension (wave numbers are from -pgwv to pgwv).
Expand Down Expand Up @@ -1426,6 +1433,36 @@ Max efficiency associated with anisotropic OGW.
Default: 1.0
</entry>

<entry id="effgw_rdg_resid" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Efficiency scaling factor associated with residual non-ridge topo
Default: set by build-namelist.
</entry>

<entry id="effgw_movmtn_pbl" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Efficiency scaling factor for moving mountain source
Default: set by build-namelist.
</entry>

<entry id="movmtn_psteer" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Global steering level (Pa) for moving mtns. If negative steering level, it will be provided by future code
Default: set by build-namelist.
</entry>

<entry id="movmtn_plaunch" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Global launch level (Pa) for moving mtns. If negative launch level, it will be provided by future code
Default: set by build-namelist.
</entry>

<entry id="movmtn_source" type="integer" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Integer code for movmtn source: 1=vorticity, 2=upwp
Default: set by build-namelist.
</entry>

<entry id="rdg_beta_cd_llb" type="real" category="gw_drag"
group="gw_drag_nl" valid_values="" >
Drag coefficient for obstacles in low-level flow.
Expand Down
103 changes: 103 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,109 @@

===============================================================

Tag name: cam6_4_062
Originator(s): juliob, cacraig, PeterHjortLauritzen
Date: Feb 7, 2025
One-line Summary: Phase 2 of GW development
Github PR URL: https://github.com/ESCOMP/CAM/pull/1117

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
- Continuing development of gravity wave parameterization (//github.com/ESCOMP/CAM/issues/1115)
- Added vorticity calculation to SE dycore. Vorticity is passed to the gravity wave (GW) scheme in
model physics to provide a possible source for ‘moving mountain’ GW, i.e., low-phase speed GW forced
by atmospheric circulations. This provides another forcing option, in addition to boundary layer
momentum flux implemented earlier. Vorticity anomalies as sources for GW have been proposed by other
researchers in published papers.

Describe any changes made to build system: N/A

Describe any changes made to the namelist:
- Added the following namelist options
- use_gw_rdg_resid
- effgw_movmtn_pbl
- movmtn_source
- movmtn_psteer
- movmtn_plaunch
- effgw_rdg_resid

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by: nusbaume, PeterHjortLauritzen

List all files eliminated: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
M bld/build-namelist
M bld/namelist_files/namelist_defaults_cam.xml
M bld/namelist_files/namelist_definition.xml
- added new GW namelist settings (see above)

M src/dynamics/se/dp_coupling.F90
M src/dynamics/se/dyn_comp.F90
M src/dynamics/se/gravity_waves_sources.F90
M src/physics/cam/gw_common.F90
M src/physics/cam/gw_drag.F90
M src/physics/cam/gw_movmtn.F90
M src/physics/cam/gw_rdg.F90
- See description listed above

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL)
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: DIFF)
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856

SMS_D_Ln9.f19_f19_mg17.FXHIST.derecho_intel.cam-outfrq9s_amie (Overall: FAIL)
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL)
- pre-existing failures due to build-namelist error requiring CLM/CTSM external update

ERP_D_Ln9.ne30pg3_ne30pg3_mg17.FLTHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
ERP_D_Ln9.ne30pg3_ne30pg3_mg17.QPLT.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details:
ERP_D_Ln9.ne30pg3_ne30pg3_mg17.QPMT.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
ERP_Ld3.ne30pg3_ne30pg3_mg17.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details:
ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
ERP_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
SMS_D_Ln9.ne30pg3_ne30pg3_mg17.FMTHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details:
SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mg17.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details:
SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details:
SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details:
- Answer changes expected for CAM7 runs

derecho/nvhpc/aux_cam:
ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: FAIL)
- pre-existing failure -- issue #1220

izumi/nag/aux_cam: All BFB

izumi/gnu/aux_cam:
ERP_D_Ln9.ne3pg3_ne3pg3_mg37.FLTHIST.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPLT.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPMT.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
- Answer changes expected for CAM7 runs

Summarize any changes to answers, i.e.,
- what code configurations: All CAM7
- what platforms/compilers: All
- nature of change (roundoff; larger than roundoff but same climate; new
climate): new climate when GW namelists are set

If this tag changes climate describe the run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced, i.e.,
- Simulations were made by Julio Bacmeister and were presented at AMWG
- Dave Lawrence presented results to the SCC at their January meeting

===============================================================

===============================================================

Tag name: cam6_4_061
Originator(s): liyptardis, PeterHjortLauritzen, cacraig
Date: Feb 6, 2025
Expand Down
48 changes: 44 additions & 4 deletions src/dynamics/se/dp_coupling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
! Note that all pressures and tracer mixing ratios coming from the dycore are based on
! dry air mass.

use gravity_waves_sources, only: gws_src_fnct
use dyn_comp, only: frontgf_idx, frontga_idx
use phys_control, only: use_gw_front, use_gw_front_igw
use gravity_waves_sources, only: gws_src_fnct,gws_src_vort
use dyn_comp, only: frontgf_idx, frontga_idx, vort4gw_idx
use phys_control, only: use_gw_front, use_gw_front_igw, use_gw_movmtn_pbl
use hycoef, only: hyai, ps0
use fvm_mapping, only: dyn2phys_vector, dyn2phys_all_vars
use se_dyn_time_mod, only: timelevel_qdp
Expand Down Expand Up @@ -84,9 +84,16 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
real (kind=r8), allocatable :: frontga(:,:,:) ! function (frontgf) and angle (frontga)
real (kind=r8), allocatable :: frontgf_phys(:,:,:)
real (kind=r8), allocatable :: frontga_phys(:,:,:)

! Vorticity
real (kind=r8), allocatable :: vort4gw(:,:,:) ! temp arrays to hold vorticity
real (kind=r8), allocatable :: vort4gw_phys(:,:,:)


! Pointers to pbuf
real (kind=r8), pointer :: pbuf_frontgf(:,:)
real (kind=r8), pointer :: pbuf_frontga(:,:)
real (kind=r8), pointer :: pbuf_vort4gw(:,:)

integer :: ncols, ierr
integer :: col_ind, blk_ind(1), m
Expand All @@ -110,6 +117,9 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
nullify(pbuf_chnk)
nullify(pbuf_frontgf)
nullify(pbuf_frontga)
nullify(pbuf_vort4gw)



if (fv_nphys > 0) then
nphys = fv_nphys
Expand All @@ -136,11 +146,18 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
allocate(frontga(nphys_pts,pver,nelemd), stat=ierr)
if (ierr /= 0) call endrun("dp_coupling: Allocate of frontga failed.")
end if
if (use_gw_movmtn_pbl) then
allocate(vort4gw(nphys_pts,pver,nelemd), stat=ierr)
if (ierr /= 0) call endrun("dp_coupling: Allocate of vort4gw failed.")
end if

if (iam < par%nprocs) then
if (use_gw_front .or. use_gw_front_igw) then
if (use_gw_front .or. use_gw_front_igw ) then
call gws_src_fnct(elem, tl_f, tl_qdp_np0, frontgf, frontga, nphys)
end if
if (use_gw_movmtn_pbl ) then
call gws_src_vort(elem, tl_f, tl_qdp_np0, vort4gw, nphys)
end if

if (fv_nphys > 0) then
call test_mapping_overwrite_dyn_state(elem,dyn_out%fvm)
Expand Down Expand Up @@ -205,6 +222,9 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
frontgf(:,:,:) = 0._r8
frontga(:,:,:) = 0._r8
end if
if (use_gw_movmtn_pbl) then
vort4gw(:,:,:) = 0._r8
end if

endif ! iam < par%nprocs

Expand All @@ -223,6 +243,9 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
allocate(frontgf_phys(pcols, pver, begchunk:endchunk))
allocate(frontga_phys(pcols, pver, begchunk:endchunk))
end if
if (use_gw_movmtn_pbl) then
allocate(vort4gw_phys(pcols, pver, begchunk:endchunk))
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
end if
!$omp parallel do num_threads(max_num_threads) private (col_ind, lchnk, icol, ie, blk_ind, ilyr, m)
do col_ind = 1, phys_columns_on_task
call get_dyn_col_p(col_ind, ie, blk_ind)
Expand All @@ -240,6 +263,9 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
frontgf_phys(icol, ilyr, lchnk) = frontgf(blk_ind(1), ilyr, ie)
frontga_phys(icol, ilyr, lchnk) = frontga(blk_ind(1), ilyr, ie)
end if
if (use_gw_movmtn_pbl) then
vort4gw_phys(icol, ilyr, lchnk) = vort4gw(blk_ind(1), ilyr, ie)
end if
end do

do m = 1, pcnst
Expand All @@ -265,6 +291,20 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out)
deallocate(frontgf_phys)
deallocate(frontga_phys)
end if
if (use_gw_movmtn_pbl) then
!$omp parallel do num_threads(max_num_threads) private (lchnk, ncols, icol, ilyr, pbuf_chnk, pbuf_vort4gw)
cacraigucar marked this conversation as resolved.
Show resolved Hide resolved
do lchnk = begchunk, endchunk
ncols = get_ncols_p(lchnk)
pbuf_chnk => pbuf_get_chunk(pbuf2d, lchnk)
call pbuf_get_field(pbuf_chnk, vort4gw_idx, pbuf_vort4gw)
do icol = 1, ncols
do ilyr = 1, pver
pbuf_vort4gw(icol, ilyr) = vort4gw_phys(icol, ilyr, lchnk)
end do
end do
end do
deallocate(vort4gw_phys)
end if

call t_stopf('dpcopy')

Expand Down
10 changes: 7 additions & 3 deletions src/dynamics/se/dyn_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module dyn_comp
cnst_is_a_water_species
use cam_control_mod, only: initial_run
use cam_initfiles, only: initial_file_get_id, topo_file_get_id, pertlim
use phys_control, only: use_gw_front, use_gw_front_igw
use phys_control, only: use_gw_front, use_gw_front_igw, use_gw_movmtn_pbl
use dyn_grid, only: ini_grid_name, timelevel, hvcoord, edgebuf, &
ini_grid_hdim_name

Expand Down Expand Up @@ -79,6 +79,7 @@ module dyn_comp
! Frontogenesis indices
integer, public :: frontgf_idx = -1
integer, public :: frontga_idx = -1
integer, public :: vort4gw_idx = -1

interface read_dyn_var
module procedure read_dyn_field_2d
Expand Down Expand Up @@ -572,6 +573,10 @@ subroutine dyn_register()
call pbuf_add_field("FRONTGA", "global", dtype_r8, (/pcols,pver/), &
frontga_idx)
end if
if (use_gw_movmtn_pbl) then
call pbuf_add_field("VORT4GW", "global", dtype_r8, (/pcols,pver/), &
vort4gw_idx)
end if

end subroutine dyn_register

Expand Down Expand Up @@ -875,8 +880,7 @@ subroutine dyn_init(dyn_in, dyn_out)
call get_loop_ranges(hybrid, ibeg=nets, iend=nete)
call prim_init2(elem, fvm, hybrid, nets, nete, TimeLevel, hvcoord)
!$OMP END PARALLEL

if (use_gw_front .or. use_gw_front_igw) call gws_init(elem)
if (use_gw_front .or. use_gw_front_igw .or. use_gw_movmtn_pbl) call gws_init(elem)
end if ! iam < par%nprocs

call addfld ('nu_kmvis', (/ 'lev' /), 'A', '', 'Molecular viscosity Laplacian coefficient' , gridname='GLL')
Expand Down
Loading