-
Notifications
You must be signed in to change notification settings - Fork 5
Add 2D compressible Euler with internal energy as prognostic variable #172
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
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d2ba850
add internal energy equations
MarcoArtiano ce0acd2
add file
MarcoArtiano 5f369d3
add tests
MarcoArtiano ebc1c30
fmt
MarcoArtiano 3a7e7c0
change test values
MarcoArtiano b839a05
add type tests
MarcoArtiano 434090d
update test values and fix fluxes
MarcoArtiano 1049fbf
fix test values
MarcoArtiano 111ebb2
increase coverage
MarcoArtiano 6c6a657
fix tests
MarcoArtiano 4cca2d9
Merge branch 'main' into ma/internal_energy_2d
ranocha e861fae
Update src/equations/compressible_euler_internal_energy_with_gravity_…
MarcoArtiano f2a3240
Apply suggestions from code review
MarcoArtiano f61ae83
change name and fix docs
MarcoArtiano 282fb28
fix exports
MarcoArtiano 0be310c
fix exports
MarcoArtiano 94c9837
fix sentence
MarcoArtiano 2f5ad31
Apply suggestions from code review
MarcoArtiano 616fb62
remove naive wave speed function
MarcoArtiano 5469438
Update test/test_type.jl
ranocha fcfec49
Update src/equations/compressible_euler_internal_energy_with_gravity_…
ranocha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
examples/euler/dry_air/buoyancy/elixir_internal_energy_inertia_gravity_waves.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # This test case is used to compute convergence rates via a linearized solution. | ||
| # The setup follows the approach commonly adopted in benchmark studies; therefore, | ||
| # a fixed CFL number is employed. | ||
| # | ||
| # References: | ||
| # - Michael Baldauf and Slavko Brdar (2013): | ||
| # "An analytic solution for linear gravity waves in a channel as a test | ||
| # for numerical models using the non-hydrostatic, compressible Euler equations" | ||
| # Q. J. R. Meteorol. Soc., DOI: 10.1002/qj.2105 | ||
| # https://doi.org/10.1002/qj.2105 | ||
| # | ||
| # - Maciej Waruszewski, Jeremy E. Kozdon, Lucas C. Wilcox, Thomas H. Gibson, | ||
| # and Francis X. Giraldo (2022): | ||
| # "Entropy stable discontinuous Galerkin methods for balance laws | ||
| # in non-conservative form: Applications to the Euler equations with gravity" | ||
| # JCP, DOI: 10.1016/j.jcp.2022.111507 | ||
| # https://doi.org/10.1016/j.jcp.2022.111507 | ||
| # | ||
| # - Marco Artiano, Oswald Knoth, Peter Spichtinger, Hendrik Ranocha (2025): | ||
| # "Structure-Preserving High-Order Methods for the Compressible Euler Equations | ||
| # in Potential Temperature Formulation for Atmospheric Flows" | ||
| # https://arxiv.org/abs/2509.10311 | ||
|
|
||
| using OrdinaryDiffEqSSPRK | ||
| using Trixi, TrixiAtmo | ||
|
|
||
| """ | ||
| initial_condition_gravity_waves(x, t, | ||
| equations::CompressibleEulerEnergyEquationsWithGravity2D) | ||
|
|
||
| Test cases for linearized analytical solution by | ||
| - Baldauf, Michael and Brdar, Slavko (2013) | ||
| An analytic solution for linear gravity waves in a channel as a test | ||
| for numerical models using the non-hydrostatic, compressible {E}uler equations | ||
| [DOI: 10.1002/qj.2105] (https://doi.org/10.1002/qj.2105) | ||
| """ | ||
| function initial_condition_gravity_waves(x, t, | ||
| equations::CompressibleEulerInternalEnergyEquationsWithGravity2D) | ||
| g = equations.g | ||
| c_p = equations.c_p | ||
| c_v = equations.c_v | ||
| # center of perturbation | ||
| x_c = 100_000.0 | ||
| a = 5_000 | ||
| H = 10_000 | ||
| R = c_p - c_v # gas constant (dry air) | ||
| T0 = 250 | ||
| delta = g / (R * T0) | ||
| DeltaT = 0.001 | ||
| Tb = DeltaT * sinpi(x[2] / H) * exp(-(x[1] - x_c)^2 / a^2) | ||
| ps = 100_000 # reference pressure | ||
| rhos = ps / (T0 * R) | ||
| rho_b = rhos * (-Tb / T0) | ||
| p = ps * exp(-delta * x[2]) | ||
| rho = rhos * exp(-delta * x[2]) + rho_b * exp(-0.5 * delta * x[2]) | ||
| v1 = 20 | ||
| v2 = 0 | ||
| return prim2cons(SVector(rho, v1, v2, p, g * x[2]), equations) | ||
| end | ||
|
|
||
| equations = CompressibleEulerInternalEnergyEquationsWithGravity2D(c_p = 1004, | ||
| c_v = 717, | ||
| gravity = 9.81) | ||
|
|
||
| surface_flux = (flux_conservative_es, flux_nonconservative_es) | ||
| volume_flux = (flux_conservative_etec, flux_nonconservative_etec) | ||
| polydeg = 3 | ||
| solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, | ||
| volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
|
||
| boundary_conditions = (; | ||
| y_neg = boundary_condition_slip_wall, | ||
| y_pos = boundary_condition_slip_wall) | ||
|
|
||
| coordinates_min = (0.0, 0.0) | ||
| coordinates_max = (300_000.0, 10_000.0) | ||
| trees_per_dimension = (60, 8) | ||
|
|
||
| mesh = P4estMesh(trees_per_dimension, polydeg = polydeg, | ||
| coordinates_min = coordinates_min, coordinates_max = coordinates_max, | ||
| periodicity = (true, false)) | ||
|
|
||
| initial_condition = initial_condition_gravity_waves | ||
| semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
| boundary_conditions = boundary_conditions) | ||
| tspan = (0.0, 1800.0) | ||
| ode = semidiscretize(semi, tspan) | ||
|
|
||
| summary_callback = SummaryCallback() | ||
|
|
||
| analysis_interval = 10000 | ||
| analysis_callback = AnalysisCallback(semi, interval = analysis_interval, | ||
| extra_analysis_integrals = (entropy,)) | ||
|
|
||
| alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
|
||
| stepsize_callback = StepsizeCallback(cfl = 1.0) | ||
|
|
||
| callbacks = CallbackSet(summary_callback, | ||
| analysis_callback, | ||
| alive_callback, | ||
| stepsize_callback) | ||
|
|
||
| sol = solve(ode, | ||
| SSPRK43(thread = Trixi.True()); | ||
| maxiters = 1.0e7, | ||
| dt = 1e-1, # solve needs some value here but it will be overwritten by the stepsize_callback | ||
| save_everystep = false, callback = callbacks, adaptive = false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.