-
Notifications
You must be signed in to change notification settings - Fork 3
Add 2D Compressible Euler with Gravity #119
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 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cee7862
first commit: gravity waves
MarcoArtiano 9caaae3
add first test
MarcoArtiano 2482bd2
add type tests
MarcoArtiano 0e6c7a8
include tests in runtest.jl
MarcoArtiano e306751
remove some fluxes with orientation
MarcoArtiano e3cdb42
fix tests
MarcoArtiano 38197f0
fix atol
MarcoArtiano fece2ae
reach full coverage
MarcoArtiano a4a38aa
fix typo
MarcoArtiano 8b33e11
fix test
MarcoArtiano a2510b0
Apply suggestions from code review
MarcoArtiano acdcebd
add description for Souza non-conservative term
MarcoArtiano a4dbcc2
modify comment for Souza flux
MarcoArtiano a0392c8
fix typo
MarcoArtiano 9b5453e
rename equation and add comment to gravity waves example
MarcoArtiano 35677c3
fix spell typo error in the comment
MarcoArtiano 80cebe5
small change in a comment
MarcoArtiano 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
89 changes: 89 additions & 0 deletions
89
examples/elixir_euler_internal_kinetic_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,89 @@ | ||
| using OrdinaryDiffEqSSPRK | ||
| using Trixi, TrixiAtmo | ||
|
|
||
| """ | ||
| initial_condition_gravity_waves(x, t, | ||
| equations::CompressibleEulerInternalKineticEnergyEquationsWithGravity2D) | ||
|
|
||
| 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::CompressibleEulerInternalKineticEnergyEquationsWithGravity2D) | ||
| 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 = CompressibleEulerInternalKineticEnergyEquationsWithGravity2D(c_p = 1004, | ||
| c_v = 717, | ||
| gravity = 9.81) | ||
|
|
||
| # We have an isothermal background state with T0 = 250 K. | ||
| # The reference speed of sound can be computed as: | ||
| # cs = sqrt(gamma * R * T0) | ||
| cs = sqrt(equations.gamma * equations.R * 250) | ||
| surface_flux = (FluxLMARS(cs), flux_zero) | ||
| volume_flux = (flux_ranocha, flux_nonconservative_waruzewski_etal) | ||
| polydeg = 3 | ||
| solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, | ||
| volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
|
||
| boundary_conditions = (x_neg = boundary_condition_periodic, | ||
| x_pos = boundary_condition_periodic, | ||
| 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) | ||
| cells_per_dimension = (60, 8) | ||
| mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, | ||
| periodicity = (true, false)) | ||
| source_terms = nothing | ||
| initial_condition = initial_condition_gravity_waves | ||
| semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
| source_terms = source_terms, | ||
| 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.