Changes needed for introducing 3D tracer diffusivities #253
Merged
Conversation
This commit adds the option to apply a linear decay in the neutral diffusion fluxes within a transition zone defined by the boundary layer depths of adjacent columns. This option is controlled by a new parameter NDIFF_TAPERING, which is only available when NDIFF_INTERIOR_ONLY=True. By default NDIFF_TAPERING=False and answers are bitwise identical.
Simplifies and reduces the code by adding hbd to the neutral diffusion contril structure. This avoid the need to "extract" hbl multiple times. Answers are bitwise indenticals.
This commit adds a vertical dimension to the tracer diffusivities (Kh_u and Kh_v) and associated coefficiets (coef_x and coef_y). The following diagnostics were changed from 2D (lat/lon) to 3D (lat/lon/depth): KhTr_u, KhTr_v, and KhTr_h. To preserve old answers, the values of all modified arrays are depth independent by default. The option to apply the equivalent barotropic structure as the vertical structure of the tracer diffusivity is also introduced and this can be controlled via a new parameter: KHTR_USE_EBT_STRUCT (default is false).
Following up on the previous commit, where a vertical dimension was added to the tracer diffusivities, this commit modifies the HBD module to work with this change. To do so, parameter khtr_u (diffusivity times the time step) is calculated at cell centers and then remapped onto the HBD vertical grid. All unit tests in this module were updated to conform with this change. This commit also makes the default value of HBD_DEBUG equal to the value set for DEBUG.
This commit modifies the neutral diffusion module to work with 3D diffusivities. When the diffusivities are depth dependent (KHTR_USE_EBT_STRUCT=True), a new array (Coef_h, with values at tracer points and at vertical interfaces) with a four-point average between Coef_x and Coef_y is introduced. This array is then used to calculate zonal and meridional neutral fluxes via optional arguments and using an existing four-point average (vertical interfaces of two tracer cells) inside subroutine neutral_surface_flux. The same approach is already used when tapering the neutral diffusive fluxes. In this case, however, the unit of the output from neutral_surface_flux (Flx) is modified because the flux of the tracer between pairs of neutral layers is multiplied by the average of Coef_h. To avoid double counting Coef_h, the code block for updating the tracer concentration from divergence of neutral diffusive flux components also had to be modified for when KHTR_USE_EBT_STRUCT=True. Similar for diagnostics trans_x_2d and trans_y_2d. This commit also makes the default value of NDIFF_DEBUG equal to the value set for DEBUG.
Follow Marshall Ward suggestion and rearrange the code to be closer to what the compilers will do (or we hope they would do). This commit aims to potentially enhance performance. Answers are bit-wise identical.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev/ncar #253 +/- ##
============================================
+ Coverage 37.06% 38.09% +1.02%
============================================
Files 264 269 +5
Lines 74436 76728 +2292
Branches 13781 14092 +311
============================================
+ Hits 27592 29230 +1638
- Misses 41754 42239 +485
- Partials 5090 5259 +169
☔ View full report in Codecov by Sentry. |
Collaborator
Author
|
@alperaltuntas, please merge #248 before this PR. |
alperaltuntas
approved these changes
Aug 24, 2023
alperaltuntas
pushed a commit
that referenced
this pull request
Apr 2, 2026
* make sure that ocn bgc baselines are captured * Clean up hist_file_ext_regex Now streams that match string.string OR string.string.string will get archived, so we don't need to explicitly list h.bgc.z and h.bgc.native Also cleaned up the test_file_names section to include a restarts split across two restart files and the current expected stream files. * Update regex to handle multiple mom6.ic files --------- Co-authored-by: Michael Levy <mike.levy.work@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds all the changes needed to convert tracer diffusivities from 2D to 3D (adding vertical dimension).
Code changes were needed in the following modules:
MOM_tracer_hor_diff,MOM_neutral_diffusion, andMOM_hor_bnd_diffusion.The first step (36c1e26) was to add a vertical dimension to the tracer diffusivities (
Kh_uandKh_v) and associated coefficients (coef_xandcoef_y). DiagnosticsKhTr_u,KhTr_v, andKhTr_hwere changed from 2D (lat/lon) to 3D (lat/lon/depth). To preserve old answers, the values of all modified arrays are depth independent by default. The option to apply the equivalent barotropic structure as the vertical structure of the tracer diffusivity is also introduced. This can be controlled via a new parameter:KHTR_USE_EBT_STRUCT(default is false).Following up on the above commit, module
MOM_hor_bnd_diffusionwas modified to work with 3D tracer diffusivities (a588033). Parameterkhtr_u(diffusivity times the time step) is now calculated at cell centers and then remapped onto the HBD vertical grid. All unit tests in this module were updated to conform with this change.Lastly, module
MOM_neutral_diffusionwas also modified to work with 3D tracer diffusivities (27518f7). When the diffusivities are depth dependent (KHTR_USE_EBT_STRUCT=True), a new array (Coef_h, with values at tracer points and vertical interfaces) with a four-point average betweenCoef_xandCoef_yis introduced. This array is then used to calculate zonal and meridional neutral fluxes via optional arguments and using an existing four-point average (vertical interfaces of two tracer cells) inside subroutine neutral_surface_flux. The same approach is already used when tapering the neutral diffusive fluxes. In this case,however, the unit of the output from neutral_surface_flux (
Flx) is modified because the flux of the tracer between pairs of neutral layers is multiplied by the average ofCoef_h. To avoid double countingCoef_h, the code block for updating the tracer concentration from divergence of neutral diffusive flux components also had to be modified for whenKHTR_USE_EBT_STRUCT=True. Similarly for diagnosticstrans_x_2dandtrans_y_2d.By default (
KHTR_USE_EBT_STRUCT = False) all answers are bitwise identical.Testing: pr_mom fails because
KhTr_u,KhTr_v, andKhTr_hwere changed from 2D (lat/lon) to 3D (lat/lon/depth).ocean.statsremains bit-wise identical.