Skip to content

Commit

Permalink
ESCOMP tag: cam6_4_062
Browse files Browse the repository at this point in the history
Merge pull request ESCOMP#1117 from JulioTBacmeister/gw_devel_b00

cam6_4_062: Phase 2 of GW development

ESCOMP commit: 834379d
  • Loading branch information
cacraigucar authored and Steve Goldhaber committed Feb 22, 2025
1 parent 5511d06 commit e8bc6f6
Show file tree
Hide file tree
Showing 8 changed files with 873 additions and 141 deletions.
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))
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)
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

0 comments on commit e8bc6f6

Please sign in to comment.