@@ -19,59 +19,15 @@ using CairoMakie
1919@assert ! Trixi. _PREFERENCE_POLYESTER
2020@assert ! Trixi. _PREFERENCE_LOOPVECTORIZATION
2121
22- using OrdinaryDiffEq
23- using Trixi
24-
25- # ##############################################################################
26- # semidiscretization of the linear advection equation
27-
28- advection_velocity = (0.2 , - 0.7 )
29- equations = LinearScalarAdvectionEquation2D (advection_velocity)
30-
31- # Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
32- solver = DGSEM (polydeg = 3 , surface_flux = flux_lax_friedrichs)
33-
34- coordinates_min = (- 1.0 , - 1.0 ) # minimum coordinates (min(x), min(y))
35- coordinates_max = (1.0 , 1.0 ) # maximum coordinates (max(x), max(y))
36-
37- # Create a uniformly refined mesh with periodic boundaries
38- mesh = TreeMesh (coordinates_min, coordinates_max,
39- initial_refinement_level = 4 ,
40- n_cells_max = 30_000 ) # set maximum capacity of tree data structure
41-
42- # A semidiscretization collects data structures and functions for the spatial discretization
43- semi = SemidiscretizationHyperbolic (mesh, equations, initial_condition_convergence_test,
44- solver)
45-
46- # ##############################################################################
47- # ODE solvers, callbacks etc.
48-
49- # Create ODE problem with time span from 0.0 to 1.0
50- ode = semidiscretize (semi, (0.0 , 1.0 ))
51-
52- # At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
53- # and resets the timers
54- summary_callback = SummaryCallback ()
55-
56- # The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
57- analysis_callback = AnalysisCallback (semi, interval = 100 )
58-
59- # The SaveSolutionCallback allows to save the solution to a file in regular intervals
60- save_solution = SaveSolutionCallback (interval = 100 ,
61- solution_variables = cons2prim)
62-
63- # The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
64-
65- # Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
66- callbacks = CallbackSet (summary_callback, analysis_callback, save_solution)
22+ trixi_include (joinpath (examples_dir (), " tree_2d_dgsem" , " elixir_advection_basic.jl" ), cfl = 10.0 , sol = nothing );
6723
6824# ##############################################################################
6925# run the simulation
7026
7127sol = solve (
72- ode, Theseus. Rosenbrock ();
73- dt = 0.01 , # solve needs some value here but it will be overwritten by the stepsize_callback
74- ode_default_options ()... , callback = callbacks,
75- # verbose=1,
76- krylov_algo = :gmres ,
77- );
28+ ode, Theseus. Rosenbrock ();
29+ dt = 1.0 , # solve needs some value here but it will be overwritten by the stepsize_callback
30+ ode_default_options ()... , callback = callbacks,
31+ # verbose=1,
32+ krylov_algo = :gmres ,
33+ );
0 commit comments