Path: blob/main/examples/tree_1d_dgsem/elixir_maxwell_convergence.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the linear advection equation56equations = MaxwellEquations1D()78solver = DGSEM(polydeg = 3, surface_flux = flux_hll)910coordinates_min = 0.011coordinates_max = 1.01213# Create a uniformly refined mesh with periodic boundaries14mesh = TreeMesh(coordinates_min, coordinates_max,15initial_refinement_level = 4,16n_cells_max = 30_000) # set maximum capacity of tree data structure1718semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,19solver)2021###############################################################################22# ODE solvers, callbacks etc.2324# As the wave speed is equal to the speed of light which is on the order of 3 * 10^825# we consider only a small time horizon.26ode = semidiscretize(semi, (0.0, 1e-8))2728summary_callback = SummaryCallback()2930# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results31analysis_callback = AnalysisCallback(semi, interval = 100)3233# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step34stepsize_callback = StepsizeCallback(cfl = 1.6)3536# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver37callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback)3839###############################################################################40# run the simulation4142sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);43dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback44ode_default_options()..., callback = callbacks);454647