Path: blob/main/examples/unstructured_2d_fdsbp/elixir_euler_source_terms.jl
2055 views
using OrdinaryDiffEqSSPRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations2D(1.4)78initial_condition = initial_condition_convergence_test910###############################################################################11# Get the FDSBP approximation operator1213D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),14derivative_order = 1, accuracy_order = 4,15xmin = -1.0, xmax = 1.0, N = 10)16# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of17# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.18# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.19# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.20# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.21# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the22# `StepsizeCallback` (CFL-Condition) and less diffusion.23solver = FDSBP(D_SBP,24surface_integral = SurfaceIntegralStrongForm(FluxLaxFriedrichs(max_abs_speed_naive)),25volume_integral = VolumeIntegralStrongForm())2627###############################################################################28# Get the curved quad mesh from a file (downloads the file if not available locally)29mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",30joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh"))3132mesh = UnstructuredMesh2D(mesh_file, periodicity = true)3334###############################################################################35# create the semi discretization object3637semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,38source_terms = source_terms_convergence_test)3940###############################################################################41# ODE solvers, callbacks etc.4243tspan = (0.0, 1.0)44ode = semidiscretize(semi, tspan)4546summary_callback = SummaryCallback()4748analysis_interval = 10049analysis_callback = AnalysisCallback(semi, interval = analysis_interval)5051alive_callback = AliveCallback(analysis_interval = analysis_interval)5253save_solution = SaveSolutionCallback(interval = 100,54save_initial_solution = true,55save_final_solution = true)5657callbacks = CallbackSet(summary_callback, analysis_callback,58alive_callback, save_solution)5960###############################################################################61# run the simulation6263sol = solve(ode, SSPRK43(), abstol = 1.0e-9, reltol = 1.0e-9;64ode_default_options()..., callback = callbacks)656667