Path: blob/main/examples/structured_1d_dgsem/elixir_advection_float128.jl
5586 views
using OrdinaryDiffEqFeagin1using Trixi23using Quadmath45###############################################################################6# semidiscretization of the linear advection equation78# See https://github.com/JuliaMath/Quadmath.jl9RealT = Float1281011advection_velocity = 4 / 3 # Does not need to be in higher precision12equations = LinearScalarAdvectionEquation1D(advection_velocity)1314solver = DGSEM(RealT = RealT, polydeg = 13, surface_flux = flux_lax_friedrichs)1516# CARE: Important to use higher precision datatype for coordinates17# as these are used for type promotion of the mesh (points etc.)18coordinates_min = (-one(RealT),)19coordinates_max = (one(RealT),)20cells_per_dimension = (1,)2122# `StructuredMesh` infers datatype from coordinates23mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,24periodicity = true)2526semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,27solver;28boundary_conditions = boundary_condition_periodic)2930###############################################################################31# ODE solvers, callbacks etc.3233# CARE: Important to use higher precision datatype in specification of final time34tspan = (zero(RealT), one(RealT))3536ode = semidiscretize(semi, tspan);3738summary_callback = SummaryCallback()3940analysis_callback = AnalysisCallback(semi, interval = 100,41extra_analysis_errors = (:conservation_error,))4243# cfl does not need to be in higher precision44stepsize_callback = StepsizeCallback(cfl = 0.25)4546callbacks = CallbackSet(summary_callback,47stepsize_callback,48analysis_callback)4950###############################################################################51# run the simulation5253sol = solve(ode, Feagin14();54# Turn off adaptivity to avoid setting very small tolerances55adaptive = false,56dt = 42, # `dt` does not need to be in higher precision57ode_default_options()..., callback = callbacks);585960