-
Notifications
You must be signed in to change notification settings - Fork 20
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
Changes needed for introducing 3D tracer diffusivities #253
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. |
@alperaltuntas, please merge #248 before this PR. |
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_u
andKh_v
) and associated coefficients (coef_x
andcoef_y
). DiagnosticsKhTr_u
,KhTr_v
, andKhTr_h
were 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_diffusion
was 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_diffusion
was 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_x
andCoef_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 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_2d
andtrans_y_2d
.By default (
KHTR_USE_EBT_STRUCT = False
) all answers are bitwise identical.Testing: pr_mom fails because
KhTr_u
,KhTr_v
, andKhTr_h
were changed from 2D (lat/lon) to 3D (lat/lon/depth).ocean.stats
remains bit-wise identical.