Path: blob/main/examples/tree_1d_dgsem/elixir_advection_doublefloat.jl
5586 views
using OrdinaryDiffEqHighOrderRK1using Trixi23using DoubleFloats45###############################################################################6# semidiscretization of the linear advection equation78# See https://github.com/JuliaMath/DoubleFloats.jl9RealT = Double641011advection_velocity = 4 / 3 # Does not need to be in higher precision12equations = LinearScalarAdvectionEquation1D(advection_velocity)1314solver = DGSEM(RealT = RealT, polydeg = 7, 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) # minimum coordinate19coordinates_max = one(RealT) # maximum coordinate2021# For `TreeMesh` the datatype has to be specified explicitly,22# i.e., is not inferred from the coordinates.23mesh = TreeMesh(coordinates_min, coordinates_max,24initial_refinement_level = 3,25n_cells_max = 30_000,26RealT = RealT, periodicity = true)2728semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,29solver;30boundary_conditions = boundary_condition_periodic)3132###############################################################################33# ODE solvers, callbacks etc.3435# CARE: Important to use higher precision datatype in specification of final time36tspan = (zero(RealT), one(RealT))3738ode = semidiscretize(semi, tspan);3940summary_callback = SummaryCallback()4142analysis_callback = AnalysisCallback(semi, interval = 100,43extra_analysis_errors = (:conservation_error,))4445# cfl does not need to be in higher precision46stepsize_callback = StepsizeCallback(cfl = 1.4)4748callbacks = CallbackSet(summary_callback,49stepsize_callback,50analysis_callback)5152###############################################################################53# run the simulation5455sol = solve(ode, DP8();56# Turn off adaptivity to avoid setting very small tolerances57adaptive = false,58dt = 42, # `dt` does not need to be in higher precision59ode_default_options()..., callback = callbacks);606162