CliMA / Thermodynamics.jl

A package containing a library of moist thermodynamic relations.
https://clima.github.io/Thermodynamics.jl/dev/
Apache License 2.0
61 stars 2 forks source link

Add capability for user-defined parameter sets, with an example #172

Closed glwagner closed 7 months ago

glwagner commented 10 months ago

This PR tweaks the internal API for defining parameter sets to support user-defined parameters. This is important, because it will allow users to invoke functions in Thermodynamics.jl without requiring the full suite of parameters in ThermodynamicsParameters. For example, if one is only interested in computing density as a function of temperature, pressure, and (total) specific humidity, then they only require the universal gas constant and the molar masses of air and water.

Next, this PR adds an example which illustrates such a parameter set, called ConstitutiveParameters. It culminates in this plot:

image

which uses sea level data derived from the JRA55 reanalysis (subsampled to make the dataset smaller), showing the primary dependence of density on temperature, secondary dependence on pressure, and teritiary dependence on specific humidity for the typical conditions of the Earth's atmosphere at sea level.

Currently, there are no examples, so this PR introduces the first one. I'd be happy to turn the example into something that appears in the documentation via Literate (the example is very close to that form already).

glwagner commented 10 months ago

I guess this PR depends on #171, but that can be removed.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.93%. Comparing base (46f51af) to head (6ec15d1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #172 +/- ## ======================================= Coverage 90.93% 90.93% ======================================= Files 10 10 Lines 1180 1180 ======================================= Hits 1073 1073 Misses 107 107 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

charleskawczynski commented 8 months ago

Can you rebase this PR @glwagner? I’d definitely like these changes

charleskawczynski commented 8 months ago

@glwagner, can you re-open this on branch off the main branch? (not the fork), I wasn't able to rebase it

glwagner commented 8 months ago

I can do that.

glwagner commented 7 months ago

@charleskawczynski I think we just need to run the formatter

glwagner commented 7 months ago

@charleskawczynski looks like the buildkite isn't running even though I added the "Launch buildkite" label

charleskawczynski commented 7 months ago

@charleskawczynski looks like the buildkite isn't running even though I added the "Launch buildkite" label

Let me try. If it works, I'll see if I can update your privileges.

charleskawczynski commented 7 months ago

@glwagner, maybe because it's a PR from a fork? Ah, or the branch needs to be rebased (so that it picks up the latest buildkite config).

glwagner commented 7 months ago

Superceded by #210