forked from E3SM-Project/E3SM
-
Notifications
You must be signed in to change notification settings - Fork 6
Add vertical mixing coefficients module #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mark-petersen
merged 19 commits into
E3SM-Project:develop
from
katsmith133:omega/add-vertical-mixing
Dec 23, 2025
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1167b61
adds basic vertical mixing class structure
katsmith133 158b4db
adds bvf to eos
katsmith133 119ce14
adding n2 and vertical mixing
katsmith133 fa68170
fixes bvf calc and vertmix calcs
katsmith133 ffeb661
fixes bvf tests
katsmith133 e68f8c9
fixes out of bounds issues
katsmith133 c128521
fixes vertmix test and adds documentation
katsmith133 7f7d1c8
adjusting testing range to nvertlayers
katsmith133 14bed30
fixing out of bounds issue
katsmith133 27438a9
removes template changes
katsmith133 ed743ac
add review suggestions/edits
katsmith133 095ae77
fix frontier GPU issue and add checks to EOS test driver
philipwjones 343edba
fix frontier gpu issues and cleanup Vmix test driver
philipwjones 3ad48fd
add more review suggestions/edits
katsmith133 9cc8d30
add more review suggestions/edits
katsmith133 b684cf1
updates user and dev guides
katsmith133 be34b0b
final review suggestions/edits
katsmith133 146c650
updates eos and vert mix docs
katsmith133 57fb146
rebase and adds in hierarchical parallelism to limit vert loops
katsmith133 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| (omega-dev-vertmix) = | ||
|
|
||
| # Vertical Mixing Coefficients | ||
|
|
||
| Omega includes a `VertMix` class that provides functions that compute `VertDiff` and `VertVisc`, the | ||
| vertical diffusivity and viscosity, where both are defined at the center of the cell and top of the layer. | ||
| Currently the values of `VertDiff` and `VertVisc` are calculated using the linear combination of three options: (1) a | ||
| constant background mixing value, (2) a convective instability mixing value, and (3) a Richardson | ||
| number dependent shear mixing value from the [Pacanowski and Philander (1981)](https://journals.ametsoc.org/view/journals/phoc/11/11/1520-0485_1981_011_1443_povmin_2_0_co_2.xml) parameterization. These options are linearly additive. In the future, additional additive options will be implemented, such as the K Profile Parameterization [(KPP; Large et al., 1994)](https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/94rg01872). For both the convective and shear mixing values `BruntVaisalaFreqSq` is needed, which | ||
| is calculated by the `EOS` class. | ||
|
|
||
| ## Initialization and Usage | ||
|
|
||
| The primary class `VertMix` is implemented using the Singleton pattern to ensure a single instance manages all vertical mixing calculations. | ||
|
|
||
| ```c++ | ||
| // Initialize VertMix | ||
| VertMix* VMix = VertMix::getInstance(); | ||
|
|
||
| // Compute mixing coefficients | ||
| VMix->computeVertMix(NormalVelocity, TangentialVelocity, BruntVaisalaFreqSq); | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The initialization process reads parameters from the yaml configuration file with the following structure and | ||
| default values: | ||
|
|
||
| ```yaml | ||
| VertMix: | ||
| Background: | ||
| Viscosity: 1e-4 | ||
| Diffusivity: 1e-5 | ||
| Convective: | ||
| Enable: true | ||
| Diffusivity: 1.0 | ||
| TriggerBVF: 0.0 | ||
| Shear: | ||
| Enable: true | ||
| NuZero: 0.005 | ||
| Alpha: 5.0 | ||
| Exponent: 2.0 | ||
| ``` | ||
|
|
||
| ## Class Structure | ||
|
|
||
| ### Core Data Members | ||
|
|
||
| - `VertDiff`: 2D array storing vertical diffusivity coefficients (m²/s) | ||
| - `VertVisc`: 2D array storing vertical viscosity coefficients (m²/s) | ||
|
|
||
| ### Mixing Parameters | ||
|
|
||
| 1. Background Mixing: | ||
| - `BackDiff`: Background vertical diffusivity (m²/s; Default: 1e-5) | ||
| - `BackVisc`: Background vertical viscosity (m²/s: Default: 1e-4) | ||
|
|
||
| 2. Convective Mixing: | ||
| - `EnableConvMix`: Flag to enable/disable convective mixing (Default: True) | ||
| - `ConvDiff`: Convective mixing coefficient (m²/s; Default: 1.0) | ||
| - `ConvTriggerBVF`: Trigger threshold for convective mixing (Default: 0.0) | ||
|
|
||
| 3. Shear Mixing: | ||
| - `EnableShearMix`: Flag to enable/disable shear mixing (Default: True) | ||
| - `ShearNuZero`: Base coefficient for Pacanowski-Philander scheme (Default: 0.005) | ||
| - `ShearAlpha`: Alpha parameter for P-P scheme (Default: 5.0) | ||
| - `ShearExponent`: Exponent parameter for P-P scheme (Default: 2.0) | ||
|
|
||
| ## Core Functionality (Vertical Mixing Coefficient Calculation) | ||
|
|
||
| The main computation is handled by: | ||
|
|
||
| ```cpp | ||
| void computeVertMix(const Array2DReal &NormalVelocity, | ||
| const Array2DReal &TangentialVelocity, | ||
| const Array2DReal &BruntVaisalaFreqSq); | ||
| ``` | ||
|
|
||
| This method combines the effects of: | ||
| - Background mixing (constant coefficients) | ||
| - Convective mixing (triggered by static instability) | ||
| - Shear instability driven mixing (Pacanowski-Philander scheme; to be changed to [Large et al., 1994](https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/94rg01872) shear mixing scheme in a later development) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| (omega-user-vertmix)= | ||
|
|
||
| # Vertical Mixing Coefficients | ||
|
|
||
| The vertical mixing module in Omega handles the parameterization of unresolved vertical mixing | ||
| processes in the ocean. It calculates vertical diffusivity and viscosity coefficients that | ||
| determine how properties (like momentum, heat, salt, and biogeochemical tracers) mix vertically | ||
| in the ocean model. Currently, Omega offers three different mixing processes within the water column: (1) a constant | ||
| background mixing value, (2) a convective instability mixing value, and (3) a Richardson number | ||
| dependent shear instability driven mixing value from the [Pacanowski and Philander (1981)](https://journals.ametsoc.org/view/journals/phoc/11/11/1520-0485_1981_011_1443_povmin_2_0_co_2.xml) parameterization. These are linearly additive and are describe a bit | ||
| more in detail below. Other mixing processes and parameterizations, such as the the K Profile Parameterization [(KPP; Large et al., 1994)](https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/94rg01872) will be added in the future. | ||
|
|
||
| The user-configurable options are the following parameters in the yaml configuration file: | ||
|
|
||
| ```yaml | ||
| VertMix: | ||
| Background: | ||
| Viscosity: 1.0e-4 # Background vertical viscosity (m²/s) | ||
| Diffusivity: 1.0e-5 # Background vertical diffusivity (m²/s) | ||
| Convective: | ||
| Enable: true # Enables the convective-induced mixing option | ||
| Diffusivity: 1.0 # Convective mixing coefficient (m²/s) | ||
| TriggerBVF: 0.0 # Squared Brunt-Vaisala frequency threshold | ||
| Shear: | ||
| Enable: true # Enables the shear-instability driven mixing option | ||
| NuZero: 1.0e-2 # Base viscosity coefficient | ||
| Alpha: 5.0 # Stability parameter | ||
| Exponent: 2 # Richardson number exponent | ||
| ``` | ||
|
|
||
| ## Vertical Mixing Processes/Types | ||
|
|
||
| ### 1. Background Mixing | ||
|
|
||
| A constant background mixing value that represents small-scale mixing processes not explicitly resolved by the model. Typically, this is chosen to represent low values of vertical mixing | ||
| happening in the ocean's stratified interior. | ||
|
|
||
| ### 2. Convective Mixing | ||
|
|
||
| Enhanced convective adjustment mixing that occurs in statically unstable regions of the water column to parameterize convection and homogenize properties. In Omega this is mixing is defaulted to occur when the squared Brunt Vaisala Frequency is less than 0.0 (unstable), and is off when equal to (neutral) or greater than (stable) 0.0. | ||
|
|
||
| $$ | ||
| \kappa = | ||
| \begin{cases} | ||
| +\kappa_b + \kappa_{conv} \quad \text{ if } N^2 < N^2_{crit}\\ | ||
| +\kappa_b \quad \text{ if } N^2 \geq N^2_{crit} | ||
| \end{cases} | ||
| $$ | ||
|
|
||
| This is different than some current implementations (i.e. in MPAS-Ocean and the CVMix package), where convective adjustment occurs both with unstable and neutral conditions ($N^2 \leq N^2_{crit}$). $\kappa_{conv}$ and $N^2_{crit}$ are constant parameters set in the `VertMix` section of the yaml file (`Diffusivity` and `TriggerBVF` under the `Convective` header). | ||
|
|
||
| ### 3. Shear Mixing | ||
|
|
||
| Mixing induced by vertical velocity shear, implemented using the Pacanowski-Philander scheme, through the gradient Richardson number (ratio of buoyancy to shear). | ||
|
|
||
| $$ | ||
| \nu = \frac{\nu_o}{(1+\alpha Ri)^n} + \nu_b\,, | ||
| $$ | ||
|
|
||
| $$ | ||
| \kappa = \frac{\nu}{(1+\alpha Ri)} + \kappa_b\,. | ||
| $$ | ||
|
|
||
| where $Ri$ is defined as: | ||
|
|
||
| $$ | ||
| Ri = \frac{N^2}{\left|\frac{\partial \mathbf{U}}{\partial z}\right|^2}\,, | ||
| $$ | ||
katsmith133 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| where $\nu_o$, $\alpha$, $n$, $\nu_b$, $\kappa_b$ are constant parameters set in the `VertMix` section of the yaml file (`NuZero`, `Alpha`, `Exponent` under the `Shear` header and `Viscosity`, `Diffusivity` under the `Background` header). $N^2$ is calculated by the EOS based on the ocean state and $\mathbf{U}$ is the magnitude of the horizontal velocity. $N^2$, $\partial \mathbf{U}}{\partial z}\right|^2$ and $Ri$ of `K` are all defined at the cell center, top interface of layer `K`. $N^2$, $\nu_{shear}$ and $\kappa_{shear}$ are set to zero for the surface layer. In a later development, the shear mixing option will be changed to the interior shear mixing formulation in [Large et al., 1994](https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/94rg01872). | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.