-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arbitrary Precision LGL Basis (#2128)
* test higher precision * try to get higher order convergence * type stability * fmt * conservation * correct * working version * changes * rm ODE * rm unused * Apply suggestions from code review Co-authored-by: Joshua Lampert <[email protected]> * RealT for TreeMesh * undo tree * Revert "undo tree" This reverts commit 8103d0a. * ones, zeros * Apply suggestions from code review Co-authored-by: Michael Schlottke-Lakemper <[email protected]> Co-authored-by: Joshua Lampert <[email protected]> * reprod test vals f32 * LV suggestion * typo * shorten * data safety * typesafety * fix * docstring * comments * Type general projection * error * syntax * bring back conv * tolerance always dynamic * convert pi * tighter tolerances * warning only * update some float test vals * remove unused/NON_TESTED * restructure arguments * docstrings * remove random 1000 * old behaviour * compliance with deprecated dgsem * Avoid breaking change * avoid ambiguity * pass datatype through * do not cast to float * remvoe comment * more type generality * do not mix up things * move example * tests * News etc * fmt * update test vals to different basis * try to disable warnings * fmt * CI hazzle * fun with Ci * more warnings * Compat entries * Tolerances for quad precision types * Comment * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <[email protected]> * comment * shorter code for analysis * Apply suggestions from code review Co-authored-by: Michael Schlottke-Lakemper <[email protected]> --------- Co-authored-by: Joshua Lampert <[email protected]> Co-authored-by: Michael Schlottke-Lakemper <[email protected]> Co-authored-by: Hendrik Ranocha <[email protected]>
- Loading branch information
1 parent
50d30e9
commit 5db379b
Showing
22 changed files
with
330 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
using Quadmath | ||
|
||
############################################################################### | ||
# semidiscretization of the linear advection equation | ||
|
||
# See https://github.com/JuliaMath/Quadmath.jl | ||
RealT = Float128 | ||
|
||
advection_velocity = 4 / 3 # Does not need to be in higher precision | ||
equations = LinearScalarAdvectionEquation1D(advection_velocity) | ||
|
||
solver = DGSEM(RealT = RealT, polydeg = 13, surface_flux = flux_lax_friedrichs) | ||
|
||
# CARE: Important to use higher precision datatype for coordinates | ||
# as these are used for type promotion of the mesh (points etc.) | ||
coordinates_min = (-one(RealT),) | ||
coordinates_max = (one(RealT),) | ||
cells_per_dimension = (1,) | ||
|
||
# `StructuredMesh` infers datatype from coordinates | ||
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, | ||
solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
# CARE: Important to use higher precision datatype in specification of final time | ||
tspan = (zero(RealT), one(RealT)) | ||
|
||
ode = semidiscretize(semi, tspan); | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_callback = AnalysisCallback(semi, interval = 100, | ||
extra_analysis_errors = (:conservation_error,)) | ||
|
||
# cfl does not need to be in higher precision | ||
stepsize_callback = StepsizeCallback(cfl = 0.25) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
stepsize_callback, | ||
analysis_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, Feagin14(), | ||
# Turn off adaptivity to avoid setting very small tolerances | ||
adaptive = false, | ||
dt = 42, # `dt` does not need to be in higher precision | ||
save_everystep = false, callback = callbacks); | ||
|
||
# Print the timer summary | ||
summary_callback() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
using DoubleFloats | ||
|
||
############################################################################### | ||
# semidiscretization of the linear advection equation | ||
|
||
# See https://github.com/JuliaMath/DoubleFloats.jl | ||
RealT = Double64 | ||
|
||
advection_velocity = 4 / 3 # Does not need to be in higher precision | ||
equations = LinearScalarAdvectionEquation1D(advection_velocity) | ||
|
||
solver = DGSEM(RealT = RealT, polydeg = 7, surface_flux = flux_lax_friedrichs) | ||
|
||
# CARE: Important to use higher precision datatype for coordinates | ||
# as these are used for type promotion of the mesh (points etc.) | ||
coordinates_min = -one(RealT) # minimum coordinate | ||
coordinates_max = one(RealT) # maximum coordinate | ||
|
||
# For `TreeMesh` the datatype has to be specified explicitly, | ||
# i.e., is not inferred from the coordinates. | ||
mesh = TreeMesh(coordinates_min, coordinates_max, | ||
initial_refinement_level = 3, | ||
n_cells_max = 30_000, | ||
RealT = RealT) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, | ||
solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
# CARE: Important to use higher precision datatype in specification of final time | ||
tspan = (zero(RealT), one(RealT)) | ||
|
||
ode = semidiscretize(semi, tspan); | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_callback = AnalysisCallback(semi, interval = 100, | ||
extra_analysis_errors = (:conservation_error,)) | ||
|
||
# cfl does not need to be in higher precision | ||
stepsize_callback = StepsizeCallback(cfl = 1.4) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
stepsize_callback, | ||
analysis_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, DP8(), | ||
# Turn off adaptivity to avoid setting very small tolerances | ||
adaptive = false, | ||
dt = 42, # `dt` does not need to be in higher precision | ||
save_everystep = false, callback = callbacks); | ||
|
||
# Print the timer summary | ||
summary_callback() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.