Path: blob/main/examples/dgmulti_2d/elixir_euler_hohqmesh.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23# This is a DGMulti version of the UnstructuredMesh2D elixir `elixir_euler_basic.jl`,4# which can be found at `examples/unstructured_2d_dgsem/elixir_euler_basic.jl`.56###############################################################################7# semidiscretization of the compressible Euler equations89equations = CompressibleEulerEquations2D(1.4)1011initial_condition = initial_condition_convergence_test12source_terms = source_terms_convergence_test1314boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)15boundary_conditions = (; :Slant => boundary_condition_convergence_test,16:Bezier => boundary_condition_convergence_test,17:Right => boundary_condition_convergence_test,18:Bottom => boundary_condition_convergence_test,19:Top => boundary_condition_convergence_test)2021###############################################################################22# Get the DG approximation space2324# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of25# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.26# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.27# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.28# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.29# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the30# `StepsizeCallback` (CFL-Condition) and less diffusion.31dg = DGMulti(polydeg = 8, element_type = Quad(), approximation_type = SBP(),32surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)),33volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))3435###############################################################################36# Get the curved quad mesh from a file (downloads the file if not available locally)37mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",38joinpath(@__DIR__, "mesh_trixi_unstructured_mesh_docs.mesh"))3940mesh = DGMultiMesh(dg, mesh_file)4142###############################################################################43# create the semi discretization object4445semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,46source_terms = source_terms,47boundary_conditions = boundary_conditions)4849###############################################################################50# ODE solvers, callbacks etc.5152tspan = (0.0, 3.0)53ode = semidiscretize(semi, tspan)5455summary_callback = SummaryCallback()5657analysis_interval = 10058analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))5960alive_callback = AliveCallback(analysis_interval = analysis_interval)6162save_solution = SaveSolutionCallback(interval = analysis_interval,63solution_variables = cons2prim)6465callbacks = CallbackSet(summary_callback,66analysis_callback,67alive_callback, save_solution)6869###############################################################################70# run the simulation7172time_int_tol = 1e-873sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,74dt = time_int_tol, ode_default_options()..., callback = callbacks)757677