Skip to content

Conversation

@benegee
Copy link
Collaborator

@benegee benegee commented Jun 24, 2025

Part of #95

I suggest merging only the Euler equations with rain and implicit condensation in a first pass. I added just enough tests to achieve good coverage.

@codecov
Copy link

codecov bot commented Jun 24, 2025

Codecov Report

❌ Patch coverage is 96.10092% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.19%. Comparing base (b55387b) to head (311af3c).

Files with missing lines Patch % Lines
src/equations/compressible_rainy_euler_2d.jl 96.33% 15 Missing ⚠️
src/callbacks_stage/nonlinear_solve_dg2d.jl 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
+ Coverage   91.46%   92.19%   +0.73%     
==========================================
  Files          22       25       +3     
  Lines        2331     2767     +436     
==========================================
+ Hits         2132     2551     +419     
- Misses        199      216      +17     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@benegee benegee mentioned this pull request Jun 27, 2025
4 tasks
@benegee benegee marked this pull request as ready for review June 30, 2025 10:18
@benegee
Copy link
Collaborator Author

benegee commented Jun 30, 2025

Unfortunately the errors for macos and ubuntu differ by more than the default tolerance. Interestingly, this only happens for the elixir involving a parabolic part.

@tristanmontoya observed discrepancies here as well trixi-framework/Trixi.jl#2431 but for other parts of the code.

Here as well: #94 (comment)

@tristanmontoya
Copy link
Member

I still have to go through this in more detail, but I am fine with this PR as a first step. Ultimately, I want to make sure we implement the different model options in an extensible way, as there are so many choices that we need to handle (e.g. gravitational potential term, choice of prognostic variables, condensation model).

@benegee
Copy link
Collaborator Author

benegee commented Jul 9, 2025

Ultimately, I want to make sure we implement the different model options in an extensible way, as there are so many choices that we need to handle (e.g. gravitational potential term, choice of prognostic variables, condensation model).

That is my goal as well! The intention of this PR rather is to make sure that @FnHck's implementation makes it into our initial release.

@benegee benegee changed the title Rainy Euler equations with implicit condendation Rainy Euler equations with implicit condensation Jul 23, 2025
@benegee
Copy link
Collaborator Author

benegee commented Jul 24, 2025

For the time being I just increased the tolerance to make the macos tests pass.

Could some mac user maybe check if this is just an issue with the github runners?

Copy link
Member

@tristanmontoya tristanmontoya left a comment

Choose a reason for hiding this comment

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

Nice work with this, thanks @benegee and @FnHck! I added some comments, which should be largely taken as suggestions. Most of the proposed changes involve moving code that is not problem specific out of the problem-specific elixirs.

Copy link
Collaborator Author

@benegee benegee left a comment

Choose a reason for hiding this comment

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

Thanks a lot @tristanmontoya for going through this.
I will address the pending items.


function CompressibleRainyEulerEquations2D(; RealT = Float64)
# Specific heat capacities:
c_liquid_water = 4186.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, very good point!

ref_pressure = 1e5

# Other:
gravity = 9.81
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same here!

ref_L = equations.ref_latent_heat_vap_temp

# testing
if (temperature < 0.0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is maybe something to discuss.

I think it is not Trixi.jl style. However, negative values, also elsewhere e.g. vapor density, are really critical here. The tests that run in CI should not throw any of them, but if you were to work on these examples again, a warning (maybe not an error) could be helpful.

@benegee benegee mentioned this pull request Oct 9, 2025
@benegee benegee force-pushed the bg/add-rain-implicit branch from f52fdd8 to 240d43a Compare October 13, 2025 20:24
@benegee
Copy link
Collaborator Author

benegee commented Oct 14, 2025

I tried to address all points raised during review, and included unit and type stability tests as done in #117 .

I also tried to apply our Float32 convention everywhere, as well as switching to our global constants like EARTH_GRAVITATIONAL_ACCELERATION. The latter causes CI to fail because we get small deviations from the reference values. In particular, I confirmed that the shallow water tests and alike finish successfully with g = 9.80616 while the moisture and potential temperature tests rather use g = 9.81. I think the concrete value is not important here, but it would make sense to unify the used constants. For the time being, both values would be fine for me. What do you think @amrueda @tristanmontoya?
(In the long run we should come up with a more flexible global constants set. Something that at least supports delivering values with a predefined floating point type).

@tristanmontoya
Copy link
Member

I tried to address all points raised during review, and included unit and type stability tests as done in #117 .

I also tried to apply our Float32 convention everywhere, as well as switching to our global constants like EARTH_GRAVITATIONAL_ACCELERATION. The latter causes CI to fail because we get small deviations from the reference values. In particular, I confirmed that the shallow water tests and alike finish successfully with g = 9.80616 while the moisture and potential temperature tests rather use g = 9.81. I think the concrete value is not important here, but it would make sense to unify the used constants. For the time being, both values would be fine for me. What do you think @amrueda @tristanmontoya? (In the long run we should come up with a more flexible global constants set. Something that at least supports delivering values with a predefined floating point type).

Can we just modify the reference values so CI passes with the unified value of the gravitational acceleration? I'm not sure I understand correctly. The values I used like EARTH_GRAVITATIONAL_ACCELERATION come from the Williamson et al. test suite for shallow water, which is standard in that context.

@benegee
Copy link
Collaborator Author

benegee commented Oct 30, 2025

Can we just modify the reference values so CI passes with the unified value of the gravitational acceleration? I'm not sure I understand correctly. The values I used like EARTH_GRAVITATIONAL_ACCELERATION come from the Williamson et al. test suite for shallow water, which is standard in that context.

All good! I had just been playing around with the constant to see which tests fail. We have to either adjust the values for the shallow water test, or for the Euler tests. I am fine with adjusting the Euler test cases.

But now we are at it, what will be our ultimate standard choice in the future? Williamson? Maybe this one: https://physics.nist.gov/cgi-bin/cuu/Value?gn
(I have no opinion, but it would be nice to have to adjust the reference values only once. 😉 )

@tristanmontoya
Copy link
Member

tristanmontoya commented Nov 6, 2025

Can we just modify the reference values so CI passes with the unified value of the gravitational acceleration? I'm not sure I understand correctly. The values I used like EARTH_GRAVITATIONAL_ACCELERATION come from the Williamson et al. test suite for shallow water, which is standard in that context.

All good! I had just been playing around with the constant to see which tests fail. We have to either adjust the values for the shallow water test, or for the Euler tests. I am fine with adjusting the Euler test cases.

But now we are at it, what will be our ultimate standard choice in the future? Williamson? Maybe this one: https://physics.nist.gov/cgi-bin/cuu/Value?gn (I have no opinion, but it would be nice to have to adjust the reference values only once. 😉 )

I would keep them as the Williamson values for no other reason than it being what was used in my paper. If DCMIP or some other more recent project has standardized values, we could use that instead. Are the reference values the only reason for the failing tests, @benegee?

xc = 10000
zc = 2000
rc = 2000
Δθ = 2
Copy link
Member

Choose a reason for hiding this comment

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

I would be careful with using integer values like this (and elsewhere) rather than using explicit Float32 and/or convert and promote. Could this lead to unwanted integer division if these variables come into contact with other integers? I typically would do something like 1f4 or 10000.0f0 instead of 100000 to avoid this. This is just a question, maybe I am incorrect here, but wanted to be careful.

@tristanmontoya
Copy link
Member

Aside from the above comments about constants and integer values, I'd say this is good to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants