Path: blob/main/examples/structured_1d_dgsem/elixir_advection_float128.jl
2055 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)2425semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,26solver)2728###############################################################################29# ODE solvers, callbacks etc.3031# CARE: Important to use higher precision datatype in specification of final time32tspan = (zero(RealT), one(RealT))3334ode = semidiscretize(semi, tspan);3536summary_callback = SummaryCallback()3738analysis_callback = AnalysisCallback(semi, interval = 100,39extra_analysis_errors = (:conservation_error,))4041# cfl does not need to be in higher precision42stepsize_callback = StepsizeCallback(cfl = 0.25)4344callbacks = CallbackSet(summary_callback,45stepsize_callback,46analysis_callback)4748###############################################################################49# run the simulation5051sol = solve(ode, Feagin14();52# Turn off adaptivity to avoid setting very small tolerances53adaptive = false,54dt = 42, # `dt` does not need to be in higher precision55ode_default_options()..., callback = callbacks);565758