Skip to content

Rainy Euler equations with implicit condensation#100

Merged
benegee merged 56 commits intomainfrom
bg/add-rain-implicit
Jan 7, 2026
Merged

Rainy Euler equations with implicit condensation#100
benegee merged 56 commits intomainfrom
bg/add-rain-implicit

Conversation

@benegee
Copy link
Copy Markdown
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
Copy Markdown

codecov bot commented Jun 24, 2025

Codecov Report

❌ Patch coverage is 96.05911% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.21%. Comparing base (7de9867) to head (e206fd5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/equations/compressible_rainy_euler_2d.jl 96.43% 18 Missing ⚠️
src/equations/compressible_moist_euler_2d_lucas.jl 94.11% 4 Missing ⚠️
src/callbacks_stage/nonlinear_solve_dg2d.jl 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
- Coverage   97.30%   97.21%   -0.10%     
==========================================
  Files          30       33       +3     
  Lines        3903     4491     +588     
==========================================
+ Hits         3798     4366     +568     
- Misses        105      125      +20     

☔ 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
5 tasks
@benegee benegee marked this pull request as ready for review June 30, 2025 10:18
@benegee
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@benegee benegee force-pushed the bg/add-rain-implicit branch from f52fdd8 to 240d43a Compare October 13, 2025 20:24
@benegee
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@tristanmontoya
Copy link
Copy Markdown
Member

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

@benegee
Copy link
Copy Markdown
Collaborator Author

benegee commented Nov 10, 2025

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?

This is of course some good reason!

Yes, I now switched back to "your" constants and your test are now working again. On the other hand, potential temperature test case are now failing. I could update the references for these test cases, or we would need to use non-common constants. What is your opinion @MarcoArtiano ?

@MarcoArtiano
Copy link
Copy Markdown
Collaborator

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?

This is of course some good reason!

Yes, I now switched back to "your" constants and your test are now working again. On the other hand, potential temperature test case are now failing. I could update the references for these test cases, or we would need to use non-common constants. What is your opinion @MarcoArtiano ?

We do not need to use particular values for the constants in the potential temperature test cases, so I'm in favor of that change.

@benegee
Copy link
Copy Markdown
Collaborator Author

benegee commented Dec 18, 2025

This is now ready to merge! I would like to accept the slight decrease in coverage. If I understand correctly this is mainly due to the new equations having about 96% coverage because of the sanity checks, such as #100 (comment). I would however like to keep those checks for the time being.

tristanmontoya
tristanmontoya previously approved these changes Dec 20, 2025
Copy link
Copy Markdown
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.

Looks good! The only other thing I noticed was that the new elixirs are in a subdirectory examples/moist_euler, but the older moist Euler elixirs are not in that subdirectory, which could appear confusing. But reorganizing the examples (i.e., addressing #29) could be left to another PR so feel free to leave it as-is for now.

@benegee
Copy link
Copy Markdown
Collaborator Author

benegee commented Jan 6, 2026

Thanks a lot @tristanmontoya !

You are right, the examples still need to be re-organized; added to #101

I need another approval because of a small adaption to upstream Trixi.jl changes.

Copy link
Copy Markdown
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.

All good now!

@benegee benegee merged commit bb81c47 into main Jan 7, 2026
8 of 10 checks passed
@benegee benegee deleted the bg/add-rain-implicit branch January 7, 2026 08:07
PhilBaa pushed a commit to PhilBaa/TrixiAtmo.jl that referenced this pull request Jan 26, 2026
* rainy Euler equations by Fabian

* more tests

* add docs

* remove coverage check

* document Newton solver

make max_iterations and tolerance keyword arguments

* fmt

* typo

* tune tests

* reference errors

* remove currently unused slip wall BCs

* use new trixi_test macros

* increase tolerance

* OrdinaryDiffEq subpackage

* wrong subpackage

* revert tolerance

* check tolerances

* check CI_ON_MAC

* use same tolerance everywhere

* check macos-15

* arch has to be set

* increase tolerance

* back to macos-latest

* even higher?

* even even higher

* Apply suggestions from code review

Co-authored-by: Tristan Montoya <montoya.tristan@gmail.com>

* review

* fmt

* use constants

* ignore mpiexec status

* check old g

* fix testset parameters

* initial condition with outer layer data

* ouch

* keyword argument

* another RealT

* ouch trixi-framework#2

* type stability tests

* revert to previous values in physical constants

* update references

* moist bubble in MPI as well

* nope

* increase tolerance for mac tests

* remove surface integral from prolong2boundaries

xref: trixi-framework/Trixi.jl@b83f30c#diff-e8f9fd74c25ebabebdbb28dc92a9ce890861c2deedac00255e01cfaa45dc9565

* adapt create_cache

xref: trixi-framework/Trixi.jl@edde724

---------

Co-authored-by: Tristan Montoya <montoya.tristan@gmail.com>
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