Enable Convective GWD - #8680
Conversation
|
There was a problem hiding this comment.
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_convectis 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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| if(m_atm_process_group->has_process("gw") && | ||
| m_atm_process_group->has_process("zm")) { | ||
| setup_gw_convect_zm_links(); | ||
| } |
| 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"), |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
This allows the convective gravity wave drag (GWD) scheme to be used in EAMxx, which is driven by the
zm_t_tendfield 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 theorographic_onlyflag 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)