Path: blob/main/examples/dgmulti_1d/elixir_burgers_gauss_shock_capturing.jl
2055 views
using Trixi1using OrdinaryDiffEqLowStorageRK23equations = InviscidBurgersEquation1D()45###############################################################################6# setup the GSBP DG discretization that uses the Gauss operators from7# Chan, Del Rey Fernandez, Carpenter (2019).8# [https://doi.org/10.1137/18M1209234](https://doi.org/10.1137/18M1209234)910surface_flux = flux_lax_friedrichs11volume_flux = flux_ec1213polydeg = 314basis = DGMultiBasis(Line(), polydeg, approximation_type = GaussSBP())1516indicator_sc = IndicatorHennemannGassner(equations, basis,17alpha_max = 0.5,18alpha_min = 0.001,19alpha_smooth = true,20variable = first)21volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;22volume_flux_dg = volume_flux,23volume_flux_fv = surface_flux)2425dg = DGMulti(basis,26surface_integral = SurfaceIntegralWeakForm(surface_flux),27volume_integral = volume_integral)2829###############################################################################30# setup the 1D mesh3132cells_per_dimension = (32,)33mesh = DGMultiMesh(dg, cells_per_dimension,34coordinates_min = (-1.0,), coordinates_max = (1.0,),35periodicity = true)3637###############################################################################38# setup the semidiscretization and ODE problem3940semi = SemidiscretizationHyperbolic(mesh,41equations,42initial_condition_convergence_test,43dg)4445tspan = (0.0, 2.0)46ode = semidiscretize(semi, tspan)4748###############################################################################49# setup the callbacks5051# prints a summary of the simulation setup and resets the timers52summary_callback = SummaryCallback()5354# analyse the solution in regular intervals and prints the results55analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg))5657# SaveSolutionCallback allows to save the solution to a file in regular intervals58save_solution = SaveSolutionCallback(interval = 100,59solution_variables = cons2prim)6061# handles the re-calculation of the maximum Δt after each time step62stepsize_callback = StepsizeCallback(cfl = 0.5)6364# collect all callbacks such that they can be passed to the ODE solver65callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,66stepsize_callback)6768# ###############################################################################69# # run the simulation7071sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);72dt = 1.0, ode_default_options()..., callback = callbacks);737475