+Add thickness_to_dz, calc_derived_thermo and avg_specific_vol#368
Conversation
Codecov Report
@@ Coverage Diff @@
## dev/gfdl #368 +/- ##
==========================================
Coverage 38.28% 38.29%
==========================================
Files 269 269
Lines 76018 76180 +162
Branches 13982 14011 +29
==========================================
+ Hits 29107 29174 +67
- Misses 41682 41767 +85
- Partials 5229 5239 +10
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Add routines to calculate and store the layer-averaged specific volume, along with code to do the unit testing of this new capability. The new public interfaces include avg_specific_vol, average_specific_vol, avg_spec_vol_Wright, avg_spec_vol_Wright_full, avg_spec_vol_Wright_red and avg_spec_vol_linear. There is also a new optional argument to test_EOS_consistency to control whether these new capabilties are tested for a particular equation of state. All answers are bitwise identical, and the new capabilities pass the unit testing for self consistency.
Added the new overloaded interface thickness_to_dz to convert the layer thicknesses in thickness units [H ~> m or kg m-2] into vertical distances in [Z ~> m], with variants that set full 3-d arrays or an i-/k- slice. Also added a field (SpV_avg) for the layer-averaged specific volume to the thermo_vars_ptr type and the new subroutine calc_derived_thermo to set it. This new subroutine is being called after halo updates to the temperatures and salinities. The new runtime parameter SEMI_BOUSSINESQ was added to determine whether tv%SpV_avg is allocated and used; it is stored in GV%semi_Boussinesq. Also added the new element GV%dZ_subroundoff to the verticalGrid_type as a counterpart to GV%H_subroundoff but in height units. All answers are bitwise identical, but there is a new runtime parameter in some MOM_parameter_doc files, new elements in a transparent type and a new public interface.
f4ed37d to
dcf5f80
Compare
marshallward
left a comment
There was a problem hiding this comment.
All looks reasonable to the best of my ability. Some of the specific volume calculations deserve a second look, but I will tentatively approve this and start the testing.
|
Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/19444 ✔️ |
adcroft
left a comment
There was a problem hiding this comment.
I'm particularly pleased to see high code-coverage of much of the new code due to the unit tests. The vert_frict new-answer code was skipped which suggests we should run units tests with answer_date=1900 and answer_date=2300.
Added the new routine post_tracer_integral_diagnostics to calculate vertically integrated tracer diagnostics. This includes properly setting the vertical layer extents from layer thicknesses via a call to thickness_to_dz. This new routine is being called from within step_MOM(), immediately after another closely related call to write out other tracer diagnostics. In so doing, it changes the thicknesses used for these diagnostics to be consistent with the state of the tracers. This commit also sets the appropriate unit conversion factors in the register_diag_field calls for three recently diagnostics of surface tracer concentrations and the integrated tracers amounts in the full water column and in the topmost 100 m. All solutions are bitwise identical, but this will correct the thicknesses used in the calculation of two groups of tracer diagnostics and properly implements the dimensional rescaling of these diagnostics when tracers (like temperature and salinity) when they are being rescaled.
This PR includes a pair of commits that add code to calculate the layer averaged specific volumes, either using analytical expressions or quadrature, and the new routines
thickness_to_dzandcalc_derived_thermoto make use of this to convert layer thicknesses to vertical distances in all cases. There is new unit testing of the layer averaged specific volumes included in this PR. Thethickness_to_dzcalls have been extensively tested (and appear to be correct) in much more extensive changes on a separate branch that will be in coming PRs, but they are not yet being exercised with this commit. The new public interfaces includeavg_specific_vol,average_specific_vol,avg_spec_vol_Wright,avg_spec_vol_Wright_full,avg_spec_vol_Wright_red,avg_spec_vol_linear,thickness_to_dzandcalc_derived_thermo, and there is a new array (tv%SpV_avg) in the transparentthermo_vars_ptrtype.All answers are bitwise identical, but there are new publicly visible interfaces. The commits in this PR include: