CliMA / SeawaterPolynomials.jl

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

Changes definition of thermal_expansion and haline_contraction #23

Closed glwagner closed 1 year ago

glwagner commented 1 year ago

Also fixes the definition of the density perturbation and total density for TEOS10.

This PR introduces the concepts "thermal sensitivity" and "haline sensitivity". These are the partial derivatives of density with respect to (the negative of) conservative temperature and absolute salinity, respectively.

Then thermal_expansion is defined,

thermal_expansion = thermal_sensitivity / reference_density

same for the haline coefficient.

Now:

julia> using SeawaterPolynomials
[ Info: Precompiling SeawaterPolynomials [d496a93d-167e-4197-9f49-d3af4ff8fe40]

julia> eos = SeawaterPolynomials.SecondOrderSeawaterPolynomials.RoquetEquationOfState(:CabbelingThermobaricity)
BoussinesqEquationOfState{Float64}:
    ├── seawater_polynomial: SecondOrderSeawaterPolynomial{Float64}
    └── reference_density: 1024.6

julia> using SeawaterPolynomials: thermal_expansion, haline_contraction

julia> thermal_expansion(0, 0, 0, eos)
-6.353699004489558e-5

julia> haline_contraction(0, 0, 0, eos)
0.0007532695686121414

and

julia> eos = SeawaterPolynomials.TEOS10.TEOS10EquationOfState()
BoussinesqEquationOfState{Float64}:
    ├── seawater_polynomial: TEOS10SeawaterPolynomial{Float64}
    └── reference_density: 1020.0

julia> thermal_expansion(0, 0, 0, eos)
-6.303301081954387e-5

julia> haline_contraction(0, 0, 0, eos)
0.0008000626354612623

Also

julia> SeawaterPolynomials.ρ′(0, 0, 0, eos)
-20.156588082935855

Closes #22 Closes #21

codecov[bot] commented 1 year ago

Codecov Report

Base: 88.57% // Head: 61.66% // Decreases project coverage by -26.90% :warning:

Coverage data is based on head (fbffaf1) compared to base (b93af02). Patch coverage: 44.44% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #23 +/- ## =========================================== - Coverage 88.57% 61.66% -26.91% =========================================== Files 3 3 Lines 35 60 +25 =========================================== + Hits 31 37 +6 - Misses 4 23 +19 ``` | [Impacted Files](https://codecov.io/gh/CliMA/SeawaterPolynomials.jl/pull/23?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/23/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA#diff-c3JjL1NlY29uZE9yZGVyU2Vhd2F0ZXJQb2x5bm9taWFscy5qbA==) | `52.00% <23.07%> (-33.72%)` | :arrow_down: | | [src/SeawaterPolynomials.jl](https://codecov.io/gh/CliMA/SeawaterPolynomials.jl/pull/23/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA#diff-c3JjL1NlYXdhdGVyUG9seW5vbWlhbHMuamw=) | `35.71% <38.46%> (+2.38%)` | :arrow_up: | | [src/TEOS10.jl](https://codecov.io/gh/CliMA/SeawaterPolynomials.jl/pull/23/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CliMA#diff-c3JjL1RFT1MxMC5qbA==) | `90.47% <80.00%> (-9.53%)` | :arrow_down: | 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 at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

navidcy commented 1 year ago

Bump patch/minor release?

glwagner commented 1 year ago

Bump patch/minor release?

I bumped the minor release to 0.3.0.