-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HLL Davis wave speeds & Cartesian Flux Winters for polytropic Euler (#…
…1733) * hll_davis for polytropic euler * flux winters for tree and tests * fmt * typo * remove copied comment * Update src/equations/polytropic_euler_2d.jl Co-authored-by: Andrew Winters <[email protected]> * orientation_or_normal_direction * typo --------- Co-authored-by: Andrew Winters <[email protected]>
- Loading branch information
1 parent
8bdd0cd
commit c8e1f99
Showing
6 changed files
with
272 additions
and
2 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
examples/tree_2d_dgsem/elixir_eulerpolytropic_convergence.jl
This file contains 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,63 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the polytropic Euler equations | ||
|
||
gamma = 1.4 | ||
kappa = 0.5 # Scaling factor for the pressure. | ||
equations = PolytropicEulerEquations2D(gamma, kappa) | ||
|
||
initial_condition = initial_condition_convergence_test | ||
|
||
volume_flux = flux_winters_etal | ||
solver = DGSEM(polydeg = 3, surface_flux = FluxHLL(min_max_speed_davis), | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
coordinates_min = (0.0, 0.0) | ||
coordinates_max = (1.0, 1.0) | ||
|
||
# Create a uniformly refined mesh with periodic boundaries | ||
mesh = TreeMesh(coordinates_min, coordinates_max, | ||
initial_refinement_level = 2, | ||
periodicity = true, | ||
n_cells_max = 30_000) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
source_terms = source_terms_convergence_test) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 0.1) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, | ||
extra_analysis_errors = (:l2_error_primitive, | ||
:linf_error_primitive)) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = 100, | ||
save_initial_solution = true, | ||
save_final_solution = true, | ||
solution_variables = cons2prim) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 0.1) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, alive_callback, | ||
save_solution, | ||
stepsize_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), | ||
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback | ||
save_everystep = false, callback = callbacks); | ||
summary_callback() # print the timer summary |
This file contains 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
This file contains 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
This file contains 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,35 @@ | ||
module TestExamples2DEulerMulticomponent | ||
|
||
using Test | ||
using Trixi | ||
|
||
include("test_trixi.jl") | ||
|
||
EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_2d_dgsem") | ||
|
||
@testset "Polytropic Euler" begin | ||
#! format: noindent | ||
|
||
@trixi_testset "elixir_eulerpolytropic_convergence.jl" begin | ||
@test_trixi_include(joinpath(EXAMPLES_DIR, | ||
"elixir_eulerpolytropic_convergence.jl"), | ||
l2=[ | ||
0.0016689832177626373, 0.0025920263793094526, | ||
0.003281074494626679, | ||
], | ||
linf=[ | ||
0.010994883201896677, 0.013309526619350365, | ||
0.02008032661117376, | ||
]) | ||
# Ensure that we do not have excessive memory allocations | ||
# (e.g., from type instabilities) | ||
let | ||
t = sol.t[end] | ||
u_ode = sol.u[end] | ||
du_ode = similar(u_ode) | ||
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000 | ||
end | ||
end | ||
end | ||
|
||
end # module |
This file contains 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
This file contains 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