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

Dont assume that MSLP and theta ref pressure are the same #151

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

trontrytel
Copy link
Member

@trontrytel trontrytel commented Aug 28, 2023

We were assuming that mean sea level pressure (MSLP) and the reference pressure used in potential temperature are the same. This is technically not a mistake. It is causing problems in ClimaAtmos where we were overwriting MSLP=101325 value to be 100000 hPa for some of our cases but not for others.

I'm hoping that differentiating between the two would help us get rid of those overwrites

I kept the MSLP in temperature profiles and in the specific_entropy_ reference pressure. Lucky for us entropy is not used in ClimaAtmos, so it doesn't really matter.

@trontrytel
Copy link
Member Author

How set in stone is this number in the test?

  Expression: count(air_temperature.(param_set, ts_mid) .== Ref(_T_freeze)) ≥ 1373
   Evaluated: 1296 ≥ 1373

src/TemperatureProfiles.jl Outdated Show resolved Hide resolved
@charleskawczynski
Copy link
Member

How set in stone is this number in the test?

Yeah, that was a bit of a kludge. We should really be testing this: https://github.com/CliMA/Thermodynamics.jl/blob/main/test/relations.jl#L837. I forget exactly why that wasn’t working.

Copy link
Contributor

@tapios tapios left a comment

Choose a reason for hiding this comment

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

This looks good. It's good to separate the different reference pressures playing different roles in thermodynamic functions.

Given that MSLP is only used as the reference pressure for entropies now, could you please rename this to p_ref_entropy or something like it, to make clear what role it plays?

Copy link
Member

@charleskawczynski charleskawczynski left a comment

Choose a reason for hiding this comment

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

My only concern is, is it possible that this opens the door for inconsistencies? Otherwise it seems good.

Copy link
Member

@charleskawczynski charleskawczynski left a comment

Choose a reason for hiding this comment

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

Also, I agree that this is a breaking change, so will need to bump the minor version

@trontrytel
Copy link
Member Author

Given that MSLP is only used as the reference pressure for entropies now, could you please rename this to p_ref_entropy or something like it, to make clear what role it plays?

@tapios - I changed the name in Thermodynamics but kept the MSLP parameter in CLIMAParameters. Or would you rather I also change the name in CLIMAParameters?

We use MSLP in a couple of places in ClimaAtmos. In some of those places it should now be replaced with p_ref_theta. I wanted to do that after I update Thermodynamics.

We use MSLP in ClimaAtmos to:

  • to compute the reference density: ᶜρ_ref = @. MSLP * exp(-grav * ᶜcoord.z / (R_d * T_ref)) / (R_d * T_ref) (don't have to be changed)
  • in initial profiles (I think in some of those it should be changed to ref_p_theta, but not all)
  • in HeldSuarez forcing (I think it should be changed for theta forcing, but not needed for energy)
  • in implicit tendency wfact for theta (should be changed to p_ref_theta)

@tapios
Copy link
Contributor

tapios commented Aug 29, 2023

Given that MSLP is only used as the reference pressure for entropies now, could you please rename this to p_ref_entropy or something like it, to make clear what role it plays?

@tapios - I changed the name in Thermodynamics but kept the MSLP parameter in CLIMAParameters. Or would you rather I also change the name in CLIMAParameters?

We use MSLP in a couple of places in ClimaAtmos. In some of those places it should now be replaced with p_ref_theta. I wanted to do that after I update Thermodynamics.

We use MSLP in ClimaAtmos to:

  • to compute the reference density: ᶜρ_ref = @. MSLP * exp(-grav * ᶜcoord.z / (R_d * T_ref)) / (R_d * T_ref) (don't have to be changed)
  • in initial profiles (I think in some of those it should be changed to ref_p_theta, but not all)
  • in HeldSuarez forcing (I think it should be changed for theta forcing, but not needed for energy)
  • in implicit tendency wfact for theta (should be changed to p_ref_theta)

Of course, please do leave MSLP as a parameter if it's used for initial conditions etc. in ClimaAtmos. Please make the changes to p_ref_theta in ClimaAtmos where needed to disambiguate the parameters.

@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f7d5775) 93.35% compared to head (7056443) 93.35%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #151   +/-   ##
=======================================
  Coverage   93.35%   93.35%           
=======================================
  Files           9        9           
  Lines        1114     1114           
=======================================
  Hits         1040     1040           
  Misses         74       74           
Files Changed Coverage Δ
src/Parameters.jl 93.33% <ø> (ø)
src/isentropic.jl 100.00% <100.00%> (ø)
src/relations.jl 96.57% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@trontrytel
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 29, 2023

Configuration problem:
bors.toml: not found

@trontrytel
Copy link
Member Author

bors try

@bors
Copy link
Contributor

bors bot commented Aug 29, 2023

try

Configuration problem:
bors.toml: not found

@charleskawczynski
Copy link
Member

Ah, right, we switched to the GH merge queue

@charleskawczynski
Copy link
Member

Let's try

@trontrytel trontrytel added the Launch Buildkite Add label to launch Buildkite label Aug 29, 2023
@charleskawczynski charleskawczynski added this pull request to the merge queue Aug 29, 2023
Merged via the queue into main with commit 500481d Aug 30, 2023
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes 💥 Launch Buildkite Add label to launch Buildkite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants