forked from E3SM-Project/E3SM
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Open
katsmith133
wants to merge
11
commits into
E3SM-Project:develop
Choose a base branch
from
katsmith133:omega/add-vertical-mixing
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9e48ad9
adds basic vertical mixing class structure
katsmith133 3e42167
adds bvf to eos
katsmith133 f78b492
adding n2 and vertical mixing
katsmith133 02ee037
fixes bvf calc and vertmix calcs
katsmith133 d029128
fixes bvf tests
katsmith133 0ab2e6f
fixes out of bounds issues
katsmith133 442d138
fixes vertmix test and adds documentation
katsmith133 2b900ac
adjusting testing range to nvertlayers
katsmith133 6643429
fixing out of bounds issue
katsmith133 089b621
removes template changes
katsmith133 6bd9672
add review suggestions/edits
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,86 @@ | ||
| (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 top of cell centers. 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 `BruntVaisalaFreq` 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* vertMix = VertMix::getInstance("Default", mesh, nLevels); | ||
|
|
||
| // Compute mixing coefficients | ||
| vertMix->computeVertMix(VertDiff, VertVisc, NormalVelocity, | ||
| TangentialVelocity, BruntVaisalaFreq); | ||
| ``` | ||
|
|
||
| ## 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(Array2DReal VertDiff, | ||
| Array2DReal VertVisc, | ||
| const Array2DReal &NormalVelocity, | ||
| const Array2DReal &TangentialVelocity, | ||
| const Array2DReal &BruntVaisalaFreq); | ||
| ``` | ||
|
|
||
| This method combines the effects of: | ||
| - Background mixing (constant coefficients) | ||
| - Convective mixing (triggered by static instability) | ||
| - Shear instability driven mixing (Pacanowski-Philander scheme) |
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,68 @@ | ||
| (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: -1e-4 # 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 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}$). | ||
|
|
||
| ### 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}\,, | ||
| $$ | ||
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.