Skip to content

Commit

Permalink
added entropy conservative test
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisshChawla committed Nov 24, 2023
1 parent f5c15be commit 75c8dca
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions examples/tree_1d_dgsem/elixir_euler_quasi_1d_ec.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using OrdinaryDiffEq
using Trixi

###############################################################################
# Semidiscretization of the quasi 1d compressible Euler equations
# See Chan et al. https://doi.org/10.48550/arXiv.2307.12089 for details

equations = CompressibleEulerEquationsQuasi1D(1.4)

function initial_condition_ec(x, t, equations::CompressibleEulerEquationsQuasi1D)
v1 = 0.1
rho = 2.0 + 0.1 * x[1]
p = 3.0
a = 2.0 + x[1]

return prim2cons(SVector(rho, v1, p, a), equations)
end

initial_condition = initial_condition_ec

volume_flux = (flux_chan_etal, flux_nonconservative_chan_etal)
surface_flux = volume_flux

basis = LobattoLegendreBasis(3)
solver = DGSEM(polydeg = 4, surface_flux = surface_flux,
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (-1.0,)
coordinates_max = (1.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level = 6,
n_cells_max = 10_000)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 2.0)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 100

analysis_callback = AnalysisCallback(semi, interval = analysis_interval)

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.5)

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

0 comments on commit 75c8dca

Please sign in to comment.