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

+Add thickness_to_dz, calc_derived_thermo and avg_specific_vol #368

Merged
merged 3 commits into from
Jun 8, 2023

Conversation

Hallberg-NOAA
Copy link
Member

@Hallberg-NOAA Hallberg-NOAA commented May 17, 2023

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_dz and calc_derived_thermo to 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. The thickness_to_dz calls 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 include avg_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_dz and calc_derived_thermo, and there is a new array (tv%SpV_avg) in the transparent thermo_vars_ptr type.

All answers are bitwise identical, but there are new publicly visible interfaces. The commits in this PR include:

  • f4ed37d57 +Add thickness_to_dz and calc_derived_thermo
  • 24fb992d6 +Code to calculate layer averaged specific volumes

@Hallberg-NOAA Hallberg-NOAA added the enhancement New feature or request label May 17, 2023
@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #368 (799809c) into dev/gfdl (1faa9ab) will increase coverage by 0.00%.
The diff coverage is 43.90%.

❗ Current head 799809c differs from pull request most recent head 081d1fe. Consider uploading reports for the commit 081d1fe to get more accurate results

@@            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     
Impacted Files Coverage Δ
src/core/MOM.F90 51.36% <0.00%> (-0.53%) ⬇️
src/core/MOM_density_integrals.F90 16.92% <0.00%> (-0.19%) ⬇️
src/core/MOM_interface_heights.F90 24.70% <0.00%> (-6.18%) ⬇️
src/core/MOM_variables.F90 46.96% <ø> (ø)
...parameterizations/vertical/MOM_diabatic_driver.F90 46.06% <0.00%> (-0.07%) ⬇️
src/tracer/MOM_offline_main.F90 0.00% <0.00%> (ø)
...c/parameterizations/vertical/MOM_vert_friction.F90 58.59% <40.00%> (-0.13%) ⬇️
src/equation_of_state/MOM_EOS.F90 55.24% <61.29%> (+0.34%) ⬆️
src/equation_of_state/MOM_EOS_Wright.F90 48.43% <100.00%> (+1.35%) ⬆️
src/equation_of_state/MOM_EOS_Wright_full.F90 33.02% <100.00%> (+1.91%) ⬆️
... and 2 more

... 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.
Copy link
Member

@marshallward marshallward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@marshallward
Copy link
Member

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/19444 ✔️

@adcroft adcroft self-assigned this Jun 8, 2023
Copy link
Member

@adcroft adcroft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@marshallward marshallward merged commit e86b35a into NOAA-GFDL:dev/gfdl Jun 8, 2023
@Hallberg-NOAA Hallberg-NOAA deleted the thickness_to_dz branch May 10, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants