Path: blob/main/examples/p4est_3d_dgsem/elixir_euler_ec.jl
5586 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations3D(5 / 3)78initial_condition = initial_condition_weak_blast_wave910boundary_conditions = (; all = boundary_condition_slip_wall)1112# Get the DG approximation space1314volume_flux = flux_ranocha15solver = DGSEM(polydeg = 5, surface_flux = flux_ranocha,16volume_integral = VolumeIntegralFluxDifferencing(volume_flux))1718# 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)43end4445# Unstructured mesh with 48 cells of the cube domain [-1, 1]^346mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",47joinpath(@__DIR__, "cube_unstructured_2.inp"))4849mesh = P4estMesh{3}(mesh_file, polydeg = 5,50mapping = mapping)5152# create the semidiscretization object5354semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;55boundary_conditions = boundary_conditions)5657###############################################################################58# ODE solvers, callbacks etc.5960tspan = (0.0, 2.0)61ode = semidiscretize(semi, tspan)6263summary_callback = SummaryCallback()6465analysis_interval = 10066analysis_callback = AnalysisCallback(semi, interval = analysis_interval)6768alive_callback = AliveCallback(analysis_interval = analysis_interval)6970save_solution = SaveSolutionCallback(interval = 100,71save_initial_solution = true,72save_final_solution = true)7374stepsize_callback = StepsizeCallback(cfl = 1.0)7576callbacks = CallbackSet(summary_callback,77analysis_callback,78alive_callback,79save_solution,80stepsize_callback)8182###############################################################################83# run the simulation8485sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);86dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback87ode_default_options()..., callback = callbacks);888990