CliMA / SeawaterPolynomials.jl

Polynomials for efficiently computing the density of seawater
https://clima.github.io/SeawaterPolynomials.jl/dev
MIT License
14 stars 3 forks source link

Fix `Base.show` so coefficients match variables and add simplest "realisitic" equation of state from Roquet et al. (2015) #28

Closed jbisits closed 1 year ago

jbisits commented 1 year ago

Purpose

Add the coefficient_set for the simplest yet "realisitic" equation of state from Roquet et al. (2015) and update Base.show for ::SecondOrderSeawaterPolynomial so that coefficients match variables. Closes #27

Content

The simplest yet "realistic" equation of state for seawater from Roquet et al. (2015) is equation (17). Following (17) the coefficients in the form $R_{\beta\chi\varphi}$ are given. This coefficient_set and tests are added to the coefficient_sets already in this package from Roquet et al. (2015), providing another equation of state that can be used.

This PR also updates Base.show so that the coefficients match the variables.

Apologies if this should have been two PR's, I only discovered #27 at the end of what I had initially set out to do which was add the simplest "realistic" eos from Roquet et al. (2015).

Review checklist

I have:

In the Content, I have included


References

Roquet et al., "Defining a Simplified Yet “Realistic” Equation of State for Seawater", Journal of Physical Oceanography (2015)

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +18.25 :tada:

Comparison is base (8873d32) 62.90% compared to head (6f70669) 81.15%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #28 +/- ## =========================================== + Coverage 62.90% 81.15% +18.25% =========================================== Files 3 3 Lines 62 69 +7 =========================================== + Hits 39 56 +17 + Misses 23 13 -10 ``` | [Impacted Files](https://codecov.io/gh/CliMA/SeawaterPolynomials.jl/pull/28?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA) | Coverage Δ | | |---|---|---| | [src/SecondOrderSeawaterPolynomials.jl](https://codecov.io/gh/CliMA/SeawaterPolynomials.jl/pull/28?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA#diff-c3JjL1NlY29uZE9yZGVyU2Vhd2F0ZXJQb2x5bm9taWFscy5qbA==) | `93.93% <100.00%> (+40.09%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

jbisits commented 1 year ago

R₀₀₀ does not appear in the thermal sensitivity or haline sensitivity

Sorry, my mistake! Have now corrected thermal_sensitivity and haline_sensitivity.

jbisits commented 1 year ago

Note that R₀₀₀ is in fact equal to the reference density at the ocean surface. That's why we omit this coefficient. I think we should remove R₀₀₀ from this PR. However, we could add some additional explanation about the potential role of the "double zero" coefficients. With this equation of state, we cannot recover the in situ density at all depths because these coefficients are not tabulated by Roquet.

For reference (apologies about the resolution), here is the part of the paper that details the density_anomaly for the simplest yet "realisitic" eos in Roquet et al. (2015) Roquet et al _2015_Defining a Simplified Yet “Realistic” Equation of State for Seawater (dragged)

This is why I added the R₀₀₀ to SecondOrderSeawaterPolynomial because then we have

$$ \rho = \rho_{r} + \rho' $$

where $\rho'$ is equation (17) in the excerpt above which has the R₀₀₀ coefficient.

I am happy to be guided by you on this and remove R₀₀₀ but the inclusion of R₀₀₀ is only for this :SimplestRealisitcRoquetSeawaterPolynomial as in all other cases R₀₀₀ = 0.

glwagner commented 1 year ago

I am happy to be guided by you on this and remove R₀₀₀ but the inclusion of R₀₀₀ is only for this :SimplestRealisitcRoquetSeawaterPolynomial as in all other cases R₀₀₀ = 0.

R₀₀₀ has no effect on dynamics (or anything) right? What's the point of including it?

jbisits commented 1 year ago

R₀₀₀ has no effect on dynamics (or anything) right? What's the point of including it?

Yes that is right. The inclusion of R₀₀₀ was just to be faithful to the Roquet et al. (2015) suggestion for the simplest "realistic" eos equation (17). Effectively R₀₀₀ shifts the reference density by

(-0.011 * (-4.5)^2) / 2 # = -0.11137499999999999

so removing R₀₀₀ is not likely to change things too much, so I will remove it now.

glwagner commented 1 year ago

I think that's for the best, because ideally users should not set or puzzle over this parameter. We can consider it absorbed into the user definition of reference density (which may also be used for thermodynamics calculations, etc).

glwagner commented 1 year ago

thanks!