Skip to content
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4964e80
gw works changes
jtruesdal Feb 19, 2025
e15806b
Fix runtime errors -- batch 1
jimmielin Aug 5, 2025
732805e
Cleanup; reindent code to prepare for debugging
jimmielin Aug 5, 2025
735b87d
Backport cam6_4_078: moving mountains update from pel
jimmielin Aug 5, 2025
a75c385
Comment structure updates to ease debugging
jimmielin Aug 5, 2025
223ec7c
Fix kind
jimmielin Aug 5, 2025
bf819a8
Cleanup 1 gw_rdg in preparation for CCPPization
jimmielin Aug 6, 2025
83646b0
Continue cleanup; insterstitials; vramp
jimmielin Aug 6, 2025
bc7c6f5
Cleanup gw_rdg interface; lift up io to host model level with sima-sp…
jimmielin Aug 7, 2025
0e1afdd
Continue general cleanup
jimmielin Aug 8, 2025
4545436
Continue cleanup; move moving mountains to separate CCPP scheme
jimmielin Aug 8, 2025
761aabf
Refactor Beres (convective drag) deep/shallow to separate schemes; gw…
jimmielin Aug 12, 2025
7845ddc
CCPPized gw_oro -> gravity_wave_drag_orographic
jimmielin Aug 12, 2025
cb78a90
CCPPize gw_front; diagnostics in Beres/convect and throughout
jimmielin Aug 14, 2025
b8871f4
Reorganize scheme module names; move index_of_nearest to gw_utils
jimmielin Aug 15, 2025
08dd41d
Cleanup; remove gw_drag in favor of gw_common initialization
jimmielin Aug 15, 2025
7368398
Mockup SDFs for CAM4 and CAM7 configurations.
jimmielin Aug 15, 2025
5378bff
Revert extraneous changes; update to use allocatable in i/o reader
jimmielin Aug 20, 2025
24b3913
Remove unused vars; fix mfcc in Beres copy when ngwv is less than ngw…
jimmielin Aug 20, 2025
888dbf2
Draft metadata
jimmielin Aug 22, 2025
af34601
Populate metadata for oro drag; namelist for oro drag
jimmielin Aug 26, 2025
8c8f81f
Fill gw_common initialization; namelist vars
jimmielin Aug 26, 2025
ea709ca
Remove extra files to build SIMA for testing.
jimmielin Aug 26, 2025
6add876
Backport coords1d from hb diff; update to lowercase to workaround fra…
jimmielin Aug 26, 2025
9e17e6e
De-pointerize vramp; clean metadata; initialize accumulators; misc fixes
jimmielin Aug 26, 2025
c235141
Further cleanup and depointerize vramp.
jimmielin Aug 26, 2025
fa7f1f4
Fix suites; add convert_dry_constituent_tendencies_to_dry_air_basis
jimmielin Aug 27, 2025
cf7e630
Remove currently unused files for PR, interactively rebased to dev
jimmielin Aug 27, 2025
376eaa4
Misc cleanup; movmtn diagnostics for CAM
jimmielin Aug 28, 2025
82593f9
Depointerize ridge inputs; movmtn diagnostics
jimmielin Aug 28, 2025
c5883ac
Simplify ridge code as i/o will be done at host model level; cleanup …
jimmielin Aug 29, 2025
6a8ebdd
Update comments
jimmielin Sep 4, 2025
f8919b6
Update standard names to conventions
jimmielin Sep 5, 2025
3b958db
Update standard names for interstitials and oro; add Ridge; movmtn dr…
jimmielin Sep 9, 2025
97ab0a7
Merge branch 'development' into hplin/gw_drag
jimmielin Sep 9, 2025
8d0093a
Fix ridge initialization beta/gamma
jimmielin Sep 9, 2025
c812844
Clean up public vars/sub in gw_common
jimmielin Sep 9, 2025
5e6fd55
Populate movmtn namelist
jimmielin Sep 16, 2025
ae2080e
Split off Beres shallow/deep initialization scheme for cleaniness
jimmielin Sep 19, 2025
cd090ca
Merge branch 'development' into hplin/gw_drag
jimmielin Sep 19, 2025
28db7a6
Separate out front and front_igw; finish meta for movmtn, front (not …
jimmielin Sep 23, 2025
7098a9a
Wip convective/Beres meta
jimmielin Sep 24, 2025
feaf146
Convective gw metadata
jimmielin Sep 25, 2025
a18d1dc
Add TTEND_DP interstitial for ZM
jimmielin Sep 25, 2025
8e7fcd0
Add CAM7 GW SDF.
jimmielin Sep 25, 2025
5a2b5dc
Fix SDF 7 path
jimmielin Sep 25, 2025
0aa8789
SIMA build-time fixes for CAM7 SE
jimmielin Sep 25, 2025
d5667cb
Update standard names to remove some TBD
jimmielin Sep 25, 2025
d35c337
Move to gravity_wave_drag dir
jimmielin Sep 25, 2025
ab15b96
Logic fix for moving mountain; revert some nl variable name changes; …
jimmielin Sep 25, 2025
11c8bc9
Merge branch 'development' into hplin/gw_drag
jimmielin Sep 26, 2025
0cc4b7d
Add intertial_init to public
jimmielin Sep 29, 2025
432f477
Add orographic gravity wave drag to suite_cam4
jimmielin Sep 29, 2025
7973eda
Merge branch 'development' into hplin/gw_drag
jimmielin Oct 12, 2025
993144f
Answer diff 1 test
jimmielin Oct 12, 2025
a7971c8
Cleanup changes 2
jimmielin Oct 12, 2025
f16ce0c
Update schemes/gravity_wave_drag/gravity_wave_drag_orographic.F90
jimmielin Oct 13, 2025
dd805ca
Address review comments (part 1)
jimmielin Oct 13, 2025
7357b76
Update schemes/gravity_wave_drag/gravity_wave_drag_convection.F90
jimmielin Oct 13, 2025
00d7fab
Update schemes/gravity_wave_drag/gravity_wave_drag_ridge.F90
jimmielin Oct 13, 2025
65d50c1
Address review comments (2)
jimmielin Oct 13, 2025
6f1fb64
Remove TBD from standard names
jimmielin Oct 13, 2025
20a78b3
Update schemes/gravity_wave_drag/gravity_wave_drag_moving_mountain.F90
jimmielin Oct 13, 2025
dbca780
Update schemes/gravity_wave_drag/gravity_wave_drag_moving_mountain.F90
jimmielin Oct 13, 2025
f19cab6
Pass top taper level as argument (needs changes in ref_pres on both e…
jimmielin Oct 13, 2025
dc49334
Add pverp to common and convective schemes
jimmielin Oct 14, 2025
0885006
Update to accummulate ttend_dp
jimmielin Oct 14, 2025
1c82aa8
Fix meta
jimmielin Oct 14, 2025
d4ccca4
Fix meta (2)
jimmielin Oct 14, 2025
eac0b5a
(proposed fix) fix division-by-zero in tropopause cold point method
jimmielin Oct 15, 2025
7a73092
Remove SAVE from modules
jimmielin Oct 27, 2025
90919fe
Update schemes/gravity_wave_drag/gravity_wave_drag_convection.F90
jimmielin Oct 27, 2025
150c820
Update schemes/gravity_wave_drag/gravity_wave_drag_convection.F90
jimmielin Oct 27, 2025
361a7a9
Update schemes/gravity_wave_drag/gravity_wave_drag_moving_mountain.F90
jimmielin Oct 27, 2025
bc18973
Update schemes/gravity_wave_drag/gravity_wave_drag_moving_mountain.F90
jimmielin Oct 27, 2025
9cdf3b7
Update schemes/gravity_wave_drag/gravity_wave_drag_convection.F90
jimmielin Oct 27, 2025
68c13e3
Address review comments
jimmielin Oct 27, 2025
ae87528
Merge branch 'development' into hplin/gw_drag
jimmielin Nov 27, 2025
3e2b105
Add stub gw drag common diagnostic (SIMA-only) to pass FPHYStest tests.
jimmielin Nov 28, 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
989 changes: 989 additions & 0 deletions schemes/gravity_wave_drag/gravity_wave_drag_convection.F90

Large diffs are not rendered by default.

721 changes: 721 additions & 0 deletions schemes/gravity_wave_drag/gravity_wave_drag_convection.meta

Large diffs are not rendered by default.

760 changes: 760 additions & 0 deletions schemes/gravity_wave_drag/gravity_wave_drag_frontogenesis.F90

Large diffs are not rendered by default.

739 changes: 739 additions & 0 deletions schemes/gravity_wave_drag/gravity_wave_drag_frontogenesis.meta

Large diffs are not rendered by default.

190 changes: 190 additions & 0 deletions schemes/gravity_wave_drag/gravity_wave_drag_interstitials.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
! Interstitial schemes for preparing fields needed for various gravity wave drag schemes
module gravity_wave_drag_interstitials
use ccpp_kinds, only: kind_phys

implicit none
private

! public CCPP-compliant subroutines
public :: gravity_wave_drag_prepare_profiles_run
public :: gravity_wave_drag_prepare_profiles_timestep_final

contains

! (originally gw_prof in gw_common)
! Compute profiles of background state quantities for multiple
! gravity wave drag parameterizations, and prepare vertical pressure
! coordinates.
!
! The parameterization is assumed to operate only where water vapor
! concentrations are negligible in determining the density.
!> \section arg_table_gravity_wave_drag_prepare_profiles_run Argument Table
!! \htmlinclude gravity_wave_drag_prepare_profiles_run.html
subroutine gravity_wave_drag_prepare_profiles_run( &
ncol, pver, &
cpair, rair, gravit, &
pint, &
t, &
do_molec_diff, nbot_molec, &
cpairv, kvt, &
p, &
rhoi, &
nm, ni, &
egwdffi, &
tend_q, tend_u, tend_v, tend_s, &
kvt_gw, &
flx_heat, &
scheme_name, &
errmsg, errflg)

use gw_utils, only: midpoint_interp
use coords_1d, only: Coords1D

! Input arguments
integer, intent(in) :: ncol
integer, intent(in) :: pver

real(kind_phys), intent(in) :: cpair ! Specific heat of dry air, constant pressure [J K-1 kg-1]
real(kind_phys), intent(in) :: rair ! Dry air gas constant [J K-1 kg-1]
real(kind_phys), intent(in) :: gravit ! standard_gravitational_acceleration [m s-2]
real(kind_phys), intent(in) :: pint(:, :) ! Interface pressures [Pa]
real(kind_phys), intent(in) :: t(:, :) ! Midpoint temperatures [K]

logical, intent(in) :: do_molec_diff ! do_molecular_diffusion [flag]
integer, intent(in) :: nbot_molec ! index_of_pressure_at_bottom_of_molecular_diffusion [index]
real(kind_phys), intent(in) :: cpairv(:,:)! composition_dependent_specific_heat_of_dry_air_at_constant_pressure [J kg-1 K-1]
real(kind_phys), intent(in) :: kvt(:,:) ! molecular_kinematic_temperature_conductivity_at_interfaces

! Output arguments
type(coords1d), intent(out) :: p ! Vertical coordinate for gravity waves [Coords1D, Pa]

real(kind_phys), intent(out) :: rhoi(:, :) ! Density at layer interfaces [kg m-3]
real(kind_phys), intent(out) :: nm(:, :) ! Midpoint Brunt-Vaisalla frequencies [s-1]
real(kind_phys), intent(out) :: ni(:, :) ! Interface Brunt-Vaisalla frequencies [s-1]
real(kind_phys), intent(out) :: egwdffi(:, :) ! Effective diffusion coefficient from gravity waves [m2 s-1]

! Initialize tendency accumulators to make framework happy about intent(inout) in the individual gw schemes.
real(kind_phys), intent(out) :: tend_q(:, :, :) ! Constituent tendencies [kg kg-1 s-1]
real(kind_phys), intent(out) :: tend_u(:, :) ! Zonal wind tendency [m s-2]
real(kind_phys), intent(out) :: tend_v(:, :) ! Meridional wind tendency [m s-2]
real(kind_phys), intent(out) :: tend_s(:, :) ! Dry static energy tendency [J kg-1 s-1]

real(kind_phys), intent(out) :: kvt_gw(:,:)! scaled_molecular_kinematic_temperature_conductivity_at_interfaces_for_gravity_wave_drag [m2 s-1]

! for energy checker:
real(kind_phys), intent(out) :: flx_heat(:) ! net_sensible_heat_flux_through_top_and_bottom_of_atmosphere_column [W m-2]
character(len=*), intent(out):: scheme_name

character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg

! Local variables
integer :: i, k
real(kind_phys) :: dtdp ! dt/dp
real(kind_phys) :: n2 ! Brunt-Vaisalla frequency squared [s-2]
real(kind_phys) :: ti(ncol, pver + 1) ! Interface temperature [K]

! Minimum value of Brunt-Vaisalla frequency squared.
real(kind_phys), parameter :: n2min = 5.e-5_kind_phys

errmsg = ''
errflg = 0

!------------------------------------------------------------------------
! Create Coords1D coordinate for gravity waves.
!------------------------------------------------------------------------
p = Coords1D(pint(:ncol, :pver+1))

!------------------------------------------------------------------------
! Initialization of effective diffusion coefficients,
! accummulated tendencies from all gravity wave schemes,
! and quantities for energy checker.
!------------------------------------------------------------------------
egwdffi(:, :) = 0._kind_phys
flx_heat(:) = 0._kind_phys
scheme_name = 'gravity_wave_drag'

tend_q(:,:,:) = 0._kind_phys
tend_u(:,:) = 0._kind_phys
tend_v(:,:) = 0._kind_phys
tend_s(:,:) = 0._kind_phys

!------------------------------------------------------------------------
! Calculate local molecular diffusivity
!------------------------------------------------------------------------
if(do_molec_diff) then
kvt_gw(:,:) = kvt(:,:)

! Use linear extrapolation of cpairv to top interface.
kvt_gw(:, 1) = kvt_gw(:, 1)/ &
(1.5_kind_phys*cpairv(:ncol, 1) - &
0.5_kind_phys*cpairv(:ncol, 2))

! Interpolate cpairv to other interfaces.
do k = 2, nbot_molec
kvt_gw(:, k) = kvt_gw(:, k)/ &
(cpairv(:ncol, k + 1) + cpairv(:ncol, k))*2._kind_phys
end do

else
kvt_gw(:,:) = 0._kind_phys
endif

!------------------------------------------------------------------------
! Determine the interface densities and Brunt-Vaisala frequencies.
!------------------------------------------------------------------------

! The top interface values are calculated assuming an isothermal
! atmosphere above the top level.
k = 1
do i = 1, ncol
ti(i, k) = t(i, k)
rhoi(i, k) = p%ifc(i, k)/(rair*ti(i, k))
ni(i, k) = sqrt(gravit*gravit/(cpair*ti(i, k)))
end do

! Interior points use centered differences.
ti(:, 2:pver) = midpoint_interp(t)
do k = 2, pver
do i = 1, ncol
rhoi(i, k) = p%ifc(i, k)/(rair*ti(i, k))
dtdp = (t(i, k) - t(i, k - 1))*p%rdst(i, k - 1)
n2 = gravit*gravit/ti(i, k)*(1._kind_phys/cpair - rhoi(i, k)*dtdp)
ni(i, k) = sqrt(max(n2min, n2))
end do
end do

! Bottom interface uses bottom level temperature, density; next interface
! B-V frequency.
k = pver + 1
do i = 1, ncol
ti(i, k) = t(i, k - 1)
rhoi(i, k) = p%ifc(i, k)/(rair*ti(i, k))
ni(i, k) = ni(i, k - 1)
end do

!------------------------------------------------------------------------
! Determine the midpoint Brunt-Vaisala frequencies.
!------------------------------------------------------------------------
nm = midpoint_interp(ni)

end subroutine gravity_wave_drag_prepare_profiles_run

!> \section arg_table_gravity_wave_drag_prepare_profiles_timestep_final Argument Table
!! \htmlinclude gravity_wave_drag_prepare_profiles_timestep_final.html
subroutine gravity_wave_drag_prepare_profiles_timestep_final(p, errmsg, errflg)

use coords_1d, only: Coords1D

type(coords1d), intent(inout) :: p ! Vertical coordinate for gravity waves [Coords1D, Pa]
character(len=512), intent(out) :: errmsg
integer, intent(out) :: errflg

errmsg = ''
errflg = 0

call p%finalize()

end subroutine gravity_wave_drag_prepare_profiles_timestep_final

end module gravity_wave_drag_interstitials
180 changes: 180 additions & 0 deletions schemes/gravity_wave_drag/gravity_wave_drag_interstitials.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
[ccpp-table-properties]
name = gravity_wave_drag_prepare_profiles
type = scheme
dependencies = gw_utils.F90,../../to_be_ccppized/coords_1d.F90

[ccpp-arg-table]
name = gravity_wave_drag_prepare_profiles_run
type = scheme
[ ncol ]
standard_name = horizontal_loop_extent
units = count
type = integer
dimensions = ()
intent = in
[ pver ]
standard_name = vertical_layer_dimension
units = count
type = integer
dimensions = ()
intent = in
[ cpair ]
standard_name = specific_heat_of_dry_air_at_constant_pressure
units = J kg-1 K-1
type = real | kind = kind_phys
dimensions = ()
intent = in
[ rair ]
standard_name = gas_constant_of_dry_air
units = J kg-1 K-1
type = real | kind = kind_phys
dimensions = ()
intent = in
[ gravit ]
standard_name = standard_gravitational_acceleration
units = m s-2
type = real | kind = kind_phys
dimensions = ()
intent = in
[ pint ]
standard_name = air_pressure_at_interface
units = Pa
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
intent = in
[ t ]
standard_name = air_temperature
units = K
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = in
[ do_molec_diff ]
standard_name = do_molecular_diffusion
units = flag
type = logical
dimensions = ()
intent = in
[ nbot_molec ]
standard_name = vertical_layer_index_at_bottom_of_molecular_diffusion
units = index
type = integer
dimensions = ()
intent = in
[ cpairv ]
standard_name = composition_dependent_specific_heat_of_dry_air_at_constant_pressure
units = J kg-1 K-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = in
[ kvt ]
standard_name = molecular_kinematic_temperature_conductivity_at_interfaces
units = m2 s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
intent = in
[ p ]
standard_name = vertical_moist_pressure_coordinates_for_gravity_wave_drag
units = Pa
type = coords1d
dimensions = ()
intent = out
[ rhoi ]
standard_name = air_density_at_interfaces_for_gravity_wave_drag
units = kg m-3
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
intent = out
[ nm ]
standard_name = brunt_vaisalla_frequencies
units = s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = out
[ ni ]
standard_name = brunt_vaisalla_frequencies_at_interfaces
units = s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
intent = out
[ egwdffi ]
standard_name = effective_diffusivity_coefficient_at_interfaces_due_to_gravity_wave_drag
units = m2 s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
intent = out
[ tend_q ]
standard_name = ccpp_constituent_tendencies
units = none
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension, number_of_ccpp_constituents)
intent = out
[ tend_u ]
standard_name = tendency_of_eastward_wind
units = m s-2
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = out
[ tend_v ]
standard_name = tendency_of_northward_wind
units = m s-2
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = out
[ tend_s ]
standard_name = tendency_of_dry_air_enthalpy_at_constant_pressure
units = J kg-1 s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
intent = out
[ kvt_gw ]
standard_name = scaled_molecular_kinematic_temperature_conductivity_at_interfaces_for_gravity_wave_drag
units = m2 s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent, vertical_interface_dimension)
intent = out
[ flx_heat ]
standard_name = net_sensible_heat_flux_through_top_and_bottom_of_atmosphere_column
units = W m-2
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent)
intent = out
[ scheme_name ]
standard_name = scheme_name
units = none
type = character | kind = len=*
dimensions = ()
intent = out
[ errmsg ]
standard_name = ccpp_error_message
units = none
type = character | kind = len=512
dimensions = ()
intent = out
[ errflg ]
standard_name = ccpp_error_code
units = 1
type = integer
dimensions = ()
intent = out

[ccpp-arg-table]
name = gravity_wave_drag_prepare_profiles_timestep_final
type = scheme
[ p ]
standard_name = vertical_moist_pressure_coordinates_for_gravity_wave_drag
units = Pa
type = coords1d
dimensions = ()
intent = inout
[ errmsg ]
standard_name = ccpp_error_message
units = none
type = character | kind = len=512
dimensions = ()
intent = out
[ errflg ]
standard_name = ccpp_error_code
units = 1
type = integer
dimensions = ()
intent = out
Loading
Loading