Path: blob/main/examples/structured_3d_dgsem/elixir_euler_ec.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations3D(5 / 3)78initial_condition = initial_condition_weak_blast_wave910###############################################################################11# Get the DG approximation space1213volume_flux = flux_ranocha14solver = DGSEM(polydeg = 5, surface_flux = flux_ranocha,15volume_integral = VolumeIntegralFluxDifferencing(volume_flux))1617###############################################################################18# Get the curved quad mesh from a file1920# Mapping as described in https://arxiv.org/abs/2012.1204021function mapping(xi_, eta_, zeta_)22# Transform input variables between -1 and 1 onto [0,3]23xi = 1.5 * xi_ + 1.524eta = 1.5 * eta_ + 1.525zeta = 1.5 * zeta_ + 1.52627y = eta +283 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *29cos(0.5 * pi * (2 * eta - 3) / 3) *30cos(0.5 * pi * (2 * zeta - 3) / 3))3132x = xi +333 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *34cos(2 * pi * (2 * y - 3) / 3) *35cos(0.5 * pi * (2 * zeta - 3) / 3))3637z = zeta +383 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *39cos(pi * (2 * y - 3) / 3) *40cos(0.5 * pi * (2 * zeta - 3) / 3))4142return SVector(x, y, z)43end4445cells_per_dimension = (4, 4, 4)4647mesh = StructuredMesh(cells_per_dimension, mapping)4849###############################################################################50# create the semi discretization object5152semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)5354###############################################################################55# ODE solvers, callbacks etc.5657tspan = (0.0, 2.0)58ode = semidiscretize(semi, tspan)5960summary_callback = SummaryCallback()6162analysis_interval = 10063analysis_callback = AnalysisCallback(semi, interval = analysis_interval)6465alive_callback = AliveCallback(analysis_interval = analysis_interval)6667save_solution = SaveSolutionCallback(interval = 100,68save_initial_solution = true,69save_final_solution = true)7071stepsize_callback = StepsizeCallback(cfl = 1.0)7273callbacks = CallbackSet(summary_callback,74analysis_callback,75alive_callback,76save_solution,77stepsize_callback)7879###############################################################################80# run the simulation8182sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);83dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback84ode_default_options()..., callback = callbacks);858687