Skip to content
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

Adding the Danabasoglu & Marshal 2007 scheme #15

Draft
wants to merge 11 commits into
base: dev/cpt
Choose a base branch
from

Conversation

gustavo-marques
Copy link
Collaborator

This PR adds the scheme for calculating the thickness diffusivity (KHTH) described by Danabasoglu & Marshall (2007).
Because the version implemented here must work on layer mode and in the absence of a surface boundary layer depth, the current implementation differs from the original one. Below is a brief description of what is implemented in this PR.

Calculate KHTH (or \kappa_{GM})

The scheme can be activated by setting USE_DANABASOGLU_MARSHALL = True

Diffusivities are calculated using
image,

where N^2 is the Brunt-Väisälä frequency and N^2_{ref} is the maximum N^2 value for a particular column (i,j point). Therefore, the ratio N^2/N^2_{ref} <= 1.0. \kappa_{GM} is a reference diffusivity prescribed by the user via the DM07_KAPPA_REF parameter. The lower bound on the diffusivities is controlled via the minimum ratio (N^2/N^2_{ref}) parameter DM07_MIN_RATIO. We also set the density ratio at the top-most interface to one.

The subroutine vert_fill_rho has been introduced to allow the calculation of N^2 in layer mode (stacked shallow water). In this mode, the target densities are prescribed by the user and can be extremely small (vanished) making the calculation of N^2 difficult because vanished layers are used in the denominator. To avoid this issue, we pass the thickness array and the density targets to subroutine vert_fill_rho and fill the vanished layers with sensible density values by diffusing vertically with a small but constant diffusivity. We then calculate N2_u and N2_v using the "corrected" density profiles.

TODO

Check if this implementation works in ALE mode.

* Remove dependency of use_VarMix on CS%KHTH_Slope_Cff > 0.
* Fix a bug in the KH_v calculation via use_dm07
* Add option to diagnose dm07_ratio_u and dm07_ratio_v;

* Trigger a fatal error when both KHTH_USE_EBT_STRUCT and
USE_DANABASOGLU_MARSHALL and set to True;

* Tirgger a fatal error when USE_DANABASOGLU_MARSHALL=True
and USE_STORED_SLOPES=False, since both of these options must
be enable;

* Simplify subroutine calc_dm07 and cleans the code;

* Fixes OMP directives.
* set ratio_u(k=1) and ratio_v(k=1) to 1. This assures KHTH will
have the maximum value at the surface;
* deleted unused variables.
@codecov-commenter
Copy link

Codecov Report

Merging #15 (1891ff0) into dev/cpt (7868fdd) will decrease coverage by 0.03%.
The diff coverage is 9.91%.

❗ Current head 1891ff0 differs from pull request most recent head 91ca6ba. Consider uploading reports for the commit 91ca6ba to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           dev/cpt      #15      +/-   ##
===========================================
- Coverage    29.29%   29.26%   -0.04%     
===========================================
  Files          235      235              
  Lines        70799    70909     +110     
===========================================
+ Hits         20742    20749       +7     
- Misses       50057    50160     +103     
Impacted Files Coverage Δ
src/core/MOM_isopycnal_slopes.F90 37.12% <3.33%> (-7.82%) ⬇️
...eterizations/lateral/MOM_lateral_mixing_coeffs.F90 30.27% <7.84%> (-1.48%) ⬇️
...arameterizations/lateral/MOM_thickness_diffuse.F90 31.68% <60.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7868fdd...91ca6ba. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants