Skip to content

Enable Convective GWD - #8680

Open
whannah1 wants to merge 6 commits into
masterfrom
whannah/eamxx/enable-conv-gwd
Open

Enable Convective GWD#8680
whannah1 wants to merge 6 commits into
masterfrom
whannah/eamxx/enable-conv-gwd

Conversation

@whannah1

Copy link
Copy Markdown
Contributor

This allows the convective gravity wave drag (GWD) scheme to be used in EAMxx, which is driven by the zm_t_tend field calculated by ZM. This also includes various updates to the GWDrag process to use convective sources, output additional diagnostics, and some code refactoring. I also opted to completely remove the orographic_only flag that is always set to false in practice because it is a relic of older CAM versions, so it has no real utility. Note that both orographic and convective gravity wave drag are enabled by default when the GW process is active.

[BFB] - except for unit tests which will need new baselines due to the removal of orographic_only
(no compsets currently use GWD)

@whannah1
whannah1 requested review from crterai and jgfouca August 28, 2026 20:09
@whannah1 whannah1 added Atmosphere BFB PR leaves answers BFB EAMxx C++ based E3SM atmosphere model (aka SCREAM) ZM labels Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://E3SM-Project.github.io/E3SM/pr-preview/pr-8680/

Built to branch gh-pages at 2026-08-28 20:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables convective gravity-wave drag in EAMxx using ZM heating tendencies.

Changes:

  • Connects ZM temperature tendencies to convective GWD.
  • Adds spectrum-table loading, diagnostics, and parameter logging.
  • Enables convective and orographic GWD by default.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
atmosphere_process_group.cpp Fixes nested-process lookup.
eamxx_zm_process_interface.cpp Exposes ZM temperature tendency.
gw_convect_init_impl.hpp Loads and initializes spectrum data.
gw_functions.hpp Adds GWD utilities and interfaces.
eamxx_gw_process_interface.cpp Integrates convective sources and diagnostics.
atmosphere_driver.hpp Declares GW–ZM setup helper.
atmosphere_driver.cpp Validates GW–ZM configuration.
namelist_defaults_eamxx.xml Enables convective and orographic GWD defaults.
Suppressed comments (1)

components/eamxx/src/physics/gw/eamxx_gw_process_interface.cpp:142

  • When use_gw_convect is false, the convective branch never assigns these computed fields. They can therefore retain uninitialized/stale values, and the driver's default all-computed-fields NaN check may fail. Initialize both diagnostics to zero before launching the source kernels.
  const auto& gw_conv_hdepth = get_field_out("gw_conv_heating_depth").get_view<Real*>();
  const auto& gw_conv_hmax   = get_field_out("gw_conv_heating_max")  .get_view<Real*>();

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

add_field<Updated>("zm_q_prev", scalar3d_mid, kg/kg, grid_name, pack_size);

// temperature tendency needed for convective GWD scheme
add_field<Updated>("zm_t_tend", scalar3d_mid, K/s, grid_name, pack_size);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also consider guarding this pollution of the FM by passing an additional flag to produce it. Err on the side of not implicitly assuming anything

add_field<Required>("phis", scalar2d, m2/s2, grid_name);
add_field<Required>("landfrac", scalar2d, nondim, grid_name);
add_field<Required>("sgh", scalar2d, nondim, grid_name);
add_field<Required>("zm_t_tend", scalar3d_mid, K/s, grid_name, pack_size);

@mahf708 mahf708 Aug 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As copilot says, guard this by the use_gw_convect boolean; if you really want you could use this opportunity to explicitly error out here if zm_t_tend is not present (which would be due to zm not being active).

        "Error! use_gw_convect=true requires the ZM process to be active "
        "to use the heating tendency (zm_t_tend) to trigger convective GWs,"
        "but 'zm' was not found in the atm process list.\n");

but if you don't do it, you will get a relatively clear error that gw can't proceed because zm_t_tend isn't available.

Comment on lines +319 to +322
if(m_atm_process_group->has_process("gw") &&
m_atm_process_group->has_process("zm")) {
setup_gw_convect_zm_links();
}
Comment on lines +65 to +66
add_field<Computed>("gw_conv_heating_depth",scalar2d, K/s, grid_name);
add_field<Computed>("gw_conv_heating_max", scalar2d, K/s, grid_name);
auto gw = m_atm_process_group->get_process_nonconst("gw");
const bool use_gw_convect = gw->get_params().get<bool>("use_gw_convect", false);
if (use_gw_convect) {
EKAT_REQUIRE_MSG(m_atm_process_group->has_process("zm"),

@mahf708 mahf708 Aug 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic doesn't belong here. Leave the driver and share alone, and apply this type of logic inside gw. See other comment

add_field<Required>("phis", scalar2d, m2/s2, grid_name);
add_field<Required>("landfrac", scalar2d, nondim, grid_name);
add_field<Required>("sgh", scalar2d, nondim, grid_name);
add_field<Required>("zm_t_tend", scalar3d_mid, K/s, grid_name, pack_size);

@mahf708 mahf708 Aug 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As copilot says, guard this by the use_gw_convect boolean; if you really want you could use this opportunity to explicitly error out here if zm_t_tend is not present (which would be due to zm not being active).

        "Error! use_gw_convect=true requires the ZM process to be active "
        "to use the heating tendency (zm_t_tend) to trigger convective GWs,"
        "but 'zm' was not found in the atm process list.\n");

but if you don't do it, you will get a relatively clear error that gw can't proceed because zm_t_tend isn't available.

@mahf708
mahf708 requested a review from bartgol August 29, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Atmosphere BFB PR leaves answers BFB EAMxx C++ based E3SM atmosphere model (aka SCREAM) ZM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants