Skip to content

EAMxx: 3D calculation of shear production of turbulence#8392

Open
bogensch wants to merge 46 commits into
masterfrom
bogensch/eamxx/turb_3d_shear_production
Open

EAMxx: 3D calculation of shear production of turbulence#8392
bogensch wants to merge 46 commits into
masterfrom
bogensch/eamxx/turb_3d_shear_production

Conversation

@bogensch
Copy link
Copy Markdown
Contributor

@bogensch bogensch commented May 13, 2026

Add support for 3D shear production (see equation below) in the EAMxx-HOMME coupling by computing the horizontal velocity-gradient tensor in HOMME, remapping the horizontal tensor components to the physics grid, and assembling the full 3D strain invariant in SHOC using physics-grid vertical shear terms. For the SHOC shear-strain implementation the vertical-gradient calculation and strain assembly are separated, with the computation of the vertical gradients and assembly occurring in SHOC while HOMME interface computes horizontal terms. Note that it was deemed necessary to compute the vertical derivative terms in the SHOC code rather than HOMME to avoid unrealistic turbulence growth when SHOC sub cycles are used. This PR also adds the required plumbing, fields, and standalone-test updates so the new path works in both coupled and SHOC-only configurations.

$$ \begin{align} -P_s &= 2K_M \Bigg[ \left(\frac{\partial u}{\partial x}\right)^{2} + \left(\frac{\partial v}{\partial y}\right)^{2} + \left(\frac{\partial w}{\partial z}\right)^{2} \notag\\ &\quad + \tfrac{1}{2}\Big( \left(\frac{\partial u}{\partial y}+\frac{\partial v}{\partial x}\right)^{2} + \left(\frac{\partial u}{\partial z}+\frac{\partial w}{\partial x}\right)^{2} + \left(\frac{\partial v}{\partial z}+\frac{\partial w}{\partial y}\right)^{2} \Big) \Bigg]. \end{align} $$

Also fix several supporting issues needed for stable and consistent 3D turbulence behavior. Horizontal turbulent diffusion in HOMME now operates on perturbations relative to the reference state for dp3d, vtheta_dp, and phinh_i, which avoids diffusing the terrain-following background state and improves stability over topography. The geometry interface is updated so the sphere-to-Cartesian transform is treated as a full 3x3 operator, enabling consistent handling of the full 3D velocity in the new strain calculation. Additional cleanup and robustness fixes were added in the SHOC driver/test infrastructure and in the HOMME-SHOC coupling so the new fields and options work correctly in standalone EAMxx tests as well as in full dynamics-physics runs.

Since do_3d_turbulence=false by default, it is expected this code will be B4B for our testing.

Peter Bogenschutz and others added 30 commits March 17, 2026 10:48
…teractively. this code compiles, appears to run well, and produce scientifically credible results. next step is to add in vertical gradients and include vertical velocity
…t there is a temporary hack as i'm currently not interpolating the vertical velocity from interface to midpoint grid. will be fixed.
…ian transform of w, note that code currently only works for plane geometry. will fix later for spherical
…sor. Note that this code currently compiles but doesn't run
…that will refactor this a bit in the future to be more consistent with the 1d calc
…ed planar assumptions in shear production to use this new transform
…, this is now automatically set by the dycore namelist parameter
Peter Bogenschutz added 16 commits April 18, 2026 15:30
…s from the dycore to SHOC. This involves having to bring in individual components of the strain term from dyanmics to physics. This was needed to preserve numerical stability
…gradients from the dycore to SHOC. This involves having to bring in individual components of the strain term from dyanmics to physics. This was needed to preserve numerical stability"

This reverts commit 66d5eea.
… gradients from the dycore to SHOC. This involves having to bring in individual components of the strain term from dyanmics to physics. This was needed to preserve numerical stability"

This reverts commit 39e9391.
…e shoc_tke and not shoc_main. Also break the subroutine up into two seperate subroutines
@bogensch bogensch added Atmosphere BFB PR leaves answers BFB HOMME EAMxx C++ based E3SM atmosphere model (aka SCREAM) labels May 13, 2026
@jgfouca jgfouca requested a review from Copilot May 14, 2026 15:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds 3D shear-production support for EAMxx SHOC/HOMME coupling,
including HOMME-side horizontal strain components, FV remapping, and
SHOC-side vertical shear/strain assembly.

Changes:

  • Expands HOMME sphere-to-Cartesian geometry from 3x2 to 3x3.
  • Adds 3D turbulence strain fields and remapping through HOMME/EAMxx.
  • Extends SHOC TKE production to optionally use the 3D strain invariant.

Reviewed changes

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

