Thermally perfect gas as an AbstractEquationOfState#3079
Conversation
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
AbstractEquationOfState
AbstractEquationOfStateAbstractEquationOfState
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3079 +/- ##
==========================================
+ Coverage 96.82% 96.83% +0.01%
==========================================
Files 659 662 +3
Lines 51050 51181 +131
==========================================
+ Hits 49429 49559 +130
- Misses 1621 1622 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This is great to see, @DanielDoehring; I was hoping to add this myself eventually. Agreed that standard What about adding type parameters to NonIdealCompressibleEulerEquations which identify whether the pressure EOS is non-ideal? This could differentiate between CPG, TPG, and fully non-ideal EOS? |
… into ThermallyPerfGas
… into ThermallyPerfGas
I noticed since there are
We could think about that, does this change something in the implementation/allow for simplifications? I did not go through the entire equation of state and nonideal Euler equations, so maybe there are some spots where things could be more efficient for an ideal gas pressure/density/temperature relation. |
|
I think of thermally perfect as modifying the internal energy/temperature relationship, while a nonideal EOS modifies the pressure equation. Specializing on thermally perfect this way might not make too much of a difference computationally, however. |
format
|
@DanielDoehring can you run the formatter? Otherwise I am ready to approve |
ranocha
left a comment
There was a problem hiding this comment.
Thanks! Are the new implementations tested in https://github.com/trixi-framework/Trixi.jl/blob/main/test/test_type.jl?
| return dpdT_V, dpdV_T | ||
| end | ||
|
|
||
| eos_newton_tol(eos::ThermallyPerfectGas9PolyFit) = 1e-8 |
There was a problem hiding this comment.
The other non-ideal EOS have the same issue https://github.com/trixi-framework/Trixi.jl/blob/main/src/equations/equation_of_state_peng_robinson.jl#L102-L103. May be good to open an issue to tackle them all at once?
There was a problem hiding this comment.
I needed to convert tol to the real type at hand to make the code statically inferrable
There was a problem hiding this comment.
Would it make sense to set the return type of eos_newton_tol from a field of eos::ThermallyPerfectGas9PolyFit?
There was a problem hiding this comment.
That would be reasonable. However, we can also open an issue for now since this will likely require some more tests and fine tuning.
There was a problem hiding this comment.
Yeah, that seems less invasive for now.
I added tests for this as well |
|
Test failures look real, e.g., https://github.com/trixi-framework/Trixi.jl/actions/runs/28684530026/job/85074668076?pr=3079#step:7:13562 |
… into ThermallyPerfGas
Thanks for pointing this out, they are now fixed (I only made the |
For high temperature flows,$c_p$ and $\gamma$ should no longer be treated as constant. In turn, they can modeled as functions of only temperature ("thermally perfect") while preserving the ideal gas relation $p = R_\text{spec} \rho T$ which makes them very attractive.$c_p$ to $T$ is given by the NASA piecewise 9-degree polynomials.
The go-to data that relates
This is an experimental implementation that implements thermally perfect gases as an equation of state.
However, I would like to not restrict this to
NonIdealCompressibleEulerEquationssince the originalCompressibleEulerEquationscould readily be extended with a non-constantgamma = gamma(T). In fact, we already have this behaviour for the viscosity:Trixi.jl/src/equations/compressible_navier_stokes_2d.jl
Lines 189 to 194 in 7091f3b
Trixi.jl/src/equations/compressible_navier_stokes.jl
Lines 125 to 137 in 7091f3b
I also added
varnamesforcons2thermo(this is probably something for a different PR) to be able to save the thermal variables to get e.g. plots of temperature conveniently:Comparison to ideal gas:
One can see that the shock is slightly further away from the cylinder compared to the real gas case.