Skip to content

Commit

Permalink
Added example elixir for the multicomponent Euler equations on struct…
Browse files Browse the repository at this point in the history
…ured meshes.
  • Loading branch information
SimonCan committed Nov 10, 2023
1 parent 134917d commit 19dd867
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions examples/structured_2d_dgsem/elixir_eulermulti_convergence_ec.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4),
gas_constants = (0.4, 0.4))

initial_condition = initial_condition_convergence_test

volume_flux = flux_ranocha
solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

cells_per_dimension = (32, 32)
coordinates_min = (-1.0, -1.0)
coordinates_max = ( 1.0, 1.0)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)


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


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

tspan = (0.0, 0.4)
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 19dd867

Please sign in to comment.