Skip to content

Commit 745e02e

Browse files
authored
Merge branch 'whannah/eamxx/create-gwd-atm-proc-rebase' (PR #8219)
This adds support for the C++ GW drag schemes in EAMxx. Nothing has been validated yet, but we can save this effort for later when ZM and frontogenesis values are available. For now this PR just adds a working GW interface to EAMxx, but keeps it as a stealth feature. [BFB]
2 parents 4fb19b3 + 773a97b commit 745e02e

15 files changed

Lines changed: 1404 additions & 216 deletions

components/eamxx/cime_config/namelist_defaults_eamxx.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,30 @@ be lost if SCREAM_HACK_XML is not enabled.
296296
<mcsp_v_coeff type="real" doc="MCSP V-wind coefficient" >0.0</mcsp_v_coeff>
297297
</zm>
298298

299+
<!-- Gravity Wave Drag -->
300+
<gw inherit="atm_proc_base">
301+
<use_gw_convect type="logical" doc="Flag for convective GWD">false</use_gw_convect>
302+
<use_gw_frontal type="logical" doc="Flag for frontal GWD">false</use_gw_frontal>
303+
<use_gw_orographic type="logical" doc="Flag for orographic GWD">false</use_gw_orographic>
304+
<gw_drag_file type="string" doc="GW source spectra file">${DIN_LOC_ROOT}/atm/waccm/gw/newmfspectra40_dc25.nc</gw_drag_file>
305+
<pgwv type="integer" doc="Maximum number of waves allowed">32</pgwv>
306+
<gw_dc type="real" doc="Bin width for spectrum">2.5</gw_dc>
307+
<tau_0_ubc type="logical" doc="flag to enforce an upper boundary condition of tau=0">false</tau_0_ubc>
308+
<fcrit2 type="real" doc="Critical Froude number">1.0</fcrit2>
309+
<gw_orographic_eff type="real" doc="Efficiency of orographic GW tendencies">0.375</gw_orographic_eff>
310+
<gw_frontal_taubgnd type="real" doc="Background stress source strength for frontal GW scheme">2.5E-3</gw_frontal_taubgnd>
311+
<gw_frontal_eff type="real" doc="Efficiency of frontal GW tendencies">1.0</gw_frontal_eff>
312+
<gw_frontal_fgfc hgrid="ne30np4.pg2" type="real" doc="Frontogenesis function critical threshold for frontal GW scheme">1.25E-15</gw_frontal_fgfc>
313+
<gw_frontal_fgfc hgrid="ne120np4.pg2" type="real" doc="Frontogenesis function critical threshold for frontal GW scheme">2.00E-14</gw_frontal_fgfc>
314+
<gw_convect_eff type="real" doc="Efficiency of convective GW tendencies">0.35</gw_convect_eff>
315+
<gw_convect_hcf type="real" doc="Convective heating rate conversion factor">10.0</gw_convect_hcf>
316+
<gw_convect_hdepth_scale type="real" doc="Scaling factor for convective heating depth">0.50</gw_convect_hdepth_scale>
317+
<gw_convect_hdepth_min type="real" doc="Minimum hdepth for for convective GWD spectrum lookup table [km]">2.5</gw_convect_hdepth_min>
318+
<gw_convect_storm_speed_min type="real" doc="Minimum convective storm speed for convective GWD [m/s]">10.0</gw_convect_storm_speed_min>
319+
<gw_convect_plev_src_wind type="real" doc="Reference pressure level for source wind for convective GWD [Pa]">70000</gw_convect_plev_src_wind>
320+
<use_gw_convect_old type="logical" doc="Switch to enable legacy behavior">false</use_gw_convect_old>
321+
</gw>
322+
299323
<!-- Basic options for each mam4 atm process -->
300324
<mam4_atm_proc_base inherit="atm_proc_base">
301325
<create_fields_interval_checks type="logical" doc="Create field interval checks for all fields that are computed and requested in mam4xx." >false</create_fields_interval_checks>

components/eamxx/src/control/atmosphere_driver.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,13 @@ void AtmosphereDriver::set_initial_conditions ()
10941094
"double or string, or vector double arguments are allowed");
10951095
}
10961096
m_fields_inited[grid_name].push_back(fname);
1097-
} else if (fname == "phis" or fname == "sgh30") {
1098-
// Both phis and sgh30 need to be loaded from the topography file
1097+
} else if (fname == "phis" or fname == "sgh30" or fname == "sgh") {
1098+
// these fields need to be loaded from the topography file
1099+
// - phis is the surface geopotential height
1100+
// - sgh30 - sub-grid std dev of surface height (on phys grid) between source grid and a 3km ref grid
1101+
// needed for turbulent mountain stress scheme (i.e. TMS)
1102+
// - sgh - sub-grid std dev of surface height (on phys grid) between source grid and target grid
1103+
// needed for orographic gravity wave drag scheme (i.e. GWD)
10991104
auto& this_grid_topo_file_fnames = topography_file_fields_names[grid_name];
11001105
auto& this_grid_topo_eamxx_fnames = topography_eamxx_fields_names[grid_name];
11011106

@@ -1122,6 +1127,15 @@ void AtmosphereDriver::set_initial_conditions ()
11221127
topography_file_fields_names[grid_name].push_back("SGH30");
11231128
topography_eamxx_fields_names[grid_name].push_back(fname);
11241129
m_fields_inited[grid_name].push_back(fname);
1130+
} else if (fname == "sgh") {
1131+
// The eamxx field "sgh" is called "SGH" in the
1132+
// topography file and is only available on the PG2 grid.
1133+
EKAT_ASSERT_MSG(grid_name == "physics_pg2",
1134+
"Error! Requesting sgh field on " + grid_name +
1135+
" topo file only has sgh for physics_pg2.\n");
1136+
topography_file_fields_names[grid_name].push_back("SGH");
1137+
topography_eamxx_fields_names[grid_name].push_back(fname);
1138+
m_fields_inited[grid_name].push_back(fname);
11251139
}
11261140
} else if (not (fvphyshack and grid_name == "physics_pg2")) {
11271141
// The IC file is written for the GLL grid, so we only load

components/eamxx/src/mct_coupling/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ if (TARGET zm)
4949
list(APPEND SCREAM_LIBS zm)
5050
endif()
5151

52+
# GW is not always on yet
53+
if (TARGET gw)
54+
list(APPEND SCREAM_LIBS gw)
55+
endif()
56+
5257
if (SCREAM_ENABLE_MAM)
5358
list (APPEND SCREAM_LIBS mam)
5459
endif()

components/eamxx/src/physics/gw/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ endif()
3333

3434
add_library(gw ${GW_SRCS})
3535

36+
target_compile_definitions(gw PUBLIC EAMXX_HAS_GW)
37+
3638
target_include_directories(gw PUBLIC
3739
${CMAKE_CURRENT_SOURCE_DIR}
3840
${CMAKE_CURRENT_SOURCE_DIR}/impl

0 commit comments

Comments
 (0)