Show a summary per file
File Description
components/homme/test_execs/thetal_kokkos_ut/compose_interface.F90 Updates test geometry interface shape.
components/homme/test_execs/share_kokkos_ut/sphere_op_ml.cpp Updates sphere operator test storage shape.
components/homme/test_execs/share_kokkos_ut/sphere_op_interface.F90 Updates Fortran test interface shape.
components/homme/src/theta-l_kokkos/prim_driver_mod.F90 Updates theta-l geometry interop shape.
components/homme/src/theta-l_kokkos/cxx/HyperviscosityFunctorImpl.cpp Diffuses perturbation reference states.
components/homme/src/share/sl_advection.F90 Restricts horizontal transforms to first two components.
components/homme/src/share/planar_mod.F90 Adds planar vertical basis vector.
components/homme/src/share/element_mod.F90 Expands element geometry tensor.
components/homme/src/share/derivative_mod.F90 Restricts horizontal vector transforms.
components/homme/src/share/cxx/SphereOperators.hpp Updates sphere operator geometry view type.
components/homme/src/share/cxx/GllFvRemapImpl.hpp Adds strain remap argument.
components/homme/src/share/cxx/GllFvRemapImpl.cpp Remaps 3D strain components.
components/homme/src/share/cxx/GllFvRemap.hpp Updates public remap API.
components/homme/src/share/cxx/GllFvRemap.cpp Forwards new remap argument.
components/homme/src/share/cxx/ElementsGeometry.hpp Expands geometry storage.
components/homme/src/share/cxx/ElementsGeometry.cpp Copies expanded geometry storage.
components/homme/src/share/cxx/ElementsDerivedState.hpp Adds derived strain component view.
components/homme/src/share/cxx/ElementsDerivedState.cpp Allocates and initializes strain components.
components/homme/src/share/cxx/ComposeTransportImplEnhancedTrajectoryImpl.hpp Updates geometry view type.
components/homme/src/share/cxx/ComposeTransportImpl.hpp Updates geometry view type.
components/homme/src/share/cube_mod.F90 Adds spherical radial basis vector.
components/homme/src/preqx_kokkos/prim_driver_mod.F90 Updates preqx geometry interop shape.
components/eamxx/src/physics/shoc/tests/infra/shoc_test_data.cpp Updates SHOC test harness call signatures.
components/eamxx/src/physics/shoc/shoc_functions.hpp Adds 3D turbulence APIs and inputs.
components/eamxx/src/physics/shoc/impl/shoc_tke_impl.hpp Adds optional 3D shear-production branch.
components/eamxx/src/physics/shoc/impl/shoc_main_impl.hpp Plumbs 3D turbulence through SHOC main.
components/eamxx/src/physics/shoc/impl/shoc_compute_shear_strain3d_impl.hpp Implements vertical shear and strain assembly.
components/eamxx/src/physics/shoc/impl/shoc_adv_sgs_tke_impl.hpp Uses 3D strain in TKE advection.
components/eamxx/src/physics/shoc/eti/shoc_compute_shear_strain3d.cpp Adds explicit instantiation source.
components/eamxx/src/physics/shoc/eamxx_shoc_process_interface.hpp Adds SHOC strain views and dummy storage.
components/eamxx/src/physics/shoc/eamxx_shoc_process_interface.cpp Registers and wires new SHOC fields/options.
components/eamxx/src/physics/shoc/disp/shoc_tke_disp.cpp Updates small-kernel TKE dispatcher.
components/eamxx/src/physics/shoc/CMakeLists.txt Adds new SHOC ETI source.
components/eamxx/src/dynamics/homme/interface/homme_params_mod.F90 Exposes HOMME 3D turbulence flag.
components/eamxx/src/dynamics/homme/eamxx_homme_process_interface.hpp Declares HOMME strain helpers.
components/eamxx/src/dynamics/homme/eamxx_homme_process_interface.cpp Registers and remaps strain fields.
components/eamxx/src/dynamics/homme/eamxx_homme_fv_phys.cpp Passes strain field through FV remap.
components/eamxx/src/dynamics/homme/eamxx_homme_3d_turbulence_strain.cpp Computes HOMME 3D strain components.
components/eamxx/src/dynamics/homme/CMakeLists.txt Builds new HOMME strain source.
components/eamxx/src/control/atmosphere_driver.hpp Declares SHOC/HOMME option link.
components/eamxx/src/control/atmosphere_driver.cpp Propagates HOMME 3D turbulence option to SHOC.

const Phys1T& ps, const Phys1T& phis,
// T,omega(ie,col,lev)
const Phys2T& T, const Phys2T& omega,
const Phys3T& strain3d_components,
ExecViewManaged<Real * [NP][NP]> m_metdet;
ExecViewManaged<Real * [2][2][NP][NP]> m_tensorvisc;
ExecViewManaged<Real * [2][3][NP][NP]> m_vec_sph2cart;
ExecViewManaged<Real * [3][3][NP][NP]> m_vec_sph2cart;
Comment on lines +75 to +85
} else {
compute_vertical_shear_terms(team,nlev,nlevi,
dz_zi,u_wind,v_wind,w_field,
zt_grid,zi_grid,workspace,
du_dz_m,dv_dz_m,dw_dz_m);
team.team_barrier();

assemble_shoc_shear_strain3d(team,nlev,
shear_strain3d_components,
du_dz_m,dv_dz_m,dw_dz_m,
shear_strain3d);
Comment on lines +531 to +538
bool do_3d_turbulence = false;
if (m_atm_process_group->has_process("homme")) {
auto homme_process = m_atm_process_group->get_process_nonconst("homme");
do_3d_turbulence = homme_process->get_params().get("do_3d_turbulence", false);
}

auto shoc_process = m_atm_process_group->get_process_nonconst("shoc");
shoc_process->get_params().set<bool>("do_3d_turbulence_shoc", do_3d_turbulence);
Comment on lines +82 to +83
}
add_field<Computed>("tke_shear_strain3d", scalar3d_mid,nondim/s2, grid_name, ps);

const auto m2 = pow(m,2);
const auto s2 = pow(s,2);
const auto nondim = Units::nondimensional();

const auto m2 = pow(m,2);
const auto s2 = pow(s,2);
const auto nondim = Units::nondimensional();
static constexpr Scalar mintke = scream::shoc::Constants<Real>::mintke;
static constexpr Scalar maxtke = scream::shoc::Constants<Real>::maxtke;
Pack a_prod_bu;
Pack a_prod_sh;
@rljacob rljacob removed the request for review from tcclevenger May 14, 2026 21:38
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) HOMME

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants