Path: blob/main/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# setup the equations56advection_velocity = 1.07equations = LinearScalarAdvectionEquation1D(advection_velocity)89###############################################################################10# setup the GSBP DG discretization that uses the Gauss operators from Chan et al.1112surface_flux = FluxLaxFriedrichs()13dg = DGMulti(polydeg = 3,14element_type = Line(),15approximation_type = GaussSBP(),16surface_integral = SurfaceIntegralWeakForm(surface_flux),17volume_integral = VolumeIntegralWeakForm())1819###############################################################################20# setup the 1D mesh2122cells_per_dimension = (8,)23mesh = DGMultiMesh(dg, cells_per_dimension,24coordinates_min = (-1.0,), coordinates_max = (1.0,),25periodicity = true)2627###############################################################################28# setup the test problem (no source term needed for linear advection)2930initial_condition = initial_condition_convergence_test3132###############################################################################33# setup the semidiscretization and ODE problem3435semi = SemidiscretizationHyperbolic(mesh,36equations,37initial_condition,38dg)3940tspan = (0.0, 1.5)41ode = semidiscretize(semi, tspan)4243###############################################################################44# setup the callbacks4546# prints a summary of the simulation setup and resets the timers47summary_callback = SummaryCallback()4849# analyse the solution in regular intervals and prints the results50analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg))5152# The SaveSolutionCallback allows to save the solution to a file in regular intervals53save_solution = SaveSolutionCallback(interval = 100,54solution_variables = cons2prim)5556# handles the re-calculation of the maximum Δt after each time step57stepsize_callback = StepsizeCallback(cfl = 0.75)5859# collect all callbacks such that they can be passed to the ODE solver60callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,61stepsize_callback)6263###############################################################################64# run the simulation6566sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);67dt = 1.0, ode_default_options()..., callback = callbacks);686970