diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml
index 81d18f4105e..a733cb7cc21 100644
--- a/.github/workflows/FormatCheck.yml
+++ b/.github/workflows/FormatCheck.yml
@@ -30,7 +30,7 @@ jobs:
# format(".")
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter"))'
- julia -e 'using JuliaFormatter; format(["benchmark", "ext", "src", "test", "utils"])'
+ julia -e 'using JuliaFormatter; format(["benchmark", "examples", "ext", "src", "test", "utils"])'
- name: Format check
run: |
julia -e '
diff --git a/README.md b/README.md
index 673708d8b89..1d52089ae3e 100644
--- a/README.md
+++ b/README.md
@@ -256,31 +256,48 @@ or [create an issue](https://github.com/trixi-framework/Trixi.jl/issues/new).
## Acknowledgments
-
-
+
-This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
-under Germany's Excellence Strategy EXC 2044-390685587, Mathematics Münster:
-Dynamics-Geometry-Structure.
-
-This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
-through the research unit FOR 5409 "Structure-Preserving Numerical Methods for Bulk- and
-Interface Coupling of Heterogeneous Models (SNuBIC)" (project number 463312734).
+This project has benefited from funding by the [Deutsche
+Forschungsgemeinschaft](https://www.dfg.de/) (DFG, German Research Foundation)
+through the following grants:
+* Excellence Strategy EXC 2044-390685587, Mathematics Münster: Dynamics-Geometry-Structure.
+* Research unit FOR 5409 "Structure-Preserving Numerical Methods for Bulk- and
+ Interface Coupling of Heterogeneous Models (SNuBIC)" (project number 463312734).
+* Individual grant no. 528753982.
-This project has benefited from funding from the European Research Council through the
+This project has benefited from funding from the [European Research Council](https://erc.europa.eu)
+through the
ERC Starting Grant "An Exascale aware and Un-crashable Space-Time-Adaptive
Discontinuous Spectral Element Solver for Non-Linear Conservation Laws" (Extreme),
ERC grant agreement no. 714487.
-This project has benefited from funding from Vetenskapsrådet (VR, Swedish Research Council), Sweden
+This project has benefited from funding from [Vetenskapsrådet](https://www.vr.se)
+(VR, Swedish Research Council), Sweden
through the VR Starting Grant "Shallow water flows including sediment transport and morphodynamics",
VR grant agreement 2020-03642 VR.
-This project has benefited from funding from the United States National Science Foundation under awards
+This project has benefited from funding from the United States
+[National Science Foundation](https://www.nsf.gov/) (NSF) under awards
DMS-1719818 and DMS-1943186.
-This project has benefited from funding from the German Federal Ministry of
-Education and Research through the project grant "Adaptive earth system modeling
+This project has benefited from funding from the German
+[Federal Ministry of Education and Research](https://www.bmbf.de) (BMBF)
+through the project grant "Adaptive earth system modeling
with significantly reduced computation time for exascale supercomputers
(ADAPTEX)" (funding id: 16ME0668K).
+
+This project has benefited from funding by the
+[Daimler und Benz Stiftung](https://www.daimler-benz-stiftung.de) (Daimler and Benz Foundation)
+through grant no. 32-10/22.
+
+Trixi.jl is supported by [NumFOCUS](https://numfocus.org/) as an Affiliated Project.
diff --git a/docs/literate/src/files/differentiable_programming.jl b/docs/literate/src/files/differentiable_programming.jl
index 33427803afc..0960ba25d9f 100644
--- a/docs/literate/src/files/differentiable_programming.jl
+++ b/docs/literate/src/files/differentiable_programming.jl
@@ -43,7 +43,7 @@ scatter(real.(λ), imag.(λ), label="central flux")
# As you can see here, the maximal real part is close to zero.
relative_maximum = maximum(real, λ) / maximum(abs, λ)
-@test 3.0e-10 < relative_maximum < 8.0e-10 #src
+@test 3.0e-10 < relative_maximum < 9.0e-10 #src
# Interestingly, if we add dissipation by switching to the `flux_lax_friedrichs`
# at the interfaces, the maximal real part of the eigenvalues increases.
@@ -87,7 +87,7 @@ scatter(real.(λ), imag.(λ), label="central flux")
# Here, the maximal real part is basically zero to machine accuracy.
relative_maximum = maximum(real, λ) / maximum(abs, λ)
-@test 1.0e-17 < relative_maximum < 1.0e-15 #src
+@test 1.0e-17 < relative_maximum < 2.0e-15 #src
# Moreover, the eigenvectors are not as ill-conditioned as in 2D.
diff --git a/docs/src/index.md b/docs/src/index.md
index 9ffaee26c40..fd923348928 100644
--- a/docs/src/index.md
+++ b/docs/src/index.md
@@ -344,29 +344,58 @@ or [create an issue](https://github.com/trixi-framework/Trixi.jl/issues/new).
## Acknowledgments
-![funding-logo](https://user-images.githubusercontent.com/3637659/233821022-84910be7-8649-4999-a0ff-22d5e20f0b90.jpg)
-
-This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
-under Germany's Excellence Strategy EXC 2044-390685587, Mathematics Münster:
-Dynamics-Geometry-Structure.
+```@raw html
+
+
+
+
+
+
+```
-This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
-through the research unit FOR 5409 "Structure-Preserving Numerical Methods for Bulk- and
-Interface Coupling of Heterogeneous Models (SNuBIC)" (project number 463312734).
+This project has benefited from funding by the [Deutsche
+Forschungsgemeinschaft](https://www.dfg.de/) (DFG, German Research Foundation)
+through the following grants:
+* Excellence Strategy EXC 2044-390685587, Mathematics Münster: Dynamics-Geometry-Structure.
+* Research unit FOR 5409 "Structure-Preserving Numerical Methods for Bulk- and
+ Interface Coupling of Heterogeneous Models (SNuBIC)" (project number 463312734).
+* Individual grant no. 528753982.
-This project has benefited from funding from the European Research Council through the
+This project has benefited from funding from the [European Research Council](https://erc.europa.eu)
+through the
ERC Starting Grant "An Exascale aware and Un-crashable Space-Time-Adaptive
Discontinuous Spectral Element Solver for Non-Linear Conservation Laws" (Extreme),
ERC grant agreement no. 714487.
-This project has benefited from funding from Vetenskapsrådet (VR, Swedish Research Council), Sweden
+This project has benefited from funding from [Vetenskapsrådet](https://www.vr.se)
+(VR, Swedish Research Council), Sweden
through the VR Starting Grant "Shallow water flows including sediment transport and morphodynamics",
VR grant agreement 2020-03642 VR.
-This project has benefited from funding from the United States National Science Foundation under awards
+This project has benefited from funding from the United States
+[National Science Foundation](https://www.nsf.gov/) (NSF) under awards
DMS-1719818 and DMS-1943186.
-This project has benefited from funding from the German Federal Ministry of
-Education and Research through the project grant "Adaptive earth system modeling
+This project has benefited from funding from the German
+[Federal Ministry of Education and Research](https://www.bmbf.de) (BMBF)
+through the project grant "Adaptive earth system modeling
with significantly reduced computation time for exascale supercomputers
(ADAPTEX)" (funding id: 16ME0668K).
+
+This project has benefited from funding by the
+[Daimler und Benz Stiftung](https://www.daimler-benz-stiftung.de) (Daimler and Benz Foundation)
+through grant no. 32-10/22.
+
+Trixi.jl is supported by [NumFOCUS](https://numfocus.org/) as an Affiliated Project.
diff --git a/docs/src/styleguide.md b/docs/src/styleguide.md
index 60e227204ca..2f28dbfcb17 100644
--- a/docs/src/styleguide.md
+++ b/docs/src/styleguide.md
@@ -17,11 +17,11 @@ conventions, we apply and enforce automated source code formatting
* Maximum line length (strictly): **92**.
* Functions that mutate their *input* are named with a trailing `!`.
* Functions order their parameters [similar to Julia Base](https://docs.julialang.org/en/v1/manual/style-guide/#Write-functions-with-argument-ordering-similar-to-Julia-Base-1).
- * The main modified argument comes first. For example, if the right-hand side `du` is modified,
- it should come first. If only the `cache` is modified, e.g., in `prolong2interfaces!`
+ * The main modified argument comes first. For example, if the right-hand side `du` is modified,
+ it should come first. If only the `cache` is modified, e.g., in `prolong2interfaces!`
and its siblings, put the `cache` first.
* Otherwise, use the order `mesh, equations, solver, cache`.
- * If something needs to be specified in more detail for dispatch, put the additional argument before the general one
+ * If something needs to be specified in more detail for dispatch, put the additional argument before the general one
that is specified in more detail. For example, we use `have_nonconservative_terms(equations), equations`
and `dg.mortar, dg`.
* Prefer `for i in ...` to `for i = ...` for better semantic clarity and greater flexibility.
@@ -55,7 +55,7 @@ julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
```
You can then recursively format the core Julia files in the Trixi.jl repo by executing
```shell
-julia -e 'using JuliaFormatter; format(["benchmark", "ext", "src", "utils"])'
+julia -e 'using JuliaFormatter; format(["benchmark", "examples", "ext", "src", "test", "utils"])'
```
from inside the Trixi.jl repository. For convenience, there is also a script you can
directly run from your terminal shell, which will automatically install JuliaFormatter in a
@@ -67,12 +67,12 @@ You can get more information about using the convenience script by running it wi
`--help`/`-h` flag.
### Checking formatting before committing
-It can be convenient to check the formatting of source code automatically before each commit.
+It can be convenient to check the formatting of source code automatically before each commit.
We use git-hooks for it and provide a `pre-commit` script in the `utils` folder. The script uses
-[JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) just like formatting script that
-runs over the whole Trixi.jl directory.
-You can copy the `pre-commit`-script into `.git/hooks/pre-commit` and it will check your formatting
+[JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) just like formatting script that
+runs over the whole Trixi.jl directory.
+You can copy the `pre-commit`-script into `.git/hooks/pre-commit` and it will check your formatting
before each commit. If errors are found the commit is aborted and you can add the corrections via
-```shell
+```shell
git add -p
```
diff --git a/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl b/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl
index d06ed05a621..09d66fe8aea 100644
--- a/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl
+++ b/examples/dgmulti_1d/elixir_advection_gauss_sbp.jl
@@ -23,8 +23,8 @@ dg = DGMulti(polydeg = 3,
cells_per_dimension = (8,)
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(-1.0,), coordinates_max=(1.0,),
- periodicity=true)
+ coordinates_min = (-1.0,), coordinates_max = (1.0,),
+ periodicity = true)
###############################################################################
# setup the test problem (no source term needed for linear advection)
@@ -49,10 +49,10 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg))
# handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.75)
+stepsize_callback = StepsizeCallback(cfl = 0.75)
# collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback)
@@ -60,9 +60,8 @@ callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
-
diff --git a/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl b/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl
index 3566185d110..6abd7118fe3 100644
--- a/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl
+++ b/examples/dgmulti_1d/elixir_euler_fdsbp_periodic.jl
@@ -2,8 +2,10 @@
using Trixi, OrdinaryDiffEq
dg = DGMulti(element_type = Line(),
- approximation_type = periodic_derivative_operator(
- derivative_order=1, accuracy_order=4, xmin=0.0, xmax=1.0, N=50),
+ approximation_type = periodic_derivative_operator(derivative_order = 1,
+ accuracy_order = 4,
+ xmin = 0.0, xmax = 1.0,
+ N = 50),
surface_flux = flux_hll,
volume_integral = VolumeIntegralWeakForm())
@@ -11,8 +13,8 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
-mesh = DGMultiMesh(dg, coordinates_min=(-1.0,),
- coordinates_max=( 1.0,))
+mesh = DGMultiMesh(dg, coordinates_min = (-1.0,),
+ coordinates_max = (1.0,))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms)
@@ -21,15 +23,16 @@ tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
-stepsize_callback = StepsizeCallback(cfl=1.0)
-callbacks = CallbackSet(summary_callback, alive_callback, stepsize_callback, analysis_callback)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
+stepsize_callback = StepsizeCallback(cfl = 1.0)
+callbacks = CallbackSet(summary_callback, alive_callback, stepsize_callback,
+ analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_1d/elixir_euler_flux_diff.jl b/examples/dgmulti_1d/elixir_euler_flux_diff.jl
index 489b23e37b2..56a24d25d07 100644
--- a/examples/dgmulti_1d/elixir_euler_flux_diff.jl
+++ b/examples/dgmulti_1d/elixir_euler_flux_diff.jl
@@ -13,17 +13,17 @@ source_terms = source_terms_convergence_test
cells_per_dimension = (8,)
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(-1.0,), coordinates_max=(1.0,), periodicity=true)
+ coordinates_min = (-1.0,), coordinates_max = (1.0,), periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
- source_terms=source_terms)
+ source_terms = source_terms)
tspan = (0.0, 1.1)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback)
@@ -31,7 +31,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_advection_diffusion.jl b/examples/dgmulti_2d/elixir_advection_diffusion.jl
index 8a79e9700ac..ce7b0e745a4 100644
--- a/examples/dgmulti_2d/elixir_advection_diffusion.jl
+++ b/examples/dgmulti_2d/elixir_advection_diffusion.jl
@@ -11,48 +11,52 @@ initial_condition_zero(x, t, equations::LinearScalarAdvectionEquation2D) = SVect
initial_condition = initial_condition_zero
# tag different boundary segments
-left(x, tol=50*eps()) = abs(x[1] + 1) < tol
-right(x, tol=50*eps()) = abs(x[1] - 1) < tol
-bottom(x, tol=50*eps()) = abs(x[2] + 1) < tol
-top(x, tol=50*eps()) = abs(x[2] - 1) < tol
+left(x, tol = 50 * eps()) = abs(x[1] + 1) < tol
+right(x, tol = 50 * eps()) = abs(x[1] - 1) < tol
+bottom(x, tol = 50 * eps()) = abs(x[2] + 1) < tol
+top(x, tol = 50 * eps()) = abs(x[2] - 1) < tol
is_on_boundary = Dict(:left => left, :right => right, :top => top, :bottom => bottom)
cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension; is_on_boundary)
# BC types
-boundary_condition_left = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 + 0.1 * x[2]))
+boundary_condition_left = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 +
+ 0.1 *
+ x[2]))
boundary_condition_zero = BoundaryConditionDirichlet((x, t, equations) -> SVector(0.0))
boundary_condition_neumann_zero = BoundaryConditionNeumann((x, t, equations) -> SVector(0.0))
# define inviscid boundary conditions
boundary_conditions = (; :left => boundary_condition_left,
- :bottom => boundary_condition_zero,
- :top => boundary_condition_do_nothing,
- :right => boundary_condition_do_nothing)
+ :bottom => boundary_condition_zero,
+ :top => boundary_condition_do_nothing,
+ :right => boundary_condition_do_nothing)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :left => boundary_condition_left,
- :bottom => boundary_condition_zero,
- :top => boundary_condition_zero,
- :right => boundary_condition_neumann_zero)
+ :bottom => boundary_condition_zero,
+ :top => boundary_condition_zero,
+ :right => boundary_condition_neumann_zero)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic))
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
tspan = (0.0, 1.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-6
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl
index 7e87d9f097d..d2f11f18507 100644
--- a/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl
+++ b/examples/dgmulti_2d/elixir_advection_diffusion_nonperiodic.jl
@@ -16,61 +16,63 @@ equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
# to numerical partial differential equations.
# [DOI](https://doi.org/10.1007/978-3-319-41640-3_6).
function initial_condition_erikkson_johnson(x, t, equations)
- l = 4
- epsilon = diffusivity() # Note: this requires epsilon < 0.6 due to the sqrt
- lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
- cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
- return SVector{1}(u)
+ l = 4
+ epsilon = diffusivity() # Note: this requires epsilon < 0.6 due to the sqrt
+ lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
+ cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
+ return SVector{1}(u)
end
initial_condition = initial_condition_erikkson_johnson
# tag different boundary segments
-left(x, tol=50*eps()) = abs(x[1] + 1) < tol
-right(x, tol=50*eps()) = abs(x[1]) < tol
-bottom(x, tol=50*eps()) = abs(x[2] + 0.5) < tol
-top(x, tol=50*eps()) = abs(x[2] - 0.5) < tol
-entire_boundary(x, tol=50*eps()) = true
+left(x, tol = 50 * eps()) = abs(x[1] + 1) < tol
+right(x, tol = 50 * eps()) = abs(x[1]) < tol
+bottom(x, tol = 50 * eps()) = abs(x[2] + 0.5) < tol
+top(x, tol = 50 * eps()) = abs(x[2] - 0.5) < tol
+entire_boundary(x, tol = 50 * eps()) = true
is_on_boundary = Dict(:left => left, :right => right, :top => top, :bottom => bottom,
:entire_boundary => entire_boundary)
cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension;
- coordinates_min=(-1.0, -0.5),
- coordinates_max=(0.0, 0.5),
+ coordinates_min = (-1.0, -0.5),
+ coordinates_max = (0.0, 0.5),
is_on_boundary)
# BC types
boundary_condition = BoundaryConditionDirichlet(initial_condition)
# define inviscid boundary conditions, enforce "do nothing" boundary condition at the outflow
-boundary_conditions = (; :left => boundary_condition,
- :top => boundary_condition,
- :bottom => boundary_condition,
- :right => boundary_condition_do_nothing)
+boundary_conditions = (; :left => boundary_condition,
+ :top => boundary_condition,
+ :bottom => boundary_condition,
+ :right => boundary_condition_do_nothing)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :entire_boundary => boundary_condition)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic))
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
tspan = (0.0, 1.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl b/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl
index 76512f1e39f..c498e5468d3 100644
--- a/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl
+++ b/examples/dgmulti_2d/elixir_advection_diffusion_periodic.jl
@@ -8,12 +8,12 @@ equations = LinearScalarAdvectionEquation2D(0.0, 0.0)
equations_parabolic = LaplaceDiffusion2D(5.0e-1, equations)
function initial_condition_sharp_gaussian(x, t, equations::LinearScalarAdvectionEquation2D)
- return SVector(exp(-100 * (x[1]^2 + x[2]^2)))
+ return SVector(exp(-100 * (x[1]^2 + x[2]^2)))
end
initial_condition = initial_condition_sharp_gaussian
cells_per_dimension = (16, 16)
-mesh = DGMultiMesh(dg, cells_per_dimension, periodicity=true)
+mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true)
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, dg)
@@ -21,16 +21,16 @@ tspan = (0.0, 0.1)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-6
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- dt = time_int_tol, ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ dt = time_int_tol, ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_bilinear.jl b/examples/dgmulti_2d/elixir_euler_bilinear.jl
index bdd582610ea..cd498bf39b8 100644
--- a/examples/dgmulti_2d/elixir_euler_bilinear.jl
+++ b/examples/dgmulti_2d/elixir_euler_bilinear.jl
@@ -10,27 +10,28 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
# example where we tag two separate boundary segments of the mesh
-top_boundary(x, tol=50*eps()) = abs(x[2]-1) top_boundary, :rest => rest_of_boundary)
function mapping(xi, eta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return SVector(x, y)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
-vertex_coordinates, EToV = StartUpDG.uniform_mesh(dg.basis.element_type, cells_per_dimension...)
+vertex_coordinates, EToV = StartUpDG.uniform_mesh(dg.basis.element_type,
+ cells_per_dimension...)
for i in eachindex(vertex_coordinates[1])
- vx, vy = getindex.(vertex_coordinates, i)
- setindex!.(vertex_coordinates, mapping(vx, vy), i)
+ vx, vy = getindex.(vertex_coordinates, i)
+ setindex!.(vertex_coordinates, mapping(vx, vy), i)
end
-mesh = DGMultiMesh(dg, vertex_coordinates, EToV, is_on_boundary=is_on_boundary)
+mesh = DGMultiMesh(dg, vertex_coordinates, EToV, is_on_boundary = is_on_boundary)
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
- :rest => boundary_condition_convergence_test)
+ :rest => boundary_condition_convergence_test)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
@@ -40,15 +41,15 @@ tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl b/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl
index 4bb05c0b062..e7830c4736b 100644
--- a/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl
+++ b/examples/dgmulti_2d/elixir_euler_brown_minion_vortex.jl
@@ -1,6 +1,6 @@
using Trixi, OrdinaryDiffEq
-dg = DGMulti(polydeg=4, element_type = Quad(), approximation_type = Polynomial(),
+dg = DGMulti(polydeg = 4, element_type = Quad(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs()),
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))
@@ -16,38 +16,38 @@ incompressible version.
[DOI: 10.1006/jcph.1995.1205](https://doi.org/10.1006/jcph.1995.1205)
"""
function initial_condition_BM_vortex(x, t, equations::CompressibleEulerEquations2D)
- pbar = 9.0 / equations.gamma
- delta = 0.05
- epsilon = 30
- H = (x[2] < 0) ? tanh(epsilon * (x[2] + 0.25)) : tanh(epsilon * (0.25 - x[2]))
- rho = 1.0
- v1 = H
- v2 = delta * cos(2.0 * pi * x[1])
- p = pbar
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ pbar = 9.0 / equations.gamma
+ delta = 0.05
+ epsilon = 30
+ H = (x[2] < 0) ? tanh(epsilon * (x[2] + 0.25)) : tanh(epsilon * (0.25 - x[2]))
+ rho = 1.0
+ v1 = H
+ v2 = delta * cos(2.0 * pi * x[1])
+ p = pbar
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_BM_vortex
cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(-0.5, -0.5), coordinates_max=(0.5, 0.5),
- periodicity=true)
+ coordinates_min = (-0.5, -0.5), coordinates_max = (0.5, 0.5),
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
###############################################################################
# run the simulation
tol = 1.0e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=tol, reltol=tol,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = tol, reltol = tol,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_curved.jl b/examples/dgmulti_2d/elixir_euler_curved.jl
index 39e3a0a0360..48662f4b12b 100644
--- a/examples/dgmulti_2d/elixir_euler_curved.jl
+++ b/examples/dgmulti_2d/elixir_euler_curved.jl
@@ -10,21 +10,21 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
# example where we tag two separate boundary segments of the mesh
-top_boundary(x, tol=50*eps()) = abs(x[2]-1) top_boundary, :rest => rest_of_boundary)
function mapping(xi, eta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return SVector(x, y)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
-mesh = DGMultiMesh(dg, cells_per_dimension, mapping, is_on_boundary=is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension, mapping, is_on_boundary = is_on_boundary)
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
- :rest => boundary_condition_convergence_test)
+ :rest => boundary_condition_convergence_test)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
@@ -34,16 +34,16 @@ tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
alg = RDPK3SpFSAL49()
-sol = solve(ode, alg; abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, alg; abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl b/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl
index d41ca2c5b34..3a73089b566 100644
--- a/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl
+++ b/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl
@@ -2,8 +2,10 @@
using Trixi, OrdinaryDiffEq
dg = DGMulti(element_type = Quad(),
- approximation_type = periodic_derivative_operator(
- derivative_order=1, accuracy_order=4, xmin=0.0, xmax=1.0, N=50),
+ approximation_type = periodic_derivative_operator(derivative_order = 1,
+ accuracy_order = 4,
+ xmin = 0.0, xmax = 1.0,
+ N = 50),
surface_flux = flux_hll,
volume_integral = VolumeIntegralWeakForm())
@@ -11,8 +13,8 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
-mesh = DGMultiMesh(dg, coordinates_min=(-1.0, -1.0),
- coordinates_max=( 1.0, 1.0))
+mesh = DGMultiMesh(dg, coordinates_min = (-1.0, -1.0),
+ coordinates_max = (1.0, 1.0))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms)
@@ -21,15 +23,16 @@ tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
-stepsize_callback = StepsizeCallback(cfl=1.0)
-callbacks = CallbackSet(summary_callback, alive_callback, stepsize_callback, analysis_callback)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
+stepsize_callback = StepsizeCallback(cfl = 1.0)
+callbacks = CallbackSet(summary_callback, alive_callback, stepsize_callback,
+ analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_hohqmesh.jl b/examples/dgmulti_2d/elixir_euler_hohqmesh.jl
index b9a24dc2450..f534b5bc8ad 100644
--- a/examples/dgmulti_2d/elixir_euler_hohqmesh.jl
+++ b/examples/dgmulti_2d/elixir_euler_hohqmesh.jl
@@ -15,11 +15,11 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = (; :Slant => boundary_condition_convergence_test,
- :Bezier => boundary_condition_convergence_test,
- :Right => boundary_condition_convergence_test,
- :Bottom => boundary_condition_convergence_test,
- :Top => boundary_condition_convergence_test )
+boundary_conditions = (; :Slant => boundary_condition_convergence_test,
+ :Bezier => boundary_condition_convergence_test,
+ :Right => boundary_condition_convergence_test,
+ :Bottom => boundary_condition_convergence_test,
+ :Top => boundary_condition_convergence_test)
###############################################################################
# Get the DG approximation space
@@ -32,8 +32,9 @@ dg = DGMulti(polydeg = 8, element_type = Quad(), approximation_type = SBP(),
# Get the curved quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_trixi_unstructured_mesh_docs.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = DGMultiMesh(dg, mesh_file)
@@ -42,8 +43,8 @@ mesh = DGMultiMesh(dg, mesh_file)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
- source_terms=source_terms,
- boundary_conditions=boundary_conditions)
+ source_terms = source_terms,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -54,9 +55,9 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -66,7 +67,7 @@ callbacks = CallbackSet(summary_callback,
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- dt = time_int_tol, ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ dt = time_int_tol, ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl b/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl
index 39e98d1a2c5..14de0bf0e8b 100644
--- a/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl
+++ b/examples/dgmulti_2d/elixir_euler_kelvin_helmholtz_instability.jl
@@ -15,23 +15,24 @@ A version of the classical Kelvin-Helmholtz instability based on
of the Euler Equations
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-1,+1]^2
- slope = 15
- amplitude = 0.02
- B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
- rho = 0.5 + 0.75 * B
- v1 = 0.5 * (B - 1)
- v2 = 0.1 * sin(2 * pi * x[1])
- p = 1.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-1,+1]^2
+ slope = 15
+ amplitude = 0.02
+ B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
+ rho = 0.5 + 0.75 * B
+ v1 = 0.5 * (B - 1)
+ v2 = 0.1 * sin(2 * pi * x[1])
+ p = 1.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
cells_per_dimension = (32, 32)
-mesh = DGMultiMesh(dg, cells_per_dimension; periodicity=true)
+mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
@@ -39,9 +40,9 @@ tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback)
@@ -49,7 +50,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl
index f5adc7bf83c..49c8b28eaf8 100644
--- a/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl
+++ b/examples/dgmulti_2d/elixir_euler_rayleigh_taylor_instability.jl
@@ -29,34 +29,34 @@ defined below.
"""
@inline function initial_condition_rayleigh_taylor_instability(x, t,
equations::CompressibleEulerEquations2D,
- slope=1000)
- tol = 1e2*eps()
-
- if x[2] < 0.5
- p = 2*x[2] + 1
- else
- p = x[2] + 3/2
- end
-
- # smooth the discontinuity to avoid ambiguity at element interfaces
- smoothed_heaviside(x, left, right) = left + 0.5*(1 + tanh(slope * x)) * (right-left)
- rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0)
-
- c = sqrt(equations.gamma * p / rho)
- # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the
- # initial condition satisfies reflective boundary conditions at the top/bottom boundaries.
- v = -0.025 * c * cos(8*pi*x[1]) * sin(pi*x[2])^6
- u = 0.0
-
- return prim2cons(SVector(rho, u, v, p), equations)
+ slope = 1000)
+ tol = 1e2 * eps()
+
+ if x[2] < 0.5
+ p = 2 * x[2] + 1
+ else
+ p = x[2] + 3 / 2
+ end
+
+ # smooth the discontinuity to avoid ambiguity at element interfaces
+ smoothed_heaviside(x, left, right) = left + 0.5 * (1 + tanh(slope * x)) * (right - left)
+ rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0)
+
+ c = sqrt(equations.gamma * p / rho)
+ # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the
+ # initial condition satisfies reflective boundary conditions at the top/bottom boundaries.
+ v = -0.025 * c * cos(8 * pi * x[1]) * sin(pi * x[2])^6
+ u = 0.0
+
+ return prim2cons(SVector(rho, u, v, p), equations)
end
@inline function source_terms_rayleigh_taylor_instability(u, x, t,
equations::CompressibleEulerEquations2D)
- g = 1.0
- rho, rho_v1, rho_v2, rho_e = u
+ g = 1.0
+ rho, rho_v1, rho_v2, rho_e = u
- return SVector(0.0, 0.0, g*rho, g*rho_v2)
+ return SVector(0.0, 0.0, g * rho, g * rho_v2)
end
# numerical parameters
@@ -67,8 +67,8 @@ dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = Polynomial
num_elements = 16
cells_per_dimension = (num_elements, 4 * num_elements)
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(0.0, 0.0), coordinates_max=(0.25, 1.0),
- periodicity=(true, false))
+ coordinates_min = (0.0, 0.0), coordinates_max = (0.25, 1.0),
+ periodicity = (true, false))
initial_condition = initial_condition_rayleigh_taylor_instability
boundary_conditions = (; :entire_boundary => boundary_condition_slip_wall)
@@ -86,9 +86,9 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -97,7 +97,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_shockcapturing.jl b/examples/dgmulti_2d/elixir_euler_shockcapturing.jl
index 4b2a408c757..36494b268d6 100644
--- a/examples/dgmulti_2d/elixir_euler_shockcapturing.jl
+++ b/examples/dgmulti_2d/elixir_euler_shockcapturing.jl
@@ -10,25 +10,25 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
-basis = DGMultiBasis(Quad(), polydeg, approximation_type=GaussSBP())
+basis = DGMultiBasis(Quad(), polydeg, approximation_type = GaussSBP())
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
dg = DGMulti(basis,
surface_integral = SurfaceIntegralWeakForm(surface_flux),
volume_integral = volume_integral)
cells_per_dimension = (8, 8)
-mesh = DGMultiMesh(dg, cells_per_dimension, periodicity=true)
+mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
@@ -36,16 +36,15 @@ tspan = (0.0, 0.15)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
-
diff --git a/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl b/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl
index dad898b99b6..5e8d9e6c8e4 100644
--- a/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl
+++ b/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.jl
@@ -10,27 +10,27 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
-basis = DGMultiBasis(Quad(), polydeg, approximation_type=GaussSBP())
+basis = DGMultiBasis(Quad(), polydeg, approximation_type = GaussSBP())
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
dg = DGMulti(basis,
surface_integral = SurfaceIntegralWeakForm(surface_flux),
volume_integral = volume_integral)
function mapping(xi, eta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return SVector(x, y)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension, mapping)
@@ -41,16 +41,15 @@ tspan = (0.0, 0.15)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
-
diff --git a/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl b/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl
index c10b5e46a14..53661af259a 100644
--- a/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl
+++ b/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl
@@ -13,11 +13,11 @@ meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole())
# the pre-defined Triangulate geometry in StartUpDG has integer boundary tags. this routine
# assigns boundary faces based on these integer boundary tags.
-mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary=>1, :inner_boundary=>2))
+mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary => 1, :inner_boundary => 2))
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :outer_boundary => boundary_condition_convergence_test,
- :inner_boundary => boundary_condition_convergence_test)
+ :inner_boundary => boundary_condition_convergence_test)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
@@ -27,14 +27,14 @@ tspan = (0.0, 0.2)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_weakform.jl b/examples/dgmulti_2d/elixir_euler_weakform.jl
index 486a30b37f1..ecf5e94a86b 100644
--- a/examples/dgmulti_2d/elixir_euler_weakform.jl
+++ b/examples/dgmulti_2d/elixir_euler_weakform.jl
@@ -10,16 +10,16 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
# example where we tag two separate boundary segments of the mesh
-top_boundary(x, tol=50*eps()) = abs(x[2]-1) top_boundary, :rest => rest_of_boundary)
cells_per_dimension = (8, 8)
-mesh = DGMultiMesh(dg, cells_per_dimension, is_on_boundary=is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension, is_on_boundary = is_on_boundary)
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
- :rest => boundary_condition_convergence_test)
+ :rest => boundary_condition_convergence_test)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
@@ -29,15 +29,16 @@ tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
-stepsize_callback = StepsizeCallback(cfl=1.5)
-callbacks = CallbackSet(summary_callback, alive_callback, stepsize_callback, analysis_callback)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
+stepsize_callback = StepsizeCallback(cfl = 1.5)
+callbacks = CallbackSet(summary_callback, alive_callback, stepsize_callback,
+ analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl b/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl
index c4c83fff642..307bf5cbf4a 100644
--- a/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl
+++ b/examples/dgmulti_2d/elixir_euler_weakform_periodic.jl
@@ -10,7 +10,7 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
cells_per_dimension = (4, 4)
-mesh = DGMultiMesh(dg, cells_per_dimension, periodicity=true)
+mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms)
@@ -18,14 +18,14 @@ tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl
index a1351cf8244..11670288526 100644
--- a/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl
+++ b/examples/dgmulti_2d/elixir_mhd_reflective_wall.jl
@@ -8,70 +8,72 @@ using LinearAlgebra: norm, dot # for use in the MHD boundary condition
equations = IdealGlmMhdEquations2D(1.4)
function initial_condition_perturbation(x, t, equations::IdealGlmMhdEquations2D)
- # pressure perturbation in a vertically magnetized field on the domain [-1, 1]^2
+ # pressure perturbation in a vertically magnetized field on the domain [-1, 1]^2
- r2 = (x[1] + 0.25)^2 + (x[2] + 0.25)^2
+ r2 = (x[1] + 0.25)^2 + (x[2] + 0.25)^2
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = 1 + 0.5 * exp(-100 * r2)
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = 1 + 0.5 * exp(-100 * r2)
- # the pressure and magnetic field are chosen to be strongly
- # magnetized, such that p / ||B||^2 ≈ 0.01.
- B1 = 0.0
- B2 = 40.0 / sqrt(4.0 * pi)
- B3 = 0.0
+ # the pressure and magnetic field are chosen to be strongly
+ # magnetized, such that p / ||B||^2 ≈ 0.01.
+ B1 = 0.0
+ B2 = 40.0 / sqrt(4.0 * pi)
+ B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
+ psi = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end
initial_condition = initial_condition_perturbation
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGMulti(polydeg=3, element_type = Quad(), approximation_type = GaussSBP(),
+solver = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = GaussSBP(),
surface_integral = SurfaceIntegralWeakForm(surface_flux),
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
-x_neg(x, tol=50*eps()) = abs(x[1] + 1) < tol
-x_pos(x, tol=50*eps()) = abs(x[1] - 1) < tol
-y_neg(x, tol=50*eps()) = abs(x[2] + 1) < tol
-y_pos(x, tol=50*eps()) = abs(x[2] - 1) < tol
+x_neg(x, tol = 50 * eps()) = abs(x[1] + 1) < tol
+x_pos(x, tol = 50 * eps()) = abs(x[1] - 1) < tol
+y_neg(x, tol = 50 * eps()) = abs(x[2] + 1) < tol
+y_pos(x, tol = 50 * eps()) = abs(x[2] - 1) < tol
is_on_boundary = Dict(:x_neg => x_neg, :x_pos => x_pos, :y_neg => y_neg, :y_pos => y_pos)
cells_per_dimension = (16, 16)
-mesh = DGMultiMesh(solver, cells_per_dimension; periodicity=(false, false), is_on_boundary)
+mesh = DGMultiMesh(solver, cells_per_dimension; periodicity = (false, false),
+ is_on_boundary)
# Create a "reflective-like" boundary condition by mirroring the velocity but leaving the magnetic field alone.
# Note that this boundary condition is probably not entropy stable.
-function boundary_condition_velocity_slip_wall(u_inner, normal_direction::AbstractVector, x, t,
- surface_flux_function, equations::IdealGlmMhdEquations2D)
+function boundary_condition_velocity_slip_wall(u_inner, normal_direction::AbstractVector,
+ x, t, surface_flux_function,
+ equations::IdealGlmMhdEquations2D)
- # Normalize the vector without using `normalize` since we need to multiply by the `norm_` later
- norm_ = norm(normal_direction)
- normal = normal_direction / norm_
+ # Normalize the vector without using `normalize` since we need to multiply by the `norm_` later
+ norm_ = norm(normal_direction)
+ normal = normal_direction / norm_
- # compute the primitive variables
- rho, v1, v2, v3, p, B1, B2, B3, psi = cons2prim(u_inner, equations)
+ # compute the primitive variables
+ rho, v1, v2, v3, p, B1, B2, B3, psi = cons2prim(u_inner, equations)
- v_normal = dot(normal, SVector(v1, v2))
- u_mirror = prim2cons(SVector(rho, v1 - 2 * v_normal * normal[1],
- v2 - 2 * v_normal * normal[2],
- v3, p, B1, B2, B3, psi), equations)
+ v_normal = dot(normal, SVector(v1, v2))
+ u_mirror = prim2cons(SVector(rho, v1 - 2 * v_normal * normal[1],
+ v2 - 2 * v_normal * normal[2],
+ v3, p, B1, B2, B3, psi), equations)
- return surface_flux_function(u_inner, u_mirror, normal, equations) * norm_
+ return surface_flux_function(u_inner, u_mirror, normal, equations) * norm_
end
-boundary_conditions = (; x_neg=boundary_condition_velocity_slip_wall,
- x_pos=boundary_condition_velocity_slip_wall,
- y_neg=boundary_condition_do_nothing,
- y_pos=BoundaryConditionDirichlet(initial_condition))
+boundary_conditions = (; x_neg = boundary_condition_velocity_slip_wall,
+ x_pos = boundary_condition_velocity_slip_wall,
+ y_neg = boundary_condition_do_nothing,
+ y_pos = BoundaryConditionDirichlet(initial_condition))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -82,12 +84,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(solver))
-alive_callback = AliveCallback(alive_interval=10)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ uEltype = real(solver))
+alive_callback = AliveCallback(alive_interval = 10)
cfl = 0.5
-stepsize_callback = StepsizeCallback(cfl=cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -98,8 +101,8 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1e-5, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1e-5, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl
index bf5045ce8b0..663301e189f 100644
--- a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl
+++ b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave.jl
@@ -11,14 +11,14 @@ initial_condition = initial_condition_weak_blast_wave
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-dg = DGMulti(polydeg=3, element_type = Quad(), approximation_type = Polynomial(),
+dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(surface_flux),
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(-2.0, -2.0), coordinates_max=(2.0, 2.0),
- periodicity=true)
+ coordinates_min = (-2.0, -2.0), coordinates_max = (2.0, 2.0),
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
###############################################################################
@@ -30,13 +30,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -47,8 +47,8 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl
index 9c8dfcb3801..3dc070a7296 100644
--- a/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl
+++ b/examples/dgmulti_2d/elixir_mhd_weak_blast_wave_SBP.jl
@@ -15,13 +15,13 @@ initial_condition = initial_condition_weak_blast_wave
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-dg = DGMulti(polydeg=3, element_type = Quad(), approximation_type = SBP(),
+dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(),
surface_integral = SurfaceIntegralWeakForm(surface_flux),
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(-2.0, -2.0), coordinates_max=(2.0, 2.0),
- periodicity=true)
+ coordinates_min = (-2.0, -2.0), coordinates_max = (2.0, 2.0),
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
###############################################################################
@@ -33,8 +33,8 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# See comment above and https://github.com/trixi-framework/Trixi.jl/issues/881
# DGMulti uses a conservative timestep estimate, so we can use a large CFL here.
@@ -46,8 +46,7 @@ alive_callback = AliveCallback(analysis_interval=analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
#stepsize_callback,
- alive_callback,
- #=glm_speed_callback=#)
+ alive_callback) #=glm_speed_callback=#
###############################################################################
# run the simulation
@@ -56,7 +55,7 @@ callbacks = CallbackSet(summary_callback,
# sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
# dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
# save_everystep=false, callback=callbacks);
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl
index 23c9c2e8ed4..38cf3d7984b 100644
--- a/examples/dgmulti_2d/elixir_navierstokes_convergence.jl
+++ b/examples/dgmulti_2d/elixir_navierstokes_convergence.jl
@@ -10,169 +10,180 @@ mu() = 0.01
equations = CompressibleEulerEquations2D(1.4)
# Note: If you change the Navier-Stokes parameters here, also change them in the initial condition
# I really do not like this structure but it should work for now
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
dg = DGMulti(polydeg = 3, element_type = Tri(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(flux_lax_friedrichs),
volume_integral = VolumeIntegralWeakForm())
-top_bottom(x, tol=50*eps()) = abs(abs(x[2]) - 1) < tol
+top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol
is_on_boundary = Dict(:top_bottom => top_bottom)
cells_per_dimension = (16, 16)
-mesh = DGMultiMesh(dg, cells_per_dimension; periodicity=(true, false), is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = (true, false), is_on_boundary)
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion2D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion2D`)
# and by the initial condition (which passes in `CompressibleEulerEquations2D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0)) ) * cos(pi_t)
- v2 = v1
- p = rho^2
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t)
+ v2 = v1
+ p = rho^2
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- y = x[2]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
- rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
- rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
- rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
-
- v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
- v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_y = sin(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_xy = pi * cos(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_yy = (sin(pi_x) * ( 2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0)
- - A * A * log(y + 2.0) * exp(-A * (y - 1.0))
- - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_xx = v1_xx
- v2_xy = v1_xy
- v2_yy = v1_yy
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
- p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
- E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
-
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- # stress tensor from x-direction
- - 4.0 / 3.0 * v1_xx * mu_
- + 2.0 / 3.0 * v2_xy * mu_
- - v1_yy * mu_
- - v2_xy * mu_ )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- # stress tensor from y-direction
- - v1_xy * mu_
- - v2_xx * mu_
- - 4.0 / 3.0 * v2_yy * mu_
- + 2.0 / 3.0 * v1_xy * mu_ )
- # total energy equation
- du4 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- # stress tensor and temperature gradient terms from x-direction
- - 4.0 / 3.0 * v1_xx * v1 * mu_
- + 2.0 / 3.0 * v2_xy * v1 * mu_
- - 4.0 / 3.0 * v1_x * v1_x * mu_
- + 2.0 / 3.0 * v2_y * v1_x * mu_
- - v1_xy * v2 * mu_
- - v2_xx * v2 * mu_
- - v1_y * v2_x * mu_
- - v2_x * v2_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_
- # stress tensor and temperature gradient terms from y-direction
- - v1_yy * v1 * mu_
- - v2_xy * v1 * mu_
- - v1_y * v1_y * mu_
- - v2_x * v1_y * mu_
- - 4.0 / 3.0 * v2_yy * v2 * mu_
- + 2.0 / 3.0 * v1_xy * v2 * mu_
- - 4.0 / 3.0 * v2_y * v2_y * mu_
- + 2.0 / 3.0 * v1_x * v2_y * mu_
- - T_const * inv_rho_cubed * ( p_yy * rho * rho
- - 2.0 * p_y * rho * rho_y
- + 2.0 * p * rho_y * rho_y
- - p * rho * rho_yy ) * mu_ )
-
- return SVector(du1, du2, du3, du4)
+ y = x[2]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
+ rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
+ rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+
+ v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
+ v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_y = sin(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_xy = pi * cos(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_yy = (sin(pi_x) *
+ (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) -
+ A * A * log(y + 2.0) * exp(-A * (y - 1.0)) -
+ (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_xx = v1_xx
+ v2_xy = v1_xy
+ v2_yy = v1_yy
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+ p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
+ E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
+
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y -
+ # stress tensor from x-direction
+ 4.0 / 3.0 * v1_xx * mu_ +
+ 2.0 / 3.0 * v2_xy * mu_ -
+ v1_yy * mu_ -
+ v2_xy * mu_)
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y -
+ # stress tensor from y-direction
+ v1_xy * mu_ -
+ v2_xx * mu_ -
+ 4.0 / 3.0 * v2_yy * mu_ +
+ 2.0 / 3.0 * v1_xy * mu_)
+ # total energy equation
+ du4 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y) -
+ # stress tensor and temperature gradient terms from x-direction
+ 4.0 / 3.0 * v1_xx * v1 * mu_ +
+ 2.0 / 3.0 * v2_xy * v1 * mu_ -
+ 4.0 / 3.0 * v1_x * v1_x * mu_ +
+ 2.0 / 3.0 * v2_y * v1_x * mu_ -
+ v1_xy * v2 * mu_ -
+ v2_xx * v2 * mu_ -
+ v1_y * v2_x * mu_ -
+ v2_x * v2_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_ -
+ # stress tensor and temperature gradient terms from y-direction
+ v1_yy * v1 * mu_ -
+ v2_xy * v1 * mu_ -
+ v1_y * v1_y * mu_ -
+ v2_x * v1_y * mu_ -
+ 4.0 / 3.0 * v2_yy * v2 * mu_ +
+ 2.0 / 3.0 * v1_xy * v2 * mu_ -
+ 4.0 / 3.0 * v2_y * v2_y * mu_ +
+ 2.0 / 3.0 * v1_x * v2_y * mu_ -
+ T_const * inv_rho_cubed *
+ (p_yy * rho * rho -
+ 2.0 * p_y * rho * rho_y +
+ 2.0 * p * rho_y * rho_y -
+ p * rho * rho_yy) * mu_)
+
+ return SVector(du1, du2, du3, du4)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2:3])
+velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2:3])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
@@ -180,10 +191,11 @@ boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
-
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -193,15 +205,15 @@ tspan = (0.0, 0.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
index 86b5ae64348..87ffd0e0995 100644
--- a/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
+++ b/examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
@@ -10,24 +10,26 @@ mu() = 0.01
equations = CompressibleEulerEquations2D(1.4)
# Note: If you change the Navier-Stokes parameters here, also change them in the initial condition
# I really do not like this structure but it should work for now
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
dg = DGMulti(polydeg = 3, element_type = Tri(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(flux_lax_friedrichs),
volume_integral = VolumeIntegralWeakForm())
-top_bottom(x, tol=50*eps()) = abs(abs(x[2]) - 1) < tol
+top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol
is_on_boundary = Dict(:top_bottom => top_bottom)
function mapping(xi, eta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return SVector(x, y)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
-mesh = DGMultiMesh(dg, cells_per_dimension, mapping; periodicity=(true, false), is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension, mapping; periodicity = (true, false),
+ is_on_boundary)
# This initial condition is taken from `examples/dgmulti_2d/elixir_navierstokes_convergence.jl`
@@ -36,150 +38,160 @@ mesh = DGMultiMesh(dg, cells_per_dimension, mapping; periodicity=(true, false),
# and by the initial condition (which passes in `CompressibleEulerEquations2D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0)) ) * cos(pi_t)
- v2 = v1
- p = rho^2
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t)
+ v2 = v1
+ p = rho^2
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- y = x[2]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
- rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
- rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
- rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
-
- v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
- v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_y = sin(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_xy = pi * cos(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_yy = (sin(pi_x) * ( 2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0)
- - A * A * log(y + 2.0) * exp(-A * (y - 1.0))
- - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_xx = v1_xx
- v2_xy = v1_xy
- v2_yy = v1_yy
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
- p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
- E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
-
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- # stress tensor from x-direction
- - 4.0 / 3.0 * v1_xx * mu_
- + 2.0 / 3.0 * v2_xy * mu_
- - v1_yy * mu_
- - v2_xy * mu_ )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- # stress tensor from y-direction
- - v1_xy * mu_
- - v2_xx * mu_
- - 4.0 / 3.0 * v2_yy * mu_
- + 2.0 / 3.0 * v1_xy * mu_ )
- # total energy equation
- du4 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- # stress tensor and temperature gradient terms from x-direction
- - 4.0 / 3.0 * v1_xx * v1 * mu_
- + 2.0 / 3.0 * v2_xy * v1 * mu_
- - 4.0 / 3.0 * v1_x * v1_x * mu_
- + 2.0 / 3.0 * v2_y * v1_x * mu_
- - v1_xy * v2 * mu_
- - v2_xx * v2 * mu_
- - v1_y * v2_x * mu_
- - v2_x * v2_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_
- # stress tensor and temperature gradient terms from y-direction
- - v1_yy * v1 * mu_
- - v2_xy * v1 * mu_
- - v1_y * v1_y * mu_
- - v2_x * v1_y * mu_
- - 4.0 / 3.0 * v2_yy * v2 * mu_
- + 2.0 / 3.0 * v1_xy * v2 * mu_
- - 4.0 / 3.0 * v2_y * v2_y * mu_
- + 2.0 / 3.0 * v1_x * v2_y * mu_
- - T_const * inv_rho_cubed * ( p_yy * rho * rho
- - 2.0 * p_y * rho * rho_y
- + 2.0 * p * rho_y * rho_y
- - p * rho * rho_yy ) * mu_ )
-
- return SVector(du1, du2, du3, du4)
+ y = x[2]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
+ rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
+ rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+
+ v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
+ v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_y = sin(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_xy = pi * cos(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_yy = (sin(pi_x) *
+ (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) -
+ A * A * log(y + 2.0) * exp(-A * (y - 1.0)) -
+ (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_xx = v1_xx
+ v2_xy = v1_xy
+ v2_yy = v1_yy
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+ p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
+ E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
+
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y -
+ # stress tensor from x-direction
+ 4.0 / 3.0 * v1_xx * mu_ +
+ 2.0 / 3.0 * v2_xy * mu_ -
+ v1_yy * mu_ -
+ v2_xy * mu_)
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y -
+ # stress tensor from y-direction
+ v1_xy * mu_ -
+ v2_xx * mu_ -
+ 4.0 / 3.0 * v2_yy * mu_ +
+ 2.0 / 3.0 * v1_xy * mu_)
+ # total energy equation
+ du4 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y) -
+ # stress tensor and temperature gradient terms from x-direction
+ 4.0 / 3.0 * v1_xx * v1 * mu_ +
+ 2.0 / 3.0 * v2_xy * v1 * mu_ -
+ 4.0 / 3.0 * v1_x * v1_x * mu_ +
+ 2.0 / 3.0 * v2_y * v1_x * mu_ -
+ v1_xy * v2 * mu_ -
+ v2_xx * v2 * mu_ -
+ v1_y * v2_x * mu_ -
+ v2_x * v2_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_ -
+ # stress tensor and temperature gradient terms from y-direction
+ v1_yy * v1 * mu_ -
+ v2_xy * v1 * mu_ -
+ v1_y * v1_y * mu_ -
+ v2_x * v1_y * mu_ -
+ 4.0 / 3.0 * v2_yy * v2 * mu_ +
+ 2.0 / 3.0 * v1_xy * v2 * mu_ -
+ 4.0 / 3.0 * v2_y * v2_y * mu_ +
+ 2.0 / 3.0 * v1_x * v2_y * mu_ -
+ T_const * inv_rho_cubed *
+ (p_yy * rho * rho -
+ 2.0 * p_y * rho * rho_y +
+ 2.0 * p * rho_y * rho_y -
+ p * rho * rho_yy) * mu_)
+
+ return SVector(du1, du2, du3, du4)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2:3])
+velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2:3])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
@@ -187,10 +199,11 @@ boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
-
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -200,15 +213,15 @@ tspan = (0.0, 0.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl b/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl
index 97b779ebaf9..7c55cbf0ccf 100644
--- a/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl
+++ b/examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl
@@ -9,28 +9,27 @@ prandtl_number() = 0.72
mu() = 0.001
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(),
- Prandtl=prandtl_number())
-
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = GaussSBP(),
surface_integral = SurfaceIntegralWeakForm(flux_lax_friedrichs),
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))
-top(x, tol=50*eps()) = abs(x[2] - 1) < tol
-rest_of_boundary(x, tol=50*eps()) = !top(x, tol)
+top(x, tol = 50 * eps()) = abs(x[2] - 1) < tol
+rest_of_boundary(x, tol = 50 * eps()) = !top(x, tol)
is_on_boundary = Dict(:top => top, :rest_of_boundary => rest_of_boundary)
cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension; is_on_boundary)
function initial_condition_cavity(x, t, equations::CompressibleEulerEquations2D)
- Ma = 0.1
- rho = 1.0
- u, v = 0.0, 0.0
- p = 1.0 / (Ma^2 * equations.gamma)
- return prim2cons(SVector(rho, u, v, p), equations)
+ Ma = 0.1
+ rho = 1.0
+ u, v = 0.0, 0.0
+ p = 1.0 / (Ma^2 * equations.gamma)
+ return prim2cons(SVector(rho, u, v, p), equations)
end
initial_condition = initial_condition_cavity
@@ -43,15 +42,16 @@ boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity
# define inviscid boundary conditions
boundary_conditions = (; :top => boundary_condition_slip_wall,
- :rest_of_boundary => boundary_condition_slip_wall)
+ :rest_of_boundary => boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :top => boundary_condition_lid,
- :rest_of_boundary => boundary_condition_cavity)
-
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic))
+ :rest_of_boundary => boundary_condition_cavity)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -61,15 +61,15 @@ tspan = (0.0, 10.0)
ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl b/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl
index 3551c863ff2..f7120d8091b 100644
--- a/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl
+++ b/examples/dgmulti_2d/elixir_shallowwater_source_terms.jl
@@ -4,24 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the shallow water equations
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal)
-dg = DGMulti(polydeg=3, element_type = Quad(), approximation_type = SBP(),
+dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = SBP(),
surface_integral = SurfaceIntegralWeakForm(surface_flux),
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
cells_per_dimension = (8, 8)
mesh = DGMultiMesh(dg, cells_per_dimension,
- coordinates_min=(0.0, 0.0), coordinates_max=(sqrt(2), sqrt(2)),
- periodicity=true)
-
+ coordinates_min = (0.0, 0.0), coordinates_max = (sqrt(2), sqrt(2)),
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,8 +31,8 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -42,7 +41,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-7, reltol=1.0e-7,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-7, reltol = 1.0e-7,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl b/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl
index 4f43f2571a3..e877e602547 100644
--- a/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl
+++ b/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl
@@ -16,17 +16,15 @@ dg = DGMulti(element_type = Wedge(),
surface_flux = flux_lax_friedrichs,
polydeg = tensor_polydeg)
-
cells_per_dimension = (8, 8, 8)
-mesh = DGMultiMesh(dg,
+mesh = DGMultiMesh(dg,
cells_per_dimension,
- coordinates_min = (-1.0, -1.0, -1.0),
+ coordinates_min = (-1.0, -1.0, -1.0),
coordinates_max = (1.0, 1.0, 1.0),
periodicity = true)
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
- boundary_conditions=boundary_condition_periodic)
+ boundary_conditions = boundary_condition_periodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,20 +35,20 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.0)
-
-callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, stepsize_callback)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
+callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback,
+ stepsize_callback)
###############################################################################
# run the simulation
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0,
- save_everystep=false, callback=callbacks);
+ save_everystep = false, callback = callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_euler_curved.jl b/examples/dgmulti_3d/elixir_euler_curved.jl
index d8c4df5dd64..67c84b50974 100644
--- a/examples/dgmulti_3d/elixir_euler_curved.jl
+++ b/examples/dgmulti_3d/elixir_euler_curved.jl
@@ -1,7 +1,7 @@
using Trixi, OrdinaryDiffEq
-dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type=SBP(),
+dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = SBP(),
surface_integral = SurfaceIntegralWeakForm(flux_hll),
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))
@@ -10,22 +10,22 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
# example where we tag two separate boundary segments of the mesh
-top_boundary(x, tol=50*eps()) = abs(x[2] - 1) < tol
-rest_of_boundary(x, tol=50*eps()) = !top_boundary(x, tol)
+top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol
+rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol)
is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary)
function mapping(xi, eta, zeta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- z = zeta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return SVector(x, y, z)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ z = zeta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return SVector(x, y, z)
end
cells_per_dimension = (4, 4, 4)
-mesh = DGMultiMesh(dg, cells_per_dimension, mapping, is_on_boundary=is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension, mapping, is_on_boundary = is_on_boundary)
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
- :rest => boundary_condition_convergence_test)
+ :rest => boundary_condition_convergence_test)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
@@ -35,14 +35,14 @@ tspan = (0.0, 0.1)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl b/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl
index 35f7aee8795..0eb38674689 100644
--- a/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl
+++ b/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl
@@ -10,19 +10,20 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
solver = DGMulti(element_type = Hex(),
- approximation_type = periodic_derivative_operator(
- derivative_order=1, accuracy_order=4, xmin=0.0, xmax=1.0, N=20),
+ approximation_type = periodic_derivative_operator(derivative_order = 1,
+ accuracy_order = 4,
+ xmin = 0.0, xmax = 1.0,
+ N = 20),
surface_flux = flux_lax_friedrichs,
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
-mesh = DGMultiMesh(solver, coordinates_min=(-1.0, -1.0, -1.0),
- coordinates_max=( 1.0, 1.0, 1.0))
+mesh = DGMultiMesh(solver, coordinates_min = (-1.0, -1.0, -1.0),
+ coordinates_max = (1.0, 1.0, 1.0))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
- source_terms=source_terms)
-
+ source_terms = source_terms)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,14 +34,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(solver))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ uEltype = real(solver))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
diff --git a/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl b/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl
index 253d2486468..fea43ad4d26 100644
--- a/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl
+++ b/examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl
@@ -12,35 +12,38 @@ equations = CompressibleEulerEquations3D(1.4)
The classical inviscid Taylor-Green vortex.
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
- v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
- v3 = 0.0
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/16.0 * A^2 * rho * (cos(2*x[1])*cos(2*x[3]) + 2*cos(2*x[2]) + 2*cos(2*x[1]) + cos(2*x[2])*cos(2*x[3]))
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations3D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
+ v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
+ v3 = 0.0
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p +
+ 1.0 / 16.0 * A^2 * rho *
+ (cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
+ cos(2 * x[2]) * cos(2 * x[3]))
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
surface_flux = flux_lax_friedrichs
solver = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = Polynomial(),
- surface_integral= SurfaceIntegralWeakForm(surface_flux),
- volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
+ surface_integral = SurfaceIntegralWeakForm(surface_flux),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
cells_per_dimension = (8, 8, 8)
mesh = DGMultiMesh(solver, cells_per_dimension,
- coordinates_min=(-pi, -pi, -pi), coordinates_max=(pi, pi, pi),
- periodicity=true)
+ coordinates_min = (-pi, -pi, -pi), coordinates_max = (pi, pi, pi),
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -50,14 +53,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(solver))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ uEltype = real(solver))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
diff --git a/examples/dgmulti_3d/elixir_euler_weakform.jl b/examples/dgmulti_3d/elixir_euler_weakform.jl
index b167377af51..6e06b35c4f6 100644
--- a/examples/dgmulti_3d/elixir_euler_weakform.jl
+++ b/examples/dgmulti_3d/elixir_euler_weakform.jl
@@ -10,16 +10,16 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
# example where we tag two separate boundary segments of the mesh
-top_boundary(x, tol=50*eps()) = abs(x[2] - 1) < tol
-rest_of_boundary(x, tol=50*eps()) = !top_boundary(x, tol)
+top_boundary(x, tol = 50 * eps()) = abs(x[2] - 1) < tol
+rest_of_boundary(x, tol = 50 * eps()) = !top_boundary(x, tol)
is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary)
cells_per_dimension = (4, 4, 4)
-mesh = DGMultiMesh(dg, cells_per_dimension, is_on_boundary=is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension, is_on_boundary = is_on_boundary)
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
- :rest => boundary_condition_convergence_test)
+ :rest => boundary_condition_convergence_test)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
@@ -29,14 +29,14 @@ tspan = (0.0, 0.1)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl b/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl
index 6b17d4bba65..bc963a3a2fd 100644
--- a/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl
+++ b/examples/dgmulti_3d/elixir_euler_weakform_periodic.jl
@@ -10,7 +10,7 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
cells_per_dimension = (4, 4, 4)
-mesh = DGMultiMesh(dg, cells_per_dimension, periodicity=true)
+mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms)
@@ -19,14 +19,14 @@ tspan = (0.0, 0.1)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl
index 9a237b2d2fc..5fa0ad7ce60 100644
--- a/examples/dgmulti_3d/elixir_navierstokes_convergence.jl
+++ b/examples/dgmulti_3d/elixir_navierstokes_convergence.jl
@@ -8,219 +8,225 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(flux_lax_friedrichs),
volume_integral = VolumeIntegralWeakForm())
-top_bottom(x, tol=50*eps()) = abs(abs(x[2]) - 1) < tol
+top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol
is_on_boundary = Dict(:top_bottom => top_bottom)
cells_per_dimension = (8, 8, 8)
-mesh = DGMultiMesh(dg, cells_per_dimension; periodicity=(true, false, true), is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension; periodicity = (true, false, true),
+ is_on_boundary)
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion3D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion3D`)
# and by the initial condition (which passes in `CompressibleEulerEquations3D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t)
- v2 = v1
- v3 = v1
- p = rho^2
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) *
+ cos(pi_t)
+ v2 = v1
+ v3 = v1
+ p = rho^2
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- # Define auxiliary functions for the strange function of the y variable
- # to make expressions easier to read
- g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
- g_y = ( A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))
- + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0) )
- g_yy = ( 2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0)
- - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2)
- - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) )
-
- # Density and its derivatives
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
- rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
- rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
- rho_xx = -pi^2 * (rho - c)
- rho_yy = -pi^2 * (rho - c)
- rho_zz = -pi^2 * (rho - c)
-
- # Velocities and their derivatives
- # v1 terms
- v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
- v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_xx = -pi^2 * v1
- v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
- v1_zz = -pi^2 * v1
- v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
- # v2 terms (simplifies from ansatz)
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_z = v1_z
- v2_xx = v1_xx
- v2_yy = v1_yy
- v2_zz = v1_zz
- v2_xy = v1_xy
- v2_yz = v1_yz
- # v3 terms (simplifies from ansatz)
- v3 = v1
- v3_t = v1_t
- v3_x = v1_x
- v3_y = v1_y
- v3_z = v1_z
- v3_xx = v1_xx
- v3_yy = v1_yy
- v3_zz = v1_zz
- v3_xz = v1_xz
- v3_yz = v1_yz
-
- # Pressure and its derivatives
- p = rho^2
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_z = 2.0 * rho * rho_z
-
- # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
- E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
- E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
-
- # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
- kappa = equations.gamma * inv_gamma_minus_one / Pr
- q_xx = kappa * rho_xx # kappa T_xx
- q_yy = kappa * rho_yy # kappa T_yy
- q_zz = kappa * rho_zz # kappa T_zz
-
- # Stress tensor and its derivatives (exploit symmetry)
- tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
- tau12 = v1_y + v2_x
- tau13 = v1_z + v3_x
- tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
- tau23 = v2_z + v3_y
- tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
-
- tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
- tau12_x = v1_xy + v2_xx
- tau13_x = v1_xz + v3_xx
-
- tau12_y = v1_yy + v2_xy
- tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
- tau23_y = v2_yz + v3_yy
-
- tau13_z = v1_zz + v3_xz
- tau23_z = v2_zz + v3_yz
- tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
-
- # Compute the source terms
- # Density equation
- du1 = ( rho_t + rho_x * v1 + rho * v1_x
- + rho_y * v2 + rho * v2_y
- + rho_z * v3 + rho * v3_z )
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- + rho_z * v1 * v3
- + rho * v1_z * v3
- + rho * v1 * v3_z
- - mu_ * (tau11_x + tau12_y + tau13_z) )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- + rho_z * v2 * v3
- + rho * v2_z * v3
- + rho * v2 * v3_z
- - mu_ * (tau12_x + tau22_y + tau23_z) )
- # z-momentum equation
- du4 = ( rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
- + rho * v1_x * v3
- + rho * v1 * v3_x
- + rho_y * v2 * v3
- + rho * v2_y * v3
- + rho * v2 * v3_y
- + rho_z * v3^2
- + 2.0 * rho * v3 * v3_z
- - mu_ * (tau13_x + tau23_y + tau33_z) )
- # Total energy equation
- du5 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- + v3_z * (E + p) + v3 * (E_z + p_z)
- # stress tensor and temperature gradient from x-direction
- - mu_ * ( q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
- + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x)
- # stress tensor and temperature gradient terms from y-direction
- - mu_ * ( q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
- + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y)
- # stress tensor and temperature gradient terms from z-direction
- - mu_ * ( q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
- + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z) )
-
- return SVector(du1, du2, du3, du4, du5)
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ # Define auxiliary functions for the strange function of the y variable
+ # to make expressions easier to read
+ g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
+ g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) +
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0))
+ g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) -
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) -
+ A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)))
+
+ # Density and its derivatives
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
+ rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
+ rho_xx = -pi^2 * (rho - c)
+ rho_yy = -pi^2 * (rho - c)
+ rho_zz = -pi^2 * (rho - c)
+
+ # Velocities and their derivatives
+ # v1 terms
+ v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
+ v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_xx = -pi^2 * v1
+ v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
+ v1_zz = -pi^2 * v1
+ v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
+ # v2 terms (simplifies from ansatz)
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_z = v1_z
+ v2_xx = v1_xx
+ v2_yy = v1_yy
+ v2_zz = v1_zz
+ v2_xy = v1_xy
+ v2_yz = v1_yz
+ # v3 terms (simplifies from ansatz)
+ v3 = v1
+ v3_t = v1_t
+ v3_x = v1_x
+ v3_y = v1_y
+ v3_z = v1_z
+ v3_xx = v1_xx
+ v3_yy = v1_yy
+ v3_zz = v1_zz
+ v3_xz = v1_xz
+ v3_yz = v1_yz
+
+ # Pressure and its derivatives
+ p = rho^2
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_z = 2.0 * rho * rho_z
+
+ # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
+ E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
+ E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
+
+ # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
+ kappa = equations.gamma * inv_gamma_minus_one / Pr
+ q_xx = kappa * rho_xx # kappa T_xx
+ q_yy = kappa * rho_yy # kappa T_yy
+ q_zz = kappa * rho_zz # kappa T_zz
+
+ # Stress tensor and its derivatives (exploit symmetry)
+ tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
+ tau12 = v1_y + v2_x
+ tau13 = v1_z + v3_x
+ tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
+ tau23 = v2_z + v3_y
+ tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
+
+ tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
+ tau12_x = v1_xy + v2_xx
+ tau13_x = v1_xz + v3_xx
+
+ tau12_y = v1_yy + v2_xy
+ tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
+ tau23_y = v2_yz + v3_yy
+
+ tau13_z = v1_zz + v3_xz
+ tau23_z = v2_zz + v3_yz
+ tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
+
+ # Compute the source terms
+ # Density equation
+ du1 = (rho_t + rho_x * v1 + rho * v1_x
+ + rho_y * v2 + rho * v2_y
+ + rho_z * v3 + rho * v3_z)
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y
+ + rho_z * v1 * v3
+ + rho * v1_z * v3
+ + rho * v1 * v3_z -
+ mu_ * (tau11_x + tau12_y + tau13_z))
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y
+ + rho_z * v2 * v3
+ + rho * v2_z * v3
+ + rho * v2 * v3_z -
+ mu_ * (tau12_x + tau22_y + tau23_z))
+ # z-momentum equation
+ du4 = (rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
+ + rho * v1_x * v3
+ + rho * v1 * v3_x
+ + rho_y * v2 * v3
+ + rho * v2_y * v3
+ + rho * v2 * v3_y
+ + rho_z * v3^2
+ + 2.0 * rho * v3 * v3_z -
+ mu_ * (tau13_x + tau23_y + tau33_z))
+ # Total energy equation
+ du5 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y)
+ + v3_z * (E + p) + v3 * (E_z + p_z) -
+ # stress tensor and temperature gradient from x-direction
+ mu_ * (q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
+ + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x) -
+ # stress tensor and temperature gradient terms from y-direction
+ mu_ * (q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
+ + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y) -
+ # stress tensor and temperature gradient terms from z-direction
+ mu_ * (q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
+ + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z))
+
+ return SVector(du1, du2, du3, du4, du5)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2:4])
+velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2:4])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
@@ -228,10 +234,11 @@ boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
-
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -241,15 +248,15 @@ tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
index c14d6620803..c58d78d2581 100644
--- a/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
+++ b/examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
@@ -8,25 +8,27 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(flux_lax_friedrichs),
volume_integral = VolumeIntegralWeakForm())
-top_bottom(x, tol=50*eps()) = abs(abs(x[2]) - 1) < tol
+top_bottom(x, tol = 50 * eps()) = abs(abs(x[2]) - 1) < tol
is_on_boundary = Dict(:top_bottom => top_bottom)
function mapping(xi, eta, zeta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- z = zeta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return SVector(x, y, z)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ z = zeta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return SVector(x, y, z)
end
cells_per_dimension = (8, 8, 8)
-mesh = DGMultiMesh(dg, cells_per_dimension, mapping; periodicity=(true, false, true), is_on_boundary)
+mesh = DGMultiMesh(dg, cells_per_dimension, mapping; periodicity = (true, false, true),
+ is_on_boundary)
# This initial condition is taken from `examples/dgmulti_3d/elixir_navierstokes_convergence.jl`
@@ -35,200 +37,204 @@ mesh = DGMultiMesh(dg, cells_per_dimension, mapping; periodicity=(true, false, t
# and by the initial condition (which passes in `CompressibleEulerEquations3D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t)
- v2 = v1
- v3 = v1
- p = rho^2
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) *
+ cos(pi_t)
+ v2 = v1
+ v3 = v1
+ p = rho^2
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- # Define auxiliary functions for the strange function of the y variable
- # to make expressions easier to read
- g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
- g_y = ( A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))
- + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0) )
- g_yy = ( 2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0)
- - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2)
- - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) )
-
- # Density and its derivatives
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
- rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
- rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
- rho_xx = -pi^2 * (rho - c)
- rho_yy = -pi^2 * (rho - c)
- rho_zz = -pi^2 * (rho - c)
-
- # Velocities and their derivatives
- # v1 terms
- v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
- v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_xx = -pi^2 * v1
- v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
- v1_zz = -pi^2 * v1
- v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
- # v2 terms (simplifies from ansatz)
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_z = v1_z
- v2_xx = v1_xx
- v2_yy = v1_yy
- v2_zz = v1_zz
- v2_xy = v1_xy
- v2_yz = v1_yz
- # v3 terms (simplifies from ansatz)
- v3 = v1
- v3_t = v1_t
- v3_x = v1_x
- v3_y = v1_y
- v3_z = v1_z
- v3_xx = v1_xx
- v3_yy = v1_yy
- v3_zz = v1_zz
- v3_xz = v1_xz
- v3_yz = v1_yz
-
- # Pressure and its derivatives
- p = rho^2
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_z = 2.0 * rho * rho_z
-
- # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
- E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
- E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
-
- # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
- kappa = equations.gamma * inv_gamma_minus_one / Pr
- q_xx = kappa * rho_xx # kappa T_xx
- q_yy = kappa * rho_yy # kappa T_yy
- q_zz = kappa * rho_zz # kappa T_zz
-
- # Stress tensor and its derivatives (exploit symmetry)
- tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
- tau12 = v1_y + v2_x
- tau13 = v1_z + v3_x
- tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
- tau23 = v2_z + v3_y
- tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
-
- tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
- tau12_x = v1_xy + v2_xx
- tau13_x = v1_xz + v3_xx
-
- tau12_y = v1_yy + v2_xy
- tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
- tau23_y = v2_yz + v3_yy
-
- tau13_z = v1_zz + v3_xz
- tau23_z = v2_zz + v3_yz
- tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
-
- # Compute the source terms
- # Density equation
- du1 = ( rho_t + rho_x * v1 + rho * v1_x
- + rho_y * v2 + rho * v2_y
- + rho_z * v3 + rho * v3_z )
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- + rho_z * v1 * v3
- + rho * v1_z * v3
- + rho * v1 * v3_z
- - mu_ * (tau11_x + tau12_y + tau13_z) )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- + rho_z * v2 * v3
- + rho * v2_z * v3
- + rho * v2 * v3_z
- - mu_ * (tau12_x + tau22_y + tau23_z) )
- # z-momentum equation
- du4 = ( rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
- + rho * v1_x * v3
- + rho * v1 * v3_x
- + rho_y * v2 * v3
- + rho * v2_y * v3
- + rho * v2 * v3_y
- + rho_z * v3^2
- + 2.0 * rho * v3 * v3_z
- - mu_ * (tau13_x + tau23_y + tau33_z) )
- # Total energy equation
- du5 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- + v3_z * (E + p) + v3 * (E_z + p_z)
- # stress tensor and temperature gradient from x-direction
- - mu_ * ( q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
- + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x)
- # stress tensor and temperature gradient terms from y-direction
- - mu_ * ( q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
- + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y)
- # stress tensor and temperature gradient terms from z-direction
- - mu_ * ( q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
- + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z) )
-
- return SVector(du1, du2, du3, du4, du5)
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ # Define auxiliary functions for the strange function of the y variable
+ # to make expressions easier to read
+ g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
+ g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) +
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0))
+ g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) -
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) -
+ A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)))
+
+ # Density and its derivatives
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
+ rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
+ rho_xx = -pi^2 * (rho - c)
+ rho_yy = -pi^2 * (rho - c)
+ rho_zz = -pi^2 * (rho - c)
+
+ # Velocities and their derivatives
+ # v1 terms
+ v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
+ v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_xx = -pi^2 * v1
+ v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
+ v1_zz = -pi^2 * v1
+ v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
+ # v2 terms (simplifies from ansatz)
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_z = v1_z
+ v2_xx = v1_xx
+ v2_yy = v1_yy
+ v2_zz = v1_zz
+ v2_xy = v1_xy
+ v2_yz = v1_yz
+ # v3 terms (simplifies from ansatz)
+ v3 = v1
+ v3_t = v1_t
+ v3_x = v1_x
+ v3_y = v1_y
+ v3_z = v1_z
+ v3_xx = v1_xx
+ v3_yy = v1_yy
+ v3_zz = v1_zz
+ v3_xz = v1_xz
+ v3_yz = v1_yz
+
+ # Pressure and its derivatives
+ p = rho^2
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_z = 2.0 * rho * rho_z
+
+ # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
+ E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
+ E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
+
+ # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
+ kappa = equations.gamma * inv_gamma_minus_one / Pr
+ q_xx = kappa * rho_xx # kappa T_xx
+ q_yy = kappa * rho_yy # kappa T_yy
+ q_zz = kappa * rho_zz # kappa T_zz
+
+ # Stress tensor and its derivatives (exploit symmetry)
+ tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
+ tau12 = v1_y + v2_x
+ tau13 = v1_z + v3_x
+ tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
+ tau23 = v2_z + v3_y
+ tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
+
+ tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
+ tau12_x = v1_xy + v2_xx
+ tau13_x = v1_xz + v3_xx
+
+ tau12_y = v1_yy + v2_xy
+ tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
+ tau23_y = v2_yz + v3_yy
+
+ tau13_z = v1_zz + v3_xz
+ tau23_z = v2_zz + v3_yz
+ tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
+
+ # Compute the source terms
+ # Density equation
+ du1 = (rho_t + rho_x * v1 + rho * v1_x
+ + rho_y * v2 + rho * v2_y
+ + rho_z * v3 + rho * v3_z)
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y
+ + rho_z * v1 * v3
+ + rho * v1_z * v3
+ + rho * v1 * v3_z -
+ mu_ * (tau11_x + tau12_y + tau13_z))
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y
+ + rho_z * v2 * v3
+ + rho * v2_z * v3
+ + rho * v2 * v3_z -
+ mu_ * (tau12_x + tau22_y + tau23_z))
+ # z-momentum equation
+ du4 = (rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
+ + rho * v1_x * v3
+ + rho * v1 * v3_x
+ + rho_y * v2 * v3
+ + rho * v2_y * v3
+ + rho * v2 * v3_y
+ + rho_z * v3^2
+ + 2.0 * rho * v3 * v3_z -
+ mu_ * (tau13_x + tau23_y + tau33_z))
+ # Total energy equation
+ du5 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y)
+ + v3_z * (E + p) + v3 * (E_z + p_z) -
+ # stress tensor and temperature gradient from x-direction
+ mu_ * (q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
+ + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x) -
+ # stress tensor and temperature gradient terms from y-direction
+ mu_ * (q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
+ + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y) -
+ # stress tensor and temperature gradient terms from z-direction
+ mu_ * (q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
+ + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z))
+
+ return SVector(du1, du2, du3, du4, du5)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2:4])
+velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2:4])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
@@ -236,10 +242,11 @@ boundary_conditions = (; :top_bottom => boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; :top_bottom => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, dg;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
-
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, dg;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -249,15 +256,15 @@ tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl b/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl
index 7953838afeb..dedd8267a3b 100644
--- a/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl
+++ b/examples/dgmulti_3d/elixir_navierstokes_taylor_green_vortex.jl
@@ -10,26 +10,30 @@ prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number())
"""
initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
The classical inviscid Taylor-Green vortex.
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
- v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
- v3 = 0.0
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/16.0 * A^2 * rho * (cos(2*x[1])*cos(2*x[3]) + 2*cos(2*x[2]) + 2*cos(2*x[1]) + cos(2*x[2])*cos(2*x[3]))
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations3D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
+ v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
+ v3 = 0.0
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p +
+ 1.0 / 16.0 * A^2 * rho *
+ (cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
+ cos(2 * x[2]) * cos(2 * x[3]))
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
@@ -39,11 +43,11 @@ dg = DGMulti(polydeg = 3, element_type = Hex(), approximation_type = GaussSBP(),
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))
coordinates_min = (-1.0, -1.0, -1.0) .* pi
-coordinates_max = ( 1.0, 1.0, 1.0) .* pi
+coordinates_max = (1.0, 1.0, 1.0) .* pi
cells_per_dimension = (8, 8, 8)
mesh = DGMultiMesh(dg, cells_per_dimension;
coordinates_min, coordinates_max,
- periodicity=(true, true, true))
+ periodicity = (true, true, true))
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, dg)
@@ -55,18 +59,18 @@ tspan = (0.0, 10.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg),
- extra_analysis_integrals=(energy_kinetic,
- energy_internal,
- enstrophy))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg),
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal,
+ enstrophy))
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl
index 841a080947e..5a2537be4e6 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_amr_solution_independent.jl
@@ -7,74 +7,73 @@ module TrixiExtension
using Trixi
-struct IndicatorSolutionIndependent{Cache<:NamedTuple} <: Trixi.AbstractIndicator
- cache::Cache
+struct IndicatorSolutionIndependent{Cache <: NamedTuple} <: Trixi.AbstractIndicator
+ cache::Cache
end
function IndicatorSolutionIndependent(semi)
- basis = semi.solver.basis
- alpha = Vector{real(basis)}()
- cache = (; semi.mesh, alpha)
- return IndicatorSolutionIndependent{typeof(cache)}(cache)
+ basis = semi.solver.basis
+ alpha = Vector{real(basis)}()
+ cache = (; semi.mesh, alpha)
+ return IndicatorSolutionIndependent{typeof(cache)}(cache)
end
-function (indicator::IndicatorSolutionIndependent)(u::AbstractArray{<:Any,4},
+function (indicator::IndicatorSolutionIndependent)(u::AbstractArray{<:Any, 4},
mesh, equations, dg, cache;
t, kwargs...)
-
- mesh = indicator.cache.mesh
- alpha = indicator.cache.alpha
- resize!(alpha, nelements(dg, cache))
-
- #Predict the theoretical center.
- advection_velocity = (0.2, -0.7)
- center = t.*advection_velocity
-
- inner_distance = 1
- outer_distance = 1.85
-
- #Iterate over all elements
- for element in 1:length(alpha)
- # Calculate periodic distance between cell and center.
- # This requires an uncurved mesh!
- coordinates = SVector(0.5 * (cache.elements.node_coordinates[1, 1, 1, element] +
- cache.elements.node_coordinates[1, end, 1, element]),
- 0.5 * (cache.elements.node_coordinates[2, 1, 1, element] +
- cache.elements.node_coordinates[2, 1, end, element]))
-
- #The geometric shape of the amr should be preserved when the base_level is increased.
- #This is done by looking at the original coordinates of each cell.
- cell_coordinates = original_coordinates(coordinates, 5/8)
- cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
- if cell_distance < (inner_distance+outer_distance)/2
- cell_coordinates = original_coordinates(coordinates, 5/16)
- cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
+ mesh = indicator.cache.mesh
+ alpha = indicator.cache.alpha
+ resize!(alpha, nelements(dg, cache))
+
+ #Predict the theoretical center.
+ advection_velocity = (0.2, -0.7)
+ center = t .* advection_velocity
+
+ inner_distance = 1
+ outer_distance = 1.85
+
+ #Iterate over all elements
+ for element in 1:length(alpha)
+ # Calculate periodic distance between cell and center.
+ # This requires an uncurved mesh!
+ coordinates = SVector(0.5 * (cache.elements.node_coordinates[1, 1, 1, element] +
+ cache.elements.node_coordinates[1, end, 1, element]),
+ 0.5 * (cache.elements.node_coordinates[2, 1, 1, element] +
+ cache.elements.node_coordinates[2, 1, end, element]))
+
+ #The geometric shape of the amr should be preserved when the base_level is increased.
+ #This is done by looking at the original coordinates of each cell.
+ cell_coordinates = original_coordinates(coordinates, 5 / 8)
+ cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
+ if cell_distance < (inner_distance + outer_distance) / 2
+ cell_coordinates = original_coordinates(coordinates, 5 / 16)
+ cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
+ end
+
+ #Set alpha according to cells position inside the circles.
+ target_level = (cell_distance < inner_distance) + (cell_distance < outer_distance)
+ alpha[element] = target_level / 2
end
-
- #Set alpha according to cells position inside the circles.
- target_level = (cell_distance < inner_distance) + (cell_distance < outer_distance)
- alpha[element] = target_level/2
- end
- return alpha
+ return alpha
end
# For periodic domains, distance between two points must take into account
# periodic extensions of the domain
function periodic_distance_2d(coordinates, center, domain_length)
- dx = coordinates .- center
- dx_shifted = abs.(dx .% domain_length)
- dx_periodic = min.(dx_shifted, domain_length .- dx_shifted)
- return sqrt(sum(dx_periodic.^2))
+ dx = coordinates .- center
+ dx_shifted = abs.(dx .% domain_length)
+ dx_periodic = min.(dx_shifted, domain_length .- dx_shifted)
+ return sqrt(sum(dx_periodic .^ 2))
end
#This takes a cells coordinates and transforms them into the coordinates of a parent-cell it originally refined from.
#It does it so that the parent-cell has given cell_length.
function original_coordinates(coordinates, cell_length)
- offset = coordinates .% cell_length
- offset_sign = sign.(offset)
- border = coordinates - offset
- center = border + (offset_sign .* cell_length/2)
- return center
+ offset = coordinates .% cell_length
+ offset_sign = sign.(offset)
+ border = coordinates - offset
+ center = border + (offset_sign .* cell_length / 2)
+ return center
end
end # module TrixiExtension
@@ -88,21 +87,19 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
trees_per_dimension = (1, 1)
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=4)
-
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 4)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -112,38 +109,38 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, TrixiExtension.IndicatorSolutionIndependent(semi),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi,
+ TrixiExtension.IndicatorSolutionIndependent(semi),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl b/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl
index 7e6d99c83b1..0a50b3644f0 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_amr_unstructured_flag.jl
@@ -12,18 +12,16 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :all => boundary_condition
-)
+boundary_conditions = Dict(:all => boundary_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-5.0, 5 * s - 5.0)
-f2(s) = SVector( 5.0, 5 * s + 5.0)
+f2(s) = SVector(5.0, 5 * s + 5.0)
f3(s) = SVector(5 * s, -5.0 + 5 * sin(0.5 * pi * s))
-f4(s) = SVector(5 * s, 5.0 + 5 * sin(0.5 * pi * s))
+f4(s) = SVector(5 * s, 5.0 + 5 * sin(0.5 * pi * s))
faces = (f1, f2, f3, f4)
# This creates a mapping that transforms [-1, 1]^2 to the domain with the faces defined above.
@@ -34,17 +32,16 @@ mapping_flag = Trixi.transfinite_mapping(faces)
# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
- mesh_file)
-
-mesh = P4estMesh{2}(mesh_file, polydeg=3,
- mapping=mapping_flag,
- initial_refinement_level=1)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
+ mesh_file)
+mesh = P4estMesh{2}(mesh_file, polydeg = 3,
+ mapping = mapping_flag,
+ initial_refinement_level = 1)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -55,41 +52,40 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=1,
- med_level=2, med_threshold=0.1,
- max_level=3, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 1,
+ med_level = 2, med_threshold = 0.1,
+ max_level = 3, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.7)
+stepsize_callback = StepsizeCallback(cfl = 0.7)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_advection_basic.jl b/examples/p4est_2d_dgsem/elixir_advection_basic.jl
index 0b2de85da48..ed235bf839c 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_basic.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_basic.jl
@@ -11,21 +11,21 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
trees_per_dimension = (8, 8)
# Create P4estMesh with 8 x 8 trees and 16 x 16 elements
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=1)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 1)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -38,26 +38,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl
index 55682f73fce..5497f13aa65 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_nonperiodic_curved.jl
@@ -16,15 +16,15 @@ equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
# to numerical partial differential equations.
# [DOI](https://doi.org/10.1007/978-3-319-41640-3_6).
function initial_condition_eriksson_johnson(x, t, equations)
- l = 4
- epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt
- lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
- cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
- return SVector{1}(u)
+ l = 4
+ epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt
+ lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
+ cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
+ return SVector{1}(u)
end
initial_condition = initial_condition_eriksson_johnson
@@ -33,34 +33,35 @@ boundary_conditions = Dict(:x_neg => BoundaryConditionDirichlet(initial_conditio
:y_pos => BoundaryConditionDirichlet(initial_condition),
:x_pos => boundary_condition_do_nothing)
-boundary_conditions_parabolic = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition),
- :x_pos => BoundaryConditionDirichlet(initial_condition),
- :y_neg => BoundaryConditionDirichlet(initial_condition),
+boundary_conditions_parabolic = Dict(:x_neg => BoundaryConditionDirichlet(initial_condition),
+ :x_pos => BoundaryConditionDirichlet(initial_condition),
+ :y_neg => BoundaryConditionDirichlet(initial_condition),
:y_pos => BoundaryConditionDirichlet(initial_condition))
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
-coordinates_min = (-1.0, -0.5)
-coordinates_max = ( 0.0, 0.5)
+coordinates_min = (-1.0, -0.5)
+coordinates_max = (0.0, 0.5)
# This maps the domain [-1, 1]^2 to [-1, 0] x [-0.5, 0.5] while also
# introducing a curved warping to interior nodes.
function mapping(xi, eta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
return SVector(0.5 * (1 + x) - 1, 0.5 * y)
-end
+end
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- mapping=mapping, periodicity=(false, false))
+ polydeg = 3, initial_refinement_level = 2,
+ mapping = mapping, periodicity = (false, false))
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver,
- boundary_conditions = (boundary_conditions, boundary_conditions_parabolic))
-
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver,
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -75,22 +76,21 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
time_int_tol = 1.0e-11
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl
index 1cd075e84ea..0b5129e3c0f 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic.jl
@@ -9,19 +9,21 @@ advection_velocity = (1.0, 0.0)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
-function x_trans_periodic(x, domain_length=SVector(2 * pi), center=SVector(0.0))
+function x_trans_periodic(x, domain_length = SVector(2 * pi), center = SVector(0.0))
x_normalized = x .- center
x_shifted = x_normalized .% domain_length
- x_offset = ((x_shifted .< -0.5 * domain_length) - (x_shifted .> 0.5 * domain_length)) .* domain_length
+ x_offset = ((x_shifted .< -0.5 * domain_length) - (x_shifted .> 0.5 * domain_length)) .*
+ domain_length
return center + x_shifted + x_offset
end
# Define initial condition (copied from "examples/tree_1d_dgsem/elixir_advection_diffusion.jl")
-function initial_condition_diffusive_convergence_test(x, t, equation::LinearScalarAdvectionEquation2D)
+function initial_condition_diffusive_convergence_test(x, t,
+ equation::LinearScalarAdvectionEquation2D)
# Store translated coordinate for easy use of exact solution
# Assumes that advection_velocity[2] = 0 (effectively that we are solving a 1D equation)
x_trans = x_trans_periodic(x[1] - equation.advection_velocity[1] * t)
-
+
nu = diffusivity()
c = 0.0
A = 1.0
@@ -32,23 +34,22 @@ end
initial_condition = initial_condition_diffusive_convergence_test
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-pi, -pi) # minimum coordinates (min(x), min(y))
-coordinates_max = ( pi, pi) # maximum coordinates (max(x), max(y))
+coordinates_max = (pi, pi) # maximum coordinates (max(x), max(y))
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=true)
+ polydeg = 3, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = true)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolicParabolic(mesh,
(equations, equations_parabolic),
initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -62,22 +63,21 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
time_int_tol = 1.0e-11
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl
index b438fb8a29c..130def37997 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_diffusion_periodic_curved.jl
@@ -9,19 +9,21 @@ advection_velocity = (1.0, 0.0)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
-function x_trans_periodic(x, domain_length=SVector(2 * pi), center=SVector(0.0))
+function x_trans_periodic(x, domain_length = SVector(2 * pi), center = SVector(0.0))
x_normalized = x .- center
x_shifted = x_normalized .% domain_length
- x_offset = ((x_shifted .< -0.5 * domain_length) - (x_shifted .> 0.5 * domain_length)) .* domain_length
+ x_offset = ((x_shifted .< -0.5 * domain_length) - (x_shifted .> 0.5 * domain_length)) .*
+ domain_length
return center + x_shifted + x_offset
end
# Define initial condition (copied from "examples/tree_1d_dgsem/elixir_advection_diffusion.jl")
-function initial_condition_diffusive_convergence_test(x, t, equation::LinearScalarAdvectionEquation2D)
+function initial_condition_diffusive_convergence_test(x, t,
+ equation::LinearScalarAdvectionEquation2D)
# Store translated coordinate for easy use of exact solution
# Assumes that advection_velocity[2] = 0 (effectively that we are solving a 1D equation)
x_trans = x_trans_periodic(x[1] - equation.advection_velocity[1] * t)
-
+
nu = diffusivity()
c = 0.0
A = 1.0
@@ -32,28 +34,27 @@ end
initial_condition = initial_condition_diffusive_convergence_test
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# This maps the domain [-1, 1]^2 to [-pi, pi]^2 while also
# introducing a curved warping to interior nodes.
function mapping(xi, eta)
- x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
- y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
- return pi * SVector(x, y)
+ x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
+ y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
+ return pi * SVector(x, y)
end
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- mapping=mapping,
- periodicity=true)
+ polydeg = 3, initial_refinement_level = 2,
+ mapping = mapping,
+ periodicity = true)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolicParabolic(mesh,
(equations, equations_parabolic),
initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,22 +68,21 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
time_int_tol = 1.0e-11
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_advection_extended.jl b/examples/p4est_2d_dgsem/elixir_advection_extended.jl
index 6d8e7030ac0..66a5b7e0f5b 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_extended.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_extended.jl
@@ -12,31 +12,28 @@ initial_condition = initial_condition_convergence_test
# BCs must be passed as Dict
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :x_neg => boundary_condition,
- :x_pos => boundary_condition,
- :y_neg => boundary_condition,
- :y_pos => boundary_condition
-)
+boundary_conditions = Dict(:x_neg => boundary_condition,
+ :x_pos => boundary_condition,
+ :y_neg => boundary_condition,
+ :y_pos => boundary_condition)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# The initial condition is 2-periodic
coordinates_min = (-1.5, 1.3) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 0.5, 5.3) # maximum coordinates (max(x), max(y))
+coordinates_max = (0.5, 5.3) # maximum coordinates (max(x), max(y))
trees_per_dimension = (19, 37)
# Create curved mesh with 19 x 37 elements
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=false)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = false)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -51,24 +48,24 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback,
@@ -76,14 +73,13 @@ callbacks = CallbackSet(summary_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl b/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl
index 0e6e314ebd7..b47b0d61192 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_nonconforming_flag.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the linear advection equation
@@ -10,42 +9,44 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 4 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
# Create P4estMesh with 3 x 2 trees and 6 x 4 elements,
# approximate the geometry with a smaller polydeg for testing.
trees_per_dimension = (3, 2)
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- faces=(f1, f2, f3, f4),
- initial_refinement_level=1)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ faces = (f1, f2, f3, f4),
+ initial_refinement_level = 1)
# Refine bottom left quadrant of each tree to level 4
function refine_fn(p4est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 4
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 4
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of a tree has level 4
# The mesh will be rebalanced before the simulation starts
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p4est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p4est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -58,26 +59,26 @@ ode = semidiscretize(semi, (0.0, 0.2));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_advection_restart.jl b/examples/p4est_2d_dgsem/elixir_advection_restart.jl
index 52917616a6a..4f43e122ab3 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_restart.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_restart.jl
@@ -10,7 +10,6 @@ restart_file = "restart_000021.h5"
trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file))
-
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -21,7 +20,7 @@ restart_filename = joinpath("out", restart_file)
mesh = load_mesh(restart_filename)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
tspan = (load_time(restart_filename), 2.0)
dt = load_dt(restart_filename)
@@ -30,14 +29,13 @@ ode = semidiscretize(semi, tspan, restart_filename);
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
-integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Get the last time index and work with that.
load_timestep!(integrator, restart_filename)
-
###############################################################################
# run the simulation
diff --git a/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl b/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl
index 9f5b813639f..37fcc547f60 100644
--- a/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl
+++ b/examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl
@@ -3,7 +3,6 @@ using Downloads: download
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the linear advection equation
@@ -13,19 +12,17 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_convergence_test
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :all => boundary_condition
-)
+boundary_conditions = Dict(:all => boundary_condition)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
faces = (f1, f2, f3, f4)
Trixi.validate_faces(faces)
@@ -33,16 +30,17 @@ mapping_flag = Trixi.transfinite_mapping(faces)
# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
+ mesh_file)
-mesh = P4estMesh{2}(mesh_file, polydeg=3,
- mapping=mapping_flag,
- initial_refinement_level=2)
+mesh = P4estMesh{2}(mesh_file, polydeg = 3,
+ mapping = mapping_flag,
+ initial_refinement_level = 2)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -56,26 +54,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.4)
+stepsize_callback = StepsizeCallback(cfl = 1.4)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl
index e3f33fb0d28..0ca4fdc2eb7 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl
@@ -17,49 +17,48 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Unstructured mesh with 48 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_1.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
+ mesh_file)
-mesh = P4estMesh{2}(mesh_file, polydeg=3, initial_refinement_level=1)
+mesh = P4estMesh{2}(mesh_file, polydeg = 3, initial_refinement_level = 1)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=Dict(
- :all => BoundaryConditionDirichlet(initial_condition)
- ))
+ boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)))
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,40 +69,39 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=1,
- max_level =3, max_threshold=0.01)
+ base_level = 1,
+ max_level = 3, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl
index 70a0e10c296..92928146d7b 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl
@@ -21,64 +21,66 @@ See Section IV c on the paper below for details.
The Numerical Simulation of Two-Dimensional Fluid Flows with Strong Shocks.
[DOI: 10.1016/0021-9991(84)90142-6](https://doi.org/10.1016/0021-9991(84)90142-6)
"""
-@inline function initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D)
-
- if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3)
- phi = pi / 6
- sin_phi, cos_phi = sincos(phi)
-
- rho = 8.0
- v1 = 8.25 * cos_phi
- v2 = -8.25 * sin_phi
- p = 116.5
- else
- rho = 1.4
- v1 = 0.0
- v2 = 0.0
- p = 1.0
- end
-
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+@inline function initial_condition_double_mach_reflection(x, t,
+ equations::CompressibleEulerEquations2D)
+ if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3)
+ phi = pi / 6
+ sin_phi, cos_phi = sincos(phi)
+
+ rho = 8.0
+ v1 = 8.25 * cos_phi
+ v2 = -8.25 * sin_phi
+ p = 116.5
+ else
+ rho = 1.4
+ v1 = 0.0
+ v2 = 0.0
+ p = 1.0
+ end
+
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_double_mach_reflection
-
boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_double_mach_reflection)
# Supersonic outflow boundary condition. Solution is taken entirely from the internal state.
# See `examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl` for complete documentation.
@inline function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x, t,
- surface_flux_function, equations::CompressibleEulerEquations2D)
- # NOTE: Only for the supersonic outflow is this strategy valid
- # Calculate the boundary flux entirely from the internal solution state
- return flux(u_inner, normal_direction, equations)
+ surface_flux_function,
+ equations::CompressibleEulerEquations2D)
+ # NOTE: Only for the supersonic outflow is this strategy valid
+ # Calculate the boundary flux entirely from the internal solution state
+ return flux(u_inner, normal_direction, equations)
end
# Special mixed boundary condition type for the :Bottom of the domain.
# It is Dirichlet when x < 1/6 and a slip wall when x >= 1/6
-@inline function boundary_condition_mixed_dirichlet_wall(u_inner, normal_direction::AbstractVector,
+@inline function boundary_condition_mixed_dirichlet_wall(u_inner,
+ normal_direction::AbstractVector,
x, t, surface_flux_function,
equations::CompressibleEulerEquations2D)
- if x[1] < 1 / 6
- # From the BoundaryConditionDirichlet
- # get the external value of the solution
- u_boundary = initial_condition_double_mach_reflection(x, t, equations)
- # Calculate boundary flux
- flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)
- else # x[1] >= 1 / 6
- # Use the free slip wall BC otherwise
- flux = boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function, equations)
- end
-
- return flux
+ if x[1] < 1 / 6
+ # From the BoundaryConditionDirichlet
+ # get the external value of the solution
+ u_boundary = initial_condition_double_mach_reflection(x, t, equations)
+ # Calculate boundary flux
+ flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)
+ else # x[1] >= 1 / 6
+ # Use the free slip wall BC otherwise
+ flux = boundary_condition_slip_wall(u_inner, normal_direction, x, t,
+ surface_flux_function, equations)
+ end
+
+ return flux
end
-boundary_conditions = Dict( :Bottom => boundary_condition_mixed_dirichlet_wall,
- :Top => boundary_condition_inflow,
- :Right => boundary_condition_outflow,
- :Left => boundary_condition_inflow )
+boundary_conditions = Dict(:Bottom => boundary_condition_mixed_dirichlet_wall,
+ :Top => boundary_condition_inflow,
+ :Right => boundary_condition_outflow,
+ :Left => boundary_condition_inflow)
volume_flux = flux_ranocha
surface_flux = flux_lax_friedrichs
@@ -86,25 +88,27 @@ surface_flux = flux_lax_friedrichs
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
shock_indicator = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(shock_indicator;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_double_mach.inp")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/a0806ef0d03cf5ea221af523167b6e32/raw/61ed0eb017eb432d996ed119a52fb041fe363e8c/abaqus_double_mach.inp",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/a0806ef0d03cf5ea221af523167b6e32/raw/61ed0eb017eb432d996ed119a52fb041fe363e8c/abaqus_double_mach.inp",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = P4estMesh{2}(mesh_file)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -115,27 +119,27 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_indicator = IndicatorLöhner(semi, variable=Trixi.density)
+amr_indicator = IndicatorLöhner(semi, variable = Trixi.density)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=0,
- med_level=3, med_threshold=0.05,
- max_level=6, max_threshold=0.1)
+ base_level = 0,
+ med_level = 3, med_threshold = 0.05,
+ max_level = 6, max_threshold = 0.1)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -143,11 +147,11 @@ callbacks = CallbackSet(summary_callback,
amr_callback)
# positivity limiter necessary for this example with strong shocks
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl
index 667834ea108..0ec9fc222f2 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl
@@ -20,19 +20,18 @@ See Section IV b on the paper below for details.
[DOI: 10.1016/0021-9991(84)90142-6](https://doi.org/10.1016/0021-9991(84)90142-6)
"""
@inline function initial_condition_mach3_flow(x, t, equations::CompressibleEulerEquations2D)
- # set the freestream flow parameters
- rho_freestream = 1.4
- v1 = 3.0
- v2 = 0.0
- p_freestream = 1.0
-
- prim = SVector(rho_freestream, v1, v2, p_freestream)
- return prim2cons(prim, equations)
+ # set the freestream flow parameters
+ rho_freestream = 1.4
+ v1 = 3.0
+ v2 = 0.0
+ p_freestream = 1.0
+
+ prim = SVector(rho_freestream, v1, v2, p_freestream)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_mach3_flow
-
boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_mach3_flow)
# Outflow boundary condition.
@@ -46,46 +45,47 @@ boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_mach3_f
# Inflow/Outflow Boundary Conditions with Application to FUN3D.
# [NASA TM 20110022658](https://ntrs.nasa.gov/citations/20110022658)
@inline function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x, t,
- surface_flux_function, equations::CompressibleEulerEquations2D)
- # # This would be for the general case where we need to check the magnitude of the local Mach number
- # norm_ = norm(normal_direction)
- # # Normalize the vector without using `normalize` since we need to multiply by the `norm_` later
- # normal = normal_direction / norm_
-
- # # Rotate the internal solution state
- # u_local = Trixi.rotate_to_x(u_inner, normal, equations)
-
- # # Compute the primitive variables
- # rho_local, v_normal, v_tangent, p_local = cons2prim(u_local, equations)
-
- # # Compute local Mach number
- # a_local = sqrt( equations.gamma * p_local / rho_local )
- # Mach_local = abs( v_normal / a_local )
- # if Mach_local <= 1.0
- # p_local = # Set to the external reference pressure value (somehow? maybe stored in `equations`)
- # end
-
- # # Create the `u_surface` solution state where the local pressure is possibly set from an external value
- # prim = SVector(rho_local, v_normal, v_tangent, p_local)
- # u_boundary = prim2cons(prim, equations)
- # u_surface = Trixi.rotate_from_x(u_boundary, normal, equations)
-
- # Compute the flux using the appropriate mixture of internal / external solution states
- # flux = Trixi.flux(u_surface, normal_direction, equations)
-
- # NOTE: Only for the supersonic outflow is this strategy valid
- # Calculate the boundary flux entirely from the internal solution state
- flux = Trixi.flux(u_inner, normal_direction, equations)
-
- return flux
+ surface_flux_function,
+ equations::CompressibleEulerEquations2D)
+ # # This would be for the general case where we need to check the magnitude of the local Mach number
+ # norm_ = norm(normal_direction)
+ # # Normalize the vector without using `normalize` since we need to multiply by the `norm_` later
+ # normal = normal_direction / norm_
+
+ # # Rotate the internal solution state
+ # u_local = Trixi.rotate_to_x(u_inner, normal, equations)
+
+ # # Compute the primitive variables
+ # rho_local, v_normal, v_tangent, p_local = cons2prim(u_local, equations)
+
+ # # Compute local Mach number
+ # a_local = sqrt( equations.gamma * p_local / rho_local )
+ # Mach_local = abs( v_normal / a_local )
+ # if Mach_local <= 1.0
+ # p_local = # Set to the external reference pressure value (somehow? maybe stored in `equations`)
+ # end
+
+ # # Create the `u_surface` solution state where the local pressure is possibly set from an external value
+ # prim = SVector(rho_local, v_normal, v_tangent, p_local)
+ # u_boundary = prim2cons(prim, equations)
+ # u_surface = Trixi.rotate_from_x(u_boundary, normal, equations)
+
+ # Compute the flux using the appropriate mixture of internal / external solution states
+ # flux = Trixi.flux(u_surface, normal_direction, equations)
+
+ # NOTE: Only for the supersonic outflow is this strategy valid
+ # Calculate the boundary flux entirely from the internal solution state
+ flux = Trixi.flux(u_inner, normal_direction, equations)
+
+ return flux
end
-boundary_conditions = Dict( :Bottom => boundary_condition_slip_wall,
- :Step_Front => boundary_condition_slip_wall,
- :Step_Top => boundary_condition_slip_wall,
- :Top => boundary_condition_slip_wall,
- :Right => boundary_condition_outflow,
- :Left => boundary_condition_inflow )
+boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall,
+ :Step_Front => boundary_condition_slip_wall,
+ :Step_Top => boundary_condition_slip_wall,
+ :Top => boundary_condition_slip_wall,
+ :Right => boundary_condition_outflow,
+ :Left => boundary_condition_inflow)
volume_flux = flux_ranocha
surface_flux = flux_lax_friedrichs
@@ -93,25 +93,27 @@ surface_flux = flux_lax_friedrichs
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
shock_indicator = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(shock_indicator;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_forward_step.inp")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/b346ee6aa5446687f128eab8b37d52a7/raw/cd1e1d43bebd8d2631a07caec45585ec8456ca4c/abaqus_forward_step.inp",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/b346ee6aa5446687f128eab8b37d52a7/raw/cd1e1d43bebd8d2631a07caec45585ec8456ca4c/abaqus_forward_step.inp",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = P4estMesh{2}(mesh_file)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -122,27 +124,27 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=2000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 2000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_indicator = IndicatorLöhner(semi, variable=Trixi.density)
+amr_indicator = IndicatorLöhner(semi, variable = Trixi.density)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=0,
- med_level=2, med_threshold=0.05,
- max_level=5, max_threshold=0.1)
+ base_level = 0,
+ med_level = 2, med_threshold = 0.05,
+ max_level = 5, max_threshold = 0.1)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -150,12 +152,12 @@ callbacks = CallbackSet(summary_callback,
amr_callback)
# positivity limiter necessary for this example with strong shocks
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43(stage_limiter!);
- maxiters=999999, ode_default_options()...,
- callback=callbacks);
+ maxiters = 999999, ode_default_options()...,
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl b/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl
index e88baa2223d..38307a7d781 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_free_stream.jl
@@ -10,21 +10,21 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_constant
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Mapping as described in https://arxiv.org/abs/2012.12040 but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
###############################################################################
@@ -32,34 +32,34 @@ end
# Unstructured mesh with 48 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_1.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
+ mesh_file)
# Map the unstructured mesh with the mapping above
-mesh = P4estMesh{2}(mesh_file, polydeg=3, mapping=mapping, initial_refinement_level=1)
+mesh = P4estMesh{2}(mesh_file, polydeg = 3, mapping = mapping, initial_refinement_level = 1)
# Refine bottom left quadrant of each tree to level 2
function refine_fn(p4est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 3
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 3
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of a tree has level 2.
# The mesh will be rebalanced before the simulation starts.
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p4est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p4est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=Dict(
- :all => BoundaryConditionDirichlet(initial_condition)
- ))
-
+ boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition)))
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,16 +70,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=2.0)
+stepsize_callback = StepsizeCallback(cfl = 2.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -89,7 +89,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl
index d5d8e0c78bf..539ddb45395 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_sedov.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_sedov.jl
@@ -14,25 +14,25 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
@@ -43,26 +43,27 @@ volume_flux = flux_ranocha
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
###############################################################################
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=4, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=true)
+ polydeg = 4, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -75,15 +76,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 300
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=300,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 300,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -94,7 +95,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl b/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl
index 6ef551c486f..0cb18526f8d 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec.jl
@@ -14,30 +14,30 @@ volume_flux = flux_ranocha
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
###############################################################################
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=4, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=true)
+ polydeg = 4, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -47,16 +47,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -66,7 +66,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl b/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl
index d9a322b065a..09d018309a6 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl
@@ -14,18 +14,16 @@ source_terms = source_terms_convergence_test
# BCs must be passed as Dict
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :all => boundary_condition
-)
+boundary_conditions = Dict(:all => boundary_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
faces = (f1, f2, f3, f4)
Trixi.validate_faces(faces)
@@ -34,34 +32,36 @@ mapping_flag = Trixi.transfinite_mapping(faces)
# Get the uncurved mesh from a file (downloads the file if not available locally)
# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
+ mesh_file)
-mesh = P4estMesh{2}(mesh_file, polydeg=3,
- mapping=mapping_flag,
- initial_refinement_level=1)
+mesh = P4estMesh{2}(mesh_file, polydeg = 3,
+ mapping = mapping_flag,
+ initial_refinement_level = 1)
# Refine bottom left quadrant of each tree to level 2
function refine_fn(p4est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 2
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 2
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of a tree has level 2
# The mesh will be rebalanced before the simulation starts
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p4est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p4est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -72,19 +72,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -93,7 +93,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl
index 366be700f9f..36c5624ba97 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl
@@ -23,14 +23,14 @@ using Trixi
equations = CompressibleEulerEquations2D(1.4)
@inline function initial_condition_mach3_flow(x, t, equations::CompressibleEulerEquations2D)
- # set the freestream flow parameters
- rho_freestream = 1.4
- v1 = 3.0
- v2 = 0.0
- p_freestream = 1.0
-
- prim = SVector(rho_freestream, v1, v2, p_freestream)
- return prim2cons(prim, equations)
+ # set the freestream flow parameters
+ rho_freestream = 1.4
+ v1 = 3.0
+ v2 = 0.0
+ p_freestream = 1.0
+
+ prim = SVector(rho_freestream, v1, v2, p_freestream)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_mach3_flow
@@ -38,30 +38,32 @@ initial_condition = initial_condition_mach3_flow
# Supersonic inflow boundary condition.
# Calculate the boundary flux entirely from the external solution state, i.e., set
# external solution state values for everything entering the domain.
-@inline function boundary_condition_supersonic_inflow(u_inner, normal_direction::AbstractVector, x, t,
- surface_flux_function, equations::CompressibleEulerEquations2D)
- u_boundary = initial_condition_mach3_flow(x, t, equations)
- flux = Trixi.flux(u_boundary, normal_direction, equations)
-
- return flux
+@inline function boundary_condition_supersonic_inflow(u_inner,
+ normal_direction::AbstractVector,
+ x, t, surface_flux_function,
+ equations::CompressibleEulerEquations2D)
+ u_boundary = initial_condition_mach3_flow(x, t, equations)
+ flux = Trixi.flux(u_boundary, normal_direction, equations)
+
+ return flux
end
-
# Supersonic outflow boundary condition.
# Calculate the boundary flux entirely from the internal solution state. Analogous to supersonic inflow
# except all the solution state values are set from the internal solution as everything leaves the domain
@inline function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x, t,
- surface_flux_function, equations::CompressibleEulerEquations2D)
- flux = Trixi.flux(u_inner, normal_direction, equations)
+ surface_flux_function,
+ equations::CompressibleEulerEquations2D)
+ flux = Trixi.flux(u_inner, normal_direction, equations)
- return flux
+ return flux
end
-boundary_conditions = Dict( :Bottom => boundary_condition_slip_wall,
- :Circle => boundary_condition_slip_wall,
- :Top => boundary_condition_slip_wall,
- :Right => boundary_condition_outflow,
- :Left => boundary_condition_supersonic_inflow )
+boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall,
+ :Circle => boundary_condition_slip_wall,
+ :Top => boundary_condition_slip_wall,
+ :Right => boundary_condition_outflow,
+ :Left => boundary_condition_supersonic_inflow)
volume_flux = flux_ranocha_turbo
surface_flux = flux_lax_friedrichs
@@ -69,25 +71,27 @@ surface_flux = flux_lax_friedrichs
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
shock_indicator = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(shock_indicator;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_cylinder_in_channel.inp")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/a08f78f6b185b63c3baeff911a63f628/raw/addac716ea0541f588b9d2bd3f92f643eb27b88f/abaqus_cylinder_in_channel.inp",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/a08f78f6b185b63c3baeff911a63f628/raw/addac716ea0541f588b9d2bd3f92f643eb27b88f/abaqus_cylinder_in_channel.inp",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = P4estMesh{2}(mesh_file)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers
@@ -100,26 +104,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_indicator = IndicatorLöhner(semi, variable=Trixi.density)
+amr_indicator = IndicatorLöhner(semi, variable = Trixi.density)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=0,
- med_level=3, med_threshold=0.05,
- max_level=5, max_threshold=0.1)
+ base_level = 0,
+ med_level = 3, med_threshold = 0.05,
+ max_level = 5, max_threshold = 0.1)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -128,11 +132,11 @@ callbacks = CallbackSet(summary_callback,
# positivity limiter necessary for this example with strong shocks. Very sensitive
# to the order of the limiter variables, pressure must come first.
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-7, 1.0e-6),
- variables=(pressure, Trixi.density))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-7, 1.0e-6),
+ variables = (pressure, Trixi.density))
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl b/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl
index 7c7896ce372..8b8d05bade8 100644
--- a/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl
+++ b/examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl
@@ -9,45 +9,46 @@ using Trixi
equations = CompressibleEulerEquations2D(1.4)
@inline function uniform_flow_state(x, t, equations::CompressibleEulerEquations2D)
- # set the freestream flow parameters
- rho_freestream = 1.0
- u_freestream = 0.3
- p_freestream = inv(equations.gamma)
-
- theta = pi / 90.0 # analogous with a two degree angle of attack
- si, co = sincos(theta)
- v1 = u_freestream * co
- v2 = u_freestream * si
-
- prim = SVector(rho_freestream, v1, v2, p_freestream)
- return prim2cons(prim, equations)
+ # set the freestream flow parameters
+ rho_freestream = 1.0
+ u_freestream = 0.3
+ p_freestream = inv(equations.gamma)
+
+ theta = pi / 90.0 # analogous with a two degree angle of attack
+ si, co = sincos(theta)
+ v1 = u_freestream * co
+ v2 = u_freestream * si
+
+ prim = SVector(rho_freestream, v1, v2, p_freestream)
+ return prim2cons(prim, equations)
end
initial_condition = uniform_flow_state
boundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state)
-boundary_conditions = Dict( :Body => boundary_condition_uniform_flow,
- :Button1 => boundary_condition_slip_wall,
- :Button2 => boundary_condition_slip_wall,
- :Eye1 => boundary_condition_slip_wall,
- :Eye2 => boundary_condition_slip_wall,
- :Smile => boundary_condition_slip_wall,
- :Bowtie => boundary_condition_slip_wall )
+boundary_conditions = Dict(:Body => boundary_condition_uniform_flow,
+ :Button1 => boundary_condition_slip_wall,
+ :Button2 => boundary_condition_slip_wall,
+ :Eye1 => boundary_condition_slip_wall,
+ :Eye2 => boundary_condition_slip_wall,
+ :Smile => boundary_condition_slip_wall,
+ :Bowtie => boundary_condition_slip_wall)
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=5, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 5, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_gingerbread_man.inp")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/0e9e990a04b5105d1d2e3096a6e41272/raw/0d924b1d7e7d3cc1070a6cc22fe1d501687aa6dd/abaqus_gingerbread_man.inp",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/0e9e990a04b5105d1d2e3096a6e41272/raw/0d924b1d7e7d3cc1070a6cc22fe1d501687aa6dd/abaqus_gingerbread_man.inp",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = P4estMesh{2}(mesh_file)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -58,36 +59,35 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_indicator = IndicatorLöhner(semi, variable=density)
+amr_indicator = IndicatorLöhner(semi, variable = density)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=0,
- med_level=1, med_threshold=0.05,
- max_level=3, max_threshold=0.1)
+ base_level = 0,
+ med_level = 1, med_threshold = 0.05,
+ max_level = 3, max_threshold = 0.1)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-7, reltol=1.0e-7,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-7, reltol = 1.0e-7,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl b/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl
index b34c73d2a4e..d55a59ca5ce 100644
--- a/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl
+++ b/examples/p4est_2d_dgsem/elixir_eulergravity_convergence.jl
@@ -2,10 +2,8 @@
using OrdinaryDiffEq
using Trixi
-
initial_condition = initial_condition_eoc_test_coupled_euler_gravity
-
###############################################################################
# semidiscretization of the compressible Euler equations
gamma = 2.0
@@ -18,13 +16,13 @@ coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
trees_per_dimension = (1, 1)
-mesh = P4estMesh(trees_per_dimension, polydeg=1,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=2)
-
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler,
- source_terms=source_terms_eoc_test_coupled_euler_gravity)
+mesh = P4estMesh(trees_per_dimension, polydeg = 1,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 2)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler,
+ source_terms = source_terms_eoc_test_coupled_euler_gravity)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -32,24 +30,23 @@ equations_gravity = HyperbolicDiffusionEquations2D()
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=2.0, # aka rho0
+parameters = ParametersEulerGravity(background_density = 2.0, # aka rho0
# rho0 is (ab)used to add a "+8π" term to the source terms
# for the manufactured solution
- gravitational_constant=1.0, # aka G
- cfl=1.1,
- resid_tol=1.0e-10,
- n_iterations_max=1000,
- timestep_gravity=timestep_gravity_erk52_3Sstar!)
+ gravitational_constant = 1.0, # aka G
+ cfl = 1.1,
+ resid_tol = 1.0e-10,
+ n_iterations_max = 1000,
+ timestep_gravity = timestep_gravity_erk52_3Sstar!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 0.5)
@@ -57,31 +54,30 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
analysis_interval = 100
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true)
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true)
callbacks = CallbackSet(summary_callback, stepsize_callback,
save_restart, save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl b/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl
index ba2ec827778..364e0296449 100644
--- a/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl
+++ b/examples/p4est_2d_dgsem/elixir_linearizedeuler_gaussian_source.jl
@@ -8,20 +8,22 @@ using Trixi
# Oscillating Gaussian-shaped source terms
function source_terms_gauss(u, x, t, equations::LinearizedEulerEquations2D)
- r = 0.1
- A = 1.0
- f = 2.0
+ r = 0.1
+ A = 1.0
+ f = 2.0
- # Velocity sources
- s2 = 0.0
- s3 = 0.0
- # Density and pressure source
- s1 = s4 = exp(-(x[1]^2 + x[2]^2) / (2 * r^2)) * A * sin(2 * pi * f * t)
+ # Velocity sources
+ s2 = 0.0
+ s3 = 0.0
+ # Density and pressure source
+ s1 = s4 = exp(-(x[1]^2 + x[2]^2) / (2 * r^2)) * A * sin(2 * pi * f * t)
- return SVector(s1, s2, s3, s4)
+ return SVector(s1, s2, s3, s4)
end
-initial_condition_zero(x, t, equations::LinearizedEulerEquations2D) = SVector(0.0, 0.0, 0.0, 0.0)
+function initial_condition_zero(x, t, equations::LinearizedEulerEquations2D)
+ SVector(0.0, 0.0, 0.0, 0.0)
+end
###############################################################################
# semidiscretization of the linearized Euler equations
@@ -30,28 +32,27 @@ initial_condition_zero(x, t, equations::LinearizedEulerEquations2D) = SVector(0.
c = cospi(2 * 30.0 / 360.0)
s = sinpi(2 * 30.0 / 360.0)
rot_mat = Trixi.SMatrix{2, 2}([c -s; s c])
-mapping(xi, eta) = rot_mat * SVector(3.0*xi, 3.0*eta)
+mapping(xi, eta) = rot_mat * SVector(3.0 * xi, 3.0 * eta)
# Mean density and speed of sound are slightly off from 1.0 to allow proper verification of
# curved LEE implementation using this elixir (some things in the LEE cancel if both are 1.0)
-equations = LinearizedEulerEquations2D(v_mean_global=Tuple(rot_mat * SVector(-0.5, 0.25)),
- c_mean_global=1.02, rho_mean_global=1.01)
+equations = LinearizedEulerEquations2D(v_mean_global = Tuple(rot_mat * SVector(-0.5, 0.25)),
+ c_mean_global = 1.02, rho_mean_global = 1.01)
initial_condition = initial_condition_zero
# Create DG solver with polynomial degree = 3 and upwind flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 3, surface_flux = flux_godunov)
# Create a uniformly refined mesh with periodic boundaries
trees_per_dimension = (4, 4)
-mesh = P4estMesh(trees_per_dimension, polydeg=1,
- mapping=mapping,
- periodicity=true, initial_refinement_level=2)
+mesh = P4estMesh(trees_per_dimension, polydeg = 1,
+ mapping = mapping,
+ periodicity = true, initial_refinement_level = 2)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_gauss)
-
+ source_terms = source_terms_gauss)
###############################################################################
# ODE solvers, callbacks etc.
@@ -65,25 +66,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100)
+save_solution = SaveSolutionCallback(interval = 100)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl
index 66bce781f60..93db7bfdbaf 100644
--- a/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl
@@ -2,28 +2,27 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test
# Get the DG approximation space
volume_flux = (flux_central, flux_nonconservative_powell)
-solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
-coordinates_min = (0.0 , 0.0 )
+coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
trees_per_dimension = (8, 8)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=0,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=true)
+ polydeg = 3, initial_refinement_level = 0,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -36,14 +35,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
cfl = 0.9
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -54,7 +53,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl
index 58915a8f6a7..380db487356 100644
--- a/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl
+++ b/examples/p4est_2d_dgsem/elixir_mhd_rotor.jl
@@ -16,74 +16,74 @@ The classical MHD rotor test case. Here, the setup is taken from
[doi: 10.1365/s13291-018-0178-9](https://doi.org/10.1365/s13291-018-0178-9)
"""
function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D)
- # setup taken from Derigs et al. DMV article (2018)
- # domain must be [0, 1] x [0, 1], γ = 1.4
- dx = x[1] - 0.5
- dy = x[2] - 0.5
- r = sqrt(dx^2 + dy^2)
- f = (0.115 - r)/0.015
- if r <= 0.1
- rho = 10.0
- v1 = -20.0*dy
- v2 = 20.0*dx
- elseif r >= 0.115
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- else
- rho = 1.0 + 9.0*f
- v1 = -20.0*f*dy
- v2 = 20.0*f*dx
- end
- v3 = 0.0
- p = 1.0
- B1 = 5.0/sqrt(4.0*pi)
- B2 = 0.0
- B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
+ # setup taken from Derigs et al. DMV article (2018)
+ # domain must be [0, 1] x [0, 1], γ = 1.4
+ dx = x[1] - 0.5
+ dy = x[2] - 0.5
+ r = sqrt(dx^2 + dy^2)
+ f = (0.115 - r) / 0.015
+ if r <= 0.1
+ rho = 10.0
+ v1 = -20.0 * dy
+ v2 = 20.0 * dx
+ elseif r >= 0.115
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ else
+ rho = 1.0 + 9.0 * f
+ v1 = -20.0 * f * dy
+ v2 = 20.0 * f * dx
+ end
+ v3 = 0.0
+ p = 1.0
+ B1 = 5.0 / sqrt(4.0 * pi)
+ B2 = 0.0
+ B3 = 0.0
+ psi = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end
initial_condition = initial_condition_rotor
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Affine type mapping to take the [-1,1]^2 domain from the mesh file
# and put it onto the rotor domain [0,1]^2 and then warp it with a mapping
# as described in https://arxiv.org/abs/2012.12040
function mapping_twist(xi, eta)
- y = 0.5 * (eta + 1.0) + 0.05 * cos(1.5 * pi * (2.0 * xi - 1.0)) * cos(0.5 * pi * (2.0 * eta - 1.0))
- x = 0.5 * (xi + 1.0) + 0.05 * cos(0.5 * pi * (2.0 * xi - 1.0)) * cos(2.0 * pi * y)
- return SVector(x, y)
+ y = 0.5 * (eta + 1.0) +
+ 0.05 * cos(1.5 * pi * (2.0 * xi - 1.0)) * cos(0.5 * pi * (2.0 * eta - 1.0))
+ x = 0.5 * (xi + 1.0) + 0.05 * cos(0.5 * pi * (2.0 * xi - 1.0)) * cos(2.0 * pi * y)
+ return SVector(x, y)
end
-
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
+ mesh_file)
mesh = P4estMesh{2}(mesh_file,
- polydeg=4,
- mapping=mapping_twist,
- initial_refinement_level=1)
+ polydeg = 4,
+ mapping = mapping_twist,
+ initial_refinement_level = 1)
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict( :all => boundary_condition )
+boundary_conditions = Dict(:all => boundary_condition)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -94,31 +94,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorLöhner(semi,
- variable=density_pressure)
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=1,
- med_level =3, med_threshold=0.05,
- max_level =5, max_threshold=0.1)
+ base_level = 1,
+ med_level = 3, med_threshold = 0.05,
+ max_level = 5, max_threshold = 0.1)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
cfl = 0.5
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -131,7 +131,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
index b0c6086ad63..7aa14e25750 100644
--- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
+++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
@@ -8,174 +8,182 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=(true, false))
+ polydeg = 3, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = (true, false))
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion2D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion2D`)
# and by the initial condition (which passes in `CompressibleEulerEquations2D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0)) ) * cos(pi_t)
- v2 = v1
- p = rho^2
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t)
+ v2 = v1
+ p = rho^2
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- y = x[2]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
- rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
- rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
- rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
-
- v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
- v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_y = sin(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_xy = pi * cos(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_yy = (sin(pi_x) * ( 2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0)
- - A * A * log(y + 2.0) * exp(-A * (y - 1.0))
- - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_xx = v1_xx
- v2_xy = v1_xy
- v2_yy = v1_yy
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
- p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
- E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
-
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- # stress tensor from x-direction
- - 4.0 / 3.0 * v1_xx * mu_
- + 2.0 / 3.0 * v2_xy * mu_
- - v1_yy * mu_
- - v2_xy * mu_ )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- # stress tensor from y-direction
- - v1_xy * mu_
- - v2_xx * mu_
- - 4.0 / 3.0 * v2_yy * mu_
- + 2.0 / 3.0 * v1_xy * mu_ )
- # total energy equation
- du4 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- # stress tensor and temperature gradient terms from x-direction
- - 4.0 / 3.0 * v1_xx * v1 * mu_
- + 2.0 / 3.0 * v2_xy * v1 * mu_
- - 4.0 / 3.0 * v1_x * v1_x * mu_
- + 2.0 / 3.0 * v2_y * v1_x * mu_
- - v1_xy * v2 * mu_
- - v2_xx * v2 * mu_
- - v1_y * v2_x * mu_
- - v2_x * v2_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_
- # stress tensor and temperature gradient terms from y-direction
- - v1_yy * v1 * mu_
- - v2_xy * v1 * mu_
- - v1_y * v1_y * mu_
- - v2_x * v1_y * mu_
- - 4.0 / 3.0 * v2_yy * v2 * mu_
- + 2.0 / 3.0 * v1_xy * v2 * mu_
- - 4.0 / 3.0 * v2_y * v2_y * mu_
- + 2.0 / 3.0 * v1_x * v2_y * mu_
- - T_const * inv_rho_cubed * ( p_yy * rho * rho
- - 2.0 * p_y * rho * rho_y
- + 2.0 * p * rho_y * rho_y
- - p * rho * rho_yy ) * mu_ )
-
- return SVector(du1, du2, du3, du4)
+ y = x[2]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
+ rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
+ rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+
+ v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
+ v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_y = sin(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_xy = pi * cos(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_yy = (sin(pi_x) *
+ (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) -
+ A * A * log(y + 2.0) * exp(-A * (y - 1.0)) -
+ (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_xx = v1_xx
+ v2_xy = v1_xy
+ v2_yy = v1_yy
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+ p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
+ E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
+
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y -
+ # stress tensor from x-direction
+ 4.0 / 3.0 * v1_xx * mu_ +
+ 2.0 / 3.0 * v2_xy * mu_ -
+ v1_yy * mu_ -
+ v2_xy * mu_)
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y -
+ # stress tensor from y-direction
+ v1_xy * mu_ -
+ v2_xx * mu_ -
+ 4.0 / 3.0 * v2_yy * mu_ +
+ 2.0 / 3.0 * v1_xy * mu_)
+ # total energy equation
+ du4 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y) -
+ # stress tensor and temperature gradient terms from x-direction
+ 4.0 / 3.0 * v1_xx * v1 * mu_ +
+ 2.0 / 3.0 * v2_xy * v1 * mu_ -
+ 4.0 / 3.0 * v1_x * v1_x * mu_ +
+ 2.0 / 3.0 * v2_y * v1_x * mu_ -
+ v1_xy * v2 * mu_ -
+ v2_xx * v2 * mu_ -
+ v1_y * v2_x * mu_ -
+ v2_x * v2_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_ -
+ # stress tensor and temperature gradient terms from y-direction
+ v1_yy * v1 * mu_ -
+ v2_xy * v1 * mu_ -
+ v1_y * v1_y * mu_ -
+ 4.0 / 3.0 * v2_yy * v2 * mu_ +
+ 2.0 / 3.0 * v1_xy * v2 * mu_ -
+ 4.0 / 3.0 * v2_y * v2_y * mu_ +
+ 2.0 / 3.0 * v1_x * v2_y * mu_ -
+ T_const * inv_rho_cubed *
+ (p_yy * rho * rho -
+ 2.0 * p_y * rho * rho_y +
+ 2.0 * p * rho_y * rho_y -
+ p * rho * rho_yy) * mu_)
+
+ return SVector(du1, du2, du3, du4)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
- u = initial_condition_navier_stokes_convergence_test(x, t, equations)
- return SVector(u[2], u[3])
+ u = initial_condition_navier_stokes_convergence_test(x, t, equations)
+ return SVector(u[2], u[3])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = Dict(:y_neg => boundary_condition_slip_wall,
@@ -185,9 +193,11 @@ boundary_conditions = Dict(:y_neg => boundary_condition_slip_wall,
boundary_conditions_parabolic = Dict(:y_neg => boundary_condition_top_bottom,
:y_pos => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
# ###############################################################################
# # ODE solvers, callbacks etc.
@@ -197,16 +207,15 @@ tspan = (0.0, 0.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl
index 935f132ba4b..b4177fe8538 100644
--- a/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl
+++ b/examples/p4est_2d_dgsem/elixir_navierstokes_convergence_nonperiodic.jl
@@ -8,171 +8,182 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=(false, false))
+ polydeg = 3, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = (false, false))
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion2D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion2D`)
# and by the initial condition (which passes in `CompressibleEulerEquations2D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0)) ) * cos(pi_t)
- v2 = v1
- p = rho^2
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t)
+ v2 = v1
+ p = rho^2
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- y = x[2]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
- rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
- rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
- rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
-
- v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
- v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_y = sin(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_xy = pi * cos(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_yy = (sin(pi_x) * ( 2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0)
- - A * A * log(y + 2.0) * exp(-A * (y - 1.0))
- - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_xx = v1_xx
- v2_xy = v1_xy
- v2_yy = v1_yy
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
- p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
- E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
-
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- # stress tensor from x-direction
- - 4.0 / 3.0 * v1_xx * mu_
- + 2.0 / 3.0 * v2_xy * mu_
- - v1_yy * mu_
- - v2_xy * mu_ )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- # stress tensor from y-direction
- - v1_xy * mu_
- - v2_xx * mu_
- - 4.0 / 3.0 * v2_yy * mu_
- + 2.0 / 3.0 * v1_xy * mu_ )
- # total energy equation
- du4 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- # stress tensor and temperature gradient terms from x-direction
- - 4.0 / 3.0 * v1_xx * v1 * mu_
- + 2.0 / 3.0 * v2_xy * v1 * mu_
- - 4.0 / 3.0 * v1_x * v1_x * mu_
- + 2.0 / 3.0 * v2_y * v1_x * mu_
- - v1_xy * v2 * mu_
- - v2_xx * v2 * mu_
- - v1_y * v2_x * mu_
- - v2_x * v2_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_
- # stress tensor and temperature gradient terms from y-direction
- - v1_yy * v1 * mu_
- - v2_xy * v1 * mu_
- - v1_y * v1_y * mu_
- - v2_x * v1_y * mu_
- - 4.0 / 3.0 * v2_yy * v2 * mu_
- + 2.0 / 3.0 * v1_xy * v2 * mu_
- - 4.0 / 3.0 * v2_y * v2_y * mu_
- + 2.0 / 3.0 * v1_x * v2_y * mu_
- - T_const * inv_rho_cubed * ( p_yy * rho * rho
- - 2.0 * p_y * rho * rho_y
- + 2.0 * p * rho_y * rho_y
- - p * rho * rho_yy ) * mu_ )
-
- return SVector(du1, du2, du3, du4)
+ y = x[2]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
+ rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
+ rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+
+ v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
+ v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_y = sin(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_xy = pi * cos(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_yy = (sin(pi_x) *
+ (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) -
+ A * A * log(y + 2.0) * exp(-A * (y - 1.0)) -
+ (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_xx = v1_xx
+ v2_xy = v1_xy
+ v2_yy = v1_yy
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+ p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
+ E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
+
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y -
+ # stress tensor from x-direction
+ 4.0 / 3.0 * v1_xx * mu_ +
+ 2.0 / 3.0 * v2_xy * mu_ -
+ v1_yy * mu_ -
+ v2_xy * mu_)
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y -
+ # stress tensor from y-direction
+ v1_xy * mu_ -
+ v2_xx * mu_ -
+ 4.0 / 3.0 * v2_yy * mu_ +
+ 2.0 / 3.0 * v1_xy * mu_)
+ # total energy equation
+ du4 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y) -
+ # stress tensor and temperature gradient terms from x-direction
+ 4.0 / 3.0 * v1_xx * v1 * mu_ +
+ 2.0 / 3.0 * v2_xy * v1 * mu_ -
+ 4.0 / 3.0 * v1_x * v1_x * mu_ +
+ 2.0 / 3.0 * v2_y * v1_x * mu_ -
+ v1_xy * v2 * mu_ -
+ v2_xx * v2 * mu_ -
+ v1_y * v2_x * mu_ -
+ v2_x * v2_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_ -
+ # stress tensor and temperature gradient terms from y-direction
+ v1_yy * v1 * mu_ -
+ v2_xy * v1 * mu_ -
+ v1_y * v1_y * mu_ -
+ v2_x * v1_y * mu_ -
+ 4.0 / 3.0 * v2_yy * v2 * mu_ +
+ 2.0 / 3.0 * v1_xy * v2 * mu_ -
+ 4.0 / 3.0 * v2_y * v2_y * mu_ +
+ 2.0 / 3.0 * v1_x * v2_y * mu_ -
+ T_const * inv_rho_cubed *
+ (p_yy * rho * rho -
+ 2.0 * p_y * rho * rho_y +
+ 2.0 * p * rho_y * rho_y -
+ p * rho * rho_yy) * mu_)
+
+ return SVector(du1, du2, du3, du4)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2:3])
+velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2:3])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
boundary_condition_left_right = BoundaryConditionDirichlet(initial_condition_navier_stokes_convergence_test)
@@ -188,9 +199,11 @@ boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_left_right,
:y_neg => boundary_condition_top_bottom,
:y_pos => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
# ###############################################################################
# # ODE solvers, callbacks etc.
@@ -200,16 +213,15 @@ tspan = (0.0, 0.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
diff --git a/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl b/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl
index 051f4defe54..e6566edb18a 100644
--- a/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl
+++ b/examples/p4est_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl
@@ -9,28 +9,28 @@ prandtl_number() = 0.72
mu() = 0.001
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh
trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=(false, false))
+ polydeg = 3, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = (false, false))
function initial_condition_cavity(x, t, equations::CompressibleEulerEquations2D)
- Ma = 0.1
- rho = 1.0
- u, v = 0.0, 0.0
- p = 1.0 / (Ma^2 * equations.gamma)
- return prim2cons(SVector(rho, u, v, p), equations)
+ Ma = 0.1
+ rho = 1.0
+ u, v = 0.0, 0.0
+ p = 1.0 / (Ma^2 * equations.gamma)
+ return prim2cons(SVector(rho, u, v, p), equations)
end
initial_condition = initial_condition_cavity
@@ -42,21 +42,21 @@ boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat
boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc)
# define periodic boundary conditions everywhere
-boundary_conditions = Dict( :x_neg => boundary_condition_slip_wall,
- :y_neg => boundary_condition_slip_wall,
- :y_pos => boundary_condition_slip_wall,
- :x_pos => boundary_condition_slip_wall)
+boundary_conditions = Dict(:x_neg => boundary_condition_slip_wall,
+ :y_neg => boundary_condition_slip_wall,
+ :y_pos => boundary_condition_slip_wall,
+ :x_pos => boundary_condition_slip_wall)
-boundary_conditions_parabolic = Dict( :x_neg => boundary_condition_cavity,
- :y_neg => boundary_condition_cavity,
- :y_pos => boundary_condition_lid,
- :x_pos => boundary_condition_cavity)
+boundary_conditions_parabolic = Dict(:x_neg => boundary_condition_cavity,
+ :y_neg => boundary_condition_cavity,
+ :y_pos => boundary_condition_lid,
+ :x_pos => boundary_condition_cavity)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver;
- boundary_conditions=(boundary_conditions,
- boundary_conditions_parabolic))
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -66,17 +66,15 @@ tspan = (0.0, 25.0)
ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=100)
+alive_callback = AliveCallback(alive_interval = 100)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
-
diff --git a/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl
index b185a8ce39d..c7922fd3b75 100644
--- a/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl
+++ b/examples/p4est_2d_dgsem/elixir_shallowwater_source_terms.jl
@@ -5,17 +5,17 @@ using Trixi
###############################################################################
# semidiscretization of the shallow water equations
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test # MMS EOC test
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the P4estMesh and setup a periodic mesh
@@ -25,14 +25,13 @@ coordinates_max = (sqrt(2.0), sqrt(2.0)) # maximum coordinates (max(x), max(y))
# Create P4estMesh with 8 x 8 trees and 16 x 16 elements
trees_per_dimension = (8, 8)
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=1)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 1)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -44,13 +43,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -58,6 +57,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_advection_amr.jl b/examples/p4est_3d_dgsem/elixir_advection_amr.jl
index 0473fd2b23a..d56ecc233ff 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_amr.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_amr.jl
@@ -11,23 +11,21 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0, -5.0)
-coordinates_max = ( 5.0, 5.0, 5.0)
+coordinates_max = (5.0, 5.0, 5.0)
trees_per_dimension = (1, 1, 1)
# Note that it is not necessary to use mesh polydeg lower than the solver polydeg
# on a Cartesian mesh.
# See https://doi.org/10.1007/s10915-018-00897-9, Section 6.
-mesh = P4estMesh(trees_per_dimension, polydeg=1,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=4)
-
+mesh = P4estMesh(trees_per_dimension, polydeg = 1,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 4)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,26 +35,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -68,7 +66,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl b/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl
index fb87c361c18..cd280cf5bf6 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_amr_unstructured_curved.jl
@@ -12,54 +12,55 @@ equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes.
# The polydeg of the solver must be at least twice as big as the polydeg of the mesh.
# See https://doi.org/10.1007/s10915-018-00897-9, Section 6.
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
initial_condition = initial_condition_gauss
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :all => boundary_condition
-)
+boundary_conditions = Dict(:all => boundary_condition)
# Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping.
# The mapping will be interpolated at tree level, and then refined without changing
# the geometry interpolant. The original mapping applied to this unstructured mesh
# causes some Jacobians to be negative, which makes the mesh invalid.
function mapping(xi, eta, zeta)
- # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
- # xi = 1.5 * xi_ + 1.5
- # eta = 1.5 * eta_ + 1.5
- # zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 1/4 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 1/4 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 1/4 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- # Transform the weird deformed cube to be approximately the size of [-5,5]^3 to match IC
- return SVector(5 * x, 5 * y, 5 * z)
+ # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
+ # xi = 1.5 * xi_ + 1.5
+ # eta = 1.5 * eta_ + 1.5
+ # zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 1 / 4 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 1 / 4 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 1 / 4 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ # Transform the weird deformed cube to be approximately the size of [-5,5]^3 to match IC
+ return SVector(5 * x, 5 * y, 5 * z)
end
# Unstructured mesh with 48 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
+ mesh_file)
# Mesh polydeg of 2 (half the solver polydeg) to ensure FSP (see above).
-mesh = P4estMesh{3}(mesh_file, polydeg=2,
- mapping=mapping,
- initial_refinement_level=1)
-
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+mesh = P4estMesh{3}(mesh_file, polydeg = 2,
+ mapping = mapping,
+ initial_refinement_level = 1)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,29 +71,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=1,
- med_level=2, med_threshold=0.1,
- max_level=3, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 1,
+ med_level = 2, med_threshold = 0.1,
+ max_level = 3, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -105,7 +106,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_advection_basic.jl b/examples/p4est_3d_dgsem/elixir_advection_basic.jl
index a165d1ff132..02ffa5c7aff 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_basic.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_basic.jl
@@ -11,19 +11,20 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
# Create P4estMesh with 8 x 8 x 8 elements (note `refinement_level=1`)
trees_per_dimension = (4, 4, 4)
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=1)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 1)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,30 +38,30 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_restart, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_restart, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl b/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl
index 07a8b36bb4c..cd641ca4af7 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_cubed_sphere.jl
@@ -9,21 +9,20 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
initial_condition = initial_condition_convergence_test
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :inside => boundary_condition,
- :outside => boundary_condition,
-)
+boundary_conditions = Dict(:inside => boundary_condition,
+ :outside => boundary_condition)
mesh = Trixi.P4estMeshCubedSphere(5, 3, 0.5, 0.5,
- polydeg=3, initial_refinement_level=0)
+ polydeg = 3, initial_refinement_level = 0)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,26 +36,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl b/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl
index 93ff17c7842..34b0e95834d 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_nonconforming.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the linear advection equation
@@ -10,39 +9,42 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
trees_per_dimension = (1, 1, 1)
# Note that it is not necessary to use mesh polydeg lower than the solver polydeg
# on a Cartesian mesh.
# See https://doi.org/10.1007/s10915-018-00897-9, Section 6.
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- initial_refinement_level=2)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ initial_refinement_level = 2)
# Refine bottom left quadrant of each tree to level 3
function refine_fn(p8est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 && quadrant_obj.level < 3
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 &&
+ quadrant_obj.level < 3
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of a tree has level 3
# The mesh will be rebalanced before the simulation starts
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p8est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p8est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -56,26 +58,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_3d_dgsem/elixir_advection_restart.jl b/examples/p4est_3d_dgsem/elixir_advection_restart.jl
index 26d10cf8826..cd97d69d692 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_restart.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_restart.jl
@@ -6,8 +6,7 @@ using Trixi
# create a restart file
trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_basic.jl"),
- trees_per_dimension=(2, 2, 2))
-
+ trees_per_dimension = (2, 2, 2))
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -18,7 +17,8 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_basic.jl"),
restart_filename = joinpath("out", "restart_000010.h5")
mesh = load_mesh(restart_filename)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
tspan = (load_time(restart_filename), 2.0)
dt = load_dt(restart_filename)
@@ -27,14 +27,13 @@ ode = semidiscretize(semi, tspan, restart_filename);
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
-integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Get the last time index and work with that.
load_timestep!(integrator, restart_filename)
-
###############################################################################
# run the simulation
diff --git a/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl b/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl
index 85fd0b9a2cf..6df9ac0b16a 100644
--- a/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl
+++ b/examples/p4est_3d_dgsem/elixir_advection_unstructured_curved.jl
@@ -10,51 +10,54 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
initial_condition = initial_condition_convergence_test
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :all => boundary_condition
-)
+boundary_conditions = Dict(:all => boundary_condition)
# Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping.
# The mapping will be interpolated at tree level, and then refined without changing
# the geometry interpolant. The original mapping applied to this unstructured mesh
# causes some Jacobians to be negative, which makes the mesh invalid.
function mapping(xi, eta, zeta)
- # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
- # xi = 1.5 * xi_ + 1.5
- # eta = 1.5 * eta_ + 1.5
- # zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 1/6 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 1/6 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 1/6 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
+ # xi = 1.5 * xi_ + 1.5
+ # eta = 1.5 * eta_ + 1.5
+ # zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 1 / 6 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 1 / 6 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 1 / 6 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
# Unstructured mesh with 68 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_1.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
+ mesh_file)
-mesh = P4estMesh{3}(mesh_file, polydeg=3,
- mapping=mapping,
- initial_refinement_level=2)
+mesh = P4estMesh{3}(mesh_file, polydeg = 3,
+ mapping = mapping,
+ initial_refinement_level = 2)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -68,32 +71,32 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_restart, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_restart,
+ save_solution, stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl
index 27c8ceb130c..0274a89aec7 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_baroclinic_instability.jl
@@ -22,190 +22,194 @@ equations = CompressibleEulerEquations3D(gamma)
# Initial condition for an idealized baroclinic instability test
# https://doi.org/10.1002/qj.2241, Section 3.2 and Appendix A
-function initial_condition_baroclinic_instability(x, t, equations::CompressibleEulerEquations3D)
- lon, lat, r = cartesian_to_sphere(x)
- radius_earth = 6.371229e6
- # Make sure that the r is not smaller than radius_earth
- z = max(r - radius_earth, 0.0)
+function initial_condition_baroclinic_instability(x, t,
+ equations::CompressibleEulerEquations3D)
+ lon, lat, r = cartesian_to_sphere(x)
+ radius_earth = 6.371229e6
+ # Make sure that the r is not smaller than radius_earth
+ z = max(r - radius_earth, 0.0)
- # Unperturbed basic state
- rho, u, p = basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z)
+ # Unperturbed basic state
+ rho, u, p = basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z)
- # Stream function type perturbation
- u_perturbation, v_perturbation = perturbation_stream_function(lon, lat, z)
+ # Stream function type perturbation
+ u_perturbation, v_perturbation = perturbation_stream_function(lon, lat, z)
- u += u_perturbation
- v = v_perturbation
+ u += u_perturbation
+ v = v_perturbation
- # Convert spherical velocity to Cartesian
- v1 = -sin(lon) * u - sin(lat) * cos(lon) * v
- v2 = cos(lon) * u - sin(lat) * sin(lon) * v
- v3 = cos(lat) * v
+ # Convert spherical velocity to Cartesian
+ v1 = -sin(lon) * u - sin(lat) * cos(lon) * v
+ v2 = cos(lon) * u - sin(lat) * sin(lon) * v
+ v3 = cos(lat) * v
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
# Steady state for RHS correction below
function steady_state_baroclinic_instability(x, t, equations::CompressibleEulerEquations3D)
- lon, lat, r = cartesian_to_sphere(x)
- radius_earth = 6.371229e6
- # Make sure that the r is not smaller than radius_earth
- z = max(r - radius_earth, 0.0)
+ lon, lat, r = cartesian_to_sphere(x)
+ radius_earth = 6.371229e6
+ # Make sure that the r is not smaller than radius_earth
+ z = max(r - radius_earth, 0.0)
- # Unperturbed basic state
- rho, u, p = basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z)
+ # Unperturbed basic state
+ rho, u, p = basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z)
- # Convert spherical velocity to Cartesian
- v1 = -sin(lon) * u
- v2 = cos(lon) * u
- v3 = 0.0
+ # Convert spherical velocity to Cartesian
+ v1 = -sin(lon) * u
+ v2 = cos(lon) * u
+ v3 = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
function cartesian_to_sphere(x)
- r = norm(x)
- lambda = atan(x[2], x[1])
- if lambda < 0
- lambda += 2 * pi
- end
- phi = asin(x[3] / r)
-
- return lambda, phi, r
+ r = norm(x)
+ lambda = atan(x[2], x[1])
+ if lambda < 0
+ lambda += 2 * pi
+ end
+ phi = asin(x[3] / r)
+
+ return lambda, phi, r
end
# Unperturbed balanced steady-state.
# Returns primitive variables with only the velocity in longitudinal direction (rho, u, p).
# The other velocity components are zero.
function basic_state_baroclinic_instability_longitudinal_velocity(lon, lat, z)
- # Parameters from Table 1 in the paper
- # Corresponding names in the paper are commented
- radius_earth = 6.371229e6 # a
- half_width_parameter = 2 # b
- gravitational_acceleration = 9.80616 # g
- k = 3 # k
- surface_pressure = 1e5 # p₀
- gas_constant = 287 # R
- surface_equatorial_temperature = 310.0 # T₀ᴱ
- surface_polar_temperature = 240.0 # T₀ᴾ
- lapse_rate = 0.005 # Γ
- angular_velocity = 7.29212e-5 # Ω
-
- # Distance to the center of the Earth
- r = z + radius_earth
-
- # In the paper: T₀
- temperature0 = 0.5 * (surface_equatorial_temperature + surface_polar_temperature)
- # In the paper: A, B, C, H
- const_a = 1 / lapse_rate
- const_b = (temperature0 - surface_polar_temperature) /
- (temperature0 * surface_polar_temperature)
- const_c = 0.5 * (k + 2) * (surface_equatorial_temperature - surface_polar_temperature) /
- (surface_equatorial_temperature * surface_polar_temperature)
- const_h = gas_constant * temperature0 / gravitational_acceleration
-
- # In the paper: (r - a) / bH
- scaled_z = z / (half_width_parameter * const_h)
-
- # Temporary variables
- temp1 = exp(lapse_rate/temperature0 * z)
- temp2 = exp(-scaled_z^2)
-
- # In the paper: ̃τ₁, ̃τ₂
- tau1 = const_a * lapse_rate / temperature0 * temp1 + const_b * (1 - 2 * scaled_z^2) * temp2
- tau2 = const_c * (1 - 2 * scaled_z^2) * temp2
-
- # In the paper: ∫τ₁(r') dr', ∫τ₂(r') dr'
- inttau1 = const_a * (temp1 - 1) + const_b * z * temp2
- inttau2 = const_c * z * temp2
-
- # Temporary variables
- temp3 = r/radius_earth * cos(lat)
- temp4 = temp3^k - k/(k + 2) * temp3^(k+2)
-
- # In the paper: T
- temperature = 1 / ((r/radius_earth)^2 * (tau1 - tau2 * temp4))
-
- # In the paper: U, u (zonal wind, first component of spherical velocity)
- big_u = gravitational_acceleration/radius_earth * k * temperature * inttau2 * (temp3^(k-1) - temp3^(k+1))
- temp5 = radius_earth * cos(lat)
- u = -angular_velocity * temp5 + sqrt(angular_velocity^2 * temp5^2 + temp5 * big_u)
-
- # Hydrostatic pressure
- p = surface_pressure * exp(-gravitational_acceleration/gas_constant * (inttau1 - inttau2 * temp4))
-
- # Density (via ideal gas law)
- rho = p / (gas_constant * temperature)
-
- return rho, u, p
+ # Parameters from Table 1 in the paper
+ # Corresponding names in the paper are commented
+ radius_earth = 6.371229e6 # a
+ half_width_parameter = 2 # b
+ gravitational_acceleration = 9.80616 # g
+ k = 3 # k
+ surface_pressure = 1e5 # p₀
+ gas_constant = 287 # R
+ surface_equatorial_temperature = 310.0 # T₀ᴱ
+ surface_polar_temperature = 240.0 # T₀ᴾ
+ lapse_rate = 0.005 # Γ
+ angular_velocity = 7.29212e-5 # Ω
+
+ # Distance to the center of the Earth
+ r = z + radius_earth
+
+ # In the paper: T₀
+ temperature0 = 0.5 * (surface_equatorial_temperature + surface_polar_temperature)
+ # In the paper: A, B, C, H
+ const_a = 1 / lapse_rate
+ const_b = (temperature0 - surface_polar_temperature) /
+ (temperature0 * surface_polar_temperature)
+ const_c = 0.5 * (k + 2) * (surface_equatorial_temperature - surface_polar_temperature) /
+ (surface_equatorial_temperature * surface_polar_temperature)
+ const_h = gas_constant * temperature0 / gravitational_acceleration
+
+ # In the paper: (r - a) / bH
+ scaled_z = z / (half_width_parameter * const_h)
+
+ # Temporary variables
+ temp1 = exp(lapse_rate / temperature0 * z)
+ temp2 = exp(-scaled_z^2)
+
+ # In the paper: ̃τ₁, ̃τ₂
+ tau1 = const_a * lapse_rate / temperature0 * temp1 +
+ const_b * (1 - 2 * scaled_z^2) * temp2
+ tau2 = const_c * (1 - 2 * scaled_z^2) * temp2
+
+ # In the paper: ∫τ₁(r') dr', ∫τ₂(r') dr'
+ inttau1 = const_a * (temp1 - 1) + const_b * z * temp2
+ inttau2 = const_c * z * temp2
+
+ # Temporary variables
+ temp3 = r / radius_earth * cos(lat)
+ temp4 = temp3^k - k / (k + 2) * temp3^(k + 2)
+
+ # In the paper: T
+ temperature = 1 / ((r / radius_earth)^2 * (tau1 - tau2 * temp4))
+
+ # In the paper: U, u (zonal wind, first component of spherical velocity)
+ big_u = gravitational_acceleration / radius_earth * k * temperature * inttau2 *
+ (temp3^(k - 1) - temp3^(k + 1))
+ temp5 = radius_earth * cos(lat)
+ u = -angular_velocity * temp5 + sqrt(angular_velocity^2 * temp5^2 + temp5 * big_u)
+
+ # Hydrostatic pressure
+ p = surface_pressure *
+ exp(-gravitational_acceleration / gas_constant * (inttau1 - inttau2 * temp4))
+
+ # Density (via ideal gas law)
+ rho = p / (gas_constant * temperature)
+
+ return rho, u, p
end
# Perturbation as in Equations 25 and 26 of the paper (analytical derivative)
function perturbation_stream_function(lon, lat, z)
- # Parameters from Table 1 in the paper
- # Corresponding names in the paper are commented
- perturbation_radius = 1/6 # d₀ / a
- perturbed_wind_amplitude = 1.0 # Vₚ
- perturbation_lon = pi/9 # Longitude of perturbation location
- perturbation_lat = 2 * pi/9 # Latitude of perturbation location
- pertz = 15000 # Perturbation height cap
-
- # Great circle distance (d in the paper) divided by a (radius of the Earth)
- # because we never actually need d without dividing by a
- great_circle_distance_by_a = acos(sin(perturbation_lat) * sin(lat) +
- cos(perturbation_lat) * cos(lat) *
- cos(lon - perturbation_lon))
-
- # In the first case, the vertical taper function is per definition zero.
- # In the second case, the stream function is per definition zero.
- if z > pertz || great_circle_distance_by_a > perturbation_radius
- return 0.0, 0.0
- end
-
- # Vertical tapering of stream function
- perttaper = 1.0 - 3 * z^2 / pertz^2 + 2 * z^3 / pertz^3
-
- # sin/cos(pi * d / (2 * d_0)) in the paper
- sin_, cos_ = sincos(0.5 * pi * great_circle_distance_by_a / perturbation_radius)
-
- # Common factor for both u and v
- factor = 16 / (3 * sqrt(3)) * perturbed_wind_amplitude * perttaper * cos_^3 * sin_
-
- u_perturbation = -factor * (-sin(perturbation_lat) * cos(lat) +
- cos(perturbation_lat) * sin(lat) * cos(lon - perturbation_lon)
- ) / sin(great_circle_distance_by_a)
-
- v_perturbation = factor * cos(perturbation_lat) * sin(lon - perturbation_lon) /
- sin(great_circle_distance_by_a)
-
- return u_perturbation, v_perturbation
-end
+ # Parameters from Table 1 in the paper
+ # Corresponding names in the paper are commented
+ perturbation_radius = 1 / 6 # d₀ / a
+ perturbed_wind_amplitude = 1.0 # Vₚ
+ perturbation_lon = pi / 9 # Longitude of perturbation location
+ perturbation_lat = 2 * pi / 9 # Latitude of perturbation location
+ pertz = 15000 # Perturbation height cap
+
+ # Great circle distance (d in the paper) divided by a (radius of the Earth)
+ # because we never actually need d without dividing by a
+ great_circle_distance_by_a = acos(sin(perturbation_lat) * sin(lat) +
+ cos(perturbation_lat) * cos(lat) *
+ cos(lon - perturbation_lon))
+
+ # In the first case, the vertical taper function is per definition zero.
+ # In the second case, the stream function is per definition zero.
+ if z > pertz || great_circle_distance_by_a > perturbation_radius
+ return 0.0, 0.0
+ end
+
+ # Vertical tapering of stream function
+ perttaper = 1.0 - 3 * z^2 / pertz^2 + 2 * z^3 / pertz^3
+
+ # sin/cos(pi * d / (2 * d_0)) in the paper
+ sin_, cos_ = sincos(0.5 * pi * great_circle_distance_by_a / perturbation_radius)
+ # Common factor for both u and v
+ factor = 16 / (3 * sqrt(3)) * perturbed_wind_amplitude * perttaper * cos_^3 * sin_
-@inline function source_terms_baroclinic_instability(u, x, t, equations::CompressibleEulerEquations3D)
- radius_earth = 6.371229e6 # a
- gravitational_acceleration = 9.80616 # g
- angular_velocity = 7.29212e-5 # Ω
+ u_perturbation = -factor * (-sin(perturbation_lat) * cos(lat) +
+ cos(perturbation_lat) * sin(lat) * cos(lon - perturbation_lon)) /
+ sin(great_circle_distance_by_a)
- r = norm(x)
- # Make sure that r is not smaller than radius_earth
- z = max(r - radius_earth, 0.0)
- r = z + radius_earth
+ v_perturbation = factor * cos(perturbation_lat) * sin(lon - perturbation_lon) /
+ sin(great_circle_distance_by_a)
- du1 = zero(eltype(u))
+ return u_perturbation, v_perturbation
+end
+
+@inline function source_terms_baroclinic_instability(u, x, t,
+ equations::CompressibleEulerEquations3D)
+ radius_earth = 6.371229e6 # a
+ gravitational_acceleration = 9.80616 # g
+ angular_velocity = 7.29212e-5 # Ω
+
+ r = norm(x)
+ # Make sure that r is not smaller than radius_earth
+ z = max(r - radius_earth, 0.0)
+ r = z + radius_earth
- # Gravity term
- temp = -gravitational_acceleration * radius_earth^2 / r^3
- du2 = temp * u[1] * x[1]
- du3 = temp * u[1] * x[2]
- du4 = temp * u[1] * x[3]
- du5 = temp * (u[2] * x[1] + u[3] * x[2] + u[4] * x[3])
+ du1 = zero(eltype(u))
- # Coriolis term, -2Ω × ρv = -2 * angular_velocity * (0, 0, 1) × u[2:4]
- du2 -= -2 * angular_velocity * u[3]
- du3 -= 2 * angular_velocity * u[2]
+ # Gravity term
+ temp = -gravitational_acceleration * radius_earth^2 / r^3
+ du2 = temp * u[1] * x[1]
+ du3 = temp * u[1] * x[2]
+ du4 = temp * u[1] * x[3]
+ du5 = temp * (u[2] * x[1] + u[3] * x[2] + u[4] * x[3])
- return SVector(du1, du2, du3, du4, du5)
+ # Coriolis term, -2Ω × ρv = -2 * angular_velocity * (0, 0, 1) × u[2:4]
+ du2 -= -2 * angular_velocity * u[3]
+ du3 -= 2 * angular_velocity * u[2]
+
+ return SVector(du1, du2, du3, du4, du5)
end
###############################################################################
@@ -213,26 +217,24 @@ end
initial_condition = initial_condition_baroclinic_instability
-boundary_conditions = Dict(
- :inside => boundary_condition_slip_wall,
- :outside => boundary_condition_slip_wall,
-)
+boundary_conditions = Dict(:inside => boundary_condition_slip_wall,
+ :outside => boundary_condition_slip_wall)
# This is a good estimate for the speed of sound in this example.
# Other values between 300 and 400 should work as well.
surface_flux = FluxLMARS(340)
-volume_flux = flux_kennedy_gruber
-solver = DGSEM(polydeg=5, surface_flux=surface_flux, volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+volume_flux = flux_kennedy_gruber
+solver = DGSEM(polydeg = 5, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# For optimal results, use (16, 8) here
trees_per_cube_face = (8, 4)
mesh = Trixi.P4estMeshCubedSphere(trees_per_cube_face..., 6.371229e6, 30000.0,
- polydeg=5, initial_refinement_level=0)
+ polydeg = 5, initial_refinement_level = 0)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_baroclinic_instability,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_baroclinic_instability,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -250,20 +252,20 @@ tspan = (0.0, 10 * 24 * 60 * 60.0) # time in seconds for 10 days
u_steady_state = compute_coefficients(steady_state_baroclinic_instability, tspan[1], semi)
# Use a `let` block for performance (otherwise du_steady_state will be a global variable)
let du_steady_state = similar(u_steady_state)
- # Save RHS of the steady state
- Trixi.rhs!(du_steady_state, u_steady_state, semi, tspan[1])
-
- global function corrected_rhs!(du, u, semi, t)
- # Normal RHS evaluation
- Trixi.rhs!(du, u, semi, t)
- # Correct by subtracting the steady-state RHS
- Trixi.@trixi_timeit Trixi.timer() "rhs correction" begin
- # Use Trixi.@threaded for threaded performance
- Trixi.@threaded for i in eachindex(du)
- du[i] -= du_steady_state[i]
- end
+ # Save RHS of the steady state
+ Trixi.rhs!(du_steady_state, u_steady_state, semi, tspan[1])
+
+ global function corrected_rhs!(du, u, semi, t)
+ # Normal RHS evaluation
+ Trixi.rhs!(du, u, semi, t)
+ # Correct by subtracting the steady-state RHS
+ Trixi.@trixi_timeit Trixi.timer() "rhs correction" begin
+ # Use Trixi.@threaded for threaded performance
+ Trixi.@threaded for i in eachindex(du)
+ du[i] -= du_steady_state[i]
+ end
+ end
end
- end
end
u0 = compute_coefficients(tspan[1], semi)
ode = ODEProblem(corrected_rhs!, u0, tspan, semi)
@@ -271,27 +273,27 @@ ode = ODEProblem(corrected_rhs!, u0, tspan, semi)
summary_callback = SummaryCallback()
analysis_interval = 5000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback,
save_solution)
-
###############################################################################
# run the simulation
# Use a Runge-Kutta method with automatic (error based) time step size control
# Enable threading of the RK method for better performance on multiple threads
-sol = solve(ode, RDPK3SpFSAL49(thread=OrdinaryDiffEq.True()); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(thread = OrdinaryDiffEq.True()); abstol = 1.0e-6,
+ reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl b/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl
index 63e937620f0..34a43a5b534 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl
@@ -14,78 +14,77 @@ using LinearAlgebra
gamma = 1.4
equations = CompressibleEulerEquations3D(gamma)
-
function initial_condition_circular_wind(x, t, equations::CompressibleEulerEquations3D)
- radius_earth = 6.371229e6
- p = 1e5
- rho = 1.0
- v1 = -10 * x[2] / radius_earth
- v2 = 10 * x[1] / radius_earth
- v3 = 0.0
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ radius_earth = 6.371229e6
+ p = 1e5
+ rho = 1.0
+ v1 = -10 * x[2] / radius_earth
+ v2 = 10 * x[1] / radius_earth
+ v3 = 0.0
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
-@inline function source_terms_circular_wind(u, x, t, equations::CompressibleEulerEquations3D)
- radius_earth = 6.371229e6
- rho = 1.0
+@inline function source_terms_circular_wind(u, x, t,
+ equations::CompressibleEulerEquations3D)
+ radius_earth = 6.371229e6
+ rho = 1.0
- du1 = 0.0
- du2 = -rho * (10 / radius_earth) * (10 * x[1] / radius_earth)
- du3 = -rho * (10 / radius_earth) * (10 * x[2] / radius_earth)
- du4 = 0.0
- du5 = 0.0
+ du1 = 0.0
+ du2 = -rho * (10 / radius_earth) * (10 * x[1] / radius_earth)
+ du3 = -rho * (10 / radius_earth) * (10 * x[2] / radius_earth)
+ du4 = 0.0
+ du5 = 0.0
- return SVector(du1, du2, du3, du4, du5)
+ return SVector(du1, du2, du3, du4, du5)
end
-
-function indicator_test(u::AbstractArray{<:Any,5},
+function indicator_test(u::AbstractArray{<:Any, 5},
mesh, equations, dg::DGSEM, cache;
kwargs...)
- alpha = zeros(Int, nelements(dg, cache))
-
- for element in eachelement(dg, cache)
- for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
- x = Trixi.get_node_coords(cache.elements.node_coordinates, equations, dg, i, j, k, element)
- lambda, phi, r = cart_to_sphere(x)
- if 0.22 < lambda < 3.3 && 0.45 < phi < 1.3
- alpha[element] = 1
- end
+ alpha = zeros(Int, nelements(dg, cache))
+
+ for element in eachelement(dg, cache)
+ for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
+ x = Trixi.get_node_coords(cache.elements.node_coordinates, equations, dg, i, j,
+ k, element)
+ lambda, phi, r = cart_to_sphere(x)
+ if 0.22 < lambda < 3.3 && 0.45 < phi < 1.3
+ alpha[element] = 1
+ end
+ end
end
- end
- return alpha
+ return alpha
end
function cart_to_sphere(x)
- r = norm(x)
- lambda = atan(x[2], x[1])
- if lambda < 0
- lambda += 2 * pi
- end
- phi = asin(x[3] / r)
-
- return lambda, phi, r
+ r = norm(x)
+ lambda = atan(x[2], x[1])
+ if lambda < 0
+ lambda += 2 * pi
+ end
+ phi = asin(x[3] / r)
+
+ return lambda, phi, r
end
-function Trixi.get_element_variables!(element_variables, indicator::typeof(indicator_test), ::AMRCallback)
- return nothing
+function Trixi.get_element_variables!(element_variables, indicator::typeof(indicator_test),
+ ::AMRCallback)
+ return nothing
end
initial_condition = initial_condition_circular_wind
-boundary_conditions = Dict(
- :inside => boundary_condition_slip_wall,
- :outside => boundary_condition_slip_wall
-)
+boundary_conditions = Dict(:inside => boundary_condition_slip_wall,
+ :outside => boundary_condition_slip_wall)
# The speed of sound in this example is 374 m/s.
surface_flux = FluxLMARS(374)
# Note that a free stream is not preserved if N < 2 * N_geo, where N is the
# polydeg of the solver and N_geo is the polydeg of the mesh.
# However, the FSP error is negligible in this example.
-solver = DGSEM(polydeg=4, surface_flux=surface_flux)
+solver = DGSEM(polydeg = 4, surface_flux = surface_flux)
# Other mesh configurations to run this simulation on.
# The cylinder allows to use a structured mesh, the face of the cubed sphere
@@ -113,12 +112,11 @@ solver = DGSEM(polydeg=4, surface_flux=surface_flux)
trees_per_cube_face = (6, 2)
mesh = Trixi.P4estMeshCubedSphere(trees_per_cube_face..., 6.371229e6, 30000.0,
- polydeg=4, initial_refinement_level=0)
+ polydeg = 4, initial_refinement_level = 0)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_circular_wind,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_circular_wind,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -129,22 +127,22 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 5000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_controller = ControllerThreeLevel(semi, indicator_test,
- base_level=0,
- max_level=1, max_threshold=0.6)
+ base_level = 0,
+ max_level = 1, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=0, # Only initial refinement
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 0, # Only initial refinement
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -152,13 +150,13 @@ callbacks = CallbackSet(summary_callback,
save_solution,
amr_callback)
-
###############################################################################
# run the simulation
# Use a Runge-Kutta method with automatic (error based) time step size control
# Enable threading of the RK method for better performance on multiple threads
-sol = solve(ode, RDPK3SpFSAL49(thread=OrdinaryDiffEq.True()); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(thread = OrdinaryDiffEq.True()); abstol = 1.0e-6,
+ reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_ec.jl b/examples/p4est_3d_dgsem/elixir_euler_ec.jl
index 463a26fca53..d9d774a7ffc 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_ec.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_ec.jl
@@ -6,56 +6,59 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-equations = CompressibleEulerEquations3D(5/3)
+equations = CompressibleEulerEquations3D(5 / 3)
initial_condition = initial_condition_weak_blast_wave
-boundary_conditions = Dict(
- :all => boundary_condition_slip_wall
-)
+boundary_conditions = Dict(:all => boundary_condition_slip_wall)
# Get the DG approximation space
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=5, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 5, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Get the curved quad mesh from a file
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/8 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
# Unstructured mesh with 48 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
+ mesh_file)
-mesh = P4estMesh{3}(mesh_file, polydeg=5,
- mapping=mapping,
- initial_refinement_level=0)
+mesh = P4estMesh{3}(mesh_file, polydeg = 5,
+ mapping = mapping,
+ initial_refinement_level = 0)
# create the semidiscretization object
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -66,15 +69,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -85,7 +88,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl
index 3450adfe861..24a781ca59e 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream.jl
@@ -10,70 +10,75 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_constant
-boundary_conditions = Dict(
- :all => BoundaryConditionDirichlet(initial_condition)
-)
+boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition))
# Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes.
# The polydeg of the solver must be at least twice as big as the polydeg of the mesh.
# See https://doi.org/10.1007/s10915-018-00897-9, Section 6.
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
# Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping.
# The mapping will be interpolated at tree level, and then refined without changing
# the geometry interpolant. This can yield problematic geometries if the unrefined mesh
# is not fine enough.
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 1/6 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 1/6 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 1/6 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 1 / 6 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 1 / 6 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 1 / 6 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
# Unstructured mesh with 68 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_1.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
+ mesh_file)
# Mesh polydeg of 2 (half the solver polydeg) to ensure FSP (see above).
-mesh = P4estMesh{3}(mesh_file, polydeg=2,
- mapping=mapping,
- initial_refinement_level=0)
+mesh = P4estMesh{3}(mesh_file, polydeg = 2,
+ mapping = mapping,
+ initial_refinement_level = 0)
# Refine bottom left quadrant of each second tree to level 2
function refine_fn(p8est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if iseven(convert(Int, which_tree)) && quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 && quadrant_obj.level < 2
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if iseven(convert(Int, which_tree)) && quadrant_obj.x == 0 && quadrant_obj.y == 0 &&
+ quadrant_obj.z == 0 && quadrant_obj.level < 2
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of every second tree has level 2.
# The mesh will be rebalanced before the simulation starts.
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p8est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p8est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -84,27 +89,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl b/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl
index 630a269b4a1..f56fe3a429d 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_free_stream_extruded.jl
@@ -10,12 +10,10 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_constant
-boundary_conditions = Dict(
- :all => BoundaryConditionDirichlet(initial_condition)
-)
+boundary_conditions = Dict(:all => BoundaryConditionDirichlet(initial_condition))
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
# Mapping as described in https://arxiv.org/abs/2012.12040 but reduced to 2D.
# This particular mesh is unstructured in the yz-plane, but extruded in x-direction.
@@ -23,47 +21,52 @@ solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
# in x-direction to ensure free stream preservation on a non-conforming mesh.
# See https://doi.org/10.1007/s10915-018-00897-9, Section 6.
function mapping(xi, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
- z = zeta + 1/6 * (cos(1.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
+ z = zeta +
+ 1 / 6 * (cos(1.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
- y = eta + 1/6 * (cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(2 * pi * (2 * z - 3)/3))
+ y = eta + 1 / 6 * (cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(2 * pi * (2 * z - 3) / 3))
- return SVector(xi, y, z)
+ return SVector(xi, y, z)
end
# Unstructured mesh with 48 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_2.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
+ mesh_file)
-mesh = P4estMesh{3}(mesh_file, polydeg=3,
- mapping=mapping,
- initial_refinement_level=0)
+mesh = P4estMesh{3}(mesh_file, polydeg = 3,
+ mapping = mapping,
+ initial_refinement_level = 0)
# Refine quadrants in y-direction of each tree at one edge to level 2
function refine_fn(p8est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if convert(Int, which_tree) < 4 && quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.level < 2
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if convert(Int, which_tree) < 4 && quadrant_obj.x == 0 && quadrant_obj.y == 0 &&
+ quadrant_obj.level < 2
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each desired quadrant has level 2.
# The mesh will be rebalanced before the simulation starts.
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p8est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p8est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -74,30 +77,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false), #maxiters=1,
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), #maxiters=1,
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl
index 6fa285b5565..8df95a3cc21 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_sedov.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_sedov.jl
@@ -14,28 +14,29 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
with smaller strength of the initial discontinuity.
"""
-function initial_condition_medium_sedov_blast_wave(x, t, equations::CompressibleEulerEquations3D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- z_norm = x[3] - inicenter[3]
- r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (4 * pi * r0^2)
- p0_outer = 1.0e-3
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_medium_sedov_blast_wave(x, t,
+ equations::CompressibleEulerEquations3D)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ z_norm = x[3] - inicenter[3]
+ r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (4 * pi * r0^2)
+ p0_outer = 1.0e-3
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_medium_sedov_blast_wave
@@ -45,24 +46,25 @@ volume_flux = flux_ranocha
polydeg = 5
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
+coordinates_max = (1.0, 1.0, 1.0)
trees_per_dimension = (4, 4, 4)
mesh = P4estMesh(trees_per_dimension,
- polydeg=4, initial_refinement_level=0,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=true)
+ polydeg = 4, initial_refinement_level = 0,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -76,15 +78,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -95,7 +97,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl
index c5e349934a2..28a300cd681 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_earth.jl
@@ -11,68 +11,68 @@ using LinearAlgebra
gamma = 1.4
equations = CompressibleEulerEquations3D(gamma)
+function initial_condition_convergence_test_sphere(x, t,
+ equations::CompressibleEulerEquations3D)
+ x_scaled = x / 6.371229e6
+ t_scaled = t / 6.371229e6
-function initial_condition_convergence_test_sphere(x, t, equations::CompressibleEulerEquations3D)
- x_scaled = x / 6.371229e6
- t_scaled = t / 6.371229e6
-
- return initial_condition_convergence_test(x_scaled, t_scaled, equations)
+ return initial_condition_convergence_test(x_scaled, t_scaled, equations)
end
-@inline function source_terms_convergence_test_sphere(u, x, t, equations::CompressibleEulerEquations3D)
- x_scaled = x / 6.371229e6
- t_scaled = t / 6.371229e6
+@inline function source_terms_convergence_test_sphere(u, x, t,
+ equations::CompressibleEulerEquations3D)
+ x_scaled = x / 6.371229e6
+ t_scaled = t / 6.371229e6
- return source_terms_convergence_test(u, x_scaled, t_scaled, equations) / 6.371229e6
+ return source_terms_convergence_test(u, x_scaled, t_scaled, equations) / 6.371229e6
end
-
-function indicator_test(u::AbstractArray{<:Any,5},
+function indicator_test(u::AbstractArray{<:Any, 5},
mesh, equations, dg::DGSEM, cache;
kwargs...)
- alpha = zeros(Int, nelements(dg, cache))
-
- for element in eachelement(dg, cache)
- for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
- x = Trixi.get_node_coords(cache.elements.node_coordinates, equations, dg, i, j, k, element)
- lambda, phi, r = cart_to_sphere(x)
- if 0.22 < lambda < 3.3 && 0.45 < phi < 1.3
- alpha[element] = 1
- end
+ alpha = zeros(Int, nelements(dg, cache))
+
+ for element in eachelement(dg, cache)
+ for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
+ x = Trixi.get_node_coords(cache.elements.node_coordinates, equations, dg, i, j,
+ k, element)
+ lambda, phi, r = cart_to_sphere(x)
+ if 0.22 < lambda < 3.3 && 0.45 < phi < 1.3
+ alpha[element] = 1
+ end
+ end
end
- end
- return alpha
+ return alpha
end
function cart_to_sphere(x)
- r = norm(x)
- lambda = atan(x[2], x[1])
- if lambda < 0
- lambda += 2 * pi
- end
- phi = asin(x[3] / r)
-
- return lambda, phi, r
+ r = norm(x)
+ lambda = atan(x[2], x[1])
+ if lambda < 0
+ lambda += 2 * pi
+ end
+ phi = asin(x[3] / r)
+
+ return lambda, phi, r
end
-function Trixi.get_element_variables!(element_variables, indicator::typeof(indicator_test), ::AMRCallback)
- return nothing
+function Trixi.get_element_variables!(element_variables, indicator::typeof(indicator_test),
+ ::AMRCallback)
+ return nothing
end
initial_condition = initial_condition_convergence_test_sphere
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :inside => boundary_condition,
- :outside => boundary_condition
-)
+boundary_conditions = Dict(:inside => boundary_condition,
+ :outside => boundary_condition)
surface_flux = flux_hll
# Note that a free stream is not preserved if N < 2 * N_geo, where N is the
# polydeg of the solver and N_geo is the polydeg of the mesh.
# However, the FSP error is negligible in this example.
-solver = DGSEM(polydeg=4, surface_flux=surface_flux)
+solver = DGSEM(polydeg = 4, surface_flux = surface_flux)
# For performance reasons, only one face of the cubed sphere can be used:
@@ -87,12 +87,11 @@ solver = DGSEM(polydeg=4, surface_flux=surface_flux)
trees_per_cube_face = (6, 2)
mesh = Trixi.P4estMeshCubedSphere(trees_per_cube_face..., 6.371229e6, 30000.0,
- polydeg=4, initial_refinement_level=0)
+ polydeg = 4, initial_refinement_level = 0)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test_sphere,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test_sphere,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -103,22 +102,22 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_controller = ControllerThreeLevel(semi, indicator_test,
- base_level=0,
- max_level=1, max_threshold=0.6)
+ base_level = 0,
+ max_level = 1, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=0, # Only initial refinement
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 0, # Only initial refinement
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -126,12 +125,11 @@ callbacks = CallbackSet(summary_callback,
save_solution,
amr_callback)
-
###############################################################################
# run the simulation
# Use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl
index dd394091758..0de22eaea40 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_curved.jl
@@ -11,73 +11,77 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :all => boundary_condition
-)
+boundary_conditions = Dict(:all => boundary_condition)
# Solver with polydeg=4 to ensure free stream preservation (FSP) on non-conforming meshes.
# The polydeg of the solver must be at least twice as big as the polydeg of the mesh.
# See https://doi.org/10.1007/s10915-018-00897-9, Section 6.
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
# Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping.
# The mapping will be interpolated at tree level, and then refined without changing
# the geometry interpolant. The original mapping applied to this unstructured mesh
# causes some Jacobians to be negative, which makes the mesh invalid.
function mapping(xi, eta, zeta)
- # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
- # xi = 1.5 * xi_ + 1.5
- # eta = 1.5 * eta_ + 1.5
- # zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 1/6 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 1/6 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 1/6 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- # Transform the weird deformed cube to be approximately the cube [0,2]^3
- return SVector(x + 1, y + 1, z + 1)
+ # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
+ # xi = 1.5 * xi_ + 1.5
+ # eta = 1.5 * eta_ + 1.5
+ # zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 1 / 6 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 1 / 6 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 1 / 6 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ # Transform the weird deformed cube to be approximately the cube [0,2]^3
+ return SVector(x + 1, y + 1, z + 1)
end
# Unstructured mesh with 68 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_1.inp")
-isfile(mesh_file) || download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
- mesh_file)
+isfile(mesh_file) ||
+ download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
+ mesh_file)
# Mesh polydeg of 2 (half the solver polydeg) to ensure FSP (see above).
-mesh = P4estMesh{3}(mesh_file, polydeg=2,
- mapping=mapping,
- initial_refinement_level=0)
+mesh = P4estMesh{3}(mesh_file, polydeg = 2,
+ mapping = mapping,
+ initial_refinement_level = 0)
# Refine bottom left quadrant of each tree to level 2
function refine_fn(p8est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 && quadrant_obj.level < 2
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 &&
+ quadrant_obj.level < 2
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of a tree has level 2
# The mesh will be rebalanced before the simulation starts
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p8est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p8est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -88,27 +92,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl
index cd796c33e47..fc5e4da3ceb 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic.jl
@@ -10,31 +10,28 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict(
- :x_neg => boundary_condition,
- :x_pos => boundary_condition,
- :y_neg => boundary_condition,
- :y_pos => boundary_condition,
- :z_neg => boundary_condition,
- :z_pos => boundary_condition
-)
-
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+boundary_conditions = Dict(:x_neg => boundary_condition,
+ :x_pos => boundary_condition,
+ :y_neg => boundary_condition,
+ :y_pos => boundary_condition,
+ :z_neg => boundary_condition,
+ :z_pos => boundary_condition)
+
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
trees_per_dimension = (2, 2, 2)
-mesh = P4estMesh(trees_per_dimension, polydeg=1,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=false, initial_refinement_level=1)
+mesh = P4estMesh(trees_per_dimension, polydeg = 1,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = false, initial_refinement_level = 1)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -45,27 +42,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl
index ff101bea8aa..0fa3a28fe8b 100644
--- a/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl
+++ b/examples/p4est_3d_dgsem/elixir_euler_source_terms_nonperiodic_hohqmesh.jl
@@ -11,25 +11,25 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict( :Bottom => boundary_condition,
- :Top => boundary_condition,
- :Circle => boundary_condition,
- :Cut => boundary_condition )
+boundary_conditions = Dict(:Bottom => boundary_condition,
+ :Top => boundary_condition,
+ :Circle => boundary_condition,
+ :Cut => boundary_condition)
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
# Unstructured 3D half circle mesh from HOHQMesh
default_mesh_file = joinpath(@__DIR__, "abaqus_half_circle_3d.inp")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/11461efbfb02c42e06aca338b3d0b645/raw/81deeb1ebc4945952c30af5bb75fe222a18d975c/abaqus_half_circle_3d.inp",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/11461efbfb02c42e06aca338b3d0b645/raw/81deeb1ebc4945952c30af5bb75fe222a18d975c/abaqus_half_circle_3d.inp",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = P4estMesh{3}(mesh_file, initial_refinement_level=0)
+mesh = P4estMesh{3}(mesh_file, initial_refinement_level = 0)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,17 +40,17 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=50,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 50,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -58,12 +58,11 @@ callbacks = CallbackSet(summary_callback,
save_solution,
stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl
index 8fe96ae3dec..6a62368ef99 100644
--- a/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl
+++ b/examples/p4est_3d_dgsem/elixir_mhd_alfven_wave_nonconforming.jl
@@ -5,40 +5,43 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdEquations3D(5/3)
+equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
+coordinates_max = (1.0, 1.0, 1.0)
# Create P4estMesh with 2 x 2 x 2 trees
trees_per_dimension = (2, 2, 2)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3, initial_refinement_level=2,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=true)
+ polydeg = 3, initial_refinement_level = 2,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = true)
# OBS! Workaround to add a refinement patch after mesh is constructed
# Refine bottom left quadrant of each tree to level 4
function refine_fn(p8est, which_tree, quadrant)
- quadrant_obj = unsafe_load(quadrant)
- if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 && quadrant_obj.level < 4
- # return true (refine)
- return Cint(1)
- else
- # return false (don't refine)
- return Cint(0)
- end
+ quadrant_obj = unsafe_load(quadrant)
+ if quadrant_obj.x == 0 && quadrant_obj.y == 0 && quadrant_obj.z == 0 &&
+ quadrant_obj.level < 4
+ # return true (refine)
+ return Cint(1)
+ else
+ # return false (don't refine)
+ return Cint(0)
+ end
end
# Refine recursively until each bottom left quadrant of a tree has level 4
# The mesh will be rebalanced before the simulation starts
-refine_fn_c = @cfunction(refine_fn, Cint, (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t}, Ptr{Trixi.p8est_quadrant_t}))
+refine_fn_c = @cfunction(refine_fn, Cint,
+ (Ptr{Trixi.p8est_t}, Ptr{Trixi.p4est_topidx_t},
+ Ptr{Trixi.p8est_quadrant_t}))
Trixi.refine_p4est!(mesh.p4est, true, refine_fn_c, C_NULL)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -52,18 +55,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -71,11 +74,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl
index fc95d427abb..3941a40b2e4 100644
--- a/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl
+++ b/examples/p4est_3d_dgsem/elixir_mhd_shockcapturing_amr.jl
@@ -17,71 +17,74 @@ Weak magnetic blast wave setup taken from Section 6.1 of the paper:
[doi: 10.1016/j.jcp.2021.110580](https://doi.org/10.1016/j.jcp.2021.110580)
"""
function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations3D)
- # Center of the blast wave is selected for the domain [0, 3]^3
- inicenter = (1.5, 1.5, 1.5)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- z_norm = x[3] - inicenter[3]
- r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)
-
- delta_0 = 0.1
- r_0 = 0.3
- lambda = exp(5.0 / delta_0 * (r - r_0))
-
- prim_inner = SVector(1.2, 0.1, 0.0, 0.1, 0.9, 1.0, 1.0, 1.0, 0.0)
- prim_outer = SVector(1.2, 0.2, -0.4, 0.2, 0.3, 1.0, 1.0, 1.0, 0.0)
- prim_vars = (prim_inner + lambda * prim_outer) / (1.0 + lambda)
-
- return prim2cons(prim_vars, equations)
+ # Center of the blast wave is selected for the domain [0, 3]^3
+ inicenter = (1.5, 1.5, 1.5)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ z_norm = x[3] - inicenter[3]
+ r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)
+
+ delta_0 = 0.1
+ r_0 = 0.3
+ lambda = exp(5.0 / delta_0 * (r - r_0))
+
+ prim_inner = SVector(1.2, 0.1, 0.0, 0.1, 0.9, 1.0, 1.0, 1.0, 0.0)
+ prim_outer = SVector(1.2, 0.2, -0.4, 0.2, 0.3, 1.0, 1.0, 1.0, 0.0)
+ prim_vars = (prim_inner + lambda * prim_outer) / (1.0 + lambda)
+
+ return prim2cons(prim_vars, equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Mapping as described in https://arxiv.org/abs/2012.12040 but with slightly less warping.
# The mapping will be interpolated at tree level, and then refined without changing
# the geometry interpolant.
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/11 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/11 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/11 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 11 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 11 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 11 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
trees_per_dimension = (2, 2, 2)
mesh = P4estMesh(trees_per_dimension,
- polydeg=3,
- mapping=mapping,
- initial_refinement_level=2,
- periodicity=true)
+ polydeg = 3,
+ mapping = mapping,
+ initial_refinement_level = 2,
+ periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -95,24 +98,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
amr_indicator = IndicatorLöhner(semi,
- variable=density_pressure)
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=2,
- max_level =4, max_threshold=0.15)
+ base_level = 2,
+ max_level = 4, max_threshold = 0.15)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
cfl = 1.4
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -121,11 +124,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl
index 0109e58dfb3..c640b255b05 100644
--- a/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl
+++ b/examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl
@@ -8,240 +8,241 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
trees_per_dimension = (2, 2, 2)
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=(true, false, true), initial_refinement_level=2)
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = (true, false, true), initial_refinement_level = 2)
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion3D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion3D`)
# and by the initial condition (which passes in `CompressibleEulerEquations3D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t)
- v2 = v1
- v3 = v1
- p = rho^2
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) *
+ cos(pi_t)
+ v2 = v1
+ v3 = v1
+ p = rho^2
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- # Define auxiliary functions for the strange function of the y variable
- # to make expressions easier to read
- g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
- g_y = ( A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))
- + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0) )
- g_yy = ( 2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0)
- - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2)
- - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) )
-
- # Density and its derivatives
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
- rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
- rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
- rho_xx = -pi^2 * (rho - c)
- rho_yy = -pi^2 * (rho - c)
- rho_zz = -pi^2 * (rho - c)
-
- # Velocities and their derivatives
- # v1 terms
- v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
- v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_xx = -pi^2 * v1
- v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
- v1_zz = -pi^2 * v1
- v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
- # v2 terms (simplifies from ansatz)
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_z = v1_z
- v2_xx = v1_xx
- v2_yy = v1_yy
- v2_zz = v1_zz
- v2_xy = v1_xy
- v2_yz = v1_yz
- # v3 terms (simplifies from ansatz)
- v3 = v1
- v3_t = v1_t
- v3_x = v1_x
- v3_y = v1_y
- v3_z = v1_z
- v3_xx = v1_xx
- v3_yy = v1_yy
- v3_zz = v1_zz
- v3_xz = v1_xz
- v3_yz = v1_yz
-
- # Pressure and its derivatives
- p = rho^2
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_z = 2.0 * rho * rho_z
-
- # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
- E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
- E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
-
- # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
- kappa = equations.gamma * inv_gamma_minus_one / Pr
- q_xx = kappa * rho_xx # kappa T_xx
- q_yy = kappa * rho_yy # kappa T_yy
- q_zz = kappa * rho_zz # kappa T_zz
-
- # Stress tensor and its derivatives (exploit symmetry)
- tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
- tau12 = v1_y + v2_x
- tau13 = v1_z + v3_x
- tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
- tau23 = v2_z + v3_y
- tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
-
- tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
- tau12_x = v1_xy + v2_xx
- tau13_x = v1_xz + v3_xx
-
- tau12_y = v1_yy + v2_xy
- tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
- tau23_y = v2_yz + v3_yy
-
- tau13_z = v1_zz + v3_xz
- tau23_z = v2_zz + v3_yz
- tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
-
- # Compute the source terms
- # Density equation
- du1 = ( rho_t + rho_x * v1 + rho * v1_x
- + rho_y * v2 + rho * v2_y
- + rho_z * v3 + rho * v3_z )
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- + rho_z * v1 * v3
- + rho * v1_z * v3
- + rho * v1 * v3_z
- - mu_ * (tau11_x + tau12_y + tau13_z) )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- + rho_z * v2 * v3
- + rho * v2_z * v3
- + rho * v2 * v3_z
- - mu_ * (tau12_x + tau22_y + tau23_z) )
- # z-momentum equation
- du4 = ( rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
- + rho * v1_x * v3
- + rho * v1 * v3_x
- + rho_y * v2 * v3
- + rho * v2_y * v3
- + rho * v2 * v3_y
- + rho_z * v3^2
- + 2.0 * rho * v3 * v3_z
- - mu_ * (tau13_x + tau23_y + tau33_z) )
- # Total energy equation
- du5 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- + v3_z * (E + p) + v3 * (E_z + p_z)
- # stress tensor and temperature gradient from x-direction
- - mu_ * ( q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
- + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x)
- # stress tensor and temperature gradient terms from y-direction
- - mu_ * ( q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
- + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y)
- # stress tensor and temperature gradient terms from z-direction
- - mu_ * ( q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
- + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z) )
-
- return SVector(du1, du2, du3, du4, du5)
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ # Define auxiliary functions for the strange function of the y variable
+ # to make expressions easier to read
+ g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
+ g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) +
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0))
+ g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) -
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) -
+ A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)))
+
+ # Density and its derivatives
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
+ rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
+ rho_xx = -pi^2 * (rho - c)
+ rho_yy = -pi^2 * (rho - c)
+ rho_zz = -pi^2 * (rho - c)
+
+ # Velocities and their derivatives
+ # v1 terms
+ v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
+ v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_xx = -pi^2 * v1
+ v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
+ v1_zz = -pi^2 * v1
+ v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
+ # v2 terms (simplifies from ansatz)
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_z = v1_z
+ v2_xx = v1_xx
+ v2_yy = v1_yy
+ v2_zz = v1_zz
+ v2_xy = v1_xy
+ v2_yz = v1_yz
+ # v3 terms (simplifies from ansatz)
+ v3 = v1
+ v3_t = v1_t
+ v3_x = v1_x
+ v3_y = v1_y
+ v3_z = v1_z
+ v3_xx = v1_xx
+ v3_yy = v1_yy
+ v3_zz = v1_zz
+ v3_xz = v1_xz
+ v3_yz = v1_yz
+
+ # Pressure and its derivatives
+ p = rho^2
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_z = 2.0 * rho * rho_z
+
+ # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
+ E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
+ E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
+
+ # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
+ kappa = equations.gamma * inv_gamma_minus_one / Pr
+ q_xx = kappa * rho_xx # kappa T_xx
+ q_yy = kappa * rho_yy # kappa T_yy
+ q_zz = kappa * rho_zz # kappa T_zz
+
+ # Stress tensor and its derivatives (exploit symmetry)
+ tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
+ tau12 = v1_y + v2_x
+ tau13 = v1_z + v3_x
+ tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
+ tau23 = v2_z + v3_y
+ tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
+
+ tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
+ tau12_x = v1_xy + v2_xx
+ tau13_x = v1_xz + v3_xx
+
+ tau12_y = v1_yy + v2_xy
+ tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
+ tau23_y = v2_yz + v3_yy
+
+ tau13_z = v1_zz + v3_xz
+ tau23_z = v2_zz + v3_yz
+ tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
+
+ # Compute the source terms
+ # Density equation
+ du1 = (rho_t + rho_x * v1 + rho * v1_x
+ + rho_y * v2 + rho * v2_y
+ + rho_z * v3 + rho * v3_z)
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y
+ + rho_z * v1 * v3
+ + rho * v1_z * v3
+ + rho * v1 * v3_z -
+ mu_ * (tau11_x + tau12_y + tau13_z))
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y
+ + rho_z * v2 * v3
+ + rho * v2_z * v3
+ + rho * v2 * v3_z -
+ mu_ * (tau12_x + tau22_y + tau23_z))
+ # z-momentum equation
+ du4 = (rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
+ + rho * v1_x * v3
+ + rho * v1 * v3_x
+ + rho_y * v2 * v3
+ + rho * v2_y * v3
+ + rho * v2 * v3_y
+ + rho_z * v3^2
+ + 2.0 * rho * v3 * v3_z -
+ mu_ * (tau13_x + tau23_y + tau33_z))
+ # Total energy equation
+ du5 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y)
+ + v3_z * (E + p) + v3 * (E_z + p_z) -
+ # stress tensor and temperature gradient from x-direction
+ mu_ * (q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
+ + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x) -
+ # stress tensor and temperature gradient terms from y-direction
+ mu_ * (q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
+ + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y) -
+ # stress tensor and temperature gradient terms from z-direction
+ mu_ * (q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
+ + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z))
+
+ return SVector(du1, du2, du3, du4, du5)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
- u = initial_condition_navier_stokes_convergence_test(x, t, equations)
- return SVector(u[2], u[3], u[4])
+ u = initial_condition_navier_stokes_convergence_test(x, t, equations)
+ return SVector(u[2], u[3], u[4])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
-boundary_conditions = Dict(
- :y_neg => boundary_condition_slip_wall,
- :y_pos => boundary_condition_slip_wall
- )
+boundary_conditions = Dict(:y_neg => boundary_condition_slip_wall,
+ :y_pos => boundary_condition_slip_wall)
# define viscous boundary conditions
-boundary_conditions_parabolic = Dict(
- :y_neg => boundary_condition_top_bottom,
- :y_pos => boundary_condition_top_bottom
- )
+boundary_conditions_parabolic = Dict(:y_neg => boundary_condition_top_bottom,
+ :y_pos => boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -251,16 +252,15 @@ tspan = (0.0, 0.2)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
diff --git a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
index c5b9ccf2e38..d785013f5a9 100644
--- a/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
+++ b/examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
@@ -10,42 +10,45 @@ prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number())
"""
initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
The classical inviscid Taylor-Green vortex.
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
- v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
- v3 = 0.0
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/16.0 * A^2 * rho * (cos(2*x[1])*cos(2*x[3]) + 2*cos(2*x[2]) + 2*cos(2*x[1]) + cos(2*x[2])*cos(2*x[3]))
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations3D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
+ v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
+ v3 = 0.0
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p +
+ 1.0 / 16.0 * A^2 * rho *
+ (cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
+ cos(2 * x[2]) * cos(2 * x[3]))
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hll,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hll,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0, -1.0) .* pi
-coordinates_max = ( 1.0, 1.0, 1.0) .* pi
+coordinates_max = (1.0, 1.0, 1.0) .* pi
trees_per_dimension = (2, 2, 2)
-mesh = P4estMesh(trees_per_dimension, polydeg=3,
- coordinates_min=coordinates_min, coordinates_max=coordinates_max,
- periodicity=(true, true, true), initial_refinement_level=2)
-
+mesh = P4estMesh(trees_per_dimension, polydeg = 3,
+ coordinates_min = coordinates_min, coordinates_max = coordinates_max,
+ periodicity = (true, true, true), initial_refinement_level = 2)
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver)
@@ -59,24 +62,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 50
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal,
- enstrophy))
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
-alive_callback = AliveCallback(analysis_interval=analysis_interval,)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal,
+ enstrophy))
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
- alive_callback,save_solution)
+ alive_callback, save_solution)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl
index 316f36adc9b..aabfce0f66b 100644
--- a/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl
+++ b/examples/paper_self_gravitating_gas_dynamics/elixir_euler_convergence.jl
@@ -8,18 +8,16 @@ equations = CompressibleEulerEquations2D(2.0)
initial_condition = initial_condition_eoc_test_coupled_euler_gravity
-solver = DGSEM(polydeg=3, surface_flux=flux_hll)
+solver = DGSEM(polydeg = 3, surface_flux = flux_hll)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_eoc_test_euler)
-
+ source_terms = source_terms_eoc_test_euler)
###############################################################################
# ODE solvers, callbacks etc.
@@ -29,26 +27,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
analysis_interval = 100
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, stepsize_callback,
save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl
index f2693c89583..ce1d2cd05bd 100644
--- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl
+++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_convergence.jl
@@ -2,10 +2,8 @@
using OrdinaryDiffEq
using Trixi
-
initial_condition = initial_condition_eoc_test_coupled_euler_gravity
-
###############################################################################
# semidiscretization of the compressible Euler equations
gamma = 2.0
@@ -17,12 +15,12 @@ solver_euler = DGSEM(polydeg, flux_hll)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler,
- source_terms=source_terms_eoc_test_coupled_euler_gravity)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler,
+ source_terms = source_terms_eoc_test_coupled_euler_gravity)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -30,24 +28,23 @@ equations_gravity = HyperbolicDiffusionEquations2D()
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=2.0, # aka rho0
+parameters = ParametersEulerGravity(background_density = 2.0, # aka rho0
# rho0 is (ab)used to add a "+8π" term to the source terms
# for the manufactured solution
- gravitational_constant=1.0, # aka G
- cfl=1.1,
- resid_tol=1.0e-10,
- n_iterations_max=1000,
- timestep_gravity=timestep_gravity_erk52_3Sstar!)
+ gravitational_constant = 1.0, # aka G
+ cfl = 1.1,
+ resid_tol = 1.0e-10,
+ n_iterations_max = 1000,
+ timestep_gravity = timestep_gravity_erk52_3Sstar!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 0.5)
@@ -55,28 +52,27 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
analysis_interval = 100
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true)
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true)
callbacks = CallbackSet(summary_callback, stepsize_callback,
save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl
index fb445616cd4..f081f6bb91a 100644
--- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl
+++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_jeans_instability.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
"""
initial_condition_jeans_instability(x, t,
equations::Union{CompressibleEulerEquations2D,
@@ -19,52 +18,51 @@ The classical Jeans instability taken from
in CGS (centimeter, gram, second) units.
"""
function initial_condition_jeans_instability(x, t,
- equations::CompressibleEulerEquations2D)
- # Jeans gravitational instability test case
- # see Derigs et al. https://arxiv.org/abs/1605.03572; Sec. 4.6
- # OBS! this uses cgs (centimeter, gram, second) units
- # periodic boundaries
- # domain size [0,L]^2 depends on the wave number chosen for the perturbation
- # OBS! Be very careful here L must be chosen such that problem is periodic
- # typical final time is T = 5
- # gamma = 5/3
- dens0 = 1.5e7 # g/cm^3
- pres0 = 1.5e7 # dyn/cm^2
- delta0 = 1e-3
- # set wave vector values for perturbation (units 1/cm)
- # see FLASH manual: https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
- kx = 2.0*pi/0.5 # 2π/λ_x, λ_x = 0.5
- ky = 0.0 # 2π/λ_y, λ_y = 1e10
- k_dot_x = kx*x[1] + ky*x[2]
- # perturb density and pressure away from reference states ρ_0 and p_0
- dens = dens0*(1.0 + delta0*cos(k_dot_x)) # g/cm^3
- pres = pres0*(1.0 + equations.gamma*delta0*cos(k_dot_x)) # dyn/cm^2
- # flow starts as stationary
- velx = 0.0 # cm/s
- vely = 0.0 # cm/s
- return prim2cons((dens, velx, vely, pres), equations)
+ equations::CompressibleEulerEquations2D)
+ # Jeans gravitational instability test case
+ # see Derigs et al. https://arxiv.org/abs/1605.03572; Sec. 4.6
+ # OBS! this uses cgs (centimeter, gram, second) units
+ # periodic boundaries
+ # domain size [0,L]^2 depends on the wave number chosen for the perturbation
+ # OBS! Be very careful here L must be chosen such that problem is periodic
+ # typical final time is T = 5
+ # gamma = 5/3
+ dens0 = 1.5e7 # g/cm^3
+ pres0 = 1.5e7 # dyn/cm^2
+ delta0 = 1e-3
+ # set wave vector values for perturbation (units 1/cm)
+ # see FLASH manual: https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
+ kx = 2.0 * pi / 0.5 # 2π/λ_x, λ_x = 0.5
+ ky = 0.0 # 2π/λ_y, λ_y = 1e10
+ k_dot_x = kx * x[1] + ky * x[2]
+ # perturb density and pressure away from reference states ρ_0 and p_0
+ dens = dens0 * (1.0 + delta0 * cos(k_dot_x)) # g/cm^3
+ pres = pres0 * (1.0 + equations.gamma * delta0 * cos(k_dot_x)) # dyn/cm^2
+ # flow starts as stationary
+ velx = 0.0 # cm/s
+ vely = 0.0 # cm/s
+ return prim2cons((dens, velx, vely, pres), equations)
end
function initial_condition_jeans_instability(x, t,
equations::HyperbolicDiffusionEquations2D)
- # gravity equation: -Δϕ = -4πGρ
- # Constants taken from the FLASH manual
- # https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
- rho0 = 1.5e7
- delta0 = 1e-3
-
- phi = rho0*delta0 # constant background perturbation magnitude
- q1 = 0.0
- q2 = 0.0
- return (phi, q1, q2)
+ # gravity equation: -Δϕ = -4πGρ
+ # Constants taken from the FLASH manual
+ # https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
+ rho0 = 1.5e7
+ delta0 = 1e-3
+
+ phi = rho0 * delta0 # constant background perturbation magnitude
+ q1 = 0.0
+ q2 = 0.0
+ return (phi, q1, q2)
end
initial_condition = initial_condition_jeans_instability
-
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations_euler = CompressibleEulerEquations2D(gamma)
polydeg = 3
@@ -73,11 +71,11 @@ solver_euler = DGSEM(polydeg, flux_hll)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -85,22 +83,21 @@ equations_gravity = HyperbolicDiffusionEquations2D()
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=1.5e7, # aka rho0
- gravitational_constant=6.674e-8, # aka G
- cfl=1.6,
- resid_tol=1.0e-4,
- n_iterations_max=1000,
- timestep_gravity=timestep_gravity_carpenter_kennedy_erk54_2N!)
+parameters = ParametersEulerGravity(background_density = 1.5e7, # aka rho0
+ gravitational_constant = 6.674e-8, # aka G
+ cfl = 1.6,
+ resid_tol = 1.0e-4,
+ n_iterations_max = 1000,
+ timestep_gravity = timestep_gravity_carpenter_kennedy_erk54_2N!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 5.0)
@@ -108,51 +105,58 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
analysis_interval = 100
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
Trixi.pretty_form_utf(::Val{:energy_potential}) = "∑e_potential"
Trixi.pretty_form_ascii(::Val{:energy_potential}) = "e_potential"
-function Trixi.analyze(::Val{:energy_potential}, du, u_euler, t, semi::SemidiscretizationEulerGravity)
-
- u_gravity = Trixi.wrap_array(semi.cache.u_ode, semi.semi_gravity)
-
- mesh, equations_euler, dg, cache = Trixi.mesh_equations_solver_cache(semi.semi_euler)
- _, equations_gravity, _, _ = Trixi.mesh_equations_solver_cache(semi.semi_gravity)
-
- e_potential = Trixi.integrate_via_indices(u_euler, mesh, equations_euler, dg, cache, equations_gravity, u_gravity) do u, i, j, element, equations_euler, dg, equations_gravity, u_gravity
- u_euler_local = Trixi.get_node_vars(u_euler, equations_euler, dg, i, j, element)
- u_gravity_local = Trixi.get_node_vars(u_gravity, equations_gravity, dg, i, j, element)
- # OBS! subtraction is specific to Jeans instability test where rho0 = 1.5e7
- return (u_euler_local[1] - 1.5e7) * u_gravity_local[1]
- end
- return e_potential
+function Trixi.analyze(::Val{:energy_potential}, du, u_euler, t,
+ semi::SemidiscretizationEulerGravity)
+ u_gravity = Trixi.wrap_array(semi.cache.u_ode, semi.semi_gravity)
+
+ mesh, equations_euler, dg, cache = Trixi.mesh_equations_solver_cache(semi.semi_euler)
+ _, equations_gravity, _, _ = Trixi.mesh_equations_solver_cache(semi.semi_gravity)
+
+ e_potential = Trixi.integrate_via_indices(u_euler, mesh, equations_euler, dg, cache,
+ equations_gravity,
+ u_gravity) do u, i, j, element,
+ equations_euler, dg,
+ equations_gravity, u_gravity
+ u_euler_local = Trixi.get_node_vars(u_euler, equations_euler, dg, i, j, element)
+ u_gravity_local = Trixi.get_node_vars(u_gravity, equations_gravity, dg, i, j,
+ element)
+ # OBS! subtraction is specific to Jeans instability test where rho0 = 1.5e7
+ return (u_euler_local[1] - 1.5e7) * u_gravity_local[1]
+ end
+ return e_potential
end
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(energy_total, energy_kinetic, energy_internal, Val(:energy_potential)))
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (energy_total,
+ energy_kinetic,
+ energy_internal,
+ Val(:energy_potential)))
callbacks = CallbackSet(summary_callback, stepsize_callback,
save_restart, save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl
index 8933224a2c7..b7be2320228 100644
--- a/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl
+++ b/examples/paper_self_gravitating_gas_dynamics/elixir_eulergravity_sedov_blast_wave.jl
@@ -19,33 +19,33 @@ based on
Should be used together with [`boundary_condition_sedov_self_gravity`](@ref).
"""
function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- r = sqrt(x[1]^2 + x[2]^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
- r0 = 0.125 # = 4.0 * smallest dx (for domain length=8 and max-ref=8)
- E = 1.0
- p_inner = (equations.gamma - 1) * E / (pi * r0^2)
- p_ambient = 1e-5 # = true Sedov setup
-
- # Calculate primitive variables
- # use a logistic function to transfer density value smoothly
- L = 1.0 # maximum of function
- x0 = 1.0 # center point of function
- k = -150.0 # sharpness of transfer
- logistic_function_rho = L/(1.0 + exp(-k*(r - x0)))
- rho_ambient = 1e-5
- rho = max(logistic_function_rho, rho_ambient) # clip background density to not be so tiny
-
- # velocities are zero
- v1 = 0.0
- v2 = 0.0
-
- # use a logistic function to transfer pressure value smoothly
- logistic_function_p = p_inner/(1.0 + exp(-k*(r - r0)))
- p = max(logistic_function_p, p_ambient)
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ r = sqrt(x[1]^2 + x[2]^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
+ r0 = 0.125 # = 4.0 * smallest dx (for domain length=8 and max-ref=8)
+ E = 1.0
+ p_inner = (equations.gamma - 1) * E / (pi * r0^2)
+ p_ambient = 1e-5 # = true Sedov setup
+
+ # Calculate primitive variables
+ # use a logistic function to transfer density value smoothly
+ L = 1.0 # maximum of function
+ x0 = 1.0 # center point of function
+ k = -150.0 # sharpness of transfer
+ logistic_function_rho = L / (1.0 + exp(-k * (r - x0)))
+ rho_ambient = 1e-5
+ rho = max(logistic_function_rho, rho_ambient) # clip background density to not be so tiny
+
+ # velocities are zero
+ v1 = 0.0
+ v2 = 0.0
+
+ # use a logistic function to transfer pressure value smoothly
+ logistic_function_p = p_inner / (1.0 + exp(-k * (r - r0)))
+ p = max(logistic_function_p, p_ambient)
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_self_gravity
@@ -65,50 +65,50 @@ Should be used together with [`initial_condition_sedov_self_gravity`](@ref).
function boundary_condition_sedov_self_gravity(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::CompressibleEulerEquations2D)
- # velocities are zero, density/pressure are ambient values according to
- # initial_condition_sedov_self_gravity
- rho = 1e-5
- v1 = 0.0
- v2 = 0.0
- p = 1e-5
-
- u_boundary = prim2cons(SVector(rho, v1, v2, p), equations)
-
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- end
-
- return flux
+ # velocities are zero, density/pressure are ambient values according to
+ # initial_condition_sedov_self_gravity
+ rho = 1e-5
+ v1 = 0.0
+ v2 = 0.0
+ p = 1e-5
+
+ u_boundary = prim2cons(SVector(rho, v1, v2, p), equations)
+
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ end
+
+ return flux
end
boundary_conditions = boundary_condition_sedov_self_gravity
surface_flux = flux_hll
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations_euler, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver_euler = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-4, -4)
-coordinates_max = ( 4, 4)
+coordinates_max = (4, 4)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=100_000,
- periodicity=false)
-
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler,
- boundary_conditions=boundary_conditions)
+ initial_refinement_level = 2,
+ n_cells_max = 100_000,
+ periodicity = false)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler,
+ boundary_conditions = boundary_conditions)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -125,12 +125,13 @@ based on
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
Should be used together with [`boundary_condition_sedov_self_gravity`](@ref).
"""
-function initial_condition_sedov_self_gravity(x, t, equations::HyperbolicDiffusionEquations2D)
- # for now just use constant initial condition for sedov blast wave (can likely be improved)
- phi = 0.0
- q1 = 0.0
- q2 = 0.0
- return SVector(phi, q1, q2)
+function initial_condition_sedov_self_gravity(x, t,
+ equations::HyperbolicDiffusionEquations2D)
+ # for now just use constant initial condition for sedov blast wave (can likely be improved)
+ phi = 0.0
+ q1 = 0.0
+ q2 = 0.0
+ return SVector(phi, q1, q2)
end
"""
@@ -147,39 +148,38 @@ based on
Should be used together with [`initial_condition_sedov_self_gravity`](@ref).
"""
function boundary_condition_sedov_self_gravity(u_inner, orientation, direction, x, t,
- surface_flux_function,
- equations::HyperbolicDiffusionEquations2D)
- u_boundary = initial_condition_sedov_self_gravity(x, t, equations)
-
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- end
-
- return flux
+ surface_flux_function,
+ equations::HyperbolicDiffusionEquations2D)
+ u_boundary = initial_condition_sedov_self_gravity(x, t, equations)
+
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ end
+
+ return flux
end
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- boundary_conditions=boundary_conditions,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ boundary_conditions = boundary_conditions,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=0.0, # aka rho0
- gravitational_constant=6.674e-8, # aka G
- cfl=2.4,
- resid_tol=1.0e-4,
- n_iterations_max=100,
- timestep_gravity=timestep_gravity_erk52_3Sstar!)
+parameters = ParametersEulerGravity(background_density = 0.0, # aka rho0
+ gravitational_constant = 6.674e-8, # aka G
+ cfl = 2.4,
+ resid_tol = 1.0e-4,
+ n_iterations_max = 100,
+ timestep_gravity = timestep_gravity_erk52_3Sstar!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 1.0)
@@ -188,41 +188,42 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.0,
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=2,
- max_level =8, max_threshold=0.0003)
+ base_level = 2,
+ max_level = 8, max_threshold = 0.0003)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
analysis_interval = 100
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(energy_total, energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (energy_total,
+ energy_kinetic,
+ energy_internal))
callbacks = CallbackSet(summary_callback, amr_callback, stepsize_callback,
save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl b/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl
index 029c19380cf..df6e4e6349f 100644
--- a/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl
+++ b/examples/paper_self_gravitating_gas_dynamics/elixir_hypdiff_convergence.jl
@@ -9,10 +9,10 @@ equations = HyperbolicDiffusionEquations2D()
initial_condition = initial_condition_poisson_nonperiodic
# 1 => -x, 2 => +x, 3 => -y, 4 => +y as usual for orientations
-boundary_conditions = (x_neg=boundary_condition_poisson_nonperiodic,
- x_pos=boundary_condition_poisson_nonperiodic,
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic)
+boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic,
+ x_pos = boundary_condition_poisson_nonperiodic,
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
polydeg = 3
surface_flux = flux_lax_friedrichs
@@ -21,15 +21,13 @@ solver = DGSEM(polydeg, surface_flux)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000,
- periodicity=(false, true))
-
+ initial_refinement_level = 2,
+ n_cells_max = 30_000,
+ periodicity = (false, true))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_poisson_nonperiodic,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_poisson_nonperiodic,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,29 +38,28 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 1.0e-10
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
analysis_interval = 500
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
callbacks = CallbackSet(summary_callback, steady_state_callback, stepsize_callback,
save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/special_elixirs/elixir_euler_ad.jl b/examples/special_elixirs/elixir_euler_ad.jl
index 48fd37cc9d4..3aa44f9a773 100644
--- a/examples/special_elixirs/elixir_euler_ad.jl
+++ b/examples/special_elixirs/elixir_euler_ad.jl
@@ -6,10 +6,10 @@ using Trixi, LinearAlgebra, ForwardDiff
equations = CompressibleEulerEquations2D(1.4)
mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0),
- initial_refinement_level=2, n_cells_max=10^5)
+ initial_refinement_level = 2, n_cells_max = 10^5)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(flux_ranocha))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))
"""
initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
@@ -21,43 +21,45 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
- cent = x - cent # distance to center point
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+ cent = x - cent # distance to center point
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_isentropic_vortex, solver)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_isentropic_vortex,
+ solver)
u0_ode = compute_coefficients(0.0, semi)
J = ForwardDiff.jacobian((du_ode, γ) -> begin
- equations_inner = CompressibleEulerEquations2D(first(γ))
- semi_inner = Trixi.remake(semi, equations=equations_inner, uEltype=eltype(γ))
- Trixi.rhs!(du_ode, u0_ode, semi_inner, 0.0)
- end, similar(u0_ode), [1.4]); # γ needs to be an `AbstractArray`
+ equations_inner = CompressibleEulerEquations2D(first(γ))
+ semi_inner = Trixi.remake(semi, equations = equations_inner,
+ uEltype = eltype(γ))
+ Trixi.rhs!(du_ode, u0_ode, semi_inner, 0.0)
+ end, similar(u0_ode), [1.4]); # γ needs to be an `AbstractArray`
diff --git a/examples/structured_1d_dgsem/elixir_advection_basic.jl b/examples/structured_1d_dgsem/elixir_advection_basic.jl
index 82464f23964..cdabeb4c61a 100644
--- a/examples/structured_1d_dgsem/elixir_advection_basic.jl
+++ b/examples/structured_1d_dgsem/elixir_advection_basic.jl
@@ -11,7 +11,7 @@ advection_velocity = 1.0
equations = LinearScalarAdvectionEquation1D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0,) # minimum coordinate
coordinates_max = (1.0,) # maximum coordinate
@@ -21,8 +21,8 @@ cells_per_dimension = (16,)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,26 +35,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl b/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl
index e87e0b36b0a..1e0c579ffcf 100644
--- a/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl
+++ b/examples/structured_1d_dgsem/elixir_advection_nonperiodic.jl
@@ -11,18 +11,16 @@ equations = LinearScalarAdvectionEquation1D(advection_velocity)
initial_condition = initial_condition_gauss
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0,)
coordinates_max = (5.0,)
-mesh = StructuredMesh((16,), coordinates_min, coordinates_max, periodicity=false)
-
+mesh = StructuredMesh((16,), coordinates_min, coordinates_max, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations,
initial_condition,
solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,31 +31,30 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl
index 313812fe08d..96566bc2373 100644
--- a/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl
+++ b/examples/structured_1d_dgsem/elixir_advection_shockcapturing.jl
@@ -17,30 +17,30 @@ Slight simplification from
[DOI: 10.1006/jcph.1996.0130](https://doi.org/10.1006/jcph.1996.0130)
"""
function initial_condition_composite(x, t, equations::LinearScalarAdvectionEquation1D)
- xmin, xmax = -1.0, 1.0 # Only works if the domain is [-1.0,1.0]
- x_trans = x[1] - t
- L = xmax - xmin
- if x_trans > xmax
- x_ = x_trans - L * floor((x_trans + xmin) / L)
- elseif x_trans < xmin
- x_ = x_trans + L * floor((xmax - x_trans) / L)
- else
- x_ = x_trans
- end
-
- if x_ > -0.8 && x_ < -0.6
- value = exp(-log(2.0) * (x_ + 0.7)^2 / 0.0009)
- elseif x_ > -0.4 && x_ < -0.2
- value = 1.0
- elseif x_ > 0.0 && x_ < 0.2
- value = 1.0 - abs(10.0 * (x_ - 0.1))
- elseif x_ > 0.4 && x_ < 0.6
- value = sqrt(1.0 - 100.0 * (x_ - 0.5)^2)
- else
- value = 0.0
- end
-
- return SVector(value)
+ xmin, xmax = -1.0, 1.0 # Only works if the domain is [-1.0,1.0]
+ x_trans = x[1] - t
+ L = xmax - xmin
+ if x_trans > xmax
+ x_ = x_trans - L * floor((x_trans + xmin) / L)
+ elseif x_trans < xmin
+ x_ = x_trans + L * floor((xmax - x_trans) / L)
+ else
+ x_ = x_trans
+ end
+
+ if x_ > -0.8 && x_ < -0.6
+ value = exp(-log(2.0) * (x_ + 0.7)^2 / 0.0009)
+ elseif x_ > -0.4 && x_ < -0.2
+ value = 1.0
+ elseif x_ > 0.0 && x_ < 0.2
+ value = 1.0 - abs(10.0 * (x_ - 0.1))
+ elseif x_ > 0.4 && x_ < 0.6
+ value = sqrt(1.0 - 100.0 * (x_ - 0.5)^2)
+ else
+ value = 0.0
+ end
+
+ return SVector(value)
end
initial_condition = initial_condition_composite
@@ -52,13 +52,13 @@ volume_flux = flux_central
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=Trixi.first)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = Trixi.first)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Create curved mesh
@@ -66,12 +66,11 @@ cells_per_dimension = (120,)
coordinates_min = (-1.0,) # minimum coordinate
coordinates_max = (1.0,) # maximum coordinate
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
- periodicity=true)
+ periodicity = true)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -84,23 +83,23 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100, solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100, solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/structured_1d_dgsem/elixir_euler_sedov.jl b/examples/structured_1d_dgsem/elixir_euler_sedov.jl
index 9d7be21a5c1..4ffa100cc71 100644
--- a/examples/structured_1d_dgsem/elixir_euler_sedov.jl
+++ b/examples/structured_1d_dgsem/elixir_euler_sedov.jl
@@ -14,50 +14,50 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
- p0_outer = 1.0e-5 # = true Sedov setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
+ p0_outer = 1.0e-5 # = true Sedov setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
shock_indicator_variable = density_pressure
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=shock_indicator_variable)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = shock_indicator_variable)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
cells_per_dimension = (64,)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
-mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity=true)
+coordinates_max = (2.0,)
+mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,16 +67,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -84,11 +84,10 @@ callbacks = CallbackSet(summary_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_1d_dgsem/elixir_euler_source_terms.jl b/examples/structured_1d_dgsem/elixir_euler_source_terms.jl
index cbda7087052..97767f3e127 100644
--- a/examples/structured_1d_dgsem/elixir_euler_source_terms.jl
+++ b/examples/structured_1d_dgsem/elixir_euler_source_terms.jl
@@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test
# Note that the expected EOC of 5 is not reached with this flux.
# Using flux_hll instead yields the expected EOC.
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0,)
coordinates_max = (2.0,)
@@ -21,10 +21,8 @@ cells_per_dimension = (16,)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,29 +33,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl
index 9aa5b7f4979..d5063838136 100644
--- a/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl
+++ b/examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl
@@ -15,20 +15,18 @@ source_terms = source_terms_convergence_test
# 1*ndims == 2 directions or you can pass a tuple containing BCs for
# each direction
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
f1() = SVector(0.0)
f2() = SVector(2.0)
-mesh = StructuredMesh((16,), (f1, f2), periodicity=false)
-
+mesh = StructuredMesh((16,), (f1, f2), periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -39,30 +37,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_advection_basic.jl b/examples/structured_2d_dgsem/elixir_advection_basic.jl
index 7d2e1f49276..1d7235fc214 100644
--- a/examples/structured_2d_dgsem/elixir_advection_basic.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_basic.jl
@@ -11,10 +11,10 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
cells_per_dimension = (16, 16)
@@ -22,8 +22,8 @@ cells_per_dimension = (16, 16)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -36,26 +36,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_advection_coupled.jl b/examples/structured_2d_dgsem/elixir_advection_coupled.jl
index 1e54e411db6..2a56d23f4c0 100644
--- a/examples/structured_2d_dgsem/elixir_advection_coupled.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_coupled.jl
@@ -1,7 +1,6 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# Coupled semidiscretization of two linear advection systems, which are connected periodically
#
@@ -35,11 +34,11 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# First mesh is the left half of a [-1,1]^2 square
coordinates_min1 = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max1 = ( 0.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max1 = (0.0, 1.0) # maximum coordinates (max(x), max(y))
# Define identical resolution as a variable such that it is easier to change from `trixi_include`
cells_per_dimension = (8, 16)
@@ -49,32 +48,45 @@ cells_per_dimension1 = cells_per_dimension
mesh1 = StructuredMesh(cells_per_dimension1, coordinates_min1, coordinates_max1)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition_convergence_test, solver,
- boundary_conditions=(
- # Connect left boundary with right boundary of right mesh
- x_neg=BoundaryConditionCoupled(2, (:end, :i_forward), Float64),
- # Connect right boundary with left boundary of right mesh
- x_pos=BoundaryConditionCoupled(2, (:begin, :i_forward), Float64),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic))
-
+semi1 = SemidiscretizationHyperbolic(mesh1, equations, initial_condition_convergence_test,
+ solver,
+ boundary_conditions = (
+ # Connect left boundary with right boundary of right mesh
+ x_neg = BoundaryConditionCoupled(2,
+ (:end,
+ :i_forward),
+ Float64),
+ # Connect right boundary with left boundary of right mesh
+ x_pos = BoundaryConditionCoupled(2,
+ (:begin,
+ :i_forward),
+ Float64),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic))
# Second mesh is the right half of a [-1,1]^2 square
coordinates_min2 = (0.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max2 = (1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max2 = (1.0, 1.0) # maximum coordinates (max(x), max(y))
cells_per_dimension2 = cells_per_dimension
mesh2 = StructuredMesh(cells_per_dimension2, coordinates_min2, coordinates_max2)
-semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition_convergence_test, solver,
- boundary_conditions=(
- # Connect left boundary with right boundary of left mesh
- x_neg=BoundaryConditionCoupled(1, (:end, :i_forward), Float64),
- # Connect right boundary with left boundary of left mesh
- x_pos=BoundaryConditionCoupled(1, (:begin, :i_forward), Float64),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic))
+semi2 = SemidiscretizationHyperbolic(mesh2, equations, initial_condition_convergence_test,
+ solver,
+ boundary_conditions = (
+ # Connect left boundary with right boundary of left mesh
+ x_neg = BoundaryConditionCoupled(1,
+ (:end,
+ :i_forward),
+ Float64),
+ # Connect right boundary with left boundary of left mesh
+ x_pos = BoundaryConditionCoupled(1,
+ (:begin,
+ :i_forward),
+ Float64),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic))
# Create a semidiscretization that bundles semi1 and semi2
semi = SemidiscretizationCoupled(semi1, semi2)
@@ -90,28 +102,28 @@ ode = semidiscretize(semi, (0.0, 2.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback1 = AnalysisCallback(semi1, interval=100)
-analysis_callback2 = AnalysisCallback(semi2, interval=100)
+analysis_callback1 = AnalysisCallback(semi1, interval = 100)
+analysis_callback2 = AnalysisCallback(semi2, interval = 100)
analysis_callback = AnalysisCallbackCoupled(semi, analysis_callback1, analysis_callback2)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_advection_extended.jl b/examples/structured_2d_dgsem/elixir_advection_extended.jl
index fbaa7783d99..df7e1f375a9 100644
--- a/examples/structured_2d_dgsem/elixir_advection_extended.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_extended.jl
@@ -18,11 +18,11 @@ initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# The initial condition is 2-periodic
coordinates_min = (-1.5, 1.3) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 0.5, 5.3) # maximum coordinates (max(x), max(y))
+coordinates_max = (0.5, 5.3) # maximum coordinates (max(x), max(y))
cells_per_dimension = (19, 37)
@@ -31,8 +31,7 @@ mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -47,24 +46,24 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback,
@@ -72,14 +71,13 @@ callbacks = CallbackSet(summary_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_advection_free_stream.jl b/examples/structured_2d_dgsem/elixir_advection_free_stream.jl
index 155a2d19fc9..7785b4f9e18 100644
--- a/examples/structured_2d_dgsem/elixir_advection_free_stream.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_free_stream.jl
@@ -11,21 +11,21 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_constant
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
@@ -36,7 +36,6 @@ mesh = StructuredMesh(cells_per_dimension, mapping)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -48,30 +47,30 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=2.0)
+stepsize_callback = StepsizeCallback(cfl = 2.0)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_restart, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_restart, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl
index 2aad3a01566..e2e113b168d 100644
--- a/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_nonperiodic.jl
@@ -13,16 +13,14 @@ initial_condition = initial_condition_gauss
# you can either use a single function to impose the BCs weakly in all
# 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
-mesh = StructuredMesh((16, 16), coordinates_min, coordinates_max, periodicity=false)
-
+coordinates_max = (5.0, 5.0)
+mesh = StructuredMesh((16, 16), coordinates_min, coordinates_max, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,17 +31,17 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -52,7 +50,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl b/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl
index b9a6d3f91ae..b70deb12318 100644
--- a/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_parallelogram.jl
@@ -7,24 +7,23 @@
using OrdinaryDiffEq
using Trixi
-
# initial_condition_convergence_test transformed to the parallelogram
function initial_condition_parallelogram(x, t, equation::LinearScalarAdvectionEquation2D)
- # Transform back to unit square
- x_transformed = SVector(x[1] - x[2], x[2])
- a = equation.advection_velocity
- a_transformed = SVector(a[1] - a[2], a[2])
-
- # Store translated coordinate for easy use of exact solution
- x_translated = x_transformed - a_transformed * t
-
- c = 1.0
- A = 0.5
- L = 2
- f = 1/L
- omega = 2 * pi * f
- scalar = c + A * sin(omega * sum(x_translated))
- return SVector(scalar)
+ # Transform back to unit square
+ x_transformed = SVector(x[1] - x[2], x[2])
+ a = equation.advection_velocity
+ a_transformed = SVector(a[1] - a[2], a[2])
+
+ # Store translated coordinate for easy use of exact solution
+ x_translated = x_transformed - a_transformed * t
+
+ c = 1.0
+ A = 0.5
+ L = 2
+ f = 1 / L
+ omega = 2 * pi * f
+ scalar = c + A * sin(omega * sum(x_translated))
+ return SVector(scalar)
end
###############################################################################
@@ -35,7 +34,7 @@ advection_velocity = (-0.5, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Define faces for a parallelogram that looks like this
#
@@ -49,11 +48,11 @@ mapping(xi, eta) = SVector(xi + eta, eta)
cells_per_dimension = (16, 16)
# Create curved mesh with 16 x 16 elements, periodic in both dimensions
-mesh = StructuredMesh(cells_per_dimension, mapping; periodicity=(true, true))
+mesh = StructuredMesh(cells_per_dimension, mapping; periodicity = (true, true))
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_parallelogram, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_parallelogram,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -66,26 +65,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_advection_restart.jl b/examples/structured_2d_dgsem/elixir_advection_restart.jl
index 82eaa21333a..19863faae8d 100644
--- a/examples/structured_2d_dgsem/elixir_advection_restart.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_restart.jl
@@ -10,7 +10,6 @@ restart_file = "restart_000021.h5"
trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file))
-
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -29,9 +28,9 @@ ode = semidiscretize(semi, tspan, restart_filename);
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
-integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Get the last time index and work with that.
load_timestep!(integrator, restart_filename)
diff --git a/examples/structured_2d_dgsem/elixir_advection_rotated.jl b/examples/structured_2d_dgsem/elixir_advection_rotated.jl
index 7dfee23a067..826c7ebaacb 100644
--- a/examples/structured_2d_dgsem/elixir_advection_rotated.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_rotated.jl
@@ -7,7 +7,6 @@
using OrdinaryDiffEq
using Trixi
-
# Define new structs inside a module to allow re-evaluating the file.
# This module name needs to be unique among all examples, otherwise Julia will throw warnings
# if multiple test cases using the same module name are run in the same session.
@@ -17,40 +16,41 @@ using Trixi
# initial_condition_convergence_test transformed to the rotated rectangle
struct InitialConditionConvergenceTestRotated
- sin_alpha::Float64
- cos_alpha::Float64
+ sin_alpha::Float64
+ cos_alpha::Float64
end
function InitialConditionConvergenceTestRotated(alpha)
- sin_alpha, cos_alpha = sincos(alpha)
+ sin_alpha, cos_alpha = sincos(alpha)
- InitialConditionConvergenceTestRotated(sin_alpha, cos_alpha)
+ InitialConditionConvergenceTestRotated(sin_alpha, cos_alpha)
end
-function (initial_condition::InitialConditionConvergenceTestRotated)(x, t, equation::LinearScalarAdvectionEquation2D)
- sin_ = initial_condition.sin_alpha
- cos_ = initial_condition.cos_alpha
+function (initial_condition::InitialConditionConvergenceTestRotated)(x, t,
+ equation::LinearScalarAdvectionEquation2D)
+ sin_ = initial_condition.sin_alpha
+ cos_ = initial_condition.cos_alpha
- # Rotate back to unit square
+ # Rotate back to unit square
- # Clockwise rotation by α and translation by 1
- # Multiply with [ cos(α) sin(α);
- # -sin(α) cos(α)]
- x_rot = SVector(cos_ * x[1] + sin_ * x[2], -sin_ * x[1] + cos_ * x[2])
- a = equation.advection_velocity
- a_rot = SVector(cos_ * a[1] + sin_ * a[2], -sin_ * a[1] + cos_ * a[2])
+ # Clockwise rotation by α and translation by 1
+ # Multiply with [ cos(α) sin(α);
+ # -sin(α) cos(α)]
+ x_rot = SVector(cos_ * x[1] + sin_ * x[2], -sin_ * x[1] + cos_ * x[2])
+ a = equation.advection_velocity
+ a_rot = SVector(cos_ * a[1] + sin_ * a[2], -sin_ * a[1] + cos_ * a[2])
- # Store translated coordinate for easy use of exact solution
- x_trans = x_rot - a_rot * t
+ # Store translated coordinate for easy use of exact solution
+ x_trans = x_rot - a_rot * t
- c = 1.0
- A = 0.5
- L = 2
- f = 1/L
- omega = 2 * pi * f
- scalar = c + A * sin(omega * sum(x_trans))
+ c = 1.0
+ A = 0.5
+ L = 2
+ f = 1 / L
+ omega = 2 * pi * f
+ scalar = c + A * sin(omega * sum(x_trans))
- return SVector(scalar)
+ return SVector(scalar)
end
end # module TrixiExtensionAdvectionRotated
@@ -70,7 +70,7 @@ advection_velocity = Tuple(T * [0.2, -0.7])
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
mapping(xi, eta) = T * SVector(xi, eta)
@@ -82,7 +82,6 @@ mesh = StructuredMesh(cells_per_dimension, mapping)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -94,26 +93,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl b/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl
index d0db19ea635..50393d50a19 100644
--- a/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl
+++ b/examples/structured_2d_dgsem/elixir_advection_waving_flag.jl
@@ -11,14 +11,14 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_convergence_test
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
cells_per_dimension = (16, 16)
@@ -28,7 +28,6 @@ mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4))
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,30 +39,30 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.4)
+stepsize_callback = StepsizeCallback(cfl = 1.4)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_restart, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_restart, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_IDP.jl b/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_IDP.jl
index 5761e638e41..57c2d2a7801 100644
--- a/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_IDP.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_IDP.jl
@@ -14,26 +14,26 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[1],
- positivity_variables_nonlinear=(pressure,),
- positivity_correction_factor=0.1,
- spec_entropy=false,
- max_iterations_newton=10,
- newton_tolerances=(1.0e-12, 1.0e-14),
- bar_states=true,
- smoothness_indicator=false)
+ positivity_variables_cons = [1],
+ positivity_variables_nonlinear = (pressure,),
+ positivity_correction_factor = 0.1,
+ spec_entropy = false,
+ max_iterations_newton = 10,
+ newton_tolerances = (1.0e-12, 1.0e-14),
+ bar_states = true,
+ smoothness_indicator = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
cells_per_dimension = (4, 4)
@@ -41,7 +41,6 @@ mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -51,16 +50,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -69,9 +68,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_MCL.jl b/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_MCL.jl
index fa59e5e0d37..20a20a9c20b 100644
--- a/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_MCL.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_convergence_wavingflag_MCL.jl
@@ -14,25 +14,26 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=false,
- DensityAlphaForAll=false,
- SequentialLimiter=false,
- ConservativeLimiter=false,
- DensityPositivityLimiter=true,
- PressurePositivityLimiterKuzmin=true, PressurePositivityLimiterKuzminExact=true,
- Plotting=true)
+ DensityLimiter = false,
+ DensityAlphaForAll = false,
+ SequentialLimiter = false,
+ ConservativeLimiter = false,
+ DensityPositivityLimiter = true,
+ PressurePositivityLimiterKuzmin = true,
+ PressurePositivityLimiterKuzminExact = true,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
cells_per_dimension = (4, 4)
@@ -40,7 +41,6 @@ mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -50,16 +50,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -68,9 +68,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_double_mach.jl b/examples/structured_2d_dgsem/elixir_euler_double_mach.jl
index 3d34e28a4f7..d306b70cb75 100644
--- a/examples/structured_2d_dgsem/elixir_euler_double_mach.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_double_mach.jl
@@ -11,33 +11,35 @@ initial_condition = Trixi.initial_condition_double_mach_reflection
boundary_condition_inflow_outflow = BoundaryConditionCharacteristic(initial_condition)
-boundary_conditions = (y_neg=Trixi.boundary_condition_mixed_dirichlet_wall,
- y_pos=boundary_condition_inflow_outflow,
- x_pos=boundary_condition_inflow_outflow,
- x_neg=boundary_condition_inflow_outflow)
+boundary_conditions = (y_neg = Trixi.boundary_condition_mixed_dirichlet_wall,
+ y_pos = boundary_condition_inflow_outflow,
+ x_pos = boundary_condition_inflow_outflow,
+ x_neg = boundary_condition_inflow_outflow)
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- spec_entropy=true,
- positivity_correction_factor=0.1, max_iterations_newton=100,
- bar_states=true)
+ local_minmax_variables_cons = [1],
+ spec_entropy = true,
+ positivity_correction_factor = 0.1,
+ max_iterations_newton = 100,
+ bar_states = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
initial_refinement_level = 6
cells_per_dimension = (4 * 2^initial_refinement_level, 2^initial_refinement_level)
coordinates_min = (0.0, 0.0)
coordinates_max = (4.0, 1.0)
-mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity=false)
+mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -48,17 +50,17 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -68,9 +70,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_double_mach_MCL.jl b/examples/structured_2d_dgsem/elixir_euler_double_mach_MCL.jl
index 2516d7e2054..c7df12f27af 100644
--- a/examples/structured_2d_dgsem/elixir_euler_double_mach_MCL.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_double_mach_MCL.jl
@@ -11,37 +11,38 @@ initial_condition = Trixi.initial_condition_double_mach_reflection
boundary_condition_inflow_outflow = BoundaryConditionCharacteristic(initial_condition)
-boundary_conditions = (y_neg=Trixi.boundary_condition_mixed_dirichlet_wall,
- y_pos=boundary_condition_inflow_outflow,
- x_pos=boundary_condition_inflow_outflow,
- x_neg=boundary_condition_inflow_outflow)
+boundary_conditions = (y_neg = Trixi.boundary_condition_mixed_dirichlet_wall,
+ y_pos = boundary_condition_inflow_outflow,
+ x_pos = boundary_condition_inflow_outflow,
+ x_neg = boundary_condition_inflow_outflow)
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=true,
- DensityAlphaForAll=false,
- SequentialLimiter=true,
- ConservativeLimiter=false,
- DensityPositivityLimiter=false,
- PressurePositivityLimiterKuzmin=false,
- SemiDiscEntropyLimiter=false,
- Plotting=true)
+ DensityLimiter = true,
+ DensityAlphaForAll = false,
+ SequentialLimiter = true,
+ ConservativeLimiter = false,
+ DensityPositivityLimiter = false,
+ PressurePositivityLimiterKuzmin = false,
+ SemiDiscEntropyLimiter = false,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
initial_refinement_level = 6
cells_per_dimension = (4 * 2^initial_refinement_level, 2^initial_refinement_level)
coordinates_min = (0.0, 0.0)
coordinates_max = (4.0, 1.0)
-mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, periodicity=false)
+mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -52,17 +53,17 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -72,9 +73,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_ec.jl b/examples/structured_2d_dgsem/elixir_euler_ec.jl
index 2c91349ff98..29686bd3cb7 100644
--- a/examples/structured_2d_dgsem/elixir_euler_ec.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_ec.jl
@@ -13,25 +13,25 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=4, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the curved quad mesh from a mapping function
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
@@ -53,15 +53,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -72,7 +72,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_free_stream.jl b/examples/structured_2d_dgsem/elixir_euler_free_stream.jl
index c4ddb887e5f..3aab4be979e 100644
--- a/examples/structured_2d_dgsem/elixir_euler_free_stream.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_free_stream.jl
@@ -9,21 +9,21 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_constant
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
@@ -32,7 +32,6 @@ mesh = StructuredMesh(cells_per_dimension, mapping)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -42,16 +41,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=2.0)
+stepsize_callback = StepsizeCallback(cfl = 2.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -61,7 +60,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_free_stream_MCL.jl b/examples/structured_2d_dgsem/elixir_euler_free_stream_MCL.jl
index 8999d435ecc..163cc6519a9 100644
--- a/examples/structured_2d_dgsem/elixir_euler_free_stream_MCL.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_free_stream_MCL.jl
@@ -10,23 +10,24 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_constant
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=false,
- DensityAlphaForAll=false,
- SequentialLimiter=false,
- ConservativeLimiter=false,
- PressurePositivityLimiterKuzmin=true, PressurePositivityLimiterKuzminExact=true,
- DensityPositivityLimiter=true,
- SemiDiscEntropyLimiter=false,
- smoothness_indicator=false,
- Plotting=true)
+ DensityLimiter = false,
+ DensityAlphaForAll = false,
+ SequentialLimiter = false,
+ ConservativeLimiter = false,
+ PressurePositivityLimiterKuzmin = true,
+ PressurePositivityLimiterKuzminExact = true,
+ DensityPositivityLimiter = true,
+ SemiDiscEntropyLimiter = false,
+ smoothness_indicator = false,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Mapping as described in https://arxiv.org/abs/2012.12040 but reduced to 2D.
@@ -37,21 +38,21 @@ solver = DGSEM(basis, surface_flux, volume_integral)
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (32, 32)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=true)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -64,29 +65,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
save_solution)
-
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_free_stream_sc_subcell.jl b/examples/structured_2d_dgsem/elixir_euler_free_stream_sc_subcell.jl
index 6b70438044e..639fb928754 100644
--- a/examples/structured_2d_dgsem/elixir_euler_free_stream_sc_subcell.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_free_stream_sc_subcell.jl
@@ -10,22 +10,22 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_constant
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[1],
- positivity_variables_nonlinear=(pressure,),
- positivity_correction_factor=0.1,
- spec_entropy=false,
- smoothness_indicator=false,
- bar_states=true,
- max_iterations_newton=10,
- newton_tolerances=(1.0e-12, 1.0e-14))
+ positivity_variables_cons = [1],
+ positivity_variables_nonlinear = (pressure,),
+ positivity_correction_factor = 0.1,
+ spec_entropy = false,
+ smoothness_indicator = false,
+ bar_states = true,
+ max_iterations_newton = 10,
+ newton_tolerances = (1.0e-12, 1.0e-14))
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Mapping as described in https://arxiv.org/abs/2012.12040 but reduced to 2D.
@@ -36,21 +36,21 @@ solver = DGSEM(basis, surface_flux, volume_integral)
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (32, 32)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=true)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -63,29 +63,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
save_solution)
-
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl
index bb5870ab9d5..6c254e8bd8b 100644
--- a/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_rayleigh_taylor_instability.jl
@@ -29,40 +29,40 @@ defined below.
"""
@inline function initial_condition_rayleigh_taylor_instability(x, t,
equations::CompressibleEulerEquations2D,
- slope=1000)
- tol = 1e2*eps()
-
- if x[2] < 0.5
- p = 2*x[2] + 1
- else
- p = x[2] + 3/2
- end
-
- # smooth the discontinuity to avoid ambiguity at element interfaces
- smoothed_heaviside(x, left, right) = left + 0.5*(1 + tanh(slope * x)) * (right-left)
- rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0)
-
- c = sqrt(equations.gamma * p / rho)
- # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the
- # initial condition satisfies reflective boundary conditions at the top/bottom boundaries.
- v = -0.025 * c * cos(8*pi*x[1]) * sin(pi*x[2])^6
- u = 0.0
-
- return prim2cons(SVector(rho, u, v, p), equations)
+ slope = 1000)
+ tol = 1e2 * eps()
+
+ if x[2] < 0.5
+ p = 2 * x[2] + 1
+ else
+ p = x[2] + 3 / 2
+ end
+
+ # smooth the discontinuity to avoid ambiguity at element interfaces
+ smoothed_heaviside(x, left, right) = left + 0.5 * (1 + tanh(slope * x)) * (right - left)
+ rho = smoothed_heaviside(x[2] - 0.5, 2.0, 1.0)
+
+ c = sqrt(equations.gamma * p / rho)
+ # the velocity is multiplied by sin(pi*y)^6 as in Remacle et al. 2003 to ensure that the
+ # initial condition satisfies reflective boundary conditions at the top/bottom boundaries.
+ v = -0.025 * c * cos(8 * pi * x[1]) * sin(pi * x[2])^6
+ u = 0.0
+
+ return prim2cons(SVector(rho, u, v, p), equations)
end
@inline function source_terms_rayleigh_taylor_instability(u, x, t,
equations::CompressibleEulerEquations2D)
- g = 1.0
- rho, rho_v1, rho_v2, rho_e = u
+ g = 1.0
+ rho, rho_v1, rho_v2, rho_e = u
- return SVector(0.0, 0.0, g*rho, g*rho_v2)
+ return SVector(0.0, 0.0, g * rho, g * rho_v2)
end
# numerical parameters
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hll,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hll,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# The domain is [0, 0.25] x [0, 1]
mapping(xi, eta) = SVector(0.25 * 0.5 * (1.0 + xi), 0.5 * (1.0 + eta))
@@ -72,12 +72,10 @@ cells_per_dimension = (num_elements_per_dimension, num_elements_per_dimension *
mesh = StructuredMesh(cells_per_dimension, mapping)
initial_condition = initial_condition_rayleigh_taylor_instability
-boundary_conditions = (
- x_neg=boundary_condition_slip_wall,
- x_pos=boundary_condition_slip_wall,
- y_neg=boundary_condition_slip_wall,
- y_pos=boundary_condition_slip_wall,
- )
+boundary_conditions = (x_neg = boundary_condition_slip_wall,
+ x_pos = boundary_condition_slip_wall,
+ y_neg = boundary_condition_slip_wall,
+ y_pos = boundary_condition_slip_wall)
# # Alternative setup: left/right periodic BCs and Dirichlet BCs on the top/bottom.
# boundary_conditions = (
@@ -88,8 +86,8 @@ boundary_conditions = (
# )
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
- source_terms=source_terms_rayleigh_taylor_instability,
- boundary_conditions=boundary_conditions)
+ source_terms = source_terms_rayleigh_taylor_instability,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -100,9 +98,9 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -111,7 +109,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_sedov.jl b/examples/structured_2d_dgsem/elixir_euler_sedov.jl
index efc3b6627c0..42094d7191c 100644
--- a/examples/structured_2d_dgsem/elixir_euler_sedov.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_sedov.jl
@@ -14,25 +14,25 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
@@ -43,29 +43,30 @@ volume_flux = flux_ranocha
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Get the curved quad mesh from a mapping function
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi, eta)
- y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta))
+ y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta))
- x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y))
+ x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=true)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)
# create the semidiscretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -79,15 +80,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 300
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=300,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 300,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -98,7 +99,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_shock_upstream_MCL.jl b/examples/structured_2d_dgsem/elixir_euler_shock_upstream_MCL.jl
index 2d4f8f608a1..06eaceb4f7c 100644
--- a/examples/structured_2d_dgsem/elixir_euler_shock_upstream_MCL.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_shock_upstream_MCL.jl
@@ -17,37 +17,38 @@ A version of the classical Kelvin-Helmholtz instability based on
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
function initial_condition_inviscid_bow(x, t, equations::CompressibleEulerEquations2D)
- rho = 1.4
- p = 1.0
- v1 = 4.0
- v2 = 0.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ rho = 1.4
+ p = 1.0
+ v1 = 4.0
+ v2 = 0.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_inviscid_bow
boundary_condition = BoundaryConditionCharacteristic(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition_slip_wall,
- y_neg=boundary_condition,
- y_pos=boundary_condition)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition_slip_wall,
+ y_neg = boundary_condition,
+ y_pos = boundary_condition)
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 5
basis = LobattoLegendreBasis(polydeg)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=true,
- DensityAlphaForAll=false,
- SequentialLimiter=true,
- ConservativeLimiter=false,
- PressurePositivityLimiterKuzmin=false, PressurePositivityLimiterKuzminExact=false,
- DensityPositivityLimiter=false,
- SemiDiscEntropyLimiter=false,
- Plotting=true)
+ DensityLimiter = true,
+ DensityAlphaForAll = false,
+ SequentialLimiter = true,
+ ConservativeLimiter = false,
+ PressurePositivityLimiterKuzmin = false,
+ PressurePositivityLimiterKuzminExact = false,
+ DensityPositivityLimiter = false,
+ SemiDiscEntropyLimiter = false,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# domain
@@ -68,19 +69,21 @@ alpha = acos(3.85 / 5.9)
l = (pi / 4) / (pi / 2 + 1)
f1(s) = SVector(5.9 * cos(pi - s * alpha) + 3.85, 5.9 * sin(pi - s * alpha)) # left
function f2(s) # right
- t = 0.5 * s + 0.5 # in [0,1]
- if 0 <= t <= l
- beta = t / l # in [0,1]
- return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi), 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5)
- elseif l < t <= 1 - l # 0 <= t - l <= 1-2l
- beta = (t - l) / (1 - 2 * l) # in [0,1]
- return SVector(-0.5, -0.5 + beta)
- else # 1 - l < t <= 1
- beta = (t + l - 1) / l # in [0,1]
- return SVector(0.5 * cos(pi - beta * 0.5 * pi), 0.5 * sin(pi - beta * 0.5 * pi) + 0.5)
- end
+ t = 0.5 * s + 0.5 # in [0,1]
+ if 0 <= t <= l
+ beta = t / l # in [0,1]
+ return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi),
+ 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5)
+ elseif l < t <= 1 - l # 0 <= t - l <= 1-2l
+ beta = (t - l) / (1 - 2 * l) # in [0,1]
+ return SVector(-0.5, -0.5 + beta)
+ else # 1 - l < t <= 1
+ beta = (t + l - 1) / l # in [0,1]
+ return SVector(0.5 * cos(pi - beta * 0.5 * pi),
+ 0.5 * sin(pi - beta * 0.5 * pi) + 0.5)
+ end
end
-f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a) # bottom
+f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a) # bottom
f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a) # top
faces = (f1, f2, f3, f4)
@@ -89,21 +92,22 @@ Trixi.validate_faces(faces)
mapping_bow = Trixi.transfinite_mapping(faces)
mapping_as_string = "a = sqrt(5.9^2 - 3.85^2); alpha = acos(3.85 / 5.9); l = (pi / 4) / (pi / 2 + 1); " *
- "f1(s) = SVector(5.9 * cos(pi - s * alpha) + 3.85, 5.9 * sin(pi - s * alpha)); " *
- "function f2(s); t = 0.5 * s + 0.5; " *
- "if 0 <= t <= l; beta = t / l; return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi), 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5); " *
- "elseif l < t <= 1 - l; beta = (t - l) / (1 - 2 * l); return SVector(-0.5, -0.5 + beta); " *
- "else beta = (t + l - 1) / l; return SVector(0.5 * cos(pi - beta * 0.5 * pi), 0.5 * sin(pi - beta * 0.5 * pi) + 0.5); end; end; " *
- "f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a); " *
- "f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a); " *
- "faces = (f1, f2, f3, f4); mapping = Trixi.transfinite_mapping(faces)"
+ "f1(s) = SVector(5.9 * cos(pi - s * alpha) + 3.85, 5.9 * sin(pi - s * alpha)); " *
+ "function f2(s); t = 0.5 * s + 0.5; " *
+ "if 0 <= t <= l; beta = t / l; return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi), 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5); " *
+ "elseif l < t <= 1 - l; beta = (t - l) / (1 - 2 * l); return SVector(-0.5, -0.5 + beta); " *
+ "else beta = (t + l - 1) / l; return SVector(0.5 * cos(pi - beta * 0.5 * pi), 0.5 * sin(pi - beta * 0.5 * pi) + 0.5); end; end; " *
+ "f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a); " *
+ "f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a); " *
+ "faces = (f1, f2, f3, f4); mapping = Trixi.transfinite_mapping(faces)"
cells_per_dimension = (24, 36)
-mesh = StructuredMesh(cells_per_dimension, mapping_bow, mapping_as_string=mapping_as_string, periodicity=false)
+mesh = StructuredMesh(cells_per_dimension, mapping_bow,
+ mapping_as_string = mapping_as_string, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -114,29 +118,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=2000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 2000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
save_solution)
-
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl b/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl
index 5d266629764..def69ecc282 100644
--- a/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_shock_upstream_sc_subcell.jl
@@ -17,33 +17,33 @@ A version of the classical Kelvin-Helmholtz instability based on
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
function initial_condition_inviscid_bow(x, t, equations::CompressibleEulerEquations2D)
- rho = 1.4
- p = 1.0
- v1 = 4.0
- v2 = 0.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ rho = 1.4
+ p = 1.0
+ v1 = 4.0
+ v2 = 0.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_inviscid_bow
boundary_condition = BoundaryConditionCharacteristic(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition_slip_wall,
- y_neg=boundary_condition,
- y_pos=boundary_condition)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition_slip_wall,
+ y_neg = boundary_condition,
+ y_pos = boundary_condition)
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 5
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- spec_entropy=true,
- max_iterations_newton=100,
- bar_states=true)
+ local_minmax_variables_cons = [1],
+ spec_entropy = true,
+ max_iterations_newton = 100,
+ bar_states = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# domain
@@ -64,19 +64,21 @@ alpha = acos(3.85 / 5.9)
l = (pi / 4) / (pi / 2 + 1)
f1(s) = SVector(5.9 * cos(pi - s * alpha) + 3.85, 5.9 * sin(pi - s * alpha)) # left
function f2(s) # right
- t = 0.5 * s + 0.5 # in [0,1]
- if 0 <= t <= l
- beta = t / l # in [0,1]
- return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi), 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5)
- elseif l < t <= 1 - l # 0 <= t - l <= 1-2l
- beta = (t - l) / (1 - 2 * l) # in [0,1]
- return SVector(-0.5, -0.5 + beta)
- else # 1 - l < t <= 1
- beta = (t + l - 1) / l # in [0,1]
- return SVector(0.5 * cos(pi - beta * 0.5 * pi), 0.5 * sin(pi - beta * 0.5 * pi) + 0.5)
- end
+ t = 0.5 * s + 0.5 # in [0,1]
+ if 0 <= t <= l
+ beta = t / l # in [0,1]
+ return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi),
+ 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5)
+ elseif l < t <= 1 - l # 0 <= t - l <= 1-2l
+ beta = (t - l) / (1 - 2 * l) # in [0,1]
+ return SVector(-0.5, -0.5 + beta)
+ else # 1 - l < t <= 1
+ beta = (t + l - 1) / l # in [0,1]
+ return SVector(0.5 * cos(pi - beta * 0.5 * pi),
+ 0.5 * sin(pi - beta * 0.5 * pi) + 0.5)
+ end
end
-f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a) # bottom
+f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a) # bottom
f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a) # top
faces = (f1, f2, f3, f4)
@@ -85,21 +87,22 @@ Trixi.validate_faces(faces)
mapping_bow = Trixi.transfinite_mapping(faces)
mapping_as_string = "a = sqrt(5.9^2 - 3.85^2); alpha = acos(3.85 / 5.9); l = (pi / 4) / (pi / 2 + 1); " *
- "f1(s) = SVector(5.9 * cos(pi - s * alpha) + 3.85, 5.9 * sin(pi - s * alpha)); " *
- "function f2(s); t = 0.5 * s + 0.5; " *
- "if 0 <= t <= l; beta = t / l; return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi), 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5); " *
- "elseif l < t <= 1 - l; beta = (t - l) / (1 - 2 * l); return SVector(-0.5, -0.5 + beta); " *
- "else beta = (t + l - 1) / l; return SVector(0.5 * cos(pi - beta * 0.5 * pi), 0.5 * sin(pi - beta * 0.5 * pi) + 0.5); end; end; " *
- "f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a); " *
- "f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a); " *
- "faces = (f1, f2, f3, f4); mapping = Trixi.transfinite_mapping(faces)"
+ "f1(s) = SVector(5.9 * cos(pi - s * alpha) + 3.85, 5.9 * sin(pi - s * alpha)); " *
+ "function f2(s); t = 0.5 * s + 0.5; " *
+ "if 0 <= t <= l; beta = t / l; return SVector(0.5 * cos(1.5 * pi - beta * 0.5 * pi), 0.5 * sin(1.5 * pi - beta * 0.5 * pi) - 0.5); " *
+ "elseif l < t <= 1 - l; beta = (t - l) / (1 - 2 * l); return SVector(-0.5, -0.5 + beta); " *
+ "else beta = (t + l - 1) / l; return SVector(0.5 * cos(pi - beta * 0.5 * pi), 0.5 * sin(pi - beta * 0.5 * pi) + 0.5); end; end; " *
+ "f3(s) = SVector(0.0, (a - 1.0) * 0.5 * (s + 1.0) - a); " *
+ "f4(s) = SVector(0.0, -(a - 1.0) * 0.5 * (s + 1.0) + a); " *
+ "faces = (f1, f2, f3, f4); mapping = Trixi.transfinite_mapping(faces)"
cells_per_dimension = (24, 36)
-mesh = StructuredMesh(cells_per_dimension, mapping_bow, mapping_as_string=mapping_as_string, periodicity=false)
+mesh = StructuredMesh(cells_per_dimension, mapping_bow,
+ mapping_as_string = mapping_as_string, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -110,29 +113,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=2000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 2000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
save_solution)
-
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms.jl
index 70d3e060dd0..6827848e185 100644
--- a/examples/structured_2d_dgsem/elixir_euler_source_terms.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_source_terms.jl
@@ -11,7 +11,7 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
@@ -20,10 +20,8 @@ cells_per_dimension = (16, 16)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,16 +32,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -53,7 +51,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl
index 94537ecef0d..f42d223611a 100644
--- a/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl
@@ -12,21 +12,20 @@ initial_condition = initial_condition_convergence_test
# you can either use a single function to impose the BCs weakly in all
# 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition,
- y_neg=boundary_condition,
- y_pos=boundary_condition,)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition,
+ y_neg = boundary_condition,
+ y_pos = boundary_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
-mesh = StructuredMesh((16, 16), coordinates_min, coordinates_max, periodicity=false)
+mesh = StructuredMesh((16, 16), coordinates_min, coordinates_max, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,19 +36,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -58,7 +57,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl
index a9c08049f41..5d6b0908389 100644
--- a/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_parallelogram.jl
@@ -9,7 +9,7 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Define faces for a parallelogram that looks like this
#
@@ -24,10 +24,8 @@ cells_per_dimension = (16, 16)
mesh = StructuredMesh(cells_per_dimension, mapping)
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -38,16 +36,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -57,7 +55,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl
index fdd189ffb55..f2e3c448893 100644
--- a/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_rotated.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
# Define new structs inside a module to allow re-evaluating the file.
# This module name needs to be unique among all examples, otherwise Julia will throw warnings
# if multiple test cases using the same module name are run in the same session.
@@ -12,68 +11,69 @@ using Trixi
# initial_condition_convergence_test transformed to the rotated rectangle
struct InitialConditionSourceTermsRotated
- sin_alpha::Float64
- cos_alpha::Float64
+ sin_alpha::Float64
+ cos_alpha::Float64
end
function InitialConditionSourceTermsRotated(alpha)
- sin_alpha, cos_alpha = sincos(alpha)
+ sin_alpha, cos_alpha = sincos(alpha)
- InitialConditionSourceTermsRotated(sin_alpha, cos_alpha)
+ InitialConditionSourceTermsRotated(sin_alpha, cos_alpha)
end
-function (initial_condition::InitialConditionSourceTermsRotated)(x, t, equations::CompressibleEulerEquations2D)
- sin_ = initial_condition.sin_alpha
- cos_ = initial_condition.cos_alpha
+function (initial_condition::InitialConditionSourceTermsRotated)(x, t,
+ equations::CompressibleEulerEquations2D)
+ sin_ = initial_condition.sin_alpha
+ cos_ = initial_condition.cos_alpha
- # Rotate back to unit square and translate from [-1, 1]^2 to [0, 2]^2
+ # Rotate back to unit square and translate from [-1, 1]^2 to [0, 2]^2
- # Clockwise rotation by α and translation by 1
- # Multiply with [ cos(α) sin(α);
- # -sin(α) cos(α)]
- x1 = cos_ * x[1] + sin_ * x[2] + 1
- x2 = -sin_ * x[1] + cos_ * x[2] + 1
+ # Clockwise rotation by α and translation by 1
+ # Multiply with [ cos(α) sin(α);
+ # -sin(α) cos(α)]
+ x1 = cos_ * x[1] + sin_ * x[2] + 1
+ x2 = -sin_ * x[1] + cos_ * x[2] + 1
- rho, rho_v1, rho_v2, rho_e = initial_condition_convergence_test(SVector(x1, x2), t, equations)
+ rho, rho_v1, rho_v2, rho_e = initial_condition_convergence_test(SVector(x1, x2), t,
+ equations)
- # Rotate velocity vector counterclockwise
- # Multiply with [ cos(α) -sin(α);
- # sin(α) cos(α)]
- rho_v1_rot = cos_ * rho_v1 - sin_ * rho_v2
- rho_v2_rot = sin_ * rho_v1 + cos_ * rho_v2
+ # Rotate velocity vector counterclockwise
+ # Multiply with [ cos(α) -sin(α);
+ # sin(α) cos(α)]
+ rho_v1_rot = cos_ * rho_v1 - sin_ * rho_v2
+ rho_v2_rot = sin_ * rho_v1 + cos_ * rho_v2
- return SVector(rho, rho_v1_rot, rho_v2_rot, rho_e)
+ return SVector(rho, rho_v1_rot, rho_v2_rot, rho_e)
end
+@inline function (source_terms::InitialConditionSourceTermsRotated)(u, x, t,
+ equations::CompressibleEulerEquations2D)
+ sin_ = source_terms.sin_alpha
+ cos_ = source_terms.cos_alpha
-@inline function (source_terms::InitialConditionSourceTermsRotated)(u, x, t, equations::CompressibleEulerEquations2D)
- sin_ = source_terms.sin_alpha
- cos_ = source_terms.cos_alpha
-
- # Rotate back to unit square and translate from [-1, 1]^2 to [0, 2]^2
+ # Rotate back to unit square and translate from [-1, 1]^2 to [0, 2]^2
- # Clockwise rotation by α and translation by 1
- # Multiply with [ cos(α) sin(α);
- # -sin(α) cos(α)]
- x1 = cos_ * x[1] + sin_ * x[2] + 1
- x2 = -sin_ * x[1] + cos_ * x[2] + 1
+ # Clockwise rotation by α and translation by 1
+ # Multiply with [ cos(α) sin(α);
+ # -sin(α) cos(α)]
+ x1 = cos_ * x[1] + sin_ * x[2] + 1
+ x2 = -sin_ * x[1] + cos_ * x[2] + 1
- du1, du2, du3, du4 = source_terms_convergence_test(u, SVector(x1, x2), t, equations)
+ du1, du2, du3, du4 = source_terms_convergence_test(u, SVector(x1, x2), t, equations)
- # Rotate velocity vector counterclockwise
- # Multiply with [ cos(α) -sin(α);
- # sin(α) cos(α)]
- du2_rotated = cos_ * du2 - sin_ * du3
- du3_rotated = sin_ * du2 + cos_ * du3
+ # Rotate velocity vector counterclockwise
+ # Multiply with [ cos(α) -sin(α);
+ # sin(α) cos(α)]
+ du2_rotated = cos_ * du2 - sin_ * du3
+ du3_rotated = sin_ * du2 + cos_ * du3
- return SVector(du1, du2_rotated, du3_rotated, du4)
+ return SVector(du1, du2_rotated, du3_rotated, du4)
end
end # module TrixiExtensionEulerRotated
import .TrixiExtensionEulerRotated
-
###############################################################################
# semidiscretization of the compressible Euler equations
@@ -85,8 +85,7 @@ sin_ = initial_condition_source_terms.sin_alpha
cos_ = initial_condition_source_terms.cos_alpha
T = [cos_ -sin_; sin_ cos_]
-
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
mapping(xi, eta) = T * SVector(xi, eta)
@@ -94,10 +93,8 @@ cells_per_dimension = (16, 16)
mesh = StructuredMesh(cells_per_dimension, mapping)
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_source_terms, solver,
- source_terms=initial_condition_source_terms)
-
+ source_terms = initial_condition_source_terms)
###############################################################################
# ODE solvers, callbacks etc.
@@ -108,16 +105,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -127,7 +124,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl
index 13ed29db2ba..53c07261c36 100644
--- a/examples/structured_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl
@@ -16,26 +16,26 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- spec_entropy=true,
- bar_states=false)
+ local_minmax_variables_cons = [1],
+ spec_entropy = true,
+ bar_states = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Waving flag
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
mapping = Trixi.transfinite_mapping((f1, f2, f3, f4))
cells_per_dimension = (16, 16)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=true)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms)
+ source_terms = source_terms)
###############################################################################
# ODE solvers, callbacks etc.
@@ -46,16 +46,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -65,9 +65,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl b/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl
index 505e28ecd8d..4a78b65ae0b 100644
--- a/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl
+++ b/examples/structured_2d_dgsem/elixir_euler_source_terms_waving_flag.jl
@@ -9,23 +9,21 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Deformed rectangle that looks like a waving flag,
# lower and upper faces are sinus curves, left and right are vertical lines.
f1(s) = SVector(-1.0, s - 1.0)
-f2(s) = SVector( 1.0, s + 1.0)
+f2(s) = SVector(1.0, s + 1.0)
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
-f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
+f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
cells_per_dimension = (16, 16)
mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4))
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -36,16 +34,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -55,7 +53,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl b/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl
index de15f6b2bc3..b96f1d3cd68 100644
--- a/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl
+++ b/examples/structured_2d_dgsem/elixir_eulerpolytropic_ec.jl
@@ -15,25 +15,25 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
volume_flux = flux_winters_etal
-solver = DGSEM(polydeg=4, surface_flux=flux_winters_etal,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = flux_winters_etal,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the curved quad mesh from a mapping function
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (16, 16)
@@ -55,15 +55,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -74,7 +74,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
index 6730b1c4beb..ccb74fa4b68 100644
--- a/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
+++ b/examples/structured_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
@@ -7,43 +7,42 @@ using Trixi
equations = HyperbolicDiffusionEquations2D()
-@inline function initial_condition_harmonic_nonperiodic(x, t, equations::HyperbolicDiffusionEquations2D)
- # elliptic equation: -ν Δϕ = 0 in Ω, u = g on ∂Ω
- if t == 0.0
- phi = 1.0
- q1 = 1.0
- q2 = 1.0
- else
- C = inv(sinh(pi))
- sinpi_x1, cospi_x1 = sincos(pi*x[1])
- sinpi_x2, cospi_x2 = sincos(pi*x[2])
- sinh_pix1 = sinh(pi*x[1])
- cosh_pix1 = cosh(pi*x[1])
- sinh_pix2 = sinh(pi*x[2])
- cosh_pix2 = cosh(pi*x[2])
- phi = C * (sinh_pix1 * sinpi_x2 + sinh_pix2 * sinpi_x1)
- q1 = C * pi * (cosh_pix1 * sinpi_x2 + sinh_pix2 * cospi_x1)
- q2 = C * pi * (sinh_pix1 * cospi_x2 + cosh_pix2 * sinpi_x1)
- end
- return SVector(phi, q1, q2)
+@inline function initial_condition_harmonic_nonperiodic(x, t,
+ equations::HyperbolicDiffusionEquations2D)
+ # elliptic equation: -ν Δϕ = 0 in Ω, u = g on ∂Ω
+ if t == 0.0
+ phi = 1.0
+ q1 = 1.0
+ q2 = 1.0
+ else
+ C = inv(sinh(pi))
+ sinpi_x1, cospi_x1 = sincos(pi * x[1])
+ sinpi_x2, cospi_x2 = sincos(pi * x[2])
+ sinh_pix1 = sinh(pi * x[1])
+ cosh_pix1 = cosh(pi * x[1])
+ sinh_pix2 = sinh(pi * x[2])
+ cosh_pix2 = cosh(pi * x[2])
+ phi = C * (sinh_pix1 * sinpi_x2 + sinh_pix2 * sinpi_x1)
+ q1 = C * pi * (cosh_pix1 * sinpi_x2 + sinh_pix2 * cospi_x1)
+ q2 = C * pi * (sinh_pix1 * cospi_x2 + cosh_pix2 * sinpi_x1)
+ end
+ return SVector(phi, q1, q2)
end
initial_condition = initial_condition_harmonic_nonperiodic
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=4, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 4, surface_flux = flux_godunov)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
cells_per_dimension = (8, 8)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
- periodicity=false)
-
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions,
- source_terms=source_terms_harmonic)
-
+ boundary_conditions = boundary_conditions,
+ source_terms = source_terms_harmonic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -54,30 +53,29 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl
index ba77dca9a99..681b3bd781b 100644
--- a/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl
+++ b/examples/structured_2d_dgsem/elixir_hypdiff_nonperiodic.jl
@@ -9,40 +9,38 @@ equations = HyperbolicDiffusionEquations2D()
initial_condition = initial_condition_poisson_nonperiodic
-solver = DGSEM(polydeg=6, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 6, surface_flux = flux_lax_friedrichs)
-boundary_conditions = (x_neg=boundary_condition_poisson_nonperiodic,
- x_pos=boundary_condition_poisson_nonperiodic,
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic)
+boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic,
+ x_pos = boundary_condition_poisson_nonperiodic,
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
###############################################################################
# Get the curved quad mesh from a mapping function
#
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
# Create curved mesh with 8 x 8 elements
cells_per_dimension = (8, 8)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=(false, true))
-
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = (false, true))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_poisson_nonperiodic,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_poisson_nonperiodic,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -53,31 +51,30 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 4000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=4000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 4000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.9)
+stepsize_callback = StepsizeCallback(cfl = 1.9)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
sol = Trixi.solve(ode, Trixi.HypDiffN3Erk3Sstar52(),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl
index 259875050c6..e8f2b2ecc3a 100644
--- a/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/structured_2d_dgsem/elixir_mhd_alfven_wave.jl
@@ -5,31 +5,34 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test
# Get the DG approximation space
volume_flux = (flux_central, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Get the curved quad mesh from a mapping function
# Mapping as described in https://arxiv.org/abs/1809.01178
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0, sqrt(2)]
- # Note, we use the domain [0, sqrt(2)]^2 for the Alfvén wave convergence test case
- xi = 0.5 * sqrt(2) * xi_ + 0.5 * sqrt(2)
- eta = 0.5 * sqrt(2) * eta_ + 0.5 * sqrt(2)
+ # Transform input variables between -1 and 1 onto [0, sqrt(2)]
+ # Note, we use the domain [0, sqrt(2)]^2 for the Alfvén wave convergence test case
+ xi = 0.5 * sqrt(2) * xi_ + 0.5 * sqrt(2)
+ eta = 0.5 * sqrt(2) * eta_ + 0.5 * sqrt(2)
- y = eta + sqrt(2)/12 * (cos(1.5 * pi * (2 * xi - sqrt(2))/sqrt(2)) *
- cos(0.5 * pi * (2 * eta - sqrt(2))/sqrt(2)))
+ y = eta +
+ sqrt(2) / 12 * (cos(1.5 * pi * (2 * xi - sqrt(2)) / sqrt(2)) *
+ cos(0.5 * pi * (2 * eta - sqrt(2)) / sqrt(2)))
- x = xi + sqrt(2)/12 * (cos(0.5 * pi * (2 * xi - sqrt(2))/sqrt(2)) *
- cos(2 * pi * (2 * y - sqrt(2))/sqrt(2)))
+ x = xi +
+ sqrt(2) / 12 * (cos(0.5 * pi * (2 * xi - sqrt(2)) / sqrt(2)) *
+ cos(2 * pi * (2 * y - sqrt(2)) / sqrt(2)))
- return SVector(x, y)
+ return SVector(x, y)
end
cells_per_dimension = (4, 4)
@@ -47,21 +50,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
-
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
+
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 2.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -73,7 +79,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_mhd_ec.jl b/examples/structured_2d_dgsem/elixir_mhd_ec.jl
index 634738e5c8b..a6c31744ca5 100644
--- a/examples/structured_2d_dgsem/elixir_mhd_ec.jl
+++ b/examples/structured_2d_dgsem/elixir_mhd_ec.jl
@@ -8,45 +8,46 @@ using Trixi
equations = IdealGlmMhdEquations2D(1.4)
function initial_condition_shifted_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)
- # Adapted MHD version of the weak blast wave from Hennemann & Gassner JCP paper 2020 (Sec. 6.3)
- # Same discontinuity in the velocities but with magnetic fields
- # Set up polar coordinates
- inicenter = (1.5, 1.5)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos(phi)
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin(phi)
- p = r > 0.5 ? 1.0 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, 0.0, p, 1.0, 1.0, 1.0, 0.0), equations)
+ # Adapted MHD version of the weak blast wave from Hennemann & Gassner JCP paper 2020 (Sec. 6.3)
+ # Same discontinuity in the velocities but with magnetic fields
+ # Set up polar coordinates
+ inicenter = (1.5, 1.5)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos(phi)
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin(phi)
+ p = r > 0.5 ? 1.0 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, 0.0, p, 1.0, 1.0, 1.0, 0.0), equations)
end
initial_condition = initial_condition_shifted_weak_blast_wave
# Get the DG approximation space
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=5, surface_flux=(flux_hindenlang_gassner, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 5,
+ surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Get the curved quad mesh from a mapping function
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D
function mapping(xi_, eta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3))
+ y = eta + 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3))
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3))
+ x = xi + 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3))
- return SVector(x, y)
+ return SVector(x, y)
end
# Create curved mesh with 8 x 8 elements
@@ -65,21 +66,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
-
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
+
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -91,7 +95,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl b/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl
index 084aeca90b9..6668014a0b6 100644
--- a/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl
+++ b/examples/structured_2d_dgsem/elixir_mhd_ec_shockcapturing.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
equations = IdealGlmMhdEquations2D(1.4)
@@ -10,17 +9,17 @@ equations = IdealGlmMhdEquations2D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
# Get the curved quad mesh from a mapping function
@@ -31,16 +30,14 @@ function mapping(xi, eta)
x = 2.0 * xi + 1.0 / 6.0 * (cos(0.5 * pi * xi) * cos(2 * pi * y))
return SVector(x, y)
- end
+end
cells_per_dimension = (16, 16)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=true)
-
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -50,14 +47,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -68,7 +65,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl b/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl
index 44bc7a12b35..e65ed19221e 100644
--- a/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl
+++ b/examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl
@@ -2,12 +2,12 @@
using OrdinaryDiffEq
using Trixi
- ###############################################################################
- # Semidiscretization of the shallow water equations
+###############################################################################
+# Semidiscretization of the shallow water equations
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=1.4)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 1.4)
"""
initial_condition_conical_island(x, t, equations::ShallowWaterEquations2D)
@@ -20,29 +20,29 @@ discontinuous water height is smoothed by a logistic function. This simulation u
boundary conditions.
"""
function initial_condition_conical_island(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
+ # Set the background values
- v1 = 0.0
- v2 = 0.0
+ v1 = 0.0
+ v2 = 0.0
- x1, x2 = x
- b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2))
+ x1, x2 = x
+ b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2))
- # use a logistic function to transfer water height value smoothly
- L = equations.H0 # maximum of function
- x0 = 0.3 # center point of function
- k = -25.0 # sharpness of transfer
+ # use a logistic function to transfer water height value smoothly
+ L = equations.H0 # maximum of function
+ x0 = 0.3 # center point of function
+ k = -25.0 # sharpness of transfer
- H = max(b, L/(1.0 + exp(-k*(sqrt(x1^2+x2^2) - x0))))
+ H = max(b, L / (1.0 + exp(-k * (sqrt(x1^2 + x2^2) - x0))))
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_conical_island
@@ -51,19 +51,20 @@ initial_condition = initial_condition_conical_island
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -71,7 +72,7 @@ solver = DGSEM(basis, surface_flux, volume_integral)
# Get the StructuredMesh and setup a periodic mesh
coordinates_min = (-1.0, -1.0)
-coordinates_max = (1.0, 1.0)
+coordinates_max = (1.0, 1.0)
cells_per_dimension = (16, 16)
@@ -92,22 +93,22 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
###############################################################################
# run the simulation
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
index 15cfe6698fc..bc198f18835 100644
--- a/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
+++ b/examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
@@ -7,7 +7,7 @@ using Trixi
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
"""
initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations2D)
@@ -28,53 +28,52 @@ The particular setup below is taken from Section 6.2 of
curvilinear meshes with wet/dry fronts accelerated by GPUs
[DOI: 10.1016/j.jcp.2018.08.038](https://doi.org/10.1016/j.jcp.2018.08.038).
"""
-function initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations2D)
- a = 1.0
- h_0 = 0.1
- sigma = 0.5
- ω = sqrt(2 * equations.gravity * h_0) / a
-
- v1 = -sigma * ω * sin(ω * t)
- v2 = sigma * ω * cos(ω * t)
-
- b = h_0 * ((x[1])^2 + (x[2])^2) / a^2
-
- H = sigma * h_0 / a^2 * (2 * x[1] * cos(ω * t) + 2 * x[2] * sin(ω * t) - sigma) + h_0
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations2D)
+ a = 1.0
+ h_0 = 0.1
+ sigma = 0.5
+ ω = sqrt(2 * equations.gravity * h_0) / a
+
+ v1 = -sigma * ω * sin(ω * t)
+ v2 = sigma * ω * cos(ω * t)
+
+ b = h_0 * ((x[1])^2 + (x[2])^2) / a^2
+
+ H = sigma * h_0 / a^2 * (2 * x[1] * cos(ω * t) + 2 * x[2] * sin(ω * t) - sigma) + h_0
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_parabolic_bowl
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.6,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.6,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
-
###############################################################################
coordinates_min = (-2.0, -2.0)
@@ -96,24 +95,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl
index 18f48080850..48fe37b9996 100644
--- a/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl
+++ b/examples/structured_2d_dgsem/elixir_shallowwater_source_terms.jl
@@ -5,13 +5,14 @@ using Trixi
###############################################################################
# semidiscretization of the shallow water equations
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
@@ -20,10 +21,8 @@ cells_per_dimension = (8, 8)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
-
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,16 +33,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=2.0)
+stepsize_callback = StepsizeCallback(cfl = 2.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -53,7 +52,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced.jl b/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced.jl
index 17836fa6b8f..61dd252fd83 100644
--- a/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced.jl
+++ b/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced.jl
@@ -7,21 +7,21 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function (set in the initial conditions)
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=3.0)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 3.0)
# An initial condition with constant total water height and zero velocities to test well-balancedness.
# Note, this routine is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_discontinuous_well_balancedness` below.
function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
- x1, x2 = x
- b = ( 1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
- + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
+ x1, x2 = x
+ b = (1.5 / exp(0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2)))
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_well_balancedness
@@ -30,16 +30,17 @@ initial_condition = initial_condition_well_balancedness
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_lax_friedrichs, hydrostatic_reconstruction_audusse_etal),
+surface_flux = (FluxHydrostaticReconstruction(flux_lax_friedrichs,
+ hydrostatic_reconstruction_audusse_etal),
flux_nonconservative_audusse_etal)
-solver = DGSEM(polydeg=4, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup a structured periodic mesh
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
cells_per_dimension = (4, 4)
@@ -64,30 +65,33 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the specific mesh loaded above!
-function initial_condition_discontinuous_well_balancedness(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_discontinuous_well_balancedness(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan),
+ element, equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -96,16 +100,16 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -113,7 +117,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl b/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
index b18b02e0b4c..8e492b1ba05 100644
--- a/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
+++ b/examples/structured_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
@@ -8,8 +8,7 @@ using Printf: @printf, @sprintf
#
# TODO: TrixiShallowWater: wet/dry example elixir
-
-equations = ShallowWaterEquations2D(gravity_constant=9.812)
+equations = ShallowWaterEquations2D(gravity_constant = 9.812)
"""
initial_condition_well_balanced_chen_noelle(x, t, equations:: ShallowWaterEquations2D)
@@ -24,29 +23,30 @@ The initial condition is taken from Section 5.2 of the paper:
A new hydrostatic reconstruction scheme based on subcell reconstructions
[DOI:10.1137/15M1053074](https://dx.doi.org/10.1137/15M1053074)
"""
-function initial_condition_complex_bottom_well_balanced(x, t, equations:: ShallowWaterEquations2D)
- v1 = 0
- v2 = 0
- b = sin(4 * pi * x[1]) + 3
-
- if x[1] >= 0.5
- b = sin(4 * pi * x[1]) + 1
- end
-
- H = max(b, 2.5)
-
- if x[1] >= 0.5
- H = max(b, 1.5)
- end
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_complex_bottom_well_balanced(x, t,
+ equations::ShallowWaterEquations2D)
+ v1 = 0
+ v2 = 0
+ b = sin(4 * pi * x[1]) + 3
+
+ if x[1] >= 0.5
+ b = sin(4 * pi * x[1]) + 1
+ end
+
+ H = max(b, 2.5)
+
+ if x[1] >= 0.5
+ H = max(b, 1.5)
+ end
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_complex_bottom_well_balanced
@@ -56,23 +56,23 @@ initial_condition = initial_condition_complex_bottom_well_balanced
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
-
###############################################################################
# Create the StructuredMesh for the domain [0, 1]^2
@@ -83,7 +83,6 @@ cells_per_dimension = (16, 16)
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
-
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -107,18 +106,20 @@ ode = semidiscretize(semi, tspan)
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
- # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
- if i == 1
- x_node = SVector(nextfloat(x_node[1]) , x_node[2])
- elseif i == nnodes(semi.solver)
- x_node = SVector(prevfloat(x_node[1]) , x_node[2])
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
+ # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
+ if i == 1
+ x_node = SVector(nextfloat(x_node[1]), x_node[2])
+ elseif i == nnodes(semi.solver)
+ x_node = SVector(prevfloat(x_node[1]), x_node[2])
+ end
+ u_node = initial_condition_complex_bottom_well_balanced(x_node, first(tspan),
+ equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
end
- u_node = initial_condition_complex_bottom_well_balanced(x_node, first(tspan), equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
end
###############################################################################
@@ -127,25 +128,27 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution, stepsize_callback)
+callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
+ stepsize_callback)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(stage_limiter!); dt=1.0,
- ode_default_options()..., callback=callbacks, adaptive=false);
+sol = solve(ode, SSPRK43(stage_limiter!); dt = 1.0,
+ ode_default_options()..., callback = callbacks, adaptive = false);
summary_callback() # print the timer summary
@@ -160,39 +163,43 @@ summary_callback() # print the timer summary
function lake_at_rest_error_two_level(u, x, equations::ShallowWaterEquations2D)
h, _, _, b = u
- # For well-balancedness testing with possible wet/dry regions the reference
- # water height `H0` accounts for the possibility that the bottom topography
- # can emerge out of the water as well as for the threshold offset to avoid
- # division by a "hard" zero water heights as well.
- if x[1] < 0.5
- H0_wet_dry = max( 2.5 , b + equations.threshold_limiter )
- else
- H0_wet_dry = max( 1.5 , b + equations.threshold_limiter )
- end
-
- return abs(H0_wet_dry - (h + b))
+ # For well-balancedness testing with possible wet/dry regions the reference
+ # water height `H0` accounts for the possibility that the bottom topography
+ # can emerge out of the water as well as for the threshold offset to avoid
+ # division by a "hard" zero water heights as well.
+ if x[1] < 0.5
+ H0_wet_dry = max(2.5, b + equations.threshold_limiter)
+ else
+ H0_wet_dry = max(1.5, b + equations.threshold_limiter)
+ end
+
+ return abs(H0_wet_dry - (h + b))
end
# point to the data we want to analyze
u = Trixi.wrap_array(sol[end], semi)
# Perform the actual integration of the well-balancedness error over the domain
-l1_well_balance_error = Trixi.integrate_via_indices(u, mesh, equations, semi.solver, semi.cache; normalize=true) do u, i, j, element, equations, solver
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, solver, i, j, element)
- # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
- # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
- if i == 1
- x_node = SVector(nextfloat(x_node[1]) , x_node[2])
- elseif i == nnodes(semi.solver)
- x_node = SVector(prevfloat(x_node[1]) , x_node[2])
- end
- u_local = Trixi.get_node_vars(u, equations, solver, i, j, element)
- return lake_at_rest_error_two_level(u_local, x_node, equations)
+l1_well_balance_error = Trixi.integrate_via_indices(u, mesh, equations, semi.solver,
+ semi.cache;
+ normalize = true) do u, i, j, element,
+ equations, solver
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, solver,
+ i, j, element)
+ # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
+ # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
+ if i == 1
+ x_node = SVector(nextfloat(x_node[1]), x_node[2])
+ elseif i == nnodes(semi.solver)
+ x_node = SVector(prevfloat(x_node[1]), x_node[2])
+ end
+ u_local = Trixi.get_node_vars(u, equations, solver, i, j, element)
+ return lake_at_rest_error_two_level(u_local, x_node, equations)
end
# report the well-balancedness lake-at-rest error to the screen
println("─"^100)
println(" Lake-at-rest error for '", Trixi.get_name(equations), "' with ", summary(solver),
- " at final time " * @sprintf("%10.8e", tspan[end]))
+ " at final time " * @sprintf("%10.8e", tspan[end]))
@printf(" %-12s:", Trixi.pretty_form_utf(lake_at_rest_error))
@printf(" % 10.8e", l1_well_balance_error)
diff --git a/examples/structured_3d_dgsem/elixir_advection_basic.jl b/examples/structured_3d_dgsem/elixir_advection_basic.jl
index 47ae6352485..5b0bb371fe8 100644
--- a/examples/structured_3d_dgsem/elixir_advection_basic.jl
+++ b/examples/structured_3d_dgsem/elixir_advection_basic.jl
@@ -11,18 +11,18 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
cells_per_dimension = (8, 8, 8)
# Create curved mesh with 8 x 8 x 8 elements
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,30 +35,30 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, save_restart, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, save_restart,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_3d_dgsem/elixir_advection_free_stream.jl b/examples/structured_3d_dgsem/elixir_advection_free_stream.jl
index 749233b8c68..12d52f15160 100644
--- a/examples/structured_3d_dgsem/elixir_advection_free_stream.jl
+++ b/examples/structured_3d_dgsem/elixir_advection_free_stream.jl
@@ -13,24 +13,27 @@ solver = DGSEM(3, flux_lax_friedrichs)
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/8 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
cells_per_dimension = (8, 8, 8)
@@ -41,7 +44,6 @@ mesh = StructuredMesh(cells_per_dimension, mapping)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_constant, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -53,26 +55,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=2.0)
+stepsize_callback = StepsizeCallback(cfl = 2.0)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl b/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl
index fa8ae756566..1a20a9c8533 100644
--- a/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl
+++ b/examples/structured_3d_dgsem/elixir_advection_nonperiodic_curved.jl
@@ -11,36 +11,38 @@ equations = LinearScalarAdvectionEquation3D(advection_velocity)
initial_condition = initial_condition_convergence_test
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
# Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping.
function mapping(xi, eta, zeta)
- # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
- # xi = 1.5 * xi_ + 1.5
- # eta = 1.5 * eta_ + 1.5
- # zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 1/6 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 1/6 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 1/6 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
+ # xi = 1.5 * xi_ + 1.5
+ # eta = 1.5 * eta_ + 1.5
+ # zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 1 / 6 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 1 / 6 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 1 / 6 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
cells_per_dimension = (8, 8, 8)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=false)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -51,20 +53,20 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -76,7 +78,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_advection_restart.jl b/examples/structured_3d_dgsem/elixir_advection_restart.jl
index 921c5310340..e81ad5d6430 100644
--- a/examples/structured_3d_dgsem/elixir_advection_restart.jl
+++ b/examples/structured_3d_dgsem/elixir_advection_restart.jl
@@ -6,8 +6,7 @@ using Trixi
# create a restart file
trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_basic.jl"),
- cells_per_dimension=(4, 4, 4))
-
+ cells_per_dimension = (4, 4, 4))
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -18,7 +17,8 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_basic.jl"),
restart_filename = joinpath("out", "restart_000010.h5")
mesh = load_mesh(restart_filename)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
tspan = (load_time(restart_filename), 2.0)
dt = load_dt(restart_filename)
@@ -27,14 +27,13 @@ ode = semidiscretize(semi, tspan, restart_filename);
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
-integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Get the last time index and work with that.
load_timestep!(integrator, restart_filename)
-
###############################################################################
# run the simulation
diff --git a/examples/structured_3d_dgsem/elixir_euler_ec.jl b/examples/structured_3d_dgsem/elixir_euler_ec.jl
index 0009eb31180..1330006760e 100644
--- a/examples/structured_3d_dgsem/elixir_euler_ec.jl
+++ b/examples/structured_3d_dgsem/elixir_euler_ec.jl
@@ -5,7 +5,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-equations = CompressibleEulerEquations3D(5/3)
+equations = CompressibleEulerEquations3D(5 / 3)
initial_condition = initial_condition_weak_blast_wave
@@ -13,32 +13,35 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=5, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 5, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the curved quad mesh from a file
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/8 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
cells_per_dimension = (4, 4, 4)
@@ -59,15 +62,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -78,7 +81,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_euler_free_stream.jl b/examples/structured_3d_dgsem/elixir_euler_free_stream.jl
index b0e71435767..1b01287100e 100644
--- a/examples/structured_3d_dgsem/elixir_euler_free_stream.jl
+++ b/examples/structured_3d_dgsem/elixir_euler_free_stream.jl
@@ -9,29 +9,32 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_constant
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/8 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
cells_per_dimension = (4, 4, 4)
@@ -40,7 +43,6 @@ mesh = StructuredMesh(cells_per_dimension, mapping)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -50,30 +52,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_euler_sedov.jl b/examples/structured_3d_dgsem/elixir_euler_sedov.jl
index e0595437c99..1f2d9d2eeb6 100644
--- a/examples/structured_3d_dgsem/elixir_euler_sedov.jl
+++ b/examples/structured_3d_dgsem/elixir_euler_sedov.jl
@@ -14,28 +14,29 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
with smaller strength of the initial discontinuity.
"""
-function initial_condition_medium_sedov_blast_wave(x, t, equations::CompressibleEulerEquations3D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- z_norm = x[3] - inicenter[3]
- r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (4 * pi * r0^2)
- p0_outer = 1.0e-3
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_medium_sedov_blast_wave(x, t,
+ equations::CompressibleEulerEquations3D)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ z_norm = x[3] - inicenter[3]
+ r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (4 * pi * r0^2)
+ p0_outer = 1.0e-3
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_medium_sedov_blast_wave
@@ -45,30 +46,31 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi, eta, zeta)
- y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta) * cos(0.5 * pi * zeta))
+ y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta) * cos(0.5 * pi * zeta))
- x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y) * cos(0.5 * pi * zeta))
+ x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y) * cos(0.5 * pi * zeta))
- z = zeta + 0.125 * (cos(0.5 * pi * x) * cos(pi * y) * cos(0.5 * pi * zeta))
+ z = zeta + 0.125 * (cos(0.5 * pi * x) * cos(pi * y) * cos(0.5 * pi * zeta))
- return SVector(x, y, z)
+ return SVector(x, y, z)
end
cells_per_dimension = (4, 4, 4)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=true)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -82,15 +84,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -101,7 +103,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_euler_source_terms.jl b/examples/structured_3d_dgsem/elixir_euler_source_terms.jl
index d8c6ea4bb83..ebf1336c12c 100644
--- a/examples/structured_3d_dgsem/elixir_euler_source_terms.jl
+++ b/examples/structured_3d_dgsem/elixir_euler_source_terms.jl
@@ -11,8 +11,8 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
# coordinates_min = (0.0, 0.0, 0.0)
# coordinates_max = (2.0, 2.0, 2.0)
@@ -28,8 +28,7 @@ cells_per_dimension = (4, 4, 4)
mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4, f5, f6))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,27 +39,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl b/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl
index 8ddfd426553..eb358fa5da1 100644
--- a/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl
+++ b/examples/structured_3d_dgsem/elixir_euler_source_terms_nonperiodic_curved.jl
@@ -12,46 +12,48 @@ initial_condition = initial_condition_convergence_test
# you can either use a single function to impose the BCs weakly in all
# 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition,
- y_neg=boundary_condition,
- y_pos=boundary_condition,
- z_neg=boundary_condition,
- z_pos=boundary_condition,)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition,
+ y_neg = boundary_condition,
+ y_pos = boundary_condition,
+ z_neg = boundary_condition,
+ z_pos = boundary_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
# Mapping as described in https://arxiv.org/abs/2012.12040 but with less warping.
function mapping(xi, eta, zeta)
- # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
- # xi = 1.5 * xi_ + 1.5
- # eta = 1.5 * eta_ + 1.5
- # zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 1/6 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 1/6 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 1/6 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- # Transform the weird deformed cube to be approximately the cube [0,2]^3
- return SVector(x + 1, y + 1, z + 1)
+ # Don't transform input variables between -1 and 1 onto [0,3] to obtain curved boundaries
+ # xi = 1.5 * xi_ + 1.5
+ # eta = 1.5 * eta_ + 1.5
+ # zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 1 / 6 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 1 / 6 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 1 / 6 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ # Transform the weird deformed cube to be approximately the cube [0,2]^3
+ return SVector(x + 1, y + 1, z + 1)
end
cells_per_dimension = (4, 4, 4)
-mesh = StructuredMesh(cells_per_dimension, mapping, periodicity=false)
+mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -62,27 +64,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl b/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl
index f4da8ee9470..6eb35078ef4 100644
--- a/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl
@@ -5,13 +5,13 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdEquations3D(5/3)
+equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_central, flux_nonconservative_powell)
-solver = DGSEM(polydeg=5, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 5, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Create the mesh
# Note, we use the domain [-1, 1]^3 for the Alfvén wave convergence test case so the
@@ -19,13 +19,13 @@ solver = DGSEM(polydeg=5, surface_flux=(flux_hll, flux_nonconservative_powell),
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi, eta, zeta)
- y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta) * cos(0.5 * pi * zeta))
+ y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta) * cos(0.5 * pi * zeta))
- x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y) * cos(0.5 * pi * zeta))
+ x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y) * cos(0.5 * pi * zeta))
- z = zeta + 0.125 * (cos(0.5 * pi * x) * cos(pi * y) * cos(0.5 * pi * zeta))
+ z = zeta + 0.125 * (cos(0.5 * pi * x) * cos(pi * y) * cos(0.5 * pi * zeta))
- return SVector(x, y, z)
+ return SVector(x, y, z)
end
cells_per_dimension = (4, 4, 4)
@@ -43,18 +43,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.2
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -62,11 +62,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_mhd_ec.jl b/examples/structured_3d_dgsem/elixir_mhd_ec.jl
index a8c2288e811..5b3cd6f3718 100644
--- a/examples/structured_3d_dgsem/elixir_mhd_ec.jl
+++ b/examples/structured_3d_dgsem/elixir_mhd_ec.jl
@@ -10,31 +10,35 @@ equations = IdealGlmMhdEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hindenlang_gassner, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Create a heavily warped curved mesh
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/8 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
cells_per_dimension = (4, 4, 4)
@@ -52,19 +56,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.4
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -72,11 +76,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl b/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
index d669c2350a5..084e2ee962a 100644
--- a/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
+++ b/examples/structured_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
@@ -10,42 +10,46 @@ equations = IdealGlmMhdEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Create a heavily warped curved mesh
# Mapping as described in https://arxiv.org/abs/2012.12040
function mapping(xi_, eta_, zeta_)
- # Transform input variables between -1 and 1 onto [0,3]
- xi = 1.5 * xi_ + 1.5
- eta = 1.5 * eta_ + 1.5
- zeta = 1.5 * zeta_ + 1.5
-
- y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *
- cos(0.5 * pi * (2 * eta - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *
- cos(2 * pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- z = zeta + 3/8 * (cos(0.5 * pi * (2 * x - 3)/3) *
- cos(pi * (2 * y - 3)/3) *
- cos(0.5 * pi * (2 * zeta - 3)/3))
-
- return SVector(x, y, z)
+ # Transform input variables between -1 and 1 onto [0,3]
+ xi = 1.5 * xi_ + 1.5
+ eta = 1.5 * eta_ + 1.5
+ zeta = 1.5 * zeta_ + 1.5
+
+ y = eta +
+ 3 / 8 * (cos(1.5 * pi * (2 * xi - 3) / 3) *
+ cos(0.5 * pi * (2 * eta - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ x = xi +
+ 3 / 8 * (cos(0.5 * pi * (2 * xi - 3) / 3) *
+ cos(2 * pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ z = zeta +
+ 3 / 8 * (cos(0.5 * pi * (2 * x - 3) / 3) *
+ cos(pi * (2 * y - 3) / 3) *
+ cos(0.5 * pi * (2 * zeta - 3) / 3))
+
+ return SVector(x, y, z)
end
cells_per_dimension = (8, 8, 8)
@@ -63,25 +67,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
cfl = 1.4
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl b/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl
index 32649eacff4..6d6bb27e0c3 100644
--- a/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl
+++ b/examples/t8code_2d_dgsem/elixir_eulergravity_convergence.jl
@@ -22,9 +22,9 @@ mesh = T8codeMesh(trees_per_dimension, polydeg = 1,
mapping = mapping,
initial_refinement_level = 2)
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler,
- source_terms=source_terms_eoc_test_coupled_euler_gravity)
-
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler,
+ source_terms = source_terms_eoc_test_coupled_euler_gravity)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -32,24 +32,23 @@ equations_gravity = HyperbolicDiffusionEquations2D()
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=2.0, # aka rho0
+parameters = ParametersEulerGravity(background_density = 2.0, # aka rho0
# rho0 is (ab)used to add a "+8π" term to the source terms
# for the manufactured solution
- gravitational_constant=1.0, # aka G
- cfl=1.1,
- resid_tol=1.0e-10,
- n_iterations_max=1000,
- timestep_gravity=timestep_gravity_erk52_3Sstar!)
+ gravitational_constant = 1.0, # aka G
+ cfl = 1.1,
+ resid_tol = 1.0e-10,
+ n_iterations_max = 1000,
+ timestep_gravity = timestep_gravity_erk52_3Sstar!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 0.5)
@@ -57,21 +56,21 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
analysis_interval = 100
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true)
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true)
callbacks = CallbackSet(summary_callback, stepsize_callback,
analysis_callback, alive_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl
index 463f916fa2e..8040f79cafd 100644
--- a/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl
@@ -4,26 +4,26 @@ using Trixi
###############################################################################
# Semidiscretization of the compressible ideal GLM-MHD equations.
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test
# Get the DG approximation space
volume_flux = (flux_central, flux_nonconservative_powell)
-solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
-coordinates_min = (0.0 , 0.0 )
+coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
mapping = Trixi.coordinates2mapping(coordinates_min, coordinates_max)
trees_per_dimension = (8, 8)
-mesh = T8codeMesh(trees_per_dimension, polydeg=3,
- mapping=mapping,
- initial_refinement_level=0, periodicity=true)
+mesh = T8codeMesh(trees_per_dimension, polydeg = 3,
+ mapping = mapping,
+ initial_refinement_level = 0, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -36,14 +36,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
cfl = 0.9
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -54,7 +54,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl
index c19f440ebc7..b2d5097036f 100644
--- a/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl
+++ b/examples/t8code_2d_dgsem/elixir_shallowwater_source_terms.jl
@@ -4,17 +4,17 @@ using Trixi
###############################################################################
# Semidiscretization of the shallow water equations.
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test # MMS EOC test
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the P4estMesh and setup a periodic mesh
@@ -26,14 +26,13 @@ mapping = Trixi.coordinates2mapping(coordinates_min, coordinates_max)
trees_per_dimension = (8, 8)
-mesh = T8codeMesh(trees_per_dimension, polydeg=3,
- mapping=mapping,
- initial_refinement_level=1)
+mesh = T8codeMesh(trees_per_dimension, polydeg = 3,
+ mapping = mapping,
+ initial_refinement_level = 1)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -45,9 +44,9 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
@@ -55,6 +54,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_advection_amr.jl b/examples/tree_1d_dgsem/elixir_advection_amr.jl
index dc371233bc8..1071c98ab7e 100644
--- a/examples/tree_1d_dgsem/elixir_advection_amr.jl
+++ b/examples/tree_1d_dgsem/elixir_advection_amr.jl
@@ -10,18 +10,16 @@ equations = LinearScalarAdvectionEquation1D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0,)
-coordinates_max = ( 5.0,)
+coordinates_max = (5.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -31,37 +29,36 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl
index 098deedb9d6..ff62e905429 100644
--- a/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl
+++ b/examples/tree_1d_dgsem/elixir_advection_amr_nonperiodic.jl
@@ -11,21 +11,19 @@ equations = LinearScalarAdvectionEquation1D(advection_velocity)
initial_condition = initial_condition_gauss
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0,)
coordinates_max = (5.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations,
initial_condition,
solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -36,40 +34,39 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_advection_basic.jl b/examples/tree_1d_dgsem/elixir_advection_basic.jl
index d61062c772e..cba522f6366 100644
--- a/examples/tree_1d_dgsem/elixir_advection_basic.jl
+++ b/examples/tree_1d_dgsem/elixir_advection_basic.jl
@@ -9,19 +9,19 @@ advection_velocity = 1.0
equations = LinearScalarAdvectionEquation1D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = -1.0 # minimum coordinate
-coordinates_max = 1.0 # maximum coordinate
+coordinates_max = 1.0 # maximum coordinate
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,26 +34,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion.jl
index 0472bd25a71..72b8b3f1933 100644
--- a/examples/tree_1d_dgsem/elixir_advection_diffusion.jl
+++ b/examples/tree_1d_dgsem/elixir_advection_diffusion.jl
@@ -11,49 +11,52 @@ diffusivity() = 0.1
equations_parabolic = LaplaceDiffusion1D(diffusivity(), equations)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = -pi # minimum coordinate
-coordinates_max = pi # maximum coordinate
+coordinates_max = pi # maximum coordinate
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000, # set maximum capacity of tree data structure
- periodicity=true)
-
-function x_trans_periodic(x, domain_length = SVector(2*pi), center = SVector(0.0))
- x_normalized = x .- center
- x_shifted = x_normalized .% domain_length
- x_offset = ((x_shifted .< -0.5*domain_length) - (x_shifted .> 0.5*domain_length)) .* domain_length
- return center + x_shifted + x_offset
+ initial_refinement_level = 4,
+ n_cells_max = 30_000, # set maximum capacity of tree data structure
+ periodicity = true)
+
+function x_trans_periodic(x, domain_length = SVector(2 * pi), center = SVector(0.0))
+ x_normalized = x .- center
+ x_shifted = x_normalized .% domain_length
+ x_offset = ((x_shifted .< -0.5 * domain_length) - (x_shifted .> 0.5 * domain_length)) .*
+ domain_length
+ return center + x_shifted + x_offset
end
# Define initial condition
-function initial_condition_diffusive_convergence_test(x, t, equation::LinearScalarAdvectionEquation1D)
- # Store translated coordinate for easy use of exact solution
- x_trans = x_trans_periodic(x - equation.advection_velocity * t)
-
- nu = diffusivity()
- c = 0.0
- A = 1.0
- L = 2
- f = 1/L
- omega = 1.0
- scalar = c + A * sin(omega * sum(x_trans)) * exp(-nu * omega^2 * t)
- return SVector(scalar)
+function initial_condition_diffusive_convergence_test(x, t,
+ equation::LinearScalarAdvectionEquation1D)
+ # Store translated coordinate for easy use of exact solution
+ x_trans = x_trans_periodic(x - equation.advection_velocity * t)
+
+ nu = diffusivity()
+ c = 0.0
+ A = 1.0
+ L = 2
+ f = 1 / L
+ omega = 1.0
+ scalar = c + A * sin(omega * sum(x_trans)) * exp(-nu * omega^2 * t)
+ return SVector(scalar)
end
initial_condition = initial_condition_diffusive_convergence_test
-
+
# define periodic boundary conditions everywhere
boundary_conditions = boundary_condition_periodic
boundary_conditions_parabolic = boundary_condition_periodic
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
- initial_condition_diffusive_convergence_test, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic))
-
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition_diffusive_convergence_test,
+ solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,23 +70,22 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=100)
+alive_callback = AliveCallback(analysis_interval = 100)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
time_int_tol = 1.0e-10
time_abs_tol = 1.0e-10
-sol = solve(ode, KenCarp4(autodiff=false), abstol=time_abs_tol, reltol=time_int_tol,
- save_everystep=false, callback=callbacks)
+sol = solve(ode, KenCarp4(autodiff = false), abstol = time_abs_tol, reltol = time_int_tol,
+ save_everystep = false, callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/tree_1d_dgsem/elixir_advection_extended.jl b/examples/tree_1d_dgsem/elixir_advection_extended.jl
index 5c87ac7ef5c..df185834701 100644
--- a/examples/tree_1d_dgsem/elixir_advection_extended.jl
+++ b/examples/tree_1d_dgsem/elixir_advection_extended.jl
@@ -18,21 +18,20 @@ initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = -1.0 # minimum coordinate
-coordinates_max = 1.0 # maximum coordinate
+coordinates_max = 1.0 # maximum coordinate
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000, # set maximum capacity of tree data structure
- periodicity=true)
+ initial_refinement_level = 4,
+ n_cells_max = 30_000, # set maximum capacity of tree data structure
+ periodicity = true)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -47,24 +46,24 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback,
@@ -72,14 +71,13 @@ callbacks = CallbackSet(summary_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl b/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl
index 28518e7276a..62701f3ecf5 100644
--- a/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl
+++ b/examples/tree_1d_dgsem/elixir_advection_finite_volume.jl
@@ -10,19 +10,19 @@ equations = LinearScalarAdvectionEquation1D(advection_velocity)
# Create DG solver with polynomial degree = 0, i.e., a first order finite volume solver,
# with (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=0, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 0, surface_flux = flux_lax_friedrichs)
coordinates_min = -1.0 # minimum coordinate
-coordinates_max = 1.0 # maximum coordinate
+coordinates_max = 1.0 # maximum coordinate
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 5,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,22 +35,21 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
sol = solve(ode, Euler(),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_1d_dgsem/elixir_burgers_basic.jl b/examples/tree_1d_dgsem/elixir_burgers_basic.jl
index cebd9b11201..f57b8e730fe 100644
--- a/examples/tree_1d_dgsem/elixir_burgers_basic.jl
+++ b/examples/tree_1d_dgsem/elixir_burgers_basic.jl
@@ -9,18 +9,16 @@ equations = InviscidBurgersEquation1D()
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -31,29 +29,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl b/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl
index 6a25f94ca05..ae2039edde6 100644
--- a/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl
+++ b/examples/tree_1d_dgsem/elixir_burgers_linear_stability.jl
@@ -8,23 +8,22 @@ using Trixi
equations = InviscidBurgersEquation1D()
function initial_condition_linear_stability(x, t, equation::InviscidBurgersEquation1D)
- k = 1
- 2 + sinpi(k * (x[1] - 0.7)) |> SVector
+ k = 1
+ 2 + sinpi(k * (x[1] - 0.7)) |> SVector
end
volume_flux = flux_ec
-solver = DGSEM(polydeg=3, surface_flux=flux_ec,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ec,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_linear_stability, solver)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_linear_stability,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,23 +34,22 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl b/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl
index 28ab7b7c768..d32b9d6f1f4 100644
--- a/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl
+++ b/examples/tree_1d_dgsem/elixir_burgers_rarefaction.jl
@@ -10,18 +10,18 @@ equations = InviscidBurgersEquation1D()
basis = LobattoLegendreBasis(3)
# Use shock capturing techniques to suppress oscillations at discontinuities
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=first)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = first)
-volume_flux = flux_ec
+volume_flux = flux_ec
surface_flux = flux_lax_friedrichs
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+
solver = DGSEM(basis, surface_flux, volume_integral)
coordinate_min = 0.0
@@ -29,42 +29,41 @@ coordinate_max = 1.0
# Make sure to turn periodicity explicitly off as special boundary conditions are specified
mesh = TreeMesh(coordinate_min, coordinate_max,
- initial_refinement_level=6,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 6,
+ n_cells_max = 10_000,
+ periodicity = false)
# Discontinuous initial condition (Riemann Problem) leading to a rarefaction fan.
function initial_condition_rarefaction(x, t, equation::InviscidBurgersEquation1D)
- scalar = x[1] < 0.5 ? 0.5 : 1.5
+ scalar = x[1] < 0.5 ? 0.5 : 1.5
- return SVector(scalar)
-end
+ return SVector(scalar)
+end
###############################################################################
# Specify non-periodic boundary conditions
function inflow(x, t, equations::InviscidBurgersEquation1D)
- return initial_condition_rarefaction(coordinate_min, t, equations)
+ return initial_condition_rarefaction(coordinate_min, t, equations)
end
boundary_condition_inflow = BoundaryConditionDirichlet(inflow)
function boundary_condition_outflow(u_inner, orientation, normal_direction, x, t,
- surface_flux_function, equations::InviscidBurgersEquation1D)
- # Calculate the boundary flux entirely from the internal solution state
- flux = Trixi.flux(u_inner, normal_direction, equations)
+ surface_flux_function,
+ equations::InviscidBurgersEquation1D)
+ # Calculate the boundary flux entirely from the internal solution state
+ flux = Trixi.flux(u_inner, normal_direction, equations)
- return flux
+ return flux
end
+boundary_conditions = (x_neg = boundary_condition_inflow,
+ x_pos = boundary_condition_outflow)
-boundary_conditions = (x_neg=boundary_condition_inflow,
- x_pos=boundary_condition_outflow)
-
initial_condition = initial_condition_rarefaction
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -75,12 +74,11 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-stepsize_callback = StepsizeCallback(cfl=0.9)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -89,9 +87,8 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=42, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 42, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_burgers_shock.jl b/examples/tree_1d_dgsem/elixir_burgers_shock.jl
index 00b5314e19f..1f0b0e7e042 100644
--- a/examples/tree_1d_dgsem/elixir_burgers_shock.jl
+++ b/examples/tree_1d_dgsem/elixir_burgers_shock.jl
@@ -10,17 +10,17 @@ equations = InviscidBurgersEquation1D()
basis = LobattoLegendreBasis(3)
# Use shock capturing techniques to suppress oscillations at discontinuities
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=first)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = first)
-volume_flux = flux_ec
+volume_flux = flux_ec
surface_flux = flux_lax_friedrichs
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=surface_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = surface_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -29,42 +29,41 @@ coordinate_max = 1.0
# Make sure to turn periodicity explicitly off as special boundary conditions are specified
mesh = TreeMesh(coordinate_min, coordinate_max,
- initial_refinement_level=6,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 6,
+ n_cells_max = 10_000,
+ periodicity = false)
# Discontinuous initial condition (Riemann Problem) leading to a shock to test e.g. correct shock speed.
function initial_condition_shock(x, t, equation::InviscidBurgersEquation1D)
- scalar = x[1] < 0.5 ? 1.5 : 0.5
+ scalar = x[1] < 0.5 ? 1.5 : 0.5
- return SVector(scalar)
+ return SVector(scalar)
end
###############################################################################
# Specify non-periodic boundary conditions
function inflow(x, t, equations::InviscidBurgersEquation1D)
- return initial_condition_shock(coordinate_min, t, equations)
+ return initial_condition_shock(coordinate_min, t, equations)
end
boundary_condition_inflow = BoundaryConditionDirichlet(inflow)
function boundary_condition_outflow(u_inner, orientation, normal_direction, x, t,
- surface_flux_function, equations::InviscidBurgersEquation1D)
- # Calculate the boundary flux entirely from the internal solution state
- flux = Trixi.flux(u_inner, normal_direction, equations)
+ surface_flux_function,
+ equations::InviscidBurgersEquation1D)
+ # Calculate the boundary flux entirely from the internal solution state
+ flux = Trixi.flux(u_inner, normal_direction, equations)
- return flux
+ return flux
end
-
-boundary_conditions = (x_neg=boundary_condition_inflow,
- x_pos=boundary_condition_outflow)
+boundary_conditions = (x_neg = boundary_condition_inflow,
+ x_pos = boundary_condition_outflow)
initial_condition = initial_condition_shock
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -75,12 +74,11 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-stepsize_callback = StepsizeCallback(cfl=0.85)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+stepsize_callback = StepsizeCallback(cfl = 0.85)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -89,9 +87,8 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=42, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 42, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl b/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl
index 2318063c2be..9cba4936d22 100644
--- a/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_blast_wave.jl
@@ -16,49 +16,47 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
- # The following code is equivalent to
- # phi = atan(0.0, x_norm)
- # cos_phi = cos(phi)
- # in 1D but faster
- cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+ # The following code is equivalent to
+ # phi = atan(0.0, x_norm)
+ # cos_phi = cos(phi)
+ # in 1D but faster
+ cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -69,27 +67,26 @@ summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl b/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl
index d35dec6bc73..05f392624fd 100644
--- a/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl
@@ -2,7 +2,8 @@ using Downloads: download
using Flux
using BSON: load
network = joinpath(@__DIR__, "modelnnpp-0.97-0.0001.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.97-0.0001.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.97-0.0001.bson",
+ network)
model1d = load(network, @__MODULE__)[:model1d]
using OrdinaryDiffEq
@@ -14,7 +15,6 @@ using Trixi
# University of Cologne, advisors: Gregor Gassner, Michael Schlottke-Lakemper
# This motivates the particular choice of fluxes, mesh resolution etc.
-
###############################################################################
# semidiscretization of the compressible Euler equations
@@ -29,53 +29,51 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
- # The following code is equivalent to
- # phi = atan(0.0, x_norm)
- # cos_phi = cos(phi)
- # in 1D but faster
- cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+ # The following code is equivalent to
+ # phi = atan(0.0, x_norm)
+ # cos_phi = cos(phi)
+ # in 1D but faster
+ cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkPerssonPeraire(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=false,
- alpha_amr=false,
- variable=density_pressure,
- network=model1d)
+ indicator_type = NeuralNetworkPerssonPeraire(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = false,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model1d)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -86,27 +84,26 @@ summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl b/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl
index fb36f8540f8..de2f5134a49 100644
--- a/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl
@@ -2,7 +2,8 @@ using Downloads: download
using Flux
using BSON: load
network = joinpath(@__DIR__, "modelnnrh-0.95-0.009.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnrh-0.95-0.009.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnrh-0.95-0.009.bson",
+ network)
model1d = load(network, @__MODULE__)[:model1d]
using OrdinaryDiffEq
@@ -14,7 +15,6 @@ using Trixi
# University of Cologne, advisors: Gregor Gassner, Michael Schlottke-Lakemper
# This motivates the particular choice of fluxes, mesh resolution etc.
-
###############################################################################
# semidiscretization of the compressible Euler equations
@@ -29,53 +29,51 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
- # The following code is equivalent to
- # phi = atan(0.0, x_norm)
- # cos_phi = cos(phi)
- # in 1D but faster
- cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+ # The following code is equivalent to
+ # phi = atan(0.0, x_norm)
+ # cos_phi = cos(phi)
+ # in 1D but faster
+ cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkRayHesthaven(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=false,
- alpha_amr=false,
- variable=density_pressure,
- network=model1d)
+ indicator_type = NeuralNetworkRayHesthaven(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = false,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model1d)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -86,27 +84,26 @@ summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl b/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl
index fe221ea5bd7..1fa07d4edda 100644
--- a/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl
@@ -9,19 +9,17 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralPureLGLFiniteVolume(flux_hllc))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralPureLGLFiniteVolume(flux_hllc))
coordinates_min = 0.0
coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,29 +30,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_density_wave.jl b/examples/tree_1d_dgsem/elixir_euler_density_wave.jl
index 746989dfe56..01ccbb2b517 100644
--- a/examples/tree_1d_dgsem/elixir_euler_density_wave.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_density_wave.jl
@@ -8,18 +8,16 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_density_wave
-solver = DGSEM(polydeg=5, surface_flux=flux_central)
+solver = DGSEM(polydeg = 5, surface_flux = flux_central)
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -29,16 +27,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 2000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -48,7 +46,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_ec.jl b/examples/tree_1d_dgsem/elixir_euler_ec.jl
index f20bd4fd69e..0be9c8fbf4c 100644
--- a/examples/tree_1d_dgsem/elixir_euler_ec.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_ec.jl
@@ -9,19 +9,17 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -31,27 +29,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_positivity.jl b/examples/tree_1d_dgsem/elixir_euler_positivity.jl
index 966661e8894..3fb96fb807b 100644
--- a/examples/tree_1d_dgsem/elixir_euler_positivity.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_positivity.jl
@@ -14,97 +14,92 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 4.0)
ode = semidiscretize(semi, tspan)
-
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorLöhner(semi,
- variable=density_pressure)
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- med_level =0, med_threshold=0.1, # med_level = current level
- max_level =6, max_threshold=0.3)
+ base_level = 4,
+ med_level = 0, med_threshold = 0.1, # med_level = current level
+ max_level = 6, max_threshold = 0.3)
amr_callback = AMRCallback(semi, amr_controller,
- interval=2,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 2,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
-
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl
index 106ccacf4f5..b67b2bc602e 100644
--- a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave.jl
@@ -14,96 +14,92 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
shock_indicator_variable = density_pressure
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=shock_indicator_variable)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = shock_indicator_variable)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 12.5)
ode = semidiscretize(semi, tspan)
-
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level=6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl
index ebe8fa7cebf..8a0241680b9 100644
--- a/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_sedov_blast_wave_pure_fv.jl
@@ -14,25 +14,25 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations1D)
- # Set up polar coordinates
- inicenter = SVector(0.0)
- x_norm = x[1] - inicenter[1]
- r = abs(x_norm)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0)
+ x_norm = x[1] - inicenter[1]
+ r = abs(x_norm)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 6 * (equations.gamma - 1) * E / (3 * pi * r0)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
@@ -42,59 +42,55 @@ volume_integral = VolumeIntegralPureLGLFiniteVolume(flux_hllc)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=7,
- n_cells_max=10_000)
-
+ initial_refinement_level = 7,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 12.5)
ode = semidiscretize(semi, tspan)
-
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level=7, max_threshold=0.01)
+ base_level = 4,
+ max_level = 7, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.25)
+stepsize_callback = StepsizeCallback(cfl = 0.25)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl b/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl
index 90547f8ddc1..08367505377 100644
--- a/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl
@@ -10,28 +10,26 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_shima_etal
+volume_flux = flux_shima_etal
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = -2.0
-coordinates_max = 2.0
+coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -41,27 +39,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_source_terms.jl b/examples/tree_1d_dgsem/elixir_euler_source_terms.jl
index 213206eb9e0..555910f69f0 100644
--- a/examples/tree_1d_dgsem/elixir_euler_source_terms.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_source_terms.jl
@@ -11,18 +11,16 @@ initial_condition = initial_condition_convergence_test
# Note that the expected EOC of 5 is not reached with this flux.
# Using flux_hll instead yields the expected EOC.
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
coordinates_min = 0.0
coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,29 +31,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl
index 3794e0c8d54..922ac3dd97d 100644
--- a/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl
+++ b/examples/tree_1d_dgsem/elixir_euler_source_terms_nonperiodic.jl
@@ -13,23 +13,21 @@ initial_condition = initial_condition_convergence_test
# 1*ndims == 2 directions or you can pass a tuple containing BCs for
# each direction
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0,)
coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,30 +38,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl b/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl
index 42de0e18e51..acde04780ee 100644
--- a/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl
+++ b/examples/tree_1d_dgsem/elixir_eulergravity_convergence.jl
@@ -15,11 +15,11 @@ solver_euler = DGSEM(polydeg, flux_hll)
coordinates_min = 0.0
coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -27,22 +27,21 @@ equations_gravity = HyperbolicDiffusionEquations1D()
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=2.0, # aka rho0
- gravitational_constant=1.0, # aka G
- cfl=1.5,
- resid_tol=1.0e-10,
- n_iterations_max=1000,
- timestep_gravity=timestep_gravity_erk52_3Sstar!)
+parameters = ParametersEulerGravity(background_density = 2.0, # aka rho0
+ gravitational_constant = 1.0, # aka G
+ cfl = 1.5,
+ resid_tol = 1.0e-10,
+ n_iterations_max = 1000,
+ timestep_gravity = timestep_gravity_erk52_3Sstar!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 0.5)
@@ -51,20 +50,20 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true)
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -73,11 +72,10 @@ callbacks = CallbackSet(summary_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl
index 2444fe8611d..6d6316898b7 100644
--- a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl
+++ b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_ec.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4),
gas_constants = (0.4, 0.4))
initial_condition = initial_condition_convergence_test
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0,)
-coordinates_max = ( 1.0,)
+coordinates_max = (1.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,27 +31,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl
index 86f4a4bad04..1b37a8a2279 100644
--- a/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl
+++ b/examples/tree_1d_dgsem/elixir_eulermulti_convergence_es.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4, 1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4, 1.4, 1.4),
gas_constants = (0.4, 0.4, 0.4, 0.4))
initial_condition = initial_condition_convergence_test
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0,)
-coordinates_max = ( 1.0,)
+coordinates_max = (1.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,27 +31,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl b/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl
index 04d937a9a8f..73f8de15d82 100644
--- a/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl
+++ b/examples/tree_1d_dgsem/elixir_eulermulti_ec.jl
@@ -4,26 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4, 1.4),
gas_constants = (0.4, 0.4, 0.4))
-
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,28 +31,27 @@ summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(Trixi.density,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (Trixi.density,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_es.jl b/examples/tree_1d_dgsem/elixir_eulermulti_es.jl
index 7abb3b0d021..7fbec0c0055 100644
--- a/examples/tree_1d_dgsem/elixir_eulermulti_es.jl
+++ b/examples/tree_1d_dgsem/elixir_eulermulti_es.jl
@@ -4,26 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4),
gas_constants = (0.4, 0.4))
-
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0,)
-coordinates_max = ( 2.0,)
+coordinates_max = (2.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,31 +31,30 @@ summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(Trixi.density,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (Trixi.density,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl b/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl
index 81966194180..c093420cc7c 100644
--- a/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl
+++ b/examples/tree_1d_dgsem/elixir_eulermulti_two_interacting_blast_waves.jl
@@ -5,8 +5,8 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4, 1.4),
- gas_constants = (0.4, 0.4, 0.4))
+equations = CompressibleEulerMulticomponentEquations1D(gammas = (1.4, 1.4, 1.4),
+ gas_constants = (0.4, 0.4, 0.4))
"""
initial_condition_two_interacting_blast_waves(x, t, equations::CompressibleEulerMulticomponentEquations1D)
@@ -16,69 +16,67 @@ A multicomponent two interacting blast wave test taken from
The consistent multi-fluid advection method
[arXiv: 9807241](https://arxiv.org/pdf/astro-ph/9807241.pdf)
"""
-function initial_condition_two_interacting_blast_waves(x, t, equations::CompressibleEulerMulticomponentEquations1D)
+function initial_condition_two_interacting_blast_waves(x, t,
+ equations::CompressibleEulerMulticomponentEquations1D)
+ rho1 = 0.5 * x[1]^2
+ rho2 = 0.5 * (sin(20 * x[1]))^2
+ rho3 = 1 - rho1 - rho2
- rho1 = 0.5 * x[1]^2
- rho2 = 0.5 * (sin(20 * x[1]))^2
- rho3 = 1 - rho1 - rho2
+ prim_rho = SVector{3, real(equations)}(rho1, rho2, rho3)
- prim_rho = SVector{3, real(equations)}(rho1, rho2, rho3)
+ v1 = 0.0
- v1 = 0.0
+ if x[1] <= 0.1
+ p = 1000
+ elseif x[1] < 0.9
+ p = 0.01
+ else
+ p = 100
+ end
- if x[1] <= 0.1
- p = 1000
- elseif x[1] < 0.9
- p = 0.01
- else
- p = 100
- end
+ prim_other = SVector{2, real(equations)}(v1, p)
- prim_other = SVector{2, real(equations)}(v1, p)
-
- return prim2cons(vcat(prim_other, prim_rho), equations)
+ return prim2cons(vcat(prim_other, prim_rho), equations)
end
initial_condition = initial_condition_two_interacting_blast_waves
-function boundary_condition_two_interacting_blast_waves(u_inner, orientation, direction, x, t,
- surface_flux_function,
+function boundary_condition_two_interacting_blast_waves(u_inner, orientation, direction,
+ x, t, surface_flux_function,
equations::CompressibleEulerMulticomponentEquations1D)
-
- u_inner_reflect = SVector(-u_inner[1], u_inner[2], u_inner[3], u_inner[4], u_inner[5])
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_inner_reflect, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_inner_reflect, u_inner, orientation, equations)
- end
-
- return flux
+ u_inner_reflect = SVector(-u_inner[1], u_inner[2], u_inner[3], u_inner[4], u_inner[5])
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_inner_reflect, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_inner_reflect, u_inner, orientation, equations)
+ end
+
+ return flux
end
boundary_conditions = boundary_condition_two_interacting_blast_waves
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max = 0.8,
alpha_min = 0.0,
alpha_smooth = true,
- variable=pressure)
+ variable = pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0,)
coordinates_max = (1.0,)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=9,
- n_cells_max=10_000,
- periodicity=false)
-
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+ initial_refinement_level = 9,
+ n_cells_max = 10_000,
+ periodicity = false)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -90,16 +88,16 @@ summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.1)
+stepsize_callback = StepsizeCallback(cfl = 0.1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -109,7 +107,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
index 9a19807ae29..b9173ec9f49 100644
--- a/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
+++ b/examples/tree_1d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
@@ -5,7 +5,7 @@ using Trixi
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
-equations = HyperbolicDiffusionEquations1D(nu=1.25)
+equations = HyperbolicDiffusionEquations1D(nu = 1.25)
"""
initial_condition_poisson_nonperiodic(x, t, equations::HyperbolicDiffusionEquations1D)
@@ -16,36 +16,36 @@ A non-priodic harmonic function used in combination with
!!! note
The only harmonic functions in 1D have the form phi(x) = A + Bx
"""
-function initial_condition_harmonic_nonperiodic(x, t, equations::HyperbolicDiffusionEquations1D)
- # elliptic equation: -νΔϕ = f
- if t == 0.0
- phi = 5.0
- q1 = 0.0
- else
- A = 3
- B = exp(1)
- phi = A + B * x[1]
- q1 = B
- end
- return SVector(phi, q1)
+function initial_condition_harmonic_nonperiodic(x, t,
+ equations::HyperbolicDiffusionEquations1D)
+ # elliptic equation: -νΔϕ = f
+ if t == 0.0
+ phi = 5.0
+ q1 = 0.0
+ else
+ A = 3
+ B = exp(1)
+ phi = A + B * x[1]
+ q1 = B
+ end
+ return SVector(phi, q1)
end
initial_condition = initial_condition_harmonic_nonperiodic
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = -1.0
-coordinates_max = 2.0
+coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000,
- periodicity=false)
+ initial_refinement_level = 2,
+ n_cells_max = 30_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions,
- source_terms=source_terms_harmonic)
-
+ boundary_conditions = boundary_conditions,
+ source_terms = source_terms_harmonic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -56,30 +56,29 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.75)
+stepsize_callback = StepsizeCallback(cfl = 1.75)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
sol = Trixi.solve(ode, Trixi.HypDiffN3Erk3Sstar52(),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl
index 827d8d25ce7..4da3b33a466 100644
--- a/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl
+++ b/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl
@@ -11,19 +11,18 @@ initial_condition = initial_condition_poisson_nonperiodic
boundary_conditions = boundary_condition_poisson_nonperiodic
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000,
- periodicity=false)
+ initial_refinement_level = 3,
+ n_cells_max = 30_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions,
- source_terms=source_terms_poisson_nonperiodic)
-
+ boundary_conditions = boundary_conditions,
+ source_terms = source_terms_poisson_nonperiodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,31 +33,30 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl
index 82bca93c707..1a66ac60b9b 100644
--- a/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations1D(gamma)
initial_condition = initial_condition_convergence_test
volume_flux = flux_hindenlang_gassner
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,32 +30,33 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl
index c5727109d92..bb294af68cb 100644
--- a/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl
+++ b/examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl
@@ -17,46 +17,44 @@ MHD extension of the Sod shock tube. Taken from Section V of the article
[DOI: 10.1016/0021-9991(88)90120-9](https://doi.org/10.1016/0021-9991(88)90120-9)
"""
function initial_condition_briowu_shock_tube(x, t, equations::IdealGlmMhdEquations1D)
- # domain must be set to [0, 1], γ = 2, final time = 0.12
- rho = x[1] < 0.5 ? 1.0 : 0.125
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = x[1] < 0.5 ? 1.0 : 0.1
- B1 = 0.75
- B2 = x[1] < 0.5 ? 1.0 : -1.0
- B3 = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
+ # domain must be set to [0, 1], γ = 2, final time = 0.12
+ rho = x[1] < 0.5 ? 1.0 : 0.125
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = x[1] < 0.5 ? 1.0 : 0.1
+ B1 = 0.75
+ B2 = x[1] < 0.5 ? 1.0 : -1.0
+ B3 = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
end
initial_condition = initial_condition_briowu_shock_tube
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
surface_flux = flux_hll
-volume_flux = flux_derigs_etal
+volume_flux = flux_derigs_etal
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,45 +65,44 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level=6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.65)
+stepsize_callback = StepsizeCallback(cfl = 0.65)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhd_ec.jl b/examples/tree_1d_dgsem/elixir_mhd_ec.jl
index 1f2e77006b1..e5da808f696 100644
--- a/examples/tree_1d_dgsem/elixir_mhd_ec.jl
+++ b/examples/tree_1d_dgsem/elixir_mhd_ec.jl
@@ -10,19 +10,17 @@ equations = IdealGlmMhdEquations1D(gamma)
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_hindenlang_gassner
-solver = DGSEM(polydeg=3, surface_flux=flux_hindenlang_gassner,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hindenlang_gassner,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,29 +30,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl
index 010788d48f5..b6f856fbc64 100644
--- a/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl
+++ b/examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations1D(gamma)
"""
@@ -22,48 +22,46 @@ present in the one dimensional MHD equations. It is the second test from Section
This paper has a typo in the initial conditions. Their variable `E` should be `p`.
"""
function initial_condition_ryujones_shock_tube(x, t, equations::IdealGlmMhdEquations1D)
- # domain must be set to [0, 1], γ = 5/3, final time = 0.2
- rho = x[1] <= 0.5 ? 1.08 : 1.0
- v1 = x[1] <= 0.5 ? 1.2 : 0.0
- v2 = x[1] <= 0.5 ? 0.01 : 0.0
- v3 = x[1] <= 0.5 ? 0.5 : 0.0
- p = x[1] <= 0.5 ? 0.95 : 1.0
- inv_sqrt4pi = 1.0 / sqrt(4 * pi)
- B1 = 2 * inv_sqrt4pi
- B2 = x[1] <= 0.5 ? 3.6 * inv_sqrt4pi : 4.0 * inv_sqrt4pi
- B3 = B1
-
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
+ # domain must be set to [0, 1], γ = 5/3, final time = 0.2
+ rho = x[1] <= 0.5 ? 1.08 : 1.0
+ v1 = x[1] <= 0.5 ? 1.2 : 0.0
+ v2 = x[1] <= 0.5 ? 0.01 : 0.0
+ v3 = x[1] <= 0.5 ? 0.5 : 0.0
+ p = x[1] <= 0.5 ? 0.95 : 1.0
+ inv_sqrt4pi = 1.0 / sqrt(4 * pi)
+ B1 = 2 * inv_sqrt4pi
+ B2 = x[1] <= 0.5 ? 3.6 * inv_sqrt4pi : 4.0 * inv_sqrt4pi
+ B3 = B1
+
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
end
initial_condition = initial_condition_ryujones_shock_tube
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
surface_flux = flux_hll
-volume_flux = flux_hindenlang_gassner
+volume_flux = flux_hindenlang_gassner
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=Trixi.density)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = Trixi.density)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=7,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 7,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -74,27 +72,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl
index 8c60b449e90..8c0317277b0 100644
--- a/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl
+++ b/examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations1D(gamma)
"""
@@ -17,19 +17,19 @@ Taken from Section 4.1 of
[DOI: 10.1016/j.jcp.2016.04.048](https://doi.org/10.1016/j.jcp.2016.04.048)
"""
function initial_condition_shu_osher_shock_tube(x, t, equations::IdealGlmMhdEquations1D)
- # domain must be set to [-5, 5], γ = 5/3, final time = 0.7
- # initial shock location is taken to be at x = -4
- x_0 = -4.0
- rho = x[1] <= x_0 ? 3.5 : 1.0 + 0.2 * sin(5.0 * x[1])
- v1 = x[1] <= x_0 ? 5.8846 : 0.0
- v2 = x[1] <= x_0 ? 1.1198 : 0.0
- v3 = 0.0
- p = x[1] <= x_0 ? 42.0267 : 1.0
- B1 = 1.0
- B2 = x[1] <= x_0 ? 3.6359 : 1.0
- B3 = 0.0
-
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
+ # domain must be set to [-5, 5], γ = 5/3, final time = 0.7
+ # initial shock location is taken to be at x = -4
+ x_0 = -4.0
+ rho = x[1] <= x_0 ? 3.5 : 1.0 + 0.2 * sin(5.0 * x[1])
+ v1 = x[1] <= x_0 ? 5.8846 : 0.0
+ v2 = x[1] <= x_0 ? 1.1198 : 0.0
+ v3 = 0.0
+ p = x[1] <= x_0 ? 42.0267 : 1.0
+ B1 = 1.0
+ B2 = x[1] <= x_0 ? 3.6359 : 1.0
+ B3 = 0.0
+
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
end
"""
@@ -41,50 +41,49 @@ but shock propagates from right to left.
!!! note
This is useful to exercise some of the components of the HLL flux.
"""
-function initial_condition_shu_osher_shock_tube_flipped(x, t, equations::IdealGlmMhdEquations1D)
- # domain must be set to [-5, 5], γ = 5/3, final time = 0.7
- # initial shock location is taken to be at x = 4
- x_0 = 4.0
- rho = x[1] <= x_0 ? 1.0 + 0.2 * sin(5.0 * x[1]) : 3.5
- v1 = x[1] <= x_0 ? 0.0 : -5.8846
- v2 = x[1] <= x_0 ? 0.0 : -1.1198
- v3 = 0.0
- p = x[1] <= x_0 ? 1.0 : 42.0267
- B1 = 1.0
- B2 = x[1] <= x_0 ? 1.0 : 3.6359
- B3 = 0.0
-
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
+function initial_condition_shu_osher_shock_tube_flipped(x, t,
+ equations::IdealGlmMhdEquations1D)
+ # domain must be set to [-5, 5], γ = 5/3, final time = 0.7
+ # initial shock location is taken to be at x = 4
+ x_0 = 4.0
+ rho = x[1] <= x_0 ? 1.0 + 0.2 * sin(5.0 * x[1]) : 3.5
+ v1 = x[1] <= x_0 ? 0.0 : -5.8846
+ v2 = x[1] <= x_0 ? 0.0 : -1.1198
+ v3 = 0.0
+ p = x[1] <= x_0 ? 1.0 : 42.0267
+ B1 = 1.0
+ B2 = x[1] <= x_0 ? 1.0 : 3.6359
+ B3 = 0.0
+
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
end
initial_condition = initial_condition_shu_osher_shock_tube
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
surface_flux = flux_hll
-volume_flux = flux_hindenlang_gassner
+volume_flux = flux_hindenlang_gassner
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = -5.0
-coordinates_max = 5.0
+coordinates_max = 5.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -95,42 +94,43 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level=7, max_threshold=0.01)
+ base_level = 4,
+ max_level = 7, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl
index 68556764293..3b366c35e0f 100644
--- a/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl
+++ b/examples/tree_1d_dgsem/elixir_mhd_torrilhon_shock_tube.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations1D(gamma)
"""
@@ -16,46 +16,44 @@ Torrilhon's shock tube test case for one dimensional ideal MHD equations.
[DOI: 10.1017/S0022377803002186](https://doi.org/10.1017/S0022377803002186)
"""
function initial_condition_torrilhon_shock_tube(x, t, equations::IdealGlmMhdEquations1D)
- # domain must be set to [-1, 1.5], γ = 5/3, final time = 0.4
- rho = x[1] <= 0 ? 3.0 : 1.0
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = x[1] <= 0 ? 3.0 : 1.0
- B1 = 1.5
- B2 = x[1] <= 0 ? 1.0 : cos(1.5)
- B3 = x[1] <= 0 ? 0.0 : sin(1.5)
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
+ # domain must be set to [-1, 1.5], γ = 5/3, final time = 0.4
+ rho = x[1] <= 0 ? 3.0 : 1.0
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = x[1] <= 0 ? 3.0 : 1.0
+ B1 = 1.5
+ B2 = x[1] <= 0 ? 1.0 : cos(1.5)
+ B3 = x[1] <= 0 ? 0.0 : sin(1.5)
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3), equations)
end
initial_condition = initial_condition_torrilhon_shock_tube
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
surface_flux = flux_lax_friedrichs
-volume_flux = flux_central
+volume_flux = flux_central
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = -1.0
-coordinates_max = 1.5
+coordinates_max = 1.5
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=7,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 7,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -66,29 +64,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl
index 376f11d52a2..831fa7afedb 100644
--- a/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl
+++ b/examples/tree_1d_dgsem/elixir_mhdmulti_briowu_shock_tube.jl
@@ -4,8 +4,8 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-equations = IdealGlmMhdMulticomponentEquations1D(gammas = (2.0, 2.0),
- gas_constants = (2.0, 2.0))
+equations = IdealGlmMhdMulticomponentEquations1D(gammas = (2.0, 2.0),
+ gas_constants = (2.0, 2.0))
"""
initial_condition_briowu_shock_tube(x, t, equations::IdealGlmMhdMulticomponentEquations1D)
@@ -16,55 +16,62 @@ MHD extension of the Sod shock tube. Taken from Section V of the article
An Upwind Differencing Scheme for the Equations of Ideal Magnetohydrodynamics
[DOI: 10.1016/0021-9991(88)90120-9](https://doi.org/10.1016/0021-9991(88)90120-9)
"""
-function initial_condition_briowu_shock_tube(x, t, equations::IdealGlmMhdMulticomponentEquations1D)
- # domain must be set to [0, 1], γ = 2, final time = 0.12
- if x[1] < 0.5
- rho = 1.0
- prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i-1) * (1-2)/(1-2^ncomponents(equations)) * rho for i in eachcomponent(equations))
- else
- rho = 0.125
- prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i-1) * (1-2)/(1-2^ncomponents(equations)) * rho for i in eachcomponent(equations))
- end
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = x[1] < 0.5 ? 1.0 : 0.1
- B1 = 0.75
- B2 = x[1] < 0.5 ? 1.0 : -1.0
- B3 = 0.0
-
- prim_other = SVector(v1, v2, v3, p, B1, B2, B3)
- return prim2cons(vcat(prim_other, prim_rho), equations)
+function initial_condition_briowu_shock_tube(x, t,
+ equations::IdealGlmMhdMulticomponentEquations1D)
+ # domain must be set to [0, 1], γ = 2, final time = 0.12
+ if x[1] < 0.5
+ rho = 1.0
+ prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
+ (1 -
+ 2^ncomponents(equations)) *
+ rho
+ for i in eachcomponent(equations))
+ else
+ rho = 0.125
+ prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
+ (1 -
+ 2^ncomponents(equations)) *
+ rho
+ for i in eachcomponent(equations))
+ end
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = x[1] < 0.5 ? 1.0 : 0.1
+ B1 = 0.75
+ B2 = x[1] < 0.5 ? 1.0 : -1.0
+ B3 = 0.0
+
+ prim_other = SVector(v1, v2, v3, p, B1, B2, B3)
+ return prim2cons(vcat(prim_other, prim_rho), equations)
end
initial_condition = initial_condition_briowu_shock_tube
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
surface_flux = flux_lax_friedrichs
-volume_flux = flux_hindenlang_gassner
+volume_flux = flux_hindenlang_gassner
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.8,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.8,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -75,45 +82,44 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level=6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl
index 573bf6bc3e9..a1636c08478 100644
--- a/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl
+++ b/examples/tree_1d_dgsem/elixir_mhdmulti_convergence.jl
@@ -5,25 +5,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdMulticomponentEquations1D(gammas = (5/3, 5/3, 5/3),
- gas_constants = (2.08, 2.08, 2.08))
+equations = IdealGlmMhdMulticomponentEquations1D(gammas = (5 / 3, 5 / 3, 5 / 3),
+ gas_constants = (2.08, 2.08, 2.08))
initial_condition = initial_condition_convergence_test
volume_flux = flux_hindenlang_gassner
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,17 +31,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 0.5
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -51,11 +50,10 @@ callbacks = CallbackSet(summary_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl
index 69ea0551bed..71466f3138a 100644
--- a/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl
+++ b/examples/tree_1d_dgsem/elixir_mhdmulti_ec.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-equations = IdealGlmMhdMulticomponentEquations1D(gammas = (2.0, 2.0, 2.0),
+equations = IdealGlmMhdMulticomponentEquations1D(gammas = (2.0, 2.0, 2.0),
gas_constants = (2.0, 2.0, 2.0))
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_hindenlang_gassner
-solver = DGSEM(polydeg=3, surface_flux=flux_hindenlang_gassner,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hindenlang_gassner,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,26 +30,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl b/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl
index 93cf3e0fdb2..37623e048ed 100644
--- a/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl
+++ b/examples/tree_1d_dgsem/elixir_mhdmulti_es.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the ideal MHD equations
-equations = IdealGlmMhdMulticomponentEquations1D(gammas = (2.0, 2.0, 2.0),
+equations = IdealGlmMhdMulticomponentEquations1D(gammas = (2.0, 2.0, 2.0),
gas_constants = (2.0, 2.0, 2.0))
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_hindenlang_gassner
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,29 +30,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl
index 3f72d319b0b..33ad0d5271c 100644
--- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl
+++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_periodic.jl
@@ -10,101 +10,101 @@ prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600
equations = CompressibleEulerEquations1D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu(),
+ Prandtl = prandtl_number())
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
# (Simplified version of the 2D)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_t = pi * t
- rho = c + A * sin(pi_x) * cos(pi_t)
- v1 = sin(pi_x) * cos(pi_t)
- p = rho^2
+ rho = c + A * sin(pi_x) * cos(pi_t)
+ v1 = sin(pi_x) * cos(pi_t)
+ p = rho^2
- return prim2cons(SVector(rho, v1, p), equations)
+ return prim2cons(SVector(rho, v1, p), equations)
end
initial_condition = initial_condition_navier_stokes_convergence_test
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * sin(pi_x) * cos(pi_t)
- rho_t = -pi * A * sin(pi_x) * sin(pi_t)
- rho_x = pi * A * cos(pi_x) * cos(pi_t)
- rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_t)
-
- v1 = sin(pi_x) * cos(pi_t)
- v1_t = -pi * sin(pi_x) * sin(pi_t)
- v1_x = pi * cos(pi_x) * cos(pi_t)
- v1_xx = -pi * pi * sin(pi_x) * cos(pi_t)
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
-
- E = p * inv_gamma_minus_one + 0.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 0.5 * rho_t * v1^2 + rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 0.5 * rho_x * v1^2 + rho * v1 * v1_x
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x
-
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t
- + p_x + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- # stress tensor from x-direction
- - v1_xx * mu_)
-
- # total energy equation
- du3 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- # stress tensor and temperature gradient terms from x-direction
- - v1_xx * v1 * mu_
- - v1_x * v1_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_)
-
- return SVector(du1, du2, du3)
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * sin(pi_x) * cos(pi_t)
+ rho_t = -pi * A * sin(pi_x) * sin(pi_t)
+ rho_x = pi * A * cos(pi_x) * cos(pi_t)
+ rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_t)
+
+ v1 = sin(pi_x) * cos(pi_t)
+ v1_t = -pi * sin(pi_x) * sin(pi_t)
+ v1_x = pi * cos(pi_x) * cos(pi_t)
+ v1_xx = -pi * pi * sin(pi_x) * cos(pi_t)
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+
+ E = p * inv_gamma_minus_one + 0.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 0.5 * rho_t * v1^2 + rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 0.5 * rho_x * v1^2 + rho * v1 * v1_x
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x
+
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t
+ + p_x + rho_x * v1^2 + 2.0 * rho * v1 * v1_x -
+ # stress tensor from x-direction
+ v1_xx * mu_)
+
+ # total energy equation
+ du3 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x) -
+ # stress tensor and temperature gradient terms from x-direction
+ v1_xx * v1 * mu_ -
+ v1_x * v1_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_)
+
+ return SVector(du1, du2, du3)
end
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=100_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver,
@@ -119,9 +119,9 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval,)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -131,6 +131,6 @@ callbacks = CallbackSet(summary_callback,
# run the simulation
time_int_tol = 1e-9
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
+summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl
index 181a2cb209f..40030d53345 100644
--- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl
+++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl
@@ -8,135 +8,145 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations1D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- periodicity=false,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 3,
+ periodicity = false,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion1D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion1D`)
# and by the initial condition (which passes in `CompressibleEulerEquations1D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_t = pi * t
- rho = c + A * cos(pi_x) * cos(pi_t)
- v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0)) ) * cos(pi_t)
- p = rho^2
+ rho = c + A * cos(pi_x) * cos(pi_t)
+ v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t)
+ p = rho^2
- return prim2cons(SVector(rho, v1, p), equations)
+ return prim2cons(SVector(rho, v1, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- x = x[1]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * cos(pi_x) * cos(pi_t)
- rho_t = -pi * A * cos(pi_x) * sin(pi_t)
- rho_x = -pi * A * sin(pi_x) * cos(pi_t)
- rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t)
-
- v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t)
- v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t)
- v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) + (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t)
- v1_xx = (( 2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0)
- - A * A * log(x + 2.0) * exp(-A * (x - 1.0))
- - (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t))
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 0.5 * rho_t * v1^2 + rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 0.5 * rho_x * v1^2 + rho * v1 * v1_x
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x
-
- # y-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t
- + p_x + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- # stress tensor from y-direction
- - v1_xx * mu_)
-
- # total energy equation
- du3 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- # stress tensor and temperature gradient terms from x-direction
- - v1_xx * v1 * mu_
- - v1_x * v1_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_ )
-
- return SVector(du1, du2, du3)
+ x = x[1]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * cos(pi_x) * cos(pi_t)
+ rho_t = -pi * A * cos(pi_x) * sin(pi_t)
+ rho_x = -pi * A * sin(pi_x) * cos(pi_t)
+ rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t)
+
+ v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t)
+ v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t)
+ v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) +
+ (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t)
+ v1_xx = ((2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0) -
+ A * A * log(x + 2.0) * exp(-A * (x - 1.0)) -
+ (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t))
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 0.5 * rho_t * v1^2 + rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 0.5 * rho_x * v1^2 + rho * v1 * v1_x
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x
+
+ # y-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t
+ + p_x + rho_x * v1^2 + 2.0 * rho * v1 * v1_x -
+ # stress tensor from y-direction
+ v1_xx * mu_)
+
+ # total energy equation
+ du3 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x) -
+ # stress tensor and temperature gradient terms from x-direction
+ v1_xx * v1 * mu_ -
+ v1_x * v1_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_)
+
+ return SVector(du1, du2, du3)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_left_right = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2])
-
-heat_bc_left = Isothermal((x, t, equations) ->
- Trixi.temperature(initial_condition_navier_stokes_convergence_test(x, t, equations),
- equations_parabolic))
+velocity_bc_left_right = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2])
+
+heat_bc_left = Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations),
+ equations_parabolic))
heat_bc_right = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_left = BoundaryConditionNavierStokesWall(velocity_bc_left_right, heat_bc_left)
-boundary_condition_right = BoundaryConditionNavierStokesWall(velocity_bc_left_right, heat_bc_right)
+boundary_condition_left = BoundaryConditionNavierStokesWall(velocity_bc_left_right,
+ heat_bc_left)
+boundary_condition_right = BoundaryConditionNavierStokesWall(velocity_bc_left_right,
+ heat_bc_right)
# define inviscid boundary conditions
boundary_conditions = (; x_neg = boundary_condition_slip_wall,
- x_pos = boundary_condition_slip_wall)
+ x_pos = boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; x_neg = boundary_condition_left,
- x_pos = boundary_condition_right)
+ x_pos = boundary_condition_right)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -146,15 +156,15 @@ tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
+summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl
index 1daeab04a71..e833155a68e 100644
--- a/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl
+++ b/examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls_amr.jl
@@ -8,135 +8,145 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations1D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesEntropy())
+equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesEntropy())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- periodicity=false,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 3,
+ periodicity = false,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion1D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion1D`)
# and by the initial condition (which passes in `CompressibleEulerEquations1D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_t = pi * t
- rho = c + A * cos(pi_x) * cos(pi_t)
- v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0)) ) * cos(pi_t)
- p = rho^2
+ rho = c + A * cos(pi_x) * cos(pi_t)
+ v1 = log(x[1] + 2.0) * (1.0 - exp(-A * (x[1] - 1.0))) * cos(pi_t)
+ p = rho^2
- return prim2cons(SVector(rho, v1, p), equations)
+ return prim2cons(SVector(rho, v1, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- x = x[1]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * cos(pi_x) * cos(pi_t)
- rho_t = -pi * A * cos(pi_x) * sin(pi_t)
- rho_x = -pi * A * sin(pi_x) * cos(pi_t)
- rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t)
-
- v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t)
- v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t)
- v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) + (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t)
- v1_xx = (( 2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0)
- - A * A * log(x + 2.0) * exp(-A * (x - 1.0))
- - (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t))
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 0.5 * rho_t * v1^2 + rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 0.5 * rho_x * v1^2 + rho * v1 * v1_x
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x
-
- # y-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t
- + p_x + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- # stress tensor from y-direction
- - v1_xx * mu_)
-
- # total energy equation
- du3 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- # stress tensor and temperature gradient terms from x-direction
- - v1_xx * v1 * mu_
- - v1_x * v1_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_ )
-
- return SVector(du1, du2, du3)
+ x = x[1]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * cos(pi_x) * cos(pi_t)
+ rho_t = -pi * A * cos(pi_x) * sin(pi_t)
+ rho_x = -pi * A * sin(pi_x) * cos(pi_t)
+ rho_xx = -pi * pi * A * cos(pi_x) * cos(pi_t)
+
+ v1 = log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * cos(pi_t)
+ v1_t = -pi * log(x + 2.0) * (1.0 - exp(-A * (x - 1.0))) * sin(pi_t)
+ v1_x = (A * log(x + 2.0) * exp(-A * (x - 1.0)) +
+ (1.0 - exp(-A * (x - 1.0))) / (x + 2.0)) * cos(pi_t)
+ v1_xx = ((2.0 * A * exp(-A * (x - 1.0)) / (x + 2.0) -
+ A * A * log(x + 2.0) * exp(-A * (x - 1.0)) -
+ (1.0 - exp(-A * (x - 1.0))) / ((x + 2.0) * (x + 2.0))) * cos(pi_t))
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 0.5 * rho_t * v1^2 + rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 0.5 * rho_x * v1^2 + rho * v1 * v1_x
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x
+
+ # y-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t
+ + p_x + rho_x * v1^2 + 2.0 * rho * v1 * v1_x -
+ # stress tensor from y-direction
+ v1_xx * mu_)
+
+ # total energy equation
+ du3 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x) -
+ # stress tensor and temperature gradient terms from x-direction
+ v1_xx * v1 * mu_ -
+ v1_x * v1_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_)
+
+ return SVector(du1, du2, du3)
end
initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
-velocity_bc_left_right = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x, t, equations)[2])
-
-heat_bc_left = Isothermal((x, t, equations) ->
- Trixi.temperature(initial_condition_navier_stokes_convergence_test(x, t, equations),
- equations_parabolic))
+velocity_bc_left_right = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations)[2])
+
+heat_bc_left = Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
+ t,
+ equations),
+ equations_parabolic))
heat_bc_right = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_left = BoundaryConditionNavierStokesWall(velocity_bc_left_right, heat_bc_left)
-boundary_condition_right = BoundaryConditionNavierStokesWall(velocity_bc_left_right, heat_bc_right)
+boundary_condition_left = BoundaryConditionNavierStokesWall(velocity_bc_left_right,
+ heat_bc_left)
+boundary_condition_right = BoundaryConditionNavierStokesWall(velocity_bc_left_right,
+ heat_bc_right)
# define inviscid boundary conditions
boundary_conditions = (; x_neg = boundary_condition_slip_wall,
- x_pos = boundary_condition_slip_wall)
+ x_pos = boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; x_neg = boundary_condition_left,
- x_pos = boundary_condition_right)
+ x_pos = boundary_condition_right)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -146,19 +156,19 @@ tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-amr_controller = ControllerThreeLevel(semi,
- IndicatorLöhner(semi, variable=Trixi.density),
- base_level=3,
- med_level=4, med_threshold=0.005,
- max_level=5, max_threshold=0.01)
+amr_controller = ControllerThreeLevel(semi,
+ IndicatorLöhner(semi, variable = Trixi.density),
+ base_level = 3,
+ med_level = 4, med_threshold = 0.005,
+ max_level = 5, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true)
+ interval = 5,
+ adapt_initial_condition = true)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, amr_callback)
@@ -167,6 +177,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, amr
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
+summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl b/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl
index 1288bc5e66a..378079ca334 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_beach.jl
@@ -7,7 +7,7 @@ using Trixi
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations1D(gravity_constant=9.812)
+equations = ShallowWaterEquations1D(gravity_constant = 9.812)
"""
initial_condition_beach(x, t, equations:: ShallowWaterEquations1D)
@@ -22,33 +22,33 @@ found in section 5.2 of the paper:
Finite volume evolution Galerkin methods for the shallow water equations with dry beds\n
[DOI: 10.4208/cicp.220210.020710a](https://dx.doi.org/10.4208/cicp.220210.020710a)
"""
-function initial_condition_beach(x, t, equations:: ShallowWaterEquations1D)
- D = 1
- delta = 0.02
- gamma = sqrt((3 * delta) / (4 * D))
- x_a = sqrt((4 * D) / (3 * delta)) * acosh(sqrt(20))
-
- f = D + 40 * delta * sech(gamma * (8 * x[1] - x_a))^2
-
- # steep curved beach
- b = 0.01 + 99 / 409600 * 4^x[1]
-
- if x[1] >= 6
- H = b
- v = 0.0
- else
- H = f
- v = sqrt(equations.gravity / D) * H
- end
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v, b), equations)
+function initial_condition_beach(x, t, equations::ShallowWaterEquations1D)
+ D = 1
+ delta = 0.02
+ gamma = sqrt((3 * delta) / (4 * D))
+ x_a = sqrt((4 * D) / (3 * delta)) * acosh(sqrt(20))
+
+ f = D + 40 * delta * sech(gamma * (8 * x[1] - x_a))^2
+
+ # steep curved beach
+ b = 0.01 + 99 / 409600 * 4^x[1]
+
+ if x[1] >= 6
+ H = b
+ v = 0.0
+ else
+ H = f
+ v = sqrt(equations.gravity / D) * H
+ end
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v, b), equations)
end
initial_condition = initial_condition_beach
@@ -58,19 +58,20 @@ boundary_condition = boundary_condition_slip_wall
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -81,13 +82,13 @@ coordinates_min = 0.0
coordinates_max = 8.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=7,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 7,
+ n_cells_max = 10_000,
+ periodicity = false)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition)
+ boundary_conditions = boundary_condition)
###############################################################################
# ODE solvers, callbacks etc.
@@ -98,24 +99,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(dt=0.5,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(dt = 0.5,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_ec.jl b/examples/tree_1d_dgsem/elixir_shallowwater_ec.jl
index 1469afec1ca..a3df37fb966 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_ec.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_ec.jl
@@ -6,7 +6,7 @@ using Trixi
# Semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations1D(gravity_constant=9.81)
+equations = ShallowWaterEquations1D(gravity_constant = 9.81)
# Initial condition with a truly discontinuous water height, velocity, and bottom
# topography function as an academic testcase for entropy conservation.
@@ -16,23 +16,23 @@ equations = ShallowWaterEquations1D(gravity_constant=9.81)
# refinement level is changed the initial condition below may need changed as well to
# ensure that the discontinuities lie on an element interface.
function initial_condition_ec_discontinuous_bottom(x, t, equations::ShallowWaterEquations1D)
- # Set the background values
- H = 4.25
- v = 0.0
- b = sin(x[1]) # arbitrary continuous function
-
- # Setup the discontinuous water height and velocity
- if x[1] >= 0.125 && x[1] <= 0.25
- H = 5.0
- v = 0.1882
- end
-
- # Setup a discontinuous bottom topography
- if x[1] >= -0.25 && x[1] <= -0.125
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1])
- end
-
- return prim2cons(SVector(H, v, b), equations)
+ # Set the background values
+ H = 4.25
+ v = 0.0
+ b = sin(x[1]) # arbitrary continuous function
+
+ # Setup the discontinuous water height and velocity
+ if x[1] >= 0.125 && x[1] <= 0.25
+ H = 5.0
+ v = 0.1882
+ end
+
+ # Setup a discontinuous bottom topography
+ if x[1] >= -0.25 && x[1] <= -0.125
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1])
+ end
+
+ return prim2cons(SVector(H, v, b), equations)
end
initial_condition = initial_condition_ec_discontinuous_bottom
@@ -41,8 +41,9 @@ initial_condition = initial_condition_ec_discontinuous_bottom
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=4, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4,
+ surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -50,8 +51,8 @@ solver = DGSEM(polydeg=4, surface_flux=(flux_fjordholm_etal, flux_nonconservativ
coordinates_min = -1.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -68,15 +69,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -84,7 +85,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl
index 916bba76ece..a586562af7e 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_parabolic_bowl.jl
@@ -7,7 +7,7 @@ using Trixi
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations1D(gravity_constant=9.81)
+equations = ShallowWaterEquations1D(gravity_constant = 9.81)
"""
initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations1D)
@@ -28,26 +28,26 @@ The particular setup below is taken from Section 6.2 of
curvilinear meshes with wet/dry fronts accelerated by GPUs
[DOI: 10.1016/j.jcp.2018.08.038](https://doi.org/10.1016/j.jcp.2018.08.038).
"""
-function initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations1D)
- a = 1
- h_0 = 0.1
- sigma = 0.5
- ω = sqrt(2 * equations.gravity * h_0) / a
-
- v = -sigma * ω * sin(ω * t)
-
- b = h_0 * x[1]^2 / a^2
-
- H = sigma * h_0 / a^2 * (2 * x[1] * cos(ω * t) - sigma) + h_0
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v, b), equations)
+function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations1D)
+ a = 1
+ h_0 = 0.1
+ sigma = 0.5
+ ω = sqrt(2 * equations.gravity * h_0) / a
+
+ v = -sigma * ω * sin(ω * t)
+
+ b = h_0 * x[1]^2 / a^2
+
+ H = sigma * h_0 / a^2 * (2 * x[1] * cos(ω * t) - sigma) + h_0
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v, b), equations)
end
initial_condition = initial_condition_parabolic_bowl
@@ -56,19 +56,20 @@ initial_condition = initial_condition_parabolic_bowl
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(5)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -79,8 +80,8 @@ coordinates_min = -2.0
coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -94,24 +95,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_shock_capturing.jl b/examples/tree_1d_dgsem/elixir_shallowwater_shock_capturing.jl
index 62346d7b5ab..511f33d1101 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_shock_capturing.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_shock_capturing.jl
@@ -5,36 +5,37 @@ using Trixi
###############################################################################
# Semidiscretization of the shallow water equations
-equations = ShallowWaterEquations1D(gravity_constant=9.812, H0=1.75)
+equations = ShallowWaterEquations1D(gravity_constant = 9.812, H0 = 1.75)
# Initial condition with a truly discontinuous velocity and bottom topography.
# Works as intended for TreeMesh1D with `initial_refinement_level=3`. If the mesh
# refinement level is changed the initial condition below may need changed as well to
# ensure that the discontinuities lie on an element interface.
-function initial_condition_stone_throw_discontinuous_bottom(x, t, equations::ShallowWaterEquations1D)
+function initial_condition_stone_throw_discontinuous_bottom(x, t,
+ equations::ShallowWaterEquations1D)
- # Calculate primitive variables
+ # Calculate primitive variables
- # flat lake
- H = equations.H0
+ # flat lake
+ H = equations.H0
- # Discontinuous velocity
- v = 0.0
- if x[1] >= -0.75 && x[1] <= 0.0
- v = -1.0
- elseif x[1] >= 0.0 && x[1] <= 0.75
- v = 1.0
- end
+ # Discontinuous velocity
+ v = 0.0
+ if x[1] >= -0.75 && x[1] <= 0.0
+ v = -1.0
+ elseif x[1] >= 0.0 && x[1] <= 0.75
+ v = 1.0
+ end
- b = ( 1.5 / exp( 0.5 * ((x[1] - 1.0)^2 ) )
- + 0.75 / exp( 0.5 * ((x[1] + 1.0)^2 ) ) )
+ b = (1.5 / exp(0.5 * ((x[1] - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x[1] + 1.0)^2)))
- # Force a discontinuous bottom topography
- if x[1] >= -1.5 && x[1] <= 0.0
- b = 0.5
- end
+ # Force a discontinuous bottom topography
+ if x[1] >= -1.5 && x[1] <= 0.0
+ b = 0.5
+ end
- return prim2cons(SVector(H, v, b), equations)
+ return prim2cons(SVector(H, v, b), equations)
end
initial_condition = initial_condition_stone_throw_discontinuous_bottom
@@ -45,18 +46,19 @@ boundary_condition = boundary_condition_slip_wall
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_lax_friedrichs, hydrostatic_reconstruction_audusse_etal),
+surface_flux = (FluxHydrostaticReconstruction(flux_lax_friedrichs,
+ hydrostatic_reconstruction_audusse_etal),
flux_nonconservative_audusse_etal)
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -66,9 +68,9 @@ solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = -3.0
coordinates_max = 3.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = false)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
@@ -86,28 +88,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal,
- lake_at_rest_error))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal,
+ lake_at_rest_error))
# Enable in-situ visualization with a new plot generated every 50 time steps
# and we explicitly pass that the plot data will be one-dimensional
# visualization = VisualizationCallback(interval=50, plot_data_creator=PlotData1D)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)#,
- # visualization)
+# visualization)
###############################################################################
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-7, reltol=1.0e-7,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-7, reltol = 1.0e-7,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl
index 2f9f93f4335..af596a377f8 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl
@@ -5,17 +5,17 @@ using Trixi
###############################################################################
# Semidiscretization of the shallow water equations
-equations = ShallowWaterEquations1D(gravity_constant=9.81)
+equations = ShallowWaterEquations1D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -23,13 +23,13 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservativ
coordinates_min = 0.0
coordinates_max = sqrt(2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,13 +40,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -54,6 +54,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl
index c8ef1c1b70b..cbc98a30f9f 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl
@@ -5,7 +5,7 @@ using Trixi
###############################################################################
# Semidiscretization of the shallow water equations
-equations = ShallowWaterEquations1D(gravity_constant=9.81)
+equations = ShallowWaterEquations1D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test
@@ -16,8 +16,8 @@ boundary_condition = BoundaryConditionDirichlet(initial_condition)
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=3, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -25,14 +25,14 @@ solver = DGSEM(polydeg=3, surface_flux=surface_flux,
coordinates_min = 0.0
coordinates_max = sqrt(2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = false)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
boundary_conditions = boundary_condition,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,13 +43,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -57,6 +57,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl
index e9f444aed27..fc76b4f034b 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_convergence.jl
@@ -5,18 +5,18 @@ using Trixi
###############################################################################
# Semidiscretization of the two-layer shallow water equations
-equations = ShallowWaterTwoLayerEquations1D(gravity_constant=10.0, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations1D(gravity_constant = 10.0, rho_upper = 0.9,
+ rho_lower = 1.0)
initial_condition = initial_condition_convergence_test
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
-
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -24,13 +24,13 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservativ
coordinates_min = 0.0
coordinates_max = sqrt(2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -41,13 +41,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=500,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 500,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -55,6 +55,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
- sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-8, reltol=1.0e-8,
- save_everystep=false, callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(), abstol = 1.0e-8, reltol = 1.0e-8,
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_dam_break.jl b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_dam_break.jl
index 60770d158fa..b2e6a81401b 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_dam_break.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_dam_break.jl
@@ -6,28 +6,29 @@ using Trixi
# Semidiscretization of the two-layer shallow water equations for a dam break
# test with a discontinuous bottom topography function to test entropy conservation
-equations = ShallowWaterTwoLayerEquations1D(gravity_constant=9.81, H0=2.0, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations1D(gravity_constant = 9.81, H0 = 2.0,
+ rho_upper = 0.9, rho_lower = 1.0)
# Initial condition of a dam break with a discontinuous water heights and bottom topography.
# Works as intended for TreeMesh1D with `initial_refinement_level=5`. If the mesh
# refinement level is changed the initial condition below may need changed as well to
# ensure that the discontinuities lie on an element interface.
function initial_condition_dam_break(x, t, equations::ShallowWaterTwoLayerEquations1D)
- v1_upper = 0.0
- v1_lower = 0.0
-
- # Set the discontinuity
- if x[1] <= 10.0
- H_lower = 2.0
- H_upper = 4.0
- b = 0.0
- else
- H_lower = 1.5
- H_upper = 3.0
- b = 0.5
- end
-
- return prim2cons(SVector(H_upper, v1_upper, H_lower, v1_lower, b), equations)
+ v1_upper = 0.0
+ v1_lower = 0.0
+
+ # Set the discontinuity
+ if x[1] <= 10.0
+ H_lower = 2.0
+ H_upper = 4.0
+ b = 0.0
+ else
+ H_lower = 1.5
+ H_upper = 3.0
+ b = 0.5
+ end
+
+ return prim2cons(SVector(H_upper, v1_upper, H_lower, v1_lower, b), equations)
end
initial_condition = initial_condition_dam_break
@@ -36,8 +37,9 @@ initial_condition = initial_condition_dam_break
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a non-periodic mesh
@@ -45,20 +47,20 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservativ
coordinates_min = 0.0
coordinates_max = 20.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10000,
- periodicity=false)
+ initial_refinement_level = 5,
+ n_cells_max = 10000,
+ periodicity = false)
boundary_condition = boundary_condition_slip_wall
# create the semidiscretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition)
+ boundary_conditions = boundary_condition)
###############################################################################
# ODE solvers
-tspan = (0.0,0.4)
+tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)
###############################################################################
@@ -67,16 +69,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_total, energy_kinetic, energy_internal,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_total,
+ energy_kinetic,
+ energy_internal))
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=500,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 500,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -84,6 +89,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-8, reltol=1.0e-8,
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, RDPK3SpFSAL49(), abstol = 1.0e-8, reltol = 1.0e-8,
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
index bec0b8ab69c..7236f1697d0 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
@@ -5,7 +5,8 @@ using Trixi
###############################################################################
# Semidiscretization of the two-layer shallow water equations to test well-balancedness
-equations = ShallowWaterTwoLayerEquations1D(gravity_constant=1.0, H0=0.6, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations1D(gravity_constant = 1.0, H0 = 0.6,
+ rho_upper = 0.9, rho_lower = 1.0)
"""
initial_condition_fjordholm_well_balanced(x, t, equations::ShallowWaterTwoLayerEquations1D)
@@ -15,7 +16,8 @@ Initial condition to test well balanced with a bottom topography from Fjordholm
Energy conservative and stable schemes for the two-layer shallow water equations.
[DOI: 10.1142/9789814417099_0039](https://doi.org/10.1142/9789814417099_0039)
"""
-function initial_condition_fjordholm_well_balanced(x, t, equations::ShallowWaterTwoLayerEquations1D)
+function initial_condition_fjordholm_well_balanced(x, t,
+ equations::ShallowWaterTwoLayerEquations1D)
inicenter = 0.5
x_norm = x[1] - inicenter
r = abs(x_norm)
@@ -24,9 +26,9 @@ function initial_condition_fjordholm_well_balanced(x, t, equations::ShallowWater
H_upper = 0.6
v1_upper = 0.0
v1_lower = 0.0
- b = r <= 0.1 ? 0.2 * (cos(10 * pi * (x[1] - 0.5)) + 1) : 0.0
+ b = r <= 0.1 ? 0.2 * (cos(10 * pi * (x[1] - 0.5)) + 1) : 0.0
return prim2cons(SVector(H_upper, v1_upper, H_lower, v1_lower, b), equations)
- end
+end
initial_condition = initial_condition_fjordholm_well_balanced
@@ -34,8 +36,9 @@ initial_condition = initial_condition_fjordholm_well_balanced
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -43,9 +46,9 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_es_fjordholm_etal, flux_nonconserva
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=true)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -59,16 +62,17 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (lake_at_rest_error,))
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -76,7 +80,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced.jl b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced.jl
index e07bc04d76a..649e5023f6d 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced.jl
@@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations1D(gravity_constant=9.81, H0=3.25)
+equations = ShallowWaterEquations1D(gravity_constant = 9.81, H0 = 3.25)
# Setup a truly discontinuous bottom topography function for this academic
# testcase of well-balancedness. The errors from the analysis callback are
@@ -15,18 +15,19 @@ equations = ShallowWaterEquations1D(gravity_constant=9.81, H0=3.25)
# Works as intended for TreeMesh1D with `initial_refinement_level=3`. If the mesh
# refinement level is changed the initial condition below may need changed as well to
# ensure that the discontinuities lie on an element interface.
-function initial_condition_discontinuous_well_balancedness(x, t, equations::ShallowWaterEquations1D)
- # Set the background values
- H = equations.H0
- v = 0.0
- b = 0.0
-
- # Setup a discontinuous bottom topography
- if x[1] >= 0.5 && x[1] <= 0.75
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1])
- end
-
- return prim2cons(SVector(H, v, b), equations)
+function initial_condition_discontinuous_well_balancedness(x, t,
+ equations::ShallowWaterEquations1D)
+ # Set the background values
+ H = equations.H0
+ v = 0.0
+ b = 0.0
+
+ # Setup a discontinuous bottom topography
+ if x[1] >= 0.5 && x[1] <= 0.75
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1])
+ end
+
+ return prim2cons(SVector(H, v, b), equations)
end
initial_condition = initial_condition_discontinuous_well_balancedness
@@ -36,17 +37,17 @@ initial_condition = initial_condition_discontinuous_well_balancedness
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=4, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -63,16 +64,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -80,7 +81,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl
index ef707b803e9..e55fffc101e 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_nonperiodic.jl
@@ -5,19 +5,19 @@ using Trixi
###############################################################################
# Semidiscretization of the shallow water equations
-equations = ShallowWaterEquations1D(gravity_constant=1.0, H0=3.0)
+equations = ShallowWaterEquations1D(gravity_constant = 1.0, H0 = 3.0)
# An initial condition with constant total water height and zero velocities to test well-balancedness.
function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations1D)
- # Set the background values
- H = equations.H0
- v = 0.0
+ # Set the background values
+ H = equations.H0
+ v = 0.0
- b = (1.5 / exp( 0.5 * ((x[1] - 1.0)^2))+ 0.75 / exp(0.5 * ((x[1] + 1.0)^2)))
+ b = (1.5 / exp(0.5 * ((x[1] - 1.0)^2)) + 0.75 / exp(0.5 * ((x[1] + 1.0)^2)))
- return prim2cons(SVector(H, v, b), equations)
+ return prim2cons(SVector(H, v, b), equations)
end
-
+
initial_condition = initial_condition_well_balancedness
boundary_condition = BoundaryConditionDirichlet(initial_condition)
@@ -26,8 +26,8 @@ boundary_condition = BoundaryConditionDirichlet(initial_condition)
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -35,9 +35,9 @@ solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_fjordholm
coordinates_min = 0.0
coordinates_max = sqrt(2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = false)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
@@ -52,25 +52,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
+callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
index 8de46c61794..26a8960ab46 100644
--- a/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
+++ b/examples/tree_1d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
@@ -8,7 +8,7 @@ using Printf: @printf, @sprintf
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations1D(gravity_constant=9.812)
+equations = ShallowWaterEquations1D(gravity_constant = 9.812)
"""
initial_condition_complex_bottom_well_balanced(x, t, equations:: ShallowWaterEquations1D)
@@ -23,28 +23,29 @@ The initial condition is taken from Section 5.2 of the paper:
A new hydrostatic reconstruction scheme based on subcell reconstructions
[DOI:10.1137/15M1053074](https://dx.doi.org/10.1137/15M1053074)
"""
-function initial_condition_complex_bottom_well_balanced(x, t, equations:: ShallowWaterEquations1D)
- v = 0.0
- b = sin(4 * pi * x[1]) + 3
-
- if x[1] >= 0.5
- b = sin(4 * pi * x[1]) + 1
- end
-
- H = max(b, 2.5)
-
- if x[1] >= 0.5
- H = max(b, 1.5)
- end
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v, b), equations)
+function initial_condition_complex_bottom_well_balanced(x, t,
+ equations::ShallowWaterEquations1D)
+ v = 0.0
+ b = sin(4 * pi * x[1]) + 3
+
+ if x[1] >= 0.5
+ b = sin(4 * pi * x[1]) + 1
+ end
+
+ H = max(b, 2.5)
+
+ if x[1] >= 0.5
+ H = max(b, 1.5)
+ end
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v, b), equations)
end
initial_condition = initial_condition_complex_bottom_well_balanced
@@ -53,19 +54,20 @@ initial_condition = initial_condition_complex_bottom_well_balanced
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -76,8 +78,8 @@ coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -91,26 +93,27 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 5000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.5)
+stepsize_callback = StepsizeCallback(cfl = 1.5)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(stage_limiter!); dt=1.0,
- ode_default_options()..., callback=callbacks, adaptive=false);
+sol = solve(ode, SSPRK43(stage_limiter!); dt = 1.0,
+ ode_default_options()..., callback = callbacks, adaptive = false);
summary_callback() # print the timer summary
@@ -123,35 +126,39 @@ summary_callback() # print the timer summary
# Declare a special version of the function to compute the lake-at-rest error
# OBS! The reference water height values are hardcoded for convenience.
function lake_at_rest_error_two_level(u, x, equations::ShallowWaterEquations1D)
- h, _, b = u
-
- # For well-balancedness testing with possible wet/dry regions the reference
- # water height `H0` accounts for the possibility that the bottom topography
- # can emerge out of the water as well as for the threshold offset to avoid
- # division by a "hard" zero water heights as well.
- if x[1] < 0.5
- H0_wet_dry = max( 2.5 , b + equations.threshold_limiter )
- else
- H0_wet_dry = max( 1.5 , b + equations.threshold_limiter )
- end
-
- return abs(H0_wet_dry - (h + b))
- end
+ h, _, b = u
+
+ # For well-balancedness testing with possible wet/dry regions the reference
+ # water height `H0` accounts for the possibility that the bottom topography
+ # can emerge out of the water as well as for the threshold offset to avoid
+ # division by a "hard" zero water heights as well.
+ if x[1] < 0.5
+ H0_wet_dry = max(2.5, b + equations.threshold_limiter)
+ else
+ H0_wet_dry = max(1.5, b + equations.threshold_limiter)
+ end
+
+ return abs(H0_wet_dry - (h + b))
+end
# point to the data we want to analyze
u = Trixi.wrap_array(sol[end], semi)
# Perform the actual integration of the well-balancedness error over the domain
-l1_well_balance_error = Trixi.integrate_via_indices(u, mesh, equations, semi.solver, semi.cache; normalize=true) do u, i, element, equations, solver
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, solver, i, element)
- # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
- # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
- if i == 1
- x_node = SVector(nextfloat(x_node[1]))
- elseif i == nnodes(semi.solver)
- x_node = SVector(prevfloat(x_node[1]))
- end
- u_local = Trixi.get_node_vars(u, equations, solver, i, element)
- return lake_at_rest_error_two_level(u_local, x_node, equations)
+l1_well_balance_error = Trixi.integrate_via_indices(u, mesh, equations, semi.solver,
+ semi.cache;
+ normalize = true) do u, i, element,
+ equations, solver
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, solver,
+ i, element)
+ # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
+ # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
+ if i == 1
+ x_node = SVector(nextfloat(x_node[1]))
+ elseif i == nnodes(semi.solver)
+ x_node = SVector(prevfloat(x_node[1]))
+ end
+ u_local = Trixi.get_node_vars(u, equations, solver, i, element)
+ return lake_at_rest_error_two_level(u_local, x_node, equations)
end
# report the well-balancedness lake-at-rest error to the screen
@@ -162,4 +169,4 @@ println(" Lake-at-rest error for '", Trixi.get_name(equations), "' with ", summa
@printf(" %-12s:", Trixi.pretty_form_utf(lake_at_rest_error))
@printf(" % 10.8e", l1_well_balance_error)
println()
-println("─"^100)
\ No newline at end of file
+println("─"^100)
diff --git a/examples/tree_1d_fdsbp/elixir_advection_upwind.jl b/examples/tree_1d_fdsbp/elixir_advection_upwind.jl
index 1f2498e0866..389a8566c97 100644
--- a/examples/tree_1d_fdsbp/elixir_advection_upwind.jl
+++ b/examples/tree_1d_fdsbp/elixir_advection_upwind.jl
@@ -24,7 +24,7 @@ solver = FDSBP(D_upw,
volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level = 4,
n_cells_max = 10_000,
@@ -32,7 +32,6 @@ mesh = TreeMesh(coordinates_min, coordinates_max,
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sin, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -42,17 +41,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl b/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl
index 035d3568a80..2d7c13d7e57 100644
--- a/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl
+++ b/examples/tree_1d_fdsbp/elixir_advection_upwind_periodic.jl
@@ -23,7 +23,7 @@ solver = FDSBP(D_upw,
volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level = 0,
n_cells_max = 10_000,
@@ -31,7 +31,6 @@ mesh = TreeMesh(coordinates_min, coordinates_max,
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sin, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -41,17 +40,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_fdsbp/elixir_burgers_basic.jl b/examples/tree_1d_fdsbp/elixir_burgers_basic.jl
index c7b0176dfdc..c58fc497e14 100644
--- a/examples/tree_1d_fdsbp/elixir_burgers_basic.jl
+++ b/examples/tree_1d_fdsbp/elixir_burgers_basic.jl
@@ -12,24 +12,23 @@ equations = InviscidBurgersEquation1D()
initial_condition = initial_condition_convergence_test
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=32)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 32)
flux_splitting = splitting_lax_friedrichs
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,25 +39,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 200
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-9, reltol=1.0e-9,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, SSPRK43(); abstol = 1.0e-9, reltol = 1.0e-9,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl b/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl
index 20508feba22..eeaae7a7843 100644
--- a/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl
+++ b/examples/tree_1d_fdsbp/elixir_burgers_linear_stability.jl
@@ -10,28 +10,28 @@ using Trixi
equations = InviscidBurgersEquation1D()
function initial_condition_linear_stability(x, t, equation::InviscidBurgersEquation1D)
- k = 1
- 2 + sinpi(k * (x[1] - 0.7)) |> SVector
+ k = 1
+ 2 + sinpi(k * (x[1] - 0.7)) |> SVector
end
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_lax_friedrichs
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_linear_stability, solver)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_linear_stability,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -42,19 +42,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, SSPRK43(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_fdsbp/elixir_euler_convergence.jl b/examples/tree_1d_fdsbp/elixir_euler_convergence.jl
index f9f9297f7c8..7b6bfee946e 100644
--- a/examples/tree_1d_fdsbp/elixir_euler_convergence.jl
+++ b/examples/tree_1d_fdsbp/elixir_euler_convergence.jl
@@ -12,24 +12,23 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_convergence_test
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=32)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 32)
flux_splitting = splitting_steger_warming
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = 0.0
coordinates_max = 2.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=1,
- n_cells_max=10_000)
+ initial_refinement_level = 1,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,25 +39,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_errors=(:l2_error_primitive,
- :linf_error_primitive))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_errors = (:l2_error_primitive,
+ :linf_error_primitive))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl b/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl
index 5c5192a3fbe..a28cd01120b 100644
--- a/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl
+++ b/examples/tree_1d_fdsbp/elixir_euler_density_wave.jl
@@ -11,24 +11,23 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_density_wave
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_coirier_vanleer
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = -1.0
-coordinates_max = 1.0
+coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000)
+ initial_refinement_level = 2,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -38,23 +37,22 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 10000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl b/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl
index d34399a5576..615da951871 100644
--- a/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl
+++ b/examples/tree_2d_dgsem/elixir_acoustics_convergence.jl
@@ -4,26 +4,25 @@ using Trixi
###############################################################################
# semidiscretization of the acoustic perturbation equations
-equations = AcousticPerturbationEquations2D(v_mean_global=(0.5, 0.3), c_mean_global=2.0,
- rho_mean_global=0.9)
+equations = AcousticPerturbationEquations2D(v_mean_global = (0.5, 0.3), c_mean_global = 2.0,
+ rho_mean_global = 0.9)
initial_condition = initial_condition_convergence_test
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0) # minimum coordinates (min(x), min(y))
coordinates_max = (2.0, 2.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 3,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,26 +36,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl b/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl
index fa608e78693..b3fe55dccea 100644
--- a/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl
+++ b/examples/tree_2d_dgsem/elixir_acoustics_gauss.jl
@@ -10,20 +10,19 @@ rho_mean_global = 1.0
equations = AcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_gauss, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -36,26 +35,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl
index 78102eaf874..918c0831fcd 100644
--- a/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl
+++ b/examples/tree_2d_dgsem/elixir_acoustics_gauss_wall.jl
@@ -4,20 +4,20 @@ using Trixi
###############################################################################
# semidiscretization of the acoustic perturbation equations
-equations = AcousticPerturbationEquations2D(v_mean_global=(0.5, 0.0), c_mean_global=1.0,
- rho_mean_global=1.0)
+equations = AcousticPerturbationEquations2D(v_mean_global = (0.5, 0.0), c_mean_global = 1.0,
+ rho_mean_global = 1.0)
# Create DG solver with polynomial degree = 5 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=5, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 5, surface_flux = flux_lax_friedrichs)
coordinates_min = (-100.0, 0.0) # minimum coordinates (min(x), min(y))
coordinates_max = (100.0, 200.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=100_000,
- periodicity=false)
+ initial_refinement_level = 4,
+ n_cells_max = 100_000,
+ periodicity = false)
"""
initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D)
@@ -26,20 +26,19 @@ A Gaussian pulse, used in the `gauss_wall` example elixir in combination with
[`boundary_condition_wall`](@ref). Uses the global mean values from `equations`.
"""
function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D)
- v1_prime = 0.0
- v2_prime = 0.0
- p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25)
+ v1_prime = 0.0
+ v2_prime = 0.0
+ p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25)
- prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...)
+ prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...)
- return prim2cons(prim, equations)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_gauss_wall
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition_wall)
-
+ boundary_conditions = boundary_condition_wall)
###############################################################################
# ODE solvers, callbacks etc.
@@ -53,24 +52,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100, solution_variables=cons2state)
+save_solution = SaveSolutionCallback(interval = 100, solution_variables = cons2state)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.7)
+stepsize_callback = StepsizeCallback(cfl = 0.7)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks)
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl b/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl
index 0a0e2520581..71d4f1a9f68 100644
--- a/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl
+++ b/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl
@@ -3,45 +3,45 @@ using Trixi
# Oscillating Gaussian-shaped source terms
function source_terms_gauss(u, x, t, equations::AcousticPerturbationEquations2D)
- r = 0.1
- A = 1.0
- f = 2.0
+ r = 0.1
+ A = 1.0
+ f = 2.0
- # Velocity sources
- s1 = 0.0
- s2 = 0.0
- # Pressure source
- s3 = exp(-(x[1]^2 + x[2]^2) / (2 * r^2)) * A * sin(2 * pi * f * t)
+ # Velocity sources
+ s1 = 0.0
+ s2 = 0.0
+ # Pressure source
+ s3 = exp(-(x[1]^2 + x[2]^2) / (2 * r^2)) * A * sin(2 * pi * f * t)
- # Mean sources
- s4 = s5 = s6 = s7 = 0.0
+ # Mean sources
+ s4 = s5 = s6 = s7 = 0.0
- return SVector(s1, s2, s3, s4, s5, s6, s7)
+ return SVector(s1, s2, s3, s4, s5, s6, s7)
end
###############################################################################
# semidiscretization of the acoustic perturbation equations
-equations = AcousticPerturbationEquations2D(v_mean_global=(-0.5, 0.25), c_mean_global=1.0,
- rho_mean_global=1.0)
+equations = AcousticPerturbationEquations2D(v_mean_global = (-0.5, 0.25),
+ c_mean_global = 1.0,
+ rho_mean_global = 1.0)
initial_condition = initial_condition_constant
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-3.0, -3.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 3.0, 3.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (3.0, 3.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_gauss)
-
+ source_terms = source_terms_gauss)
###############################################################################
# ODE solvers, callbacks etc.
@@ -55,30 +55,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The TimeSeriesCallback records the solution at the given points over time
time_series = TimeSeriesCallback(semi, [(0.0, 0.0), (-1.0, 0.5)])
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, time_series,
stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl b/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl
index 0fdcbd22c44..d7265775114 100644
--- a/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl
+++ b/examples/tree_2d_dgsem/elixir_acoustics_monopole.jl
@@ -4,11 +4,11 @@ using Trixi
###############################################################################
# semidiscretization of the acoustic perturbation equations
-equations = AcousticPerturbationEquations2D(v_mean_global=(0.0, 0.0), c_mean_global=0.0,
- rho_mean_global=0.0)
+equations = AcousticPerturbationEquations2D(v_mean_global = (0.0, 0.0), c_mean_global = 0.0,
+ rho_mean_global = 0.0)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-20.6, 0.0) # minimum coordinates (min(x), min(y))
coordinates_max = (30.6, 51.2) # maximum coordinates (max(x), max(y))
@@ -20,20 +20,20 @@ Initial condition for the monopole in a boundary layer setup, used in combinatio
[`boundary_condition_monopole`](@ref).
"""
function initial_condition_monopole(x, t, equations::AcousticPerturbationEquations2D)
- m = 0.3 # Mach number
+ m = 0.3 # Mach number
- v1_prime = 0.0
- v2_prime = 0.0
- p_prime = 0.0
+ v1_prime = 0.0
+ v2_prime = 0.0
+ p_prime = 0.0
- v1_mean = x[2] > 1 ? m : m * (2*x[2] - 2*x[2]^2 + x[2]^4)
- v2_mean = 0.0
- c_mean = 1.0
- rho_mean = 1.0
+ v1_mean = x[2] > 1 ? m : m * (2 * x[2] - 2 * x[2]^2 + x[2]^4)
+ v2_mean = 0.0
+ c_mean = 1.0
+ rho_mean = 1.0
- prim = SVector(v1_prime, v2_prime, p_prime, v1_mean, v2_mean, c_mean, rho_mean)
+ prim = SVector(v1_prime, v2_prime, p_prime, v1_mean, v2_mean, c_mean, rho_mean)
- return prim2cons(prim, equations)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_monopole # does not use the global mean values given above
@@ -45,32 +45,35 @@ Boundary condition for a monopole in a boundary layer at the -y boundary, i.e. `
This will return an error for any other direction. This boundary condition is used in combination
with [`initial_condition_monopole`](@ref).
"""
-function boundary_condition_monopole(u_inner, orientation, direction, x, t, surface_flux_function,
+function boundary_condition_monopole(u_inner, orientation, direction, x, t,
+ surface_flux_function,
equations::AcousticPerturbationEquations2D)
- if direction != 3
- error("expected direction = 3, got $direction instead")
- end
-
- # Wall at the boundary in -y direction with a monopole at -0.05 <= x <= 0.05. In the monopole area
- # we use a sinusoidal boundary state for the perturbed variables. For the rest of the -y boundary
- # we set the boundary state to the inner state and multiply the perturbed velocity in the
- # y-direction by -1.
- if -0.05 <= x[1] <= 0.05 # Monopole
- v1_prime = 0.0
- v2_prime = p_prime = sin(2 * pi * t)
-
- prim_boundary = SVector(v1_prime, v2_prime, p_prime, u_inner[4], u_inner[5], u_inner[6], u_inner[7])
-
- u_boundary = prim2cons(prim_boundary, equations)
- else # Wall
- u_boundary = SVector(u_inner[1], -u_inner[2], u_inner[3], u_inner[4], u_inner[5], u_inner[6],
- u_inner[7])
- end
-
- # Calculate boundary flux
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ if direction != 3
+ error("expected direction = 3, got $direction instead")
+ end
+
+ # Wall at the boundary in -y direction with a monopole at -0.05 <= x <= 0.05. In the monopole area
+ # we use a sinusoidal boundary state for the perturbed variables. For the rest of the -y boundary
+ # we set the boundary state to the inner state and multiply the perturbed velocity in the
+ # y-direction by -1.
+ if -0.05 <= x[1] <= 0.05 # Monopole
+ v1_prime = 0.0
+ v2_prime = p_prime = sin(2 * pi * t)
+
+ prim_boundary = SVector(v1_prime, v2_prime, p_prime, u_inner[4], u_inner[5],
+ u_inner[6], u_inner[7])
+
+ u_boundary = prim2cons(prim_boundary, equations)
+ else # Wall
+ u_boundary = SVector(u_inner[1], -u_inner[2], u_inner[3], u_inner[4], u_inner[5],
+ u_inner[6],
+ u_inner[7])
+ end
+
+ # Calculate boundary flux
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- return flux
+ return flux
end
"""
@@ -80,42 +83,42 @@ end
Boundary condition that uses a boundary state where the state variables are zero and the mean
variables are the same as in `u_inner`.
"""
-function boundary_condition_zero(u_inner, orientation, direction, x, t, surface_flux_function,
+function boundary_condition_zero(u_inner, orientation, direction, x, t,
+ surface_flux_function,
equations::AcousticPerturbationEquations2D)
- value = zero(eltype(u_inner))
- u_boundary = SVector(value, value, value, cons2mean(u_inner, equations)...)
+ value = zero(eltype(u_inner))
+ u_boundary = SVector(value, value, value, cons2mean(u_inner, equations)...)
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- end
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ end
- return flux
+ return flux
end
-boundary_conditions = (x_neg=boundary_condition_zero,
- x_pos=boundary_condition_zero,
- y_neg=boundary_condition_monopole,
- y_pos=boundary_condition_zero)
+boundary_conditions = (x_neg = boundary_condition_zero,
+ x_pos = boundary_condition_zero,
+ y_neg = boundary_condition_monopole,
+ y_pos = boundary_condition_zero)
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000,
- periodicity=false)
+ initial_refinement_level = 6,
+ n_cells_max = 100_000,
+ periodicity = false)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
# Create ODE problem with time span from 0.0 to 24.0
-tspan = (0.0, 24.0)
+tspan = (0.0, 24.0)
ode = semidiscretize(semi, tspan)
# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
@@ -123,24 +126,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100, solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100, solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks)
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks)
# Print the timer summary
-summary_callback()
\ No newline at end of file
+summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_advection_amr.jl b/examples/tree_2d_dgsem/elixir_advection_amr.jl
index 84841877448..c3f971d2ffc 100644
--- a/examples/tree_2d_dgsem/elixir_advection_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_amr.jl
@@ -9,18 +9,16 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,37 +28,36 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl b/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl
index 897d3569e10..aa042e7500e 100644
--- a/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_amr_coarsen_twice.jl
@@ -3,7 +3,6 @@
using OrdinaryDiffEq
using Trixi
-
# Define new structs inside a module to allow re-evaluating the file.
# This module name needs to be unique among all examples, otherwise Julia will throw warnings
# if multiple test cases using the same module name are run in the same session.
@@ -11,27 +10,27 @@ module TrixiExtensionCoarsen
using Trixi
-struct IndicatorAlwaysCoarsen{Cache<:NamedTuple} <: Trixi.AbstractIndicator
- cache::Cache
+struct IndicatorAlwaysCoarsen{Cache <: NamedTuple} <: Trixi.AbstractIndicator
+ cache::Cache
end
function IndicatorAlwaysCoarsen(semi)
- basis = semi.solver.basis
- alpha = Vector{real(basis)}()
- cache = (; semi.mesh, alpha)
+ basis = semi.solver.basis
+ alpha = Vector{real(basis)}()
+ cache = (; semi.mesh, alpha)
- return IndicatorAlwaysCoarsen{typeof(cache)}(cache)
+ return IndicatorAlwaysCoarsen{typeof(cache)}(cache)
end
-function (indicator::IndicatorAlwaysCoarsen)(u::AbstractArray{<:Any,4},
+function (indicator::IndicatorAlwaysCoarsen)(u::AbstractArray{<:Any, 4},
mesh, equations, dg, cache;
t, kwargs...)
- alpha = indicator.cache.alpha
- resize!(alpha, nelements(dg, cache))
+ alpha = indicator.cache.alpha
+ resize!(alpha, nelements(dg, cache))
- alpha .= -1.0
+ alpha .= -1.0
- return alpha
+ return alpha
end
end # module TrixiExtensionCoarsen
@@ -46,18 +45,16 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,37 +64,37 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, TrixiExtensionCoarsen.IndicatorAlwaysCoarsen(semi),
- base_level=2, max_level=2,
- med_threshold=0.1, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi,
+ TrixiExtensionCoarsen.IndicatorAlwaysCoarsen(semi),
+ base_level = 2, max_level = 2,
+ med_threshold = 0.1, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl
index 42aee985889..abb8a5035be 100644
--- a/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_amr_nonperiodic.jl
@@ -14,19 +14,17 @@ initial_condition = initial_condition_gauss
# 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,26 +35,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -65,7 +63,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = stepsize_callback(ode), # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl b/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl
index e69cab29bb6..7b441775204 100644
--- a/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_amr_refine_twice.jl
@@ -3,7 +3,6 @@
using OrdinaryDiffEq
using Trixi
-
# Define new structs inside a module to allow re-evaluating the file.
# This module name needs to be unique among all examples, otherwise Julia will throw warnings
# if multiple test cases using the same module name are run in the same session.
@@ -11,27 +10,27 @@ module TrixiExtensionRefine
using Trixi
-struct IndicatorAlwaysRefine{Cache<:NamedTuple} <: Trixi.AbstractIndicator
- cache::Cache
+struct IndicatorAlwaysRefine{Cache <: NamedTuple} <: Trixi.AbstractIndicator
+ cache::Cache
end
function IndicatorAlwaysRefine(semi)
- basis = semi.solver.basis
- alpha = Vector{real(basis)}()
- cache = (; semi.mesh, alpha)
+ basis = semi.solver.basis
+ alpha = Vector{real(basis)}()
+ cache = (; semi.mesh, alpha)
- return IndicatorAlwaysRefine{typeof(cache)}(cache)
+ return IndicatorAlwaysRefine{typeof(cache)}(cache)
end
-function (indicator::IndicatorAlwaysRefine)(u::AbstractArray{<:Any,4},
+function (indicator::IndicatorAlwaysRefine)(u::AbstractArray{<:Any, 4},
mesh, equations, dg, cache;
t, kwargs...)
- alpha = indicator.cache.alpha
- resize!(alpha, nelements(dg, cache))
+ alpha = indicator.cache.alpha
+ resize!(alpha, nelements(dg, cache))
- alpha .= 1.0
+ alpha .= 1.0
- return alpha
+ return alpha
end
end # module TrixiExtensionRefine
@@ -46,18 +45,16 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,37 +64,37 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, TrixiExtensionRefine.IndicatorAlwaysRefine(semi),
- base_level=4, max_level=4,
- med_threshold=0.1, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi,
+ TrixiExtensionRefine.IndicatorAlwaysRefine(semi),
+ base_level = 4, max_level = 4,
+ med_threshold = 0.1, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl
index efd282dab1f..03a213689ec 100644
--- a/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_amr_solution_independent.jl
@@ -7,69 +7,68 @@ module TrixiExtension
using Trixi
-struct IndicatorSolutionIndependent{Cache<:NamedTuple} <: Trixi.AbstractIndicator
- cache::Cache
+struct IndicatorSolutionIndependent{Cache <: NamedTuple} <: Trixi.AbstractIndicator
+ cache::Cache
end
function IndicatorSolutionIndependent(semi)
- basis = semi.solver.basis
- alpha = Vector{real(basis)}()
- cache = (; semi.mesh, alpha)
- return IndicatorSolutionIndependent{typeof(cache)}(cache)
+ basis = semi.solver.basis
+ alpha = Vector{real(basis)}()
+ cache = (; semi.mesh, alpha)
+ return IndicatorSolutionIndependent{typeof(cache)}(cache)
end
-function (indicator::IndicatorSolutionIndependent)(u::AbstractArray{<:Any,4},
+function (indicator::IndicatorSolutionIndependent)(u::AbstractArray{<:Any, 4},
mesh, equations, dg, cache;
t, kwargs...)
-
- mesh = indicator.cache.mesh
- alpha = indicator.cache.alpha
- resize!(alpha, nelements(dg, cache))
-
- #Predict the theoretical center.
- advection_velocity = (0.2, -0.7)
- center = t.*advection_velocity
-
- inner_distance = 1
- outer_distance = 1.85
-
- #Iterate over all elements
- for element in 1:length(alpha)
- #Calculate periodic distance between cell and center.
- cell_id = cache.elements.cell_ids[element]
- coordinates = mesh.tree.coordinates[1:2, cell_id]
-
- #The geometric shape of the amr should be preserved when the base_level is increased.
- #This is done by looking at the original coordinates of each cell.
- cell_coordinates = original_coordinates(coordinates, 5/8)
- cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
- if cell_distance < (inner_distance+outer_distance)/2
- cell_coordinates = original_coordinates(coordinates, 5/16)
- cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
+ mesh = indicator.cache.mesh
+ alpha = indicator.cache.alpha
+ resize!(alpha, nelements(dg, cache))
+
+ #Predict the theoretical center.
+ advection_velocity = (0.2, -0.7)
+ center = t .* advection_velocity
+
+ inner_distance = 1
+ outer_distance = 1.85
+
+ #Iterate over all elements
+ for element in 1:length(alpha)
+ #Calculate periodic distance between cell and center.
+ cell_id = cache.elements.cell_ids[element]
+ coordinates = mesh.tree.coordinates[1:2, cell_id]
+
+ #The geometric shape of the amr should be preserved when the base_level is increased.
+ #This is done by looking at the original coordinates of each cell.
+ cell_coordinates = original_coordinates(coordinates, 5 / 8)
+ cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
+ if cell_distance < (inner_distance + outer_distance) / 2
+ cell_coordinates = original_coordinates(coordinates, 5 / 16)
+ cell_distance = periodic_distance_2d(cell_coordinates, center, 10)
+ end
+
+ #Set alpha according to cells position inside the circles.
+ target_level = (cell_distance < inner_distance) + (cell_distance < outer_distance)
+ alpha[element] = target_level / 2
end
-
- #Set alpha according to cells position inside the circles.
- target_level = (cell_distance < inner_distance) + (cell_distance < outer_distance)
- alpha[element] = target_level/2
- end
- return alpha
+ return alpha
end
# For periodic domains, distance between two points must take into account
# periodic extensions of the domain
function periodic_distance_2d(coordinates, center, domain_length)
- dx = coordinates .- center
- dx_shifted = abs.(dx .% domain_length)
- dx_periodic = min.(dx_shifted, domain_length .- dx_shifted)
- return sqrt(sum(dx_periodic.^2))
+ dx = coordinates .- center
+ dx_shifted = abs.(dx .% domain_length)
+ dx_periodic = min.(dx_shifted, domain_length .- dx_shifted)
+ return sqrt(sum(dx_periodic .^ 2))
end
#This takes a cells coordinates and transforms them into the coordinates of a parent-cell it originally refined from.
#It does it so that the parent-cell has given cell_length.
function original_coordinates(coordinates, cell_length)
- offset = coordinates .% cell_length
- offset_sign = sign.(offset)
- border = coordinates - offset
- center = border + (offset_sign .* cell_length/2)
- return center
+ offset = coordinates .% cell_length
+ offset_sign = sign.(offset)
+ border = coordinates - offset
+ center = border + (offset_sign .* cell_length / 2)
+ return center
end
end # module TrixiExtension
@@ -83,18 +82,16 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -104,38 +101,38 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, TrixiExtension.IndicatorSolutionIndependent(semi),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi,
+ TrixiExtension.IndicatorSolutionIndependent(semi),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl b/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl
index f517b4eb1cf..7b67b811177 100644
--- a/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl
@@ -9,27 +9,26 @@ using Plots
advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
-function initial_condition_gauss_largedomain(x, t, equation::LinearScalarAdvectionEquation2D)
- # Store translated coordinate for easy use of exact solution
- domain_length = SVector(10, 10)
- x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t, domain_length)
+function initial_condition_gauss_largedomain(x, t,
+ equation::LinearScalarAdvectionEquation2D)
+ # Store translated coordinate for easy use of exact solution
+ domain_length = SVector(10, 10)
+ x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t, domain_length)
- return SVector(exp(-(x_trans[1]^2 + x_trans[2]^2)))
+ return SVector(exp(-(x_trans[1]^2 + x_trans[2]^2)))
end
initial_condition = initial_condition_gauss_largedomain
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -39,41 +38,40 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# Enable in-situ visualization with a new plot generated every 20 time steps
# and additional plotting options passed as keyword arguments
-visualization = VisualizationCallback(interval=20, clims=(0,1))
+visualization = VisualizationCallback(interval = 20, clims = (0, 1))
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=3,
- med_level=4, med_threshold=0.1,
- max_level=5, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 3,
+ med_level = 4, med_threshold = 0.1,
+ max_level = 5, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution, visualization,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_basic.jl b/examples/tree_2d_dgsem/elixir_advection_basic.jl
index 269ab8cdd04..0ec0bc3629a 100644
--- a/examples/tree_2d_dgsem/elixir_advection_basic.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_basic.jl
@@ -9,19 +9,19 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,26 +34,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_advection_callbacks.jl b/examples/tree_2d_dgsem/elixir_advection_callbacks.jl
index 2ddd3e92ed2..708cd0aa3a3 100644
--- a/examples/tree_2d_dgsem/elixir_advection_callbacks.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_callbacks.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
# define new structs inside a module to allow re-evaluating the file
module TrixiExtensionExample
@@ -14,83 +13,81 @@ using OrdinaryDiffEq: DiscreteCallback, u_modified!
# each time it is called. Its sole purpose here is to showcase how to implement
# a stage callback for Trixi.jl.
struct ExampleStageCallback
- times::Vector{Float64}
- min_values::Vector{Float64}
- max_values::Vector{Float64}
-
- # You can optionally define an inner constructor like the one below to set up
- # some required stuff. You can also create outer constructors (not demonstrated
- # here) for further customization options.
- function ExampleStageCallback()
- new(Float64[], Float64[], Float64[])
- end
+ times::Vector{Float64}
+ min_values::Vector{Float64}
+ max_values::Vector{Float64}
+
+ # You can optionally define an inner constructor like the one below to set up
+ # some required stuff. You can also create outer constructors (not demonstrated
+ # here) for further customization options.
+ function ExampleStageCallback()
+ new(Float64[], Float64[], Float64[])
+ end
end
# This method is called when the `ExampleStageCallback` is used as `stage_limiter!`
# which gets called after every RK stage. There is no specific initialization
# method for such `stage_limiter!`s in OrdinaryDiffEq.jl.
function (example_stage_callback::ExampleStageCallback)(u_ode, _, semi, t)
+ min_val, max_val = extrema(u_ode)
+ push!(example_stage_callback.times, t)
+ push!(example_stage_callback.min_values, min_val)
+ push!(example_stage_callback.max_values, max_val)
- min_val, max_val = extrema(u_ode)
- push!(example_stage_callback.times, t)
- push!(example_stage_callback.min_values, min_val)
- push!(example_stage_callback.max_values, max_val)
-
- return nothing
+ return nothing
end
-
# This is an example implementation for a simple step callback (i.e., a callable
# that is potentially executed after each Runge-Kutta *step*), which records
# some values each time it is called. Its sole purpose here is to showcase
# how to implement a step callback for Trixi.jl.
struct ExampleStepCallback
- message::String
- times::Vector{Float64}
- min_values::Vector{Float64}
- max_values::Vector{Float64}
-
- # You can optionally define an inner constructor like the one below to set up
- # some required stuff. You can also create outer constructors (not demonstrated
- # here) for further customization options.
- function ExampleStepCallback(message::String)
- new(message, Float64[], Float64[], Float64[])
- end
+ message::String
+ times::Vector{Float64}
+ min_values::Vector{Float64}
+ max_values::Vector{Float64}
+
+ # You can optionally define an inner constructor like the one below to set up
+ # some required stuff. You can also create outer constructors (not demonstrated
+ # here) for further customization options.
+ function ExampleStepCallback(message::String)
+ new(message, Float64[], Float64[], Float64[])
+ end
end
# This method is called when the `ExampleStepCallback` is used as callback
# which gets called after RK steps.
function (example_callback::ExampleStepCallback)(integrator)
- u_ode = integrator.u
- t = integrator.t
- # You can also access semi = integrator.p
-
- min_val, max_val = extrema(u_ode)
- push!(example_callback.times, t)
- push!(example_callback.min_values, min_val)
- push!(example_callback.max_values, max_val)
-
- # avoid re-evaluating possible FSAL stages
- u_modified!(integrator, false)
- return nothing
+ u_ode = integrator.u
+ t = integrator.t
+ # You can also access semi = integrator.p
+
+ min_val, max_val = extrema(u_ode)
+ push!(example_callback.times, t)
+ push!(example_callback.min_values, min_val)
+ push!(example_callback.max_values, max_val)
+
+ # avoid re-evaluating possible FSAL stages
+ u_modified!(integrator, false)
+ return nothing
end
# This method is used to wrap an `ExampleStepCallback` inside a `DiscreteCallback`
# which gets called after every RK step. You can pass an additional initialization
# method and a separate condition specifying whether the callback shall be called.
function ExampleStepCallback(; message::String)
- # Call the `ExampleStepCallback` after every RK step.
- condition = (u_ode, t, integrator) -> true
+ # Call the `ExampleStepCallback` after every RK step.
+ condition = (u_ode, t, integrator) -> true
- # You can optionally pass an initialization method. There, you can access the
- # `ExampleStepCallback` as `cb.affect!`.
- initialize = (cb, u_ode, t, integrator) -> println(cb.affect!.message)
+ # You can optionally pass an initialization method. There, you can access the
+ # `ExampleStepCallback` as `cb.affect!`.
+ initialize = (cb, u_ode, t, integrator) -> println(cb.affect!.message)
- example_callback = ExampleStepCallback(message)
+ example_callback = ExampleStepCallback(message)
- DiscreteCallback(condition, example_callback,
- save_positions=(false,false),
- initialize=initialize)
+ DiscreteCallback(condition, example_callback,
+ save_positions = (false, false),
+ initialize = initialize)
end
end # module TrixiExtensionExample
@@ -104,18 +101,16 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -125,19 +120,19 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2cons)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2cons)
-example_callback = TrixiExtensionExample.ExampleStepCallback(message="안녕하세요?")
+example_callback = TrixiExtensionExample.ExampleStepCallback(message = "안녕하세요?")
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -158,9 +153,10 @@ example_stage_callback! = TrixiExtensionExample.ExampleStageCallback()
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(example_stage_callback!, williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode,
+ CarpenterKennedy2N54(example_stage_callback!, williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
# Check whether we recorded the same values.
diff --git a/examples/tree_2d_dgsem/elixir_advection_diffusion.jl b/examples/tree_2d_dgsem/elixir_advection_diffusion.jl
index a716bd278b8..1f765ff3564 100644
--- a/examples/tree_2d_dgsem/elixir_advection_diffusion.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_diffusion.jl
@@ -10,30 +10,31 @@ diffusivity() = 5.0e-2
equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- periodicity=true,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ periodicity = true,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# Define initial condition
-function initial_condition_diffusive_convergence_test(x, t, equation::LinearScalarAdvectionEquation2D)
- # Store translated coordinate for easy use of exact solution
- x_trans = x - equation.advection_velocity * t
-
- nu = diffusivity()
- c = 1.0
- A = 0.5
- L = 2
- f = 1/L
- omega = 2 * pi * f
- scalar = c + A * sin(omega * sum(x_trans)) * exp(-2 * nu * omega^2 * t)
- return SVector(scalar)
+function initial_condition_diffusive_convergence_test(x, t,
+ equation::LinearScalarAdvectionEquation2D)
+ # Store translated coordinate for easy use of exact solution
+ x_trans = x - equation.advection_velocity * t
+
+ nu = diffusivity()
+ c = 1.0
+ A = 0.5
+ L = 2
+ f = 1 / L
+ omega = 2 * pi * f
+ scalar = c + A * sin(omega * sum(x_trans)) * exp(-2 * nu * omega^2 * t)
+ return SVector(scalar)
end
initial_condition = initial_condition_diffusive_convergence_test
@@ -45,9 +46,8 @@ boundary_conditions_parabolic = boundary_condition_periodic
semi = SemidiscretizationHyperbolicParabolic(mesh,
(equations, equations_parabolic),
initial_condition, solver;
- boundary_conditions=(boundary_conditions,
- boundary_conditions_parabolic))
-
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -62,23 +62,22 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
alg = RDPK3SpFSAL49()
time_int_tol = 1.0e-11
-sol = solve(ode, alg; abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, alg; abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl
index c3cd2ebeb20..8da542b0b5d 100644
--- a/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_diffusion_nonperiodic.jl
@@ -10,16 +10,16 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -0.5) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 0.0, 0.5) # maximum coordinates (max(x), max(y))
+coordinates_max = (0.0, 0.5) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- periodicity=false,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ periodicity = false,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# Example setup taken from
# - Truman Ellis, Jesse Chan, and Leszek Demkowicz (2016).
@@ -28,22 +28,22 @@ mesh = TreeMesh(coordinates_min, coordinates_max,
# to numerical partial differential equations.
# [DOI](https://doi.org/10.1007/978-3-319-41640-3_6).
function initial_condition_eriksson_johnson(x, t, equations)
- l = 4
- epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt
- lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
- cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
- return SVector{1}(u)
+ l = 4
+ epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt
+ lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
+ cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
+ return SVector{1}(u)
end
initial_condition = initial_condition_eriksson_johnson
boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition),
- y_neg = BoundaryConditionDirichlet(initial_condition),
- y_pos = BoundaryConditionDirichlet(initial_condition),
- x_pos = boundary_condition_do_nothing)
+ y_neg = BoundaryConditionDirichlet(initial_condition),
+ y_pos = BoundaryConditionDirichlet(initial_condition),
+ x_pos = boundary_condition_do_nothing)
boundary_conditions_parabolic = BoundaryConditionDirichlet(initial_condition)
@@ -51,9 +51,8 @@ boundary_conditions_parabolic = BoundaryConditionDirichlet(initial_condition)
semi = SemidiscretizationHyperbolicParabolic(mesh,
(equations, equations_parabolic),
initial_condition, solver;
- boundary_conditions=(boundary_conditions,
- boundary_conditions_parabolic))
-
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -68,22 +67,21 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
time_int_tol = 1.0e-11
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_advection_extended.jl b/examples/tree_2d_dgsem/elixir_advection_extended.jl
index 278dc85386d..4d3da47b04a 100644
--- a/examples/tree_2d_dgsem/elixir_advection_extended.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_extended.jl
@@ -18,21 +18,20 @@ initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000, # set maximum capacity of tree data structure
- periodicity=true)
+ initial_refinement_level = 4,
+ n_cells_max = 30_000, # set maximum capacity of tree data structure
+ periodicity = true)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -47,24 +46,24 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The SaveRestartCallback allows to save a file from which a Trixi.jl simulation can be restarted
-save_restart = SaveRestartCallback(interval=40,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 40,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback,
@@ -72,15 +71,14 @@ callbacks = CallbackSet(summary_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-alg = CarpenterKennedy2N54(williamson_condition=false)
+alg = CarpenterKennedy2N54(williamson_condition = false)
sol = solve(ode, alg,
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks; ode_default_options()...);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks; ode_default_options()...);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_advection_mortar.jl b/examples/tree_2d_dgsem/elixir_advection_mortar.jl
index 2a283fb9008..645c55ba438 100644
--- a/examples/tree_2d_dgsem/elixir_advection_mortar.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_mortar.jl
@@ -9,22 +9,19 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
-refinement_patches = (
- (type="box", coordinates_min=(0.0, -1.0), coordinates_max=(1.0, 1.0)),
-)
+coordinates_max = (1.0, 1.0)
+refinement_patches = ((type = "box", coordinates_min = (0.0, -1.0),
+ coordinates_max = (1.0, 1.0)),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- refinement_patches=refinement_patches,
- n_cells_max=10_000,)
-
+ initial_refinement_level = 2,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,28 +31,27 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_advection_restart.jl b/examples/tree_2d_dgsem/elixir_advection_restart.jl
index b63a8d1f7bc..770629bb15e 100644
--- a/examples/tree_2d_dgsem/elixir_advection_restart.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_restart.jl
@@ -4,10 +4,10 @@ using Trixi
###############################################################################
# Define time integration algorithm
-alg = CarpenterKennedy2N54(williamson_condition=false)
+alg = CarpenterKennedy2N54(williamson_condition = false)
# Create a restart file
-trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_extended.jl"), alg = alg, tspan = (0.0, 10.0))
-
+trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_extended.jl"), alg = alg,
+ tspan = (0.0, 10.0))
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -28,8 +28,8 @@ ode = semidiscretize(semi, tspan, restart_filename);
save_solution.condition.save_initial_solution = false
integrator = init(ode, alg,
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks; ode_default_options()...)
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks; ode_default_options()...)
# Load saved context for adaptive time integrator
if integrator.opts.adaptive
diff --git a/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl b/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl
index be87f24f817..06982bb9a27 100644
--- a/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl
+++ b/examples/tree_2d_dgsem/elixir_advection_timeintegration.jl
@@ -9,18 +9,16 @@ advection_velocity = (0.2, -0.7)
equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0)
-coordinates_max = ( 5.0, 5.0)
+coordinates_max = (5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,39 +28,38 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2cons)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2cons)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
# sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
ode_algorithm = Trixi.CarpenterKennedy2N54()
sol = Trixi.solve(ode, ode_algorithm,
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_astro_jet_MCL.jl b/examples/tree_2d_dgsem/elixir_euler_astro_jet_MCL.jl
index f51b73dd497..69148f5bdb6 100644
--- a/examples/tree_2d_dgsem/elixir_euler_astro_jet_MCL.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_astro_jet_MCL.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations = CompressibleEulerEquations2D(gamma)
# Initial condition adopted from
@@ -13,57 +13,56 @@ equations = CompressibleEulerEquations2D(gamma)
# https://tinyurl.com/c76fjtx4
# Mach = 2000 jet
function initial_condition_astro_jet(x, t, equations::CompressibleEulerEquations2D)
- @unpack gamma = equations
- rho = 0.5
- v1 = 0
- v2 = 0
- p = 0.4127
- # add inflow for t>0 at x=-0.5
- # domain size is [-0.5,+0.5]^2
- if (x[1] ≈ -0.5) && (abs(x[2]) < 0.05)
- rho = 5
- v1 = 800 # about Mach number Ma = 2000
+ @unpack gamma = equations
+ rho = 0.5
+ v1 = 0
v2 = 0
p = 0.4127
- end
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # add inflow for t>0 at x=-0.5
+ # domain size is [-0.5,+0.5]^2
+ if (x[1] ≈ -0.5) && (abs(x[2]) < 0.05)
+ rho = 5
+ v1 = 800 # about Mach number Ma = 2000
+ v2 = 0
+ p = 0.4127
+ end
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_astro_jet
-boundary_conditions = (
- x_neg=BoundaryConditionCharacteristic(initial_condition_astro_jet),
- x_pos=BoundaryConditionCharacteristic(initial_condition_astro_jet),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic,
- )
+boundary_conditions = (x_neg = BoundaryConditionCharacteristic(initial_condition_astro_jet),
+ x_pos = BoundaryConditionCharacteristic(initial_condition_astro_jet),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
surface_flux = flux_lax_friedrichs # HLLC needs more shock capturing (alpha_max)
-volume_flux = flux_chandrashekar # works with Ranocha flux as well
+volume_flux = flux_chandrashekar # works with Ranocha flux as well
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
# shock capturing necessary for this tough example
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=true,
- DensityAlphaForAll=true,
- SequentialLimiter=true,
- PressurePositivityLimiterKuzmin=true,
- DensityPositivityLimiter=false,
- SemiDiscEntropyLimiter=false,
- Plotting=true)
+ DensityLimiter = true,
+ DensityAlphaForAll = true,
+ SequentialLimiter = true,
+ PressurePositivityLimiterKuzmin = true,
+ DensityPositivityLimiter = false,
+ SemiDiscEntropyLimiter = false,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-0.5, -0.5)
-coordinates_max = ( 0.5, 0.5)
+coordinates_max = (0.5, 0.5)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=8,
- periodicity=(false,true),
- n_cells_max=100_000)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+ initial_refinement_level = 8,
+ periodicity = (false, true),
+ n_cells_max = 100_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -74,16 +73,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -93,9 +92,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- maxiters=1e6, dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ maxiters = 1e6, dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl b/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl
index c5790e455bc..1393f4a6cc8 100644
--- a/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations = CompressibleEulerEquations2D(gamma)
# Initial condition adopted from
@@ -13,55 +13,54 @@ equations = CompressibleEulerEquations2D(gamma)
# https://tinyurl.com/c76fjtx4
# Mach = 2000 jet
function initial_condition_astro_jet(x, t, equations::CompressibleEulerEquations2D)
- @unpack gamma = equations
- rho = 0.5
- v1 = 0
- v2 = 0
- p = 0.4127
- # add inflow for t>0 at x=-0.5
- # domain size is [-0.5,+0.5]^2
- if (t > 0) && (x[1] ≈ -0.5) && (abs(x[2]) < 0.05)
- rho = 5
- v1 = 800 # about Mach number Ma = 2000
+ @unpack gamma = equations
+ rho = 0.5
+ v1 = 0
v2 = 0
p = 0.4127
- end
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # add inflow for t>0 at x=-0.5
+ # domain size is [-0.5,+0.5]^2
+ if (t > 0) && (x[1] ≈ -0.5) && (abs(x[2]) < 0.05)
+ rho = 5
+ v1 = 800 # about Mach number Ma = 2000
+ v2 = 0
+ p = 0.4127
+ end
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_astro_jet
-boundary_conditions = (
- x_neg=BoundaryConditionDirichlet(initial_condition_astro_jet),
- x_pos=BoundaryConditionDirichlet(initial_condition_astro_jet),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic,
- )
+boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_astro_jet),
+ x_pos = BoundaryConditionDirichlet(initial_condition_astro_jet),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
surface_flux = flux_lax_friedrichs # HLLC needs more shock capturing (alpha_max)
-volume_flux = flux_ranocha # works with Chandrashekar flux as well
+volume_flux = flux_ranocha # works with Chandrashekar flux as well
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
# shock capturing necessary for this tough example
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.3,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.3,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-0.5, -0.5)
-coordinates_max = ( 0.5, 0.5)
+coordinates_max = (0.5, 0.5)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- periodicity=(false,true),
- n_cells_max=100_000)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+ initial_refinement_level = 6,
+ periodicity = (false, true),
+ n_cells_max = 100_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -72,43 +71,43 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 5000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
-
-amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0001,
- alpha_smooth=false,
- variable=Trixi.density)
-
-amr_controller = ControllerThreeLevelCombined(semi, amr_indicator, indicator_sc,
- base_level=2,
- med_level =0, med_threshold=0.0003, # med_level = current level
- max_level =8, max_threshold=0.003,
- max_threshold_secondary=indicator_sc.alpha_max)
-
-amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
+
+amr_indicator = IndicatorHennemannGassner(semi,
+ alpha_max = 1.0,
+ alpha_min = 0.0001,
+ alpha_smooth = false,
+ variable = Trixi.density)
+
+amr_controller = ControllerThreeLevelCombined(semi, amr_indicator, indicator_sc,
+ base_level = 2,
+ med_level = 0, med_threshold = 0.0003, # med_level = current level
+ max_level = 8, max_threshold = 0.003,
+ max_threshold_secondary = indicator_sc.alpha_max)
+
+amr_callback = AMRCallback(semi, amr_controller,
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
- analysis_callback, alive_callback,
+ analysis_callback, alive_callback,
amr_callback, save_solution)
# positivity limiter necessary for this tough example
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
# use adaptive time stepping based on error estimates, time step roughly dt = 1e-7
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_astro_jet_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_astro_jet_subcell.jl
index 5b95fef374e..3bf4f230d44 100644
--- a/examples/tree_2d_dgsem/elixir_euler_astro_jet_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_astro_jet_subcell.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations = CompressibleEulerEquations2D(gamma)
# Initial condition adopted from
@@ -13,54 +13,53 @@ equations = CompressibleEulerEquations2D(gamma)
# https://tinyurl.com/c76fjtx4
# Mach = 2000 jet
function initial_condition_astro_jet(x, t, equations::CompressibleEulerEquations2D)
- @unpack gamma = equations
- rho = 0.5
- v1 = 0
- v2 = 0
- p = 0.4127
- # add inflow for t>0 at x=-0.5
- # domain size is [-0.5,+0.5]^2
- if (x[1] ≈ -0.5) && (abs(x[2]) < 0.05)
- rho = 5
- v1 = 800 # about Mach number Ma = 2000
+ @unpack gamma = equations
+ rho = 0.5
+ v1 = 0
v2 = 0
p = 0.4127
- end
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # add inflow for t>0 at x=-0.5
+ # domain size is [-0.5,+0.5]^2
+ if (x[1] ≈ -0.5) && (abs(x[2]) < 0.05)
+ rho = 5
+ v1 = 800 # about Mach number Ma = 2000
+ v2 = 0
+ p = 0.4127
+ end
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_astro_jet
-boundary_conditions = (
- x_neg=BoundaryConditionCharacteristic(initial_condition_astro_jet),
- x_pos=BoundaryConditionCharacteristic(initial_condition_astro_jet),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic,
- )
+boundary_conditions = (x_neg = BoundaryConditionCharacteristic(initial_condition_astro_jet),
+ x_pos = BoundaryConditionCharacteristic(initial_condition_astro_jet),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
surface_flux = flux_lax_friedrichs # HLLC needs more shock capturing (alpha_max)
-volume_flux = flux_chandrashekar # works with Ranocha flux as well
+volume_flux = flux_chandrashekar # works with Ranocha flux as well
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
# shock capturing necessary for this tough example
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- spec_entropy=true,
- bar_states=true,
- max_iterations_newton=25)
+ local_minmax_variables_cons = [1],
+ spec_entropy = true,
+ bar_states = true,
+ max_iterations_newton = 25)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-0.5, -0.5)
-coordinates_max = ( 0.5, 0.5)
+coordinates_max = (0.5, 0.5)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=8,
- periodicity=(false,true),
- n_cells_max=100_000)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+ initial_refinement_level = 8,
+ periodicity = (false, true),
+ n_cells_max = 100_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -71,16 +70,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -89,9 +88,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- maxiters=1e6, dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ maxiters = 1e6, dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl
index 0da18b7120d..ccd7b54086b 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave.jl
@@ -16,48 +16,46 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,27 +65,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_MCL.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_MCL.jl
index 0e5a85e00a8..3e90ef7da2e 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_MCL.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_MCL.jl
@@ -16,54 +16,52 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=true,
- DensityAlphaForAll=true,
- SequentialLimiter=false,
- ConservativeLimiter=true,
- DensityPositivityLimiter=true,
- PressurePositivityLimiterKuzmin=true,
- PressurePositivityLimiterKuzminExact=false,
- SemiDiscEntropyLimiter=true,
- smoothness_indicator=true,
- Plotting=false)
+ DensityLimiter = true,
+ DensityAlphaForAll = true,
+ SequentialLimiter = false,
+ ConservativeLimiter = true,
+ DensityPositivityLimiter = true,
+ PressurePositivityLimiterKuzmin = true,
+ PressurePositivityLimiterKuzminExact = false,
+ SemiDiscEntropyLimiter = true,
+ smoothness_indicator = true,
+ Plotting = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -73,29 +71,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=500,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 500,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl
index 6ce9268486c..d32c2e51b06 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl
@@ -16,48 +16,46 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,40 +65,39 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_cnn.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_cnn.jl
index 659788f2f5c..79d7474dc66 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_cnn.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_cnn.jl
@@ -2,7 +2,8 @@ using Downloads: download
using Flux
using BSON: load
network = joinpath(@__DIR__, "modelcnn-0.964-0.001.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelcnn-0.964-0.001.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelcnn-0.964-0.001.bson",
+ network)
model2dcnn = load(network, @__MODULE__)[:model2dcnn]
using OrdinaryDiffEq
@@ -28,52 +29,50 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkCNN(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=true,
- alpha_amr=false,
- variable=density_pressure,
- network=model2dcnn)
+ indicator_type = NeuralNetworkCNN(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = true,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model2dcnn)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -83,27 +82,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl
index 3f4862674d2..27398593efd 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_perssonperaire.jl
@@ -2,7 +2,8 @@ using Downloads: download
using Flux
using BSON: load
network = joinpath(@__DIR__, "modelnnpp-0.904-0.0005.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.904-0.0005.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.904-0.0005.bson",
+ network)
model2d = load(network, @__MODULE__)[:model2d]
using OrdinaryDiffEq
@@ -28,52 +29,50 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkPerssonPeraire(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=true,
- alpha_amr=false,
- variable=density_pressure,
- network=model2d)
+ indicator_type = NeuralNetworkPerssonPeraire(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = true,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model2d)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -83,27 +82,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl
index db2fffacb36..6c67f948636 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_neuralnetwork_rayhesthaven.jl
@@ -3,7 +3,8 @@ using Flux
using Random
using BSON: load
network = joinpath(@__DIR__, "modelnnrhs-0.973-0.001.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnrhs-0.973-0.001.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnrhs-0.973-0.001.bson",
+ network)
model2d = load(network, @__MODULE__)[:model2d]
using OrdinaryDiffEq
@@ -29,54 +30,52 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkRayHesthaven(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=true,
- alpha_amr=false,
- variable=density_pressure,
- network=model2d)
+ indicator_type = NeuralNetworkRayHesthaven(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = true,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model2d)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
refinement_patches = () # To allow for specifying them via `trixi_include`
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- refinement_patches=refinement_patches,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -86,27 +85,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl
index a0fc9349696..a2392d05e5a 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_pure_fv.jl
@@ -16,40 +16,38 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
-surface_flux = flux_hllc
+surface_flux = flux_hllc
basis = LobattoLegendreBasis(3)
volume_integral = VolumeIntegralPureLGLFiniteVolume(flux_hllc)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -59,27 +57,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell.jl
index 0e44f62c7bd..fab3a86e531 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell.jl
@@ -16,48 +16,46 @@ A medium blast wave taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- math_entropy=true,
- bar_states=false,
- smoothness_indicator=true)
+ local_minmax_variables_cons = [1],
+ math_entropy = true,
+ bar_states = false,
+ smoothness_indicator = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=10_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -67,29 +65,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl
index f4040732667..2b3659017a3 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blob_amr.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations = CompressibleEulerEquations2D(gamma)
"""
@@ -16,67 +16,67 @@ The blob test case taken from
[arXiv: astro-ph/0610051](https://arxiv.org/abs/astro-ph/0610051)
"""
function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D)
- # blob test case, see Agertz et al. https://arxiv.org/pdf/astro-ph/0610051.pdf
- # other reference: https://arxiv.org/pdf/astro-ph/0610051.pdf
- # change discontinuity to tanh
- # typical domain is rectangular, we change it to a square
- # resolution 128^2, 256^2
- # domain size is [-20.0,20.0]^2
- # gamma = 5/3 for this test case
- R = 1.0 # radius of the blob
- # background density
- dens0 = 1.0
- Chi = 10.0 # density contrast
- # reference time of characteristic growth of KH instability equal to 1.0
- tau_kh = 1.0
- tau_cr = tau_kh/1.6 # crushing time
- # determine background velocity
- velx0 = 2*R*sqrt(Chi)/tau_cr
- vely0 = 0.0
- Ma0 = 2.7 # background flow Mach number Ma=v/c
- c = velx0/Ma0 # sound speed
- # use perfect gas assumption to compute background pressure via the sound speed c^2 = gamma * pressure/density
- p0 = c*c*dens0/equations.gamma
- # initial center of the blob
- inicenter = [-15,0]
- x_rel = x-inicenter
- r = sqrt(x_rel[1]^2 + x_rel[2]^2)
- # steepness of the tanh transition zone
- slope = 2
- # density blob
- dens = dens0 + (Chi-1) * 0.5*(1+(tanh(slope*(r+R)) - (tanh(slope*(r-R)) + 1)))
- # velocity blob is zero
- velx = velx0 - velx0 * 0.5*(1+(tanh(slope*(r+R)) - (tanh(slope*(r-R)) + 1)))
- return prim2cons(SVector(dens, velx, vely0, p0), equations)
+ # blob test case, see Agertz et al. https://arxiv.org/pdf/astro-ph/0610051.pdf
+ # other reference: https://arxiv.org/pdf/astro-ph/0610051.pdf
+ # change discontinuity to tanh
+ # typical domain is rectangular, we change it to a square
+ # resolution 128^2, 256^2
+ # domain size is [-20.0,20.0]^2
+ # gamma = 5/3 for this test case
+ R = 1.0 # radius of the blob
+ # background density
+ dens0 = 1.0
+ Chi = 10.0 # density contrast
+ # reference time of characteristic growth of KH instability equal to 1.0
+ tau_kh = 1.0
+ tau_cr = tau_kh / 1.6 # crushing time
+ # determine background velocity
+ velx0 = 2 * R * sqrt(Chi) / tau_cr
+ vely0 = 0.0
+ Ma0 = 2.7 # background flow Mach number Ma=v/c
+ c = velx0 / Ma0 # sound speed
+ # use perfect gas assumption to compute background pressure via the sound speed c^2 = gamma * pressure/density
+ p0 = c * c * dens0 / equations.gamma
+ # initial center of the blob
+ inicenter = [-15, 0]
+ x_rel = x - inicenter
+ r = sqrt(x_rel[1]^2 + x_rel[2]^2)
+ # steepness of the tanh transition zone
+ slope = 2
+ # density blob
+ dens = dens0 +
+ (Chi - 1) * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope * (r - R)) + 1)))
+ # velocity blob is zero
+ velx = velx0 - velx0 * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope * (r - R)) + 1)))
+ return prim2cons(SVector(dens, velx, vely0, p0), equations)
end
initial_condition = initial_condition_blob
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.4,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=pressure)
+ alpha_max = 0.4,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-20.0, -20.0)
-coordinates_max = ( 20.0, 20.0)
+coordinates_max = (20.0, 20.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000,)
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -86,42 +86,41 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0001,
- alpha_smooth=false,
- variable=Trixi.density)
+ alpha_max = 1.0,
+ alpha_min = 0.0001,
+ alpha_smooth = false,
+ variable = Trixi.density)
amr_controller = ControllerThreeLevelCombined(semi, amr_indicator, indicator_sc,
- base_level=4,
- med_level =0, med_threshold=0.0003, # med_level = current level
- max_level =7, max_threshold=0.003,
- max_threshold_secondary=indicator_sc.alpha_max)
+ base_level = 4,
+ med_level = 0, med_threshold = 0.0003, # med_level = current level
+ max_level = 7, max_threshold = 0.003,
+ max_threshold_secondary = indicator_sc.alpha_max)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.25)
+stepsize_callback = StepsizeCallback(cfl = 0.25)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl
index 5b7365f860f..8bd5db00c9a 100644
--- a/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_blob_mortar.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations = CompressibleEulerEquations2D(gamma)
"""
@@ -16,71 +16,71 @@ The blob test case taken from
[arXiv: astro-ph/0610051](https://arxiv.org/abs/astro-ph/0610051)
"""
function initial_condition_blob(x, t, equations::CompressibleEulerEquations2D)
- # blob test case, see Agertz et al. https://arxiv.org/pdf/astro-ph/0610051.pdf
- # other reference: https://arxiv.org/pdf/astro-ph/0610051.pdf
- # change discontinuity to tanh
- # typical domain is rectangular, we change it to a square
- # resolution 128^2, 256^2
- # domain size is [-20.0,20.0]^2
- # gamma = 5/3 for this test case
- R = 1.0 # radius of the blob
- # background density
- dens0 = 1.0
- Chi = 10.0 # density contrast
- # reference time of characteristic growth of KH instability equal to 1.0
- tau_kh = 1.0
- tau_cr = tau_kh/1.6 # crushing time
- # determine background velocity
- velx0 = 2*R*sqrt(Chi)/tau_cr
- vely0 = 0.0
- Ma0 = 2.7 # background flow Mach number Ma=v/c
- c = velx0/Ma0 # sound speed
- # use perfect gas assumption to compute background pressure via the sound speed c^2 = gamma * pressure/density
- p0 = c*c*dens0/equations.gamma
- # initial center of the blob
- inicenter = [-15,0]
- x_rel = x-inicenter
- r = sqrt(x_rel[1]^2 + x_rel[2]^2)
- # steepness of the tanh transition zone
- slope = 2
- # density blob
- dens = dens0 + (Chi-1) * 0.5*(1+(tanh(slope*(r+R)) - (tanh(slope*(r-R)) + 1)))
- # velocity blob is zero
- velx = velx0 - velx0 * 0.5*(1+(tanh(slope*(r+R)) - (tanh(slope*(r-R)) + 1)))
- return prim2cons(SVector(dens, velx, vely0, p0), equations)
+ # blob test case, see Agertz et al. https://arxiv.org/pdf/astro-ph/0610051.pdf
+ # other reference: https://arxiv.org/pdf/astro-ph/0610051.pdf
+ # change discontinuity to tanh
+ # typical domain is rectangular, we change it to a square
+ # resolution 128^2, 256^2
+ # domain size is [-20.0,20.0]^2
+ # gamma = 5/3 for this test case
+ R = 1.0 # radius of the blob
+ # background density
+ dens0 = 1.0
+ Chi = 10.0 # density contrast
+ # reference time of characteristic growth of KH instability equal to 1.0
+ tau_kh = 1.0
+ tau_cr = tau_kh / 1.6 # crushing time
+ # determine background velocity
+ velx0 = 2 * R * sqrt(Chi) / tau_cr
+ vely0 = 0.0
+ Ma0 = 2.7 # background flow Mach number Ma=v/c
+ c = velx0 / Ma0 # sound speed
+ # use perfect gas assumption to compute background pressure via the sound speed c^2 = gamma * pressure/density
+ p0 = c * c * dens0 / equations.gamma
+ # initial center of the blob
+ inicenter = [-15, 0]
+ x_rel = x - inicenter
+ r = sqrt(x_rel[1]^2 + x_rel[2]^2)
+ # steepness of the tanh transition zone
+ slope = 2
+ # density blob
+ dens = dens0 +
+ (Chi - 1) * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope * (r - R)) + 1)))
+ # velocity blob is zero
+ velx = velx0 - velx0 * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope * (r - R)) + 1)))
+ return prim2cons(SVector(dens, velx, vely0, p0), equations)
end
initial_condition = initial_condition_blob
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.05,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=pressure)
+ alpha_max = 0.05,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-32.0, -32.0)
-coordinates_max = ( 32.0, 32.0)
-refinement_patches = (
- (type="box", coordinates_min=(-40.0, -5.0), coordinates_max=(40.0, 5.0)),
- (type="box", coordinates_min=(-40.0, -5.0), coordinates_max=(40.0, 5.0)),
-)
+coordinates_max = (32.0, 32.0)
+refinement_patches = ((type = "box", coordinates_min = (-40.0, -5.0),
+ coordinates_max = (40.0, 5.0)),
+ (type = "box", coordinates_min = (-40.0, -5.0),
+ coordinates_max = (40.0, 5.0)))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- refinement_patches=refinement_patches,
- n_cells_max=100_000,)
+ initial_refinement_level = 4,
+ refinement_patches = refinement_patches,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -90,27 +90,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.7)
+stepsize_callback = StepsizeCallback(cfl = 0.7)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl b/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl
index cb2a5b16816..984ac3ff1f6 100644
--- a/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl
@@ -10,71 +10,71 @@ equations = CompressibleEulerEquations2D(gamma)
# This is a hand made colliding flow setup without reference. Features Mach=70 inflow from both
# sides, with relative low temperature, such that pressure keeps relatively small
# Computed with gamma close to 1, to simulate isothermal gas
-function initial_condition_colliding_flow_astro(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # resolution 128^2 elements (refined close to the interface) and polydeg=3 (total of 512^2 DOF)
- # domain size is [-64,+64]^2
- @unpack gamma = equations
- # the quantities are chosen such, that they are as close as possible to the astro examples
- # keep in mind, that in the astro example, the physical units are weird (parsec, mega years, ...)
- rho = 0.0247
- c = 0.2
- p = c^2 / gamma * rho
- vel = 13.907432274789372
- slope = 1.0
- v1 = -vel*tanh(slope * x[1])
- # add small initial disturbance to the field, but only close to the interface
- if abs(x[1]) < 10
- v1 = v1 * (1 + 0.01 * sin(pi * x[2]))
- end
- v2 = 0.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_colliding_flow_astro(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # resolution 128^2 elements (refined close to the interface) and polydeg=3 (total of 512^2 DOF)
+ # domain size is [-64,+64]^2
+ @unpack gamma = equations
+ # the quantities are chosen such, that they are as close as possible to the astro examples
+ # keep in mind, that in the astro example, the physical units are weird (parsec, mega years, ...)
+ rho = 0.0247
+ c = 0.2
+ p = c^2 / gamma * rho
+ vel = 13.907432274789372
+ slope = 1.0
+ v1 = -vel * tanh(slope * x[1])
+ # add small initial disturbance to the field, but only close to the interface
+ if abs(x[1]) < 10
+ v1 = v1 * (1 + 0.01 * sin(pi * x[2]))
+ end
+ v2 = 0.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_colliding_flow_astro
-
-boundary_conditions = (
- x_neg=BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
- x_pos=BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic,
- )
-
-
+boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
+ x_pos = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
surface_flux = flux_lax_friedrichs # HLLC needs more shock capturing (alpha_max)
-volume_flux = flux_ranocha # works with Chandrashekar flux as well
+volume_flux = flux_ranocha # works with Chandrashekar flux as well
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
# shock capturing necessary for this tough example, however alpha_max = 0.5 is fine
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-64.0, -64.0)
-coordinates_max = ( 64.0, 64.0)
+coordinates_max = (64.0, 64.0)
# only refinement in a patch. Needs x=-17/+17 to trigger refinement due to coarse base mesh
-refinement_patches = (
- (type="box", coordinates_min=(-17, -64), coordinates_max=(17, 64)),
- (type="box", coordinates_min=(-17, -64), coordinates_max=(17, 64)),
- (type="box", coordinates_min=(-17, -64), coordinates_max=(17, 64)),
- (type="box", coordinates_min=(-17, -64), coordinates_max=(17, 64)),
- #(type="box", coordinates_min=(-17, -64), coordinates_max=(17, 64)), # very high resolution, takes about 1000s on 2 cores
-)
+refinement_patches = ((type = "box", coordinates_min = (-17, -64),
+ coordinates_max = (17, 64)),
+ (type = "box", coordinates_min = (-17, -64),
+ coordinates_max = (17, 64)),
+ (type = "box", coordinates_min = (-17, -64),
+ coordinates_max = (17, 64)),
+ (type = "box", coordinates_min = (-17, -64),
+ coordinates_max = (17, 64))
+ #(type="box", coordinates_min=(-17, -64), coordinates_max=(17, 64)), # very high resolution, takes about 1000s on 2 cores
+ )
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- refinement_patches=refinement_patches,
- periodicity=(false,true),
- n_cells_max=100_000)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+ initial_refinement_level = 3,
+ refinement_patches = refinement_patches,
+ periodicity = (false, true),
+ n_cells_max = 100_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -85,26 +85,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
- analysis_callback, alive_callback,
+ analysis_callback, alive_callback,
save_solution)
# positivity limiter necessary for this tough example
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
# use adaptive time stepping based on error estimates, time step roughly dt = 5e-3
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl b/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl
index 21de07147ca..a9eb671929f 100644
--- a/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_colliding_flow_amr.jl
@@ -10,62 +10,59 @@ equations = CompressibleEulerEquations2D(gamma)
# This is a hand made colliding flow setup without reference. Features Mach=70 inflow from both
# sides, with relative low temperature, such that pressure keeps relatively small
# Computed with gamma close to 1, to simulate isothermal gas
-function initial_condition_colliding_flow_astro(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # resolution 128^2 elements (refined close to the interface) and polydeg=3 (total of 512^2 DOF)
- # domain size is [-64,+64]^2
- @unpack gamma = equations
- # the quantities are chosen such, that they are as close as possible to the astro examples
- # keep in mind, that in the astro example, the physical units are weird (parsec, mega years, ...)
- rho = 0.0247
- c = 0.2
- p = c^2 / gamma * rho
- vel = 13.907432274789372
- slope = 1.0
- v1 = -vel*tanh(slope * x[1])
- # add small initial disturbance to the field, but only close to the interface
- if abs(x[1]) < 10
- v1 = v1 * (1 + 0.01 * sin(pi*x[2]))
- end
- v2 = 0.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_colliding_flow_astro(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # resolution 128^2 elements (refined close to the interface) and polydeg=3 (total of 512^2 DOF)
+ # domain size is [-64,+64]^2
+ @unpack gamma = equations
+ # the quantities are chosen such, that they are as close as possible to the astro examples
+ # keep in mind, that in the astro example, the physical units are weird (parsec, mega years, ...)
+ rho = 0.0247
+ c = 0.2
+ p = c^2 / gamma * rho
+ vel = 13.907432274789372
+ slope = 1.0
+ v1 = -vel * tanh(slope * x[1])
+ # add small initial disturbance to the field, but only close to the interface
+ if abs(x[1]) < 10
+ v1 = v1 * (1 + 0.01 * sin(pi * x[2]))
+ end
+ v2 = 0.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_colliding_flow_astro
-
-boundary_conditions = (
- x_neg=BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
- x_pos=BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic,
- )
-
-
+boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
+ x_pos = BoundaryConditionDirichlet(initial_condition_colliding_flow_astro),
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
surface_flux = flux_lax_friedrichs # HLLC needs more shock capturing (alpha_max)
-volume_flux = flux_ranocha # works with Chandrashekar flux as well
+volume_flux = flux_ranocha # works with Chandrashekar flux as well
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
# shock capturing necessary for this tough example, however alpha_max = 0.5 is fine
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-64.0, -64.0)
-coordinates_max = ( 64.0, 64.0)
+coordinates_max = (64.0, 64.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- periodicity=(false,true),
- n_cells_max=100_000)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, boundary_conditions=boundary_conditions)
+ initial_refinement_level = 4,
+ periodicity = (false, true),
+ n_cells_max = 100_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -76,44 +73,44 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# Simulation also feasible without AMR: AMR reduces CPU time by a factor of about 2
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0001,
- alpha_smooth=false,
- variable=Trixi.density)
+ alpha_max = 1.0,
+ alpha_min = 0.0001,
+ alpha_smooth = false,
+ variable = Trixi.density)
amr_controller = ControllerThreeLevelCombined(semi, amr_indicator, indicator_sc,
- base_level=2,
- med_level =0, med_threshold=0.0003, # med_level = current level
- max_level =8, max_threshold=0.003,
- max_threshold_secondary=indicator_sc.alpha_max)
+ base_level = 2,
+ med_level = 0, med_threshold = 0.0003, # med_level = current level
+ max_level = 8, max_threshold = 0.003,
+ max_threshold_secondary = indicator_sc.alpha_max)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
callbacks = CallbackSet(summary_callback,
- analysis_callback, alive_callback,
+ analysis_callback, alive_callback,
amr_callback, save_solution)
# positivity limiter necessary for this tough example
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
# use adaptive time stepping based on error estimates, time step roughly dt = 5e-3
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_convergence_IDP.jl b/examples/tree_2d_dgsem/elixir_euler_convergence_IDP.jl
index bf6064dc219..eccf13c6d2c 100644
--- a/examples/tree_2d_dgsem/elixir_euler_convergence_IDP.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_convergence_IDP.jl
@@ -14,29 +14,28 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[1],
- positivity_variables_nonlinear=(pressure,),
- positivity_correction_factor=0.1,
- spec_entropy=false,
- max_iterations_newton=10,
- newton_tolerances=(1.0e-12, 1.0e-14),
- bar_states=true,
- smoothness_indicator=false)
+ positivity_variables_cons = [1],
+ positivity_variables_nonlinear = (pressure,),
+ positivity_correction_factor = 0.1,
+ spec_entropy = false,
+ max_iterations_newton = 10,
+ newton_tolerances = (1.0e-12, 1.0e-14),
+ bar_states = true,
+ smoothness_indicator = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -46,16 +45,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -64,9 +63,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_convergence_MCL.jl b/examples/tree_2d_dgsem/elixir_euler_convergence_MCL.jl
index d7e4250bb67..d82aed8ba32 100644
--- a/examples/tree_2d_dgsem/elixir_euler_convergence_MCL.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_convergence_MCL.jl
@@ -14,28 +14,28 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=false,
- DensityAlphaForAll=false,
- SequentialLimiter=false,
- ConservativeLimiter=false,
- DensityPositivityLimiter=true,
- PressurePositivityLimiterKuzmin=true, PressurePositivityLimiterKuzminExact=true,
- Plotting=true)
+ DensityLimiter = false,
+ DensityAlphaForAll = false,
+ SequentialLimiter = false,
+ ConservativeLimiter = false,
+ DensityPositivityLimiter = true,
+ PressurePositivityLimiterKuzmin = true,
+ PressurePositivityLimiterKuzminExact = true,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -45,16 +45,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -63,9 +63,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl b/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl
index 89d7422cfe6..96184b5ba47 100644
--- a/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_convergence_pure_fv.jl
@@ -18,13 +18,11 @@ solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,16 +33,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -54,7 +52,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_density_wave.jl b/examples/tree_2d_dgsem/elixir_euler_density_wave.jl
index a5e9d30e389..0f9e232fa14 100644
--- a/examples/tree_2d_dgsem/elixir_euler_density_wave.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_density_wave.jl
@@ -9,18 +9,16 @@ equations = CompressibleEulerEquations2D(gamma)
initial_condition = initial_condition_density_wave
-solver = DGSEM(polydeg=5, surface_flux=flux_central)
+solver = DGSEM(polydeg = 5, surface_flux = flux_central)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,27 +28,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_ec.jl b/examples/tree_2d_dgsem/elixir_euler_ec.jl
index 88f65c3d689..e634a383cdf 100644
--- a/examples/tree_2d_dgsem/elixir_euler_ec.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_ec.jl
@@ -9,20 +9,18 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000,
- periodicity=true)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition_periodic)
-
+ boundary_conditions = boundary_condition_periodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,27 +31,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl
index 4fdedf516ef..5e6b1e0cc0d 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability.jl
@@ -16,40 +16,41 @@ A version of the classical Kelvin-Helmholtz instability based on
of the Euler Equations
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-1,+1]^2
- slope = 15
- amplitude = 0.02
- B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
- rho = 0.5 + 0.75 * B
- v1 = 0.5 * (B - 1)
- v2 = 0.1 * sin(2 * pi * x[1])
- p = 1.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-1,+1]^2
+ slope = 15
+ amplitude = 0.02
+ B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
+ rho = 0.5 + 0.75 * B
+ v1 = 0.5 * (B - 1)
+ v2 = 0.1 * sin(2 * pi * x[1])
+ p = 1.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.002,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.002,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=100_000)
+ initial_refinement_level = 5,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
###############################################################################
@@ -61,27 +62,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=20,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 20,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_MCL.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_MCL.jl
index 3be50d01995..548485a1abc 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_MCL.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_MCL.jl
@@ -16,45 +16,47 @@ A version of the classical Kelvin-Helmholtz instability based on
of the Euler Equations
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-1,+1]^2
- slope = 15
- amplitude = 0.02
- B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
- rho = 0.5 + 0.75 * B
- v1 = 0.5 * (B - 1)
- v2 = 0.1 * sin(2 * pi * x[1])
- p = 1.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-1,+1]^2
+ slope = 15
+ amplitude = 0.02
+ B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
+ rho = 0.5 + 0.75 * B
+ v1 = 0.5 * (B - 1)
+ v2 = 0.1 * sin(2 * pi * x[1])
+ p = 1.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=false,
- DensityAlphaForAll=false,
- SequentialLimiter=false,
- ConservativeLimiter=false,
- PressurePositivityLimiterKuzmin=true, PressurePositivityLimiterKuzminExact=true,
- DensityPositivityLimiter=true,
- SemiDiscEntropyLimiter=false,
- Plotting=true)
+ DensityLimiter = false,
+ DensityAlphaForAll = false,
+ SequentialLimiter = false,
+ ConservativeLimiter = false,
+ PressurePositivityLimiterKuzmin = true,
+ PressurePositivityLimiterKuzminExact = true,
+ DensityPositivityLimiter = true,
+ SemiDiscEntropyLimiter = false,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000)
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
###############################################################################
@@ -66,32 +68,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-save_restart = SaveRestartCallback(interval=50000,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 50000,
+ save_final_restart = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
save_restart, save_solution)
-
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+stage_callbacks = (BoundsCheckCallback(save_errors = false),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- maxiters=1e7, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ maxiters = 1e7, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl
index b8927c3fd6b..5c237835cc5 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl
@@ -16,45 +16,44 @@ A version of the classical Kelvin-Helmholtz instability based on
of the Euler Equations
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-1,+1]^2
- slope = 15
- amplitude = 0.02
- B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
- rho = 0.5 + 0.75 * B
- v1 = 0.5 * (B - 1)
- v2 = 0.1 * sin(2 * pi * x[1])
- p = 1.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-1,+1]^2
+ slope = 15
+ amplitude = 0.02
+ B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
+ rho = 0.5 + 0.75 * B
+ v1 = 0.5 * (B - 1)
+ v2 = 0.1 * sin(2 * pi * x[1])
+ p = 1.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.002,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.002,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=100_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -64,41 +63,40 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0001,
- alpha_smooth=false,
- variable=Trixi.density)
+ alpha_max = 1.0,
+ alpha_min = 0.0001,
+ alpha_smooth = false,
+ variable = Trixi.density)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- med_level=0, med_threshold=0.0003, # med_level = current level
- max_level=6, max_threshold=0.003)
+ base_level = 4,
+ med_level = 0, med_threshold = 0.0003, # med_level = current level
+ max_level = 6, max_threshold = 0.003)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr_neuralnetwork_perssonperaire.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr_neuralnetwork_perssonperaire.jl
index 952fa372696..d2cab04223e 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr_neuralnetwork_perssonperaire.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr_neuralnetwork_perssonperaire.jl
@@ -2,7 +2,8 @@ using Downloads: download
using Flux
using BSON: load
network = joinpath(@__DIR__, "modelnnpp-0.904-0.0005.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.904-0.0005.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.904-0.0005.bson",
+ network)
model2d = load(network, @__MODULE__)[:model2d]
using Random: seed!
@@ -28,55 +29,59 @@ equations = CompressibleEulerEquations2D(gamma)
A version of the classical Kelvin-Helmholtz instability based on
https://rsaa.anu.edu.au/research/established-projects/fyris/2-d-kelvin-helmholtz-test.
"""
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-0.5,0.5]^2
- dens0 = 1.0 # outside density
- dens1 = 2.0 # inside density
- velx0 = -0.5 # outside velocity
- velx1 = 0.5 # inside velocity
- slope = 50 # used for tanh instead of discontinuous initial condition
- # pressure equilibrium
- p = 2.5
- # y velocity v2 is only white noise
- v2 = 0.01*(rand(Float64,1)[1]-0.5)
- # density
- rho = dens0 + (dens1-dens0) * 0.5*(1+(tanh(slope*(x[2]+0.25)) - (tanh(slope*(x[2]-0.25)) + 1)))
- # x velocity is also augmented with noise
- v1 = velx0 + (velx1-velx0) * 0.5*(1+(tanh(slope*(x[2]+0.25)) - (tanh(slope*(x[2]-0.25)) + 1)))+0.01*(rand(Float64,1)[1]-0.5)
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-0.5,0.5]^2
+ dens0 = 1.0 # outside density
+ dens1 = 2.0 # inside density
+ velx0 = -0.5 # outside velocity
+ velx1 = 0.5 # inside velocity
+ slope = 50 # used for tanh instead of discontinuous initial condition
+ # pressure equilibrium
+ p = 2.5
+ # y velocity v2 is only white noise
+ v2 = 0.01 * (rand(Float64, 1)[1] - 0.5)
+ # density
+ rho = dens0 +
+ (dens1 - dens0) * 0.5 *
+ (1 + (tanh(slope * (x[2] + 0.25)) - (tanh(slope * (x[2] - 0.25)) + 1)))
+ # x velocity is also augmented with noise
+ v1 = velx0 +
+ (velx1 - velx0) * 0.5 *
+ (1 + (tanh(slope * (x[2] + 0.25)) - (tanh(slope * (x[2] - 0.25)) + 1))) +
+ 0.01 * (rand(Float64, 1)[1] - 0.5)
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkPerssonPeraire(),
- alpha_max=0.002,
- alpha_min=0.0001,
- alpha_smooth=true,
- alpha_continuous=true,
- alpha_amr=false,
- variable=density_pressure,
- network=model2d)
+ indicator_type = NeuralNetworkPerssonPeraire(),
+ alpha_max = 0.002,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ alpha_continuous = true,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model2d)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-0.5, -0.5)
-coordinates_max = ( 0.5, 0.5)
+coordinates_max = (0.5, 0.5)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=100_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -86,45 +91,44 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorNeuralNetwork(semi,
- indicator_type=NeuralNetworkPerssonPeraire(),
- alpha_max=1.0,
- alpha_min=0.0001,
- alpha_smooth=false,
- alpha_continuous=true,
- alpha_amr=true,
- variable=density_pressure,
- network=model2d)
+ indicator_type = NeuralNetworkPerssonPeraire(),
+ alpha_max = 1.0,
+ alpha_min = 0.0001,
+ alpha_smooth = false,
+ alpha_continuous = true,
+ alpha_amr = true,
+ variable = density_pressure,
+ network = model2d)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- med_level=6, med_threshold=0.3, # med_level = current level
- max_level=7, max_threshold=0.5)
+ base_level = 4,
+ med_level = 6, med_threshold = 0.3, # med_level = current level
+ max_level = 7, max_threshold = 0.5)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl
index 8e7484a96d4..5b2b80d84f3 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl
@@ -1,7 +1,6 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the compressible Euler equations
gamma = 1.4
@@ -16,83 +15,86 @@ A version of the classical Kelvin-Helmholtz instability based on
solutions for hyperbolic systems of conservation laws
[arXiv: 1402.0909](https://arxiv.org/abs/1402.0909)
"""
-function initial_condition_kelvin_helmholtz_instability_fjordholm_etal(x, t, equations::CompressibleEulerEquations2D)
- # typical resolution 128^2, 256^2
- # domain size is [0,+1]^2
- # interface is sharp, but randomly perturbed
- # The random numbers used in the initial conditions have been generated as follows:
- #
- # using StableRNGs
- #
- # rng = StableRNG(100)
- #
- # a1 = rand(rng, m)
- # a2 = rand(rng, m)
- # a1 .= a1 / sum(a1)
- # a2 .= a2 / sum(a2)
- # b1 = (rand(rng, m) .- 0.5) .* pi
- # b2 = (rand(rng, m) .- 0.5) .* pi
-
- m = 10
- a1 = [0.04457096674422902, 0.03891512410182607, 0.0030191053979293433, 0.0993913172320319,
+function initial_condition_kelvin_helmholtz_instability_fjordholm_etal(x, t,
+ equations::CompressibleEulerEquations2D)
+ # typical resolution 128^2, 256^2
+ # domain size is [0,+1]^2
+ # interface is sharp, but randomly perturbed
+ # The random numbers used in the initial conditions have been generated as follows:
+ #
+ # using StableRNGs
+ #
+ # rng = StableRNG(100)
+ #
+ # a1 = rand(rng, m)
+ # a2 = rand(rng, m)
+ # a1 .= a1 / sum(a1)
+ # a2 .= a2 / sum(a2)
+ # b1 = (rand(rng, m) .- 0.5) .* pi
+ # b2 = (rand(rng, m) .- 0.5) .* pi
+
+ m = 10
+ a1 = [0.04457096674422902, 0.03891512410182607, 0.0030191053979293433,
+ 0.0993913172320319,
0.1622302137588842, 0.1831383653456182, 0.11758003014101702, 0.07964318348142958,
0.0863245324711805, 0.18518716132585408]
- a2 = [0.061688440856337096, 0.23000237877135882, 0.04453793881833177, 0.19251530387370916,
+ a2 = [0.061688440856337096, 0.23000237877135882, 0.04453793881833177,
+ 0.19251530387370916,
0.11107917357941084, 0.05898041974649702, 0.09949312336096268, 0.07022276346006465,
0.10670366489014596, 0.02477679264318211]
- b1 = [0.06582340543754152, 0.9857886297001535, 0.8450452205037154, -1.279648120993805,
+ b1 = [0.06582340543754152, 0.9857886297001535, 0.8450452205037154, -1.279648120993805,
0.45454198915209526, -0.13359370986823993, 0.07062615913363897, -1.0097986278512623,
1.0810669017430343, -0.14207309803877177]
- b2 = [-1.1376882185131414, -1.4798197129947765, 0.6139290513283818, -0.3319087388365522,
+ b2 = [-1.1376882185131414, -1.4798197129947765, 0.6139290513283818, -0.3319087388365522,
0.14633328999192285, -0.06373231463100072, -0.6270101051216724, 0.13941252226261905,
-1.0337526453303645, 1.0441408867083155]
- Y1 = 0.0
- Y2 = 0.0
- for n = 1:m
- Y1 += a1[n] * cos(b1[n] + 2 * n * pi * x[1])
- Y2 += a2[n] * cos(b2[n] + 2 * n * pi * x[1])
- end
-
- J1 = 0.25
- J2 = 0.75
- epsilon = 0.01
- I1 = J1 + epsilon * Y1
- I2 = J2 + epsilon * Y2
-
- if (x[2] > I1) && (x[2] < I2)
- rho = 2
- v1 = -0.5
- else
- rho = 1
- v1 = 0.5
- end
- v2 = 0
- p = 2.5
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ Y1 = 0.0
+ Y2 = 0.0
+ for n in 1:m
+ Y1 += a1[n] * cos(b1[n] + 2 * n * pi * x[1])
+ Y2 += a2[n] * cos(b2[n] + 2 * n * pi * x[1])
+ end
+
+ J1 = 0.25
+ J2 = 0.75
+ epsilon = 0.01
+ I1 = J1 + epsilon * Y1
+ I2 = J2 + epsilon * Y2
+
+ if (x[2] > I1) && (x[2] < I2)
+ rho = 2
+ v1 = -0.5
+ else
+ rho = 1
+ v1 = 0.5
+ end
+ v2 = 0
+ p = 2.5
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability_fjordholm_etal
surface_flux = flux_hllc
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.001,
- alpha_min=0.0001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.001,
+ alpha_min = 0.0001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000)
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -105,14 +107,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 400
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=400,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 400,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -121,5 +123,5 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
sol = solve(ode, SSPRK43();
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_restart.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_restart.jl
index e31a0476a43..dc54bb1fb3d 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_restart.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_restart.jl
@@ -11,15 +11,15 @@ new_path = path
tspan = (load_time(restart_filename), 6.7)
ode = semidiscretize(semi, tspan, restart_filename);
-save_solution = SaveSolutionCallback(output_directory=path,
- interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(output_directory = path,
+ interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-save_restart = SaveRestartCallback(output_directory=path,
- interval=50000,
- save_final_restart=true)
+save_restart = SaveRestartCallback(output_directory = path,
+ interval = 50000,
+ save_final_restart = true)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -27,6 +27,6 @@ callbacks = CallbackSet(summary_callback,
save_restart, save_solution)
sol = Trixi.solve(ode,
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl
index 42b529cb638..8f07b7ca920 100644
--- a/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl
@@ -16,41 +16,42 @@ A version of the classical Kelvin-Helmholtz instability based on
of the Euler Equations
[arXiv: 2102.06017](https://arxiv.org/abs/2102.06017)
"""
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-1,+1]^2
- slope = 15
- amplitude = 0.02
- B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
- rho = 0.5 + 0.75 * B
- v1 = 0.5 * (B - 1)
- v2 = 0.1 * sin(2 * pi * x[1])
- p = 1.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-1,+1]^2
+ slope = 15
+ amplitude = 0.02
+ B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
+ rho = 0.5 + 0.75 * B
+ v1 = 0.5 * (B - 1)
+ v2 = 0.1 * sin(2 * pi * x[1])
+ p = 1.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[1],
- positivity_variables_nonlinear=(pressure,),
- spec_entropy=false,
- bar_states=true)
+ positivity_variables_cons = [1],
+ positivity_variables_nonlinear = (pressure,),
+ spec_entropy = false,
+ bar_states = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000)
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
###############################################################################
@@ -62,32 +63,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=5000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 5000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-save_restart = SaveRestartCallback(interval=50000,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 50000,
+ save_final_restart = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
save_restart, save_solution)
-
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_positivity.jl b/examples/tree_2d_dgsem/elixir_euler_positivity.jl
index 4c7dd7eb6cf..6fec4c1bf9b 100644
--- a/examples/tree_2d_dgsem/elixir_euler_positivity.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_positivity.jl
@@ -14,53 +14,51 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,42 +68,40 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorLöhner(semi,
- variable=density_pressure)
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- med_level =0, med_threshold=0.1, # med_level = current level
- max_level =6, max_threshold=0.3)
+ base_level = 4,
+ med_level = 0, med_threshold = 0.1, # med_level = current level
+ max_level = 6, max_threshold = 0.3)
amr_callback = AMRCallback(semi, amr_controller,
- interval=2,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 2,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),
- variables=(Trixi.density, pressure))
-
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6, 5.0e-6),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl
index 512e5822374..5b8959b97d1 100644
--- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave.jl
@@ -14,53 +14,51 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,29 +68,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -101,7 +99,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_MCL.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_MCL.jl
index af239b7c1a3..a5e7532854e 100644
--- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_MCL.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_MCL.jl
@@ -14,57 +14,57 @@ The Sedov blast wave setup based on Flash
- http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
limiter_mcl = SubcellLimiterMCL(equations, basis;
- DensityLimiter=true,
- DensityAlphaForAll=false,
- SequentialLimiter=true,
- ConservativeLimiter=false,
- DensityPositivityLimiter=false,
- PressurePositivityLimiterKuzmin=true, PressurePositivityLimiterKuzminExact=true,
- SemiDiscEntropyLimiter=true,
- smoothness_indicator=false,
- Plotting=true)
+ DensityLimiter = true,
+ DensityAlphaForAll = false,
+ SequentialLimiter = true,
+ ConservativeLimiter = false,
+ DensityPositivityLimiter = false,
+ PressurePositivityLimiterKuzmin = true,
+ PressurePositivityLimiterKuzminExact = true,
+ SemiDiscEntropyLimiter = true,
+ smoothness_indicator = false,
+ Plotting = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_mcl;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -74,18 +74,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
-limiting_analysis_callback = LimitingAnalysisCallback(output_directory="out", interval=1)
+limiting_analysis_callback = LimitingAnalysisCallback(output_directory = "out",
+ interval = 1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -94,9 +95,11 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (BoundsCheckCallback(save_errors=false),)
+output_directory = "out"
+stage_callbacks = (BoundsCheckCallback(save_errors = true, interval = 100,
+ output_directory = output_directory),)
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl
index 5fd32da2e5c..39ea947f872 100644
--- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl
@@ -2,7 +2,8 @@ using Downloads: download
using Flux
using BSON: load
network = joinpath(@__DIR__, "modelnnpp-0.904-0.0005.bson")
-download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.904-0.0005.bson", network)
+download("https://github.com/trixi-framework/Trixi_IndicatorNeuralNetwork_networks/raw/main/networks/modelnnpp-0.904-0.0005.bson",
+ network)
model2d = load(network, @__MODULE__)[:model2d]
using OrdinaryDiffEq
@@ -26,57 +27,55 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorNeuralNetwork(equations, basis,
- indicator_type=NeuralNetworkPerssonPeraire(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=true,
- alpha_amr=false,
- variable=density_pressure,
- network=model2d)
+ indicator_type = NeuralNetworkPerssonPeraire(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = true,
+ alpha_amr = false,
+ variable = density_pressure,
+ network = model2d)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- n_cells_max=100_000)
-
+ initial_refinement_level = 6,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -86,33 +85,33 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorNeuralNetwork(semi,
- indicator_type=NeuralNetworkPerssonPeraire(),
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- alpha_continuous=true,
- alpha_amr=true,
- variable=density_pressure,
- network=model2d)
+ indicator_type = NeuralNetworkPerssonPeraire(),
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ alpha_continuous = true,
+ alpha_amr = true,
+ variable = density_pressure,
+ network = model2d)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.22)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.22)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -121,7 +120,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl
index 98861064415..b460b7a507b 100644
--- a/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_sedov_blast_wave_sc_subcell.jl
@@ -14,53 +14,51 @@ The Sedov blast wave setup based on Flash
- http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- # r0 = 0.5 # = more reasonable setup
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
- # p0_outer = 1.0e-3 # = more reasonable setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ # r0 = 0.5 # = more reasonable setup
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+ # p0_outer = 1.0e-3 # = more reasonable setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_chandrashekar
+volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- spec_entropy=true,
- smoothness_indicator=false,
- bar_states=true)
+ local_minmax_variables_cons = [1],
+ spec_entropy = true,
+ smoothness_indicator = false,
+ bar_states = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,18 +68,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
-limiting_analysis_callback = LimitingAnalysisCallback(output_directory="out", interval=1)
+limiting_analysis_callback = LimitingAnalysisCallback(output_directory = "out",
+ interval = 1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -91,9 +90,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl b/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl
index f0a7ed0b953..40f19cbd4e2 100644
--- a/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl
@@ -10,28 +10,26 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_shima_etal
+volume_flux = flux_shima_etal
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -41,26 +39,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, stepsize_callback,
save_solution,
analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl
index 810c37ff5bd..4e64cb3a91c 100644
--- a/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_shockcapturing_subcell.jl
@@ -16,46 +16,45 @@ A medium blast wave (modified to lower density and higher pressure) taken from
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044)
"""
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> modified to lower density, higher pressure
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Calculate primitive variables "normal" medium blast wave
- rho = r > 0.5 ? 0.1 : 0.2691 # rho = r > 0.5 ? 1 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
- p = r > 0.5 ? 1.0E-1 : 1.245 # p = r > 0.5 ? 1.0E-3 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> modified to lower density, higher pressure
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Calculate primitive variables "normal" medium blast wave
+ rho = r > 0.5 ? 0.1 : 0.2691 # rho = r > 0.5 ? 1 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi
+ p = r > 0.5 ? 1.0E-1 : 1.245 # p = r > 0.5 ? 1.0E-3 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
+volume_flux = flux_ranocha
basis = LobattoLegendreBasis(3)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[1],
- positivity_correction_factor=0.5,
- bar_states=false)
+ positivity_variables_cons = [1],
+ positivity_correction_factor = 0.5,
+ bar_states = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=100_000)
+ initial_refinement_level = 5,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -65,29 +64,28 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms.jl
index 36d93147289..ec230145537 100644
--- a/examples/tree_2d_dgsem/elixir_euler_source_terms.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_source_terms.jl
@@ -8,18 +8,16 @@ using Trixi
equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,16 +28,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -49,7 +47,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl
index 231486b11c9..28ab4cec1d3 100644
--- a/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_source_terms_amr_refine_coarsen.jl
@@ -10,60 +10,57 @@ module TrixiExtensionEulerAMR
using Trixi
-struct IndicatorRefineCoarsen{Cache<:NamedTuple} <: Trixi.AbstractIndicator
- cache::Cache
+struct IndicatorRefineCoarsen{Cache <: NamedTuple} <: Trixi.AbstractIndicator
+ cache::Cache
end
function IndicatorRefineCoarsen(semi)
- basis = semi.solver.basis
- alpha = Vector{real(basis)}()
- cache = (; semi.mesh, alpha)
+ basis = semi.solver.basis
+ alpha = Vector{real(basis)}()
+ cache = (; semi.mesh, alpha)
- return IndicatorRefineCoarsen{typeof(cache)}(cache)
+ return IndicatorRefineCoarsen{typeof(cache)}(cache)
end
-function (indicator::IndicatorRefineCoarsen)(u::AbstractArray{<:Any,4},
+function (indicator::IndicatorRefineCoarsen)(u::AbstractArray{<:Any, 4},
mesh, equations, dg, cache;
t, kwargs...)
- alpha = indicator.cache.alpha
- resize!(alpha, nelements(dg, cache))
-
- if t >= 0.7 && t < 1.0
- # Refine to max level
- alpha .= 1.0
- elseif t >= 1.0
- # Coarsen to base level
- alpha .= -1.0
- else
- alpha .= 0.0
- end
-
- return alpha
+ alpha = indicator.cache.alpha
+ resize!(alpha, nelements(dg, cache))
+
+ if t >= 0.7 && t < 1.0
+ # Refine to max level
+ alpha .= 1.0
+ elseif t >= 1.0
+ # Coarsen to base level
+ alpha .= -1.0
+ else
+ alpha .= 0.0
+ end
+
+ return alpha
end
end # module TrixiExtensionEulerAMR
import .TrixiExtensionEulerAMR
-
###############################################################################
# semidiscretization of the compressible Euler equations
equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -74,25 +71,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, TrixiExtensionEulerAMR.IndicatorRefineCoarsen(semi),
- base_level=3, max_level=6,
- med_threshold=0.1, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi,
+ TrixiExtensionEulerAMR.IndicatorRefineCoarsen(semi),
+ base_level = 3, max_level = 6,
+ med_threshold = 0.1, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -102,7 +100,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl
index 9826a53d3d5..05ed7ba78cc 100644
--- a/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_source_terms_nonperiodic.jl
@@ -12,26 +12,23 @@ initial_condition = initial_condition_convergence_test
# you can either use a single function to impose the BCs weakly in all
# 2*ndims == 4 directions or you can pass a tuple containing BCs for each direction
boundary_condition = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = (x_neg=boundary_condition,
- x_pos=boundary_condition,
- y_neg=boundary_condition,
- y_pos=boundary_condition,)
-
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+boundary_conditions = (x_neg = boundary_condition,
+ x_pos = boundary_condition,
+ y_neg = boundary_condition,
+ y_pos = boundary_condition)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_convergence_test,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -42,19 +39,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -63,7 +60,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl b/examples/tree_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl
index 5c92414e66a..6d5281fcbc0 100644
--- a/examples/tree_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_source_terms_sc_subcell.jl
@@ -14,25 +14,24 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[1],
- positivity_variables_cons=[1],
- positivity_variables_nonlinear=(pressure,),
- bar_states=true,
- smoothness_indicator=true)
+ local_minmax_variables_cons = [1],
+ positivity_variables_cons = [1],
+ positivity_variables_nonlinear = (pressure,),
+ bar_states = true,
+ smoothness_indicator = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0, 0.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,16 +42,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -61,9 +60,9 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex.jl b/examples/tree_2d_dgsem/elixir_euler_vortex.jl
index 14e46ce7540..c87d6f49ba8 100644
--- a/examples/tree_2d_dgsem/elixir_euler_vortex.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_vortex.jl
@@ -17,46 +17,45 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
- cent = x - cent # distance to center point
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+ cent = x - cent # distance to center point
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
+coordinates_max = (10.0, 10.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -69,30 +68,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_errors=(:conservation_error,),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_errors = (:conservation_error,),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl
index 6f6eb25efa4..e9831c95526 100644
--- a/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_vortex_amr.jl
@@ -7,55 +7,54 @@ module TrixiExtension
using Trixi
-struct IndicatorVortex{Cache<:NamedTuple} <: Trixi.AbstractIndicator
- cache::Cache
+struct IndicatorVortex{Cache <: NamedTuple} <: Trixi.AbstractIndicator
+ cache::Cache
end
function IndicatorVortex(semi)
- basis = semi.solver.basis
- alpha = Vector{real(basis)}()
- A = Array{real(basis), 2}
- indicator_threaded = [A(undef, nnodes(basis), nnodes(basis))
- for _ in 1:Threads.nthreads()]
- cache = (; semi.mesh, alpha, indicator_threaded)
-
- return IndicatorVortex{typeof(cache)}(cache)
+ basis = semi.solver.basis
+ alpha = Vector{real(basis)}()
+ A = Array{real(basis), 2}
+ indicator_threaded = [A(undef, nnodes(basis), nnodes(basis))
+ for _ in 1:Threads.nthreads()]
+ cache = (; semi.mesh, alpha, indicator_threaded)
+
+ return IndicatorVortex{typeof(cache)}(cache)
end
-function (indicator_vortex::IndicatorVortex)(u::AbstractArray{<:Any,4},
+function (indicator_vortex::IndicatorVortex)(u::AbstractArray{<:Any, 4},
mesh, equations, dg, cache;
t, kwargs...)
- mesh = indicator_vortex.cache.mesh
- alpha = indicator_vortex.cache.alpha
- indicator_threaded = indicator_vortex.cache.indicator_threaded
- resize!(alpha, nelements(dg, cache))
-
-
- # get analytical vortex center (based on assumption that center=[0.0,0.0]
- # at t=0.0 and that we stop after one period)
- domain_length = mesh.tree.length_level_0
- if t < 0.5 * domain_length
- center = (t, t)
- else
- center = (t-domain_length, t-domain_length)
- end
-
- Threads.@threads for element in eachelement(dg, cache)
- cell_id = cache.elements.cell_ids[element]
- coordinates = (mesh.tree.coordinates[1, cell_id], mesh.tree.coordinates[2, cell_id])
- # use the negative radius as indicator since the AMR controller increases
- # the level with increasing value of the indicator and we want to use
- # high levels near the vortex center
- alpha[element] = -periodic_distance_2d(coordinates, center, domain_length)
- end
-
- return alpha
+ mesh = indicator_vortex.cache.mesh
+ alpha = indicator_vortex.cache.alpha
+ indicator_threaded = indicator_vortex.cache.indicator_threaded
+ resize!(alpha, nelements(dg, cache))
+
+ # get analytical vortex center (based on assumption that center=[0.0,0.0]
+ # at t=0.0 and that we stop after one period)
+ domain_length = mesh.tree.length_level_0
+ if t < 0.5 * domain_length
+ center = (t, t)
+ else
+ center = (t - domain_length, t - domain_length)
+ end
+
+ Threads.@threads for element in eachelement(dg, cache)
+ cell_id = cache.elements.cell_ids[element]
+ coordinates = (mesh.tree.coordinates[1, cell_id], mesh.tree.coordinates[2, cell_id])
+ # use the negative radius as indicator since the AMR controller increases
+ # the level with increasing value of the indicator and we want to use
+ # high levels near the vortex center
+ alpha[element] = -periodic_distance_2d(coordinates, center, domain_length)
+ end
+
+ return alpha
end
function periodic_distance_2d(coordinates, center, domain_length)
- dx = @. abs(coordinates - center)
- dx_periodic = @. min(dx, domain_length - dx)
- return sqrt(sum(abs2, dx_periodic))
+ dx = @. abs(coordinates - center)
+ dx_periodic = @. min(dx, domain_length - dx)
+ return sqrt(sum(abs2, dx_periodic))
end
end # module TrixiExtension
@@ -77,48 +76,47 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
-
- cent = x - cent # distance to center point
-
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+
+ cent = x - cent # distance to center point
+
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
+coordinates_max = (10.0, 10.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -132,39 +130,40 @@ summary_callback = SummaryCallback()
analysis_interval = 200
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_errors=(:conservation_error,),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_errors = (:conservation_error,),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=50,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 50,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_controller = ControllerThreeLevel(semi, TrixiExtension.IndicatorVortex(semi),
- base_level=3,
- med_level=4, med_threshold=-3.0,
- max_level=5, max_threshold=-2.0)
+ base_level = 3,
+ med_level = 4, med_threshold = -3.0,
+ max_level = 5, max_threshold = -2.0)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl
index 637133b9b2f..858799d2d3d 100644
--- a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar.jl
@@ -17,49 +17,48 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
- cent = x - cent # distance to center point
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+ cent = x - cent # distance to center point
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
-refinement_patches = (
- (type="box", coordinates_min=(0.0, -10.0), coordinates_max=(10.0, 10.0)),
-)
+coordinates_max = (10.0, 10.0)
+refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0),
+ coordinates_max = (10.0, 10.0)),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- refinement_patches=refinement_patches,
- n_cells_max=10_000,)
+ initial_refinement_level = 4,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -72,30 +71,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_errors=(:conservation_error,),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_errors = (:conservation_error,),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.4)
+stepsize_callback = StepsizeCallback(cfl = 1.4)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl
index dc6a326c5d5..026f6d1462c 100644
--- a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_shockcapturing.jl
@@ -17,36 +17,36 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
- cent = x - cent # distance to center point
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+ cent = x - cent # distance to center point
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
@@ -56,24 +56,23 @@ volume_flux = flux_shima_etal
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
-refinement_patches = (
- (type="box", coordinates_min=(0.0, -10.0), coordinates_max=(10.0, 10.0)),
-)
+coordinates_max = (10.0, 10.0)
+refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0),
+ coordinates_max = (10.0, 10.0)),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- refinement_patches=refinement_patches,
- n_cells_max=10_000,)
+ initial_refinement_level = 4,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -86,30 +85,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_errors=(:conservation_error,),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_errors = (:conservation_error,),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.7)
+stepsize_callback = StepsizeCallback(cfl = 0.7)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl
index 99036c36451..d719e01fd7c 100644
--- a/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl
@@ -17,52 +17,51 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
- cent = x - cent # distance to center point
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+ cent = x - cent # distance to center point
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
volume_flux = flux_shima_etal
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
-refinement_patches = (
- (type="box", coordinates_min=(0.0, -10.0), coordinates_max=(10.0, 10.0)),
-)
+coordinates_max = (10.0, 10.0)
+refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0),
+ coordinates_max = (10.0, 10.0)),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- refinement_patches=refinement_patches,
- n_cells_max=10_000,)
+ initial_refinement_level = 4,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -75,30 +74,31 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_errors=(:conservation_error,),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_errors = (:conservation_error,),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.4)
+stepsize_callback = StepsizeCallback(cfl = 1.4)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl b/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl
index 65a497374ed..99e4b090633 100644
--- a/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl
+++ b/examples/tree_2d_dgsem/elixir_euler_vortex_shockcapturing.jl
@@ -17,36 +17,36 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
- cent = x - cent # distance to center point
- # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation
- dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
- rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
- vel = vel + du * cent
- v1, v2 = vel
- p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+ cent = x - cent # distance to center point
+ # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
@@ -56,20 +56,20 @@ volume_flux = flux_shima_etal
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
+coordinates_max = (10.0, 10.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -82,22 +82,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_errors=(:conservation_error,),
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_errors = (:conservation_error,),
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.7)
+stepsize_callback = StepsizeCallback(cfl = 0.7)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -107,7 +109,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl b/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl
index 38b48b5d537..ea81bd049e4 100644
--- a/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl
+++ b/examples/tree_2d_dgsem/elixir_euleracoustics_co-rotating_vortex_pair.jl
@@ -19,203 +19,199 @@ module VortexPairSetup
using LinearAlgebra: norm
using Trixi
-
# Parameters that describe the co-rotating vortex pair
-struct VortexPair{RealT<:Real}
- r0::RealT # Distance between origin and each vortex center
- rc::RealT # Vortex core radius
- c0::RealT # Speed of sound
- circulation::RealT # Circulation of the vortices
- rho0::RealT # Density
+struct VortexPair{RealT <: Real}
+ r0::RealT # Distance between origin and each vortex center
+ rc::RealT # Vortex core radius
+ c0::RealT # Speed of sound
+ circulation::RealT # Circulation of the vortices
+ rho0::RealT # Density
end
-
# Analytical flow solution, used for the initial condition of the flow simulation
function velocity(x, t, vortex_pair::VortexPair)
- @unpack r0, rc, circulation = vortex_pair
+ @unpack r0, rc, circulation = vortex_pair
- omega = circulation / (4 * pi * r0^2)
- si, co = sincos(omega * t)
- b = SVector(r0 * co, r0 * si) # vortex centers are b and -b
- z_plus = x - b
- z_minus = x + b
+ omega = circulation / (4 * pi * r0^2)
+ si, co = sincos(omega * t)
+ b = SVector(r0 * co, r0 * si) # vortex centers are b and -b
+ z_plus = x - b
+ z_minus = x + b
- # Transform to polar coordinates
- r_plus = norm(z_plus)
- r_minus = norm(z_minus)
- theta_plus = atan(z_plus[2], z_plus[1])
- theta_minus = atan(z_minus[2], z_minus[1])
+ # Transform to polar coordinates
+ r_plus = norm(z_plus)
+ r_minus = norm(z_minus)
+ theta_plus = atan(z_plus[2], z_plus[1])
+ theta_minus = atan(z_minus[2], z_minus[1])
- si_plus, co_plus = sincos(theta_plus)
- si_minus, co_minus = sincos(theta_minus)
+ si_plus, co_plus = sincos(theta_plus)
+ si_minus, co_minus = sincos(theta_minus)
- v1 = -circulation/(2 * pi) * ( r_plus /(rc^2 + r_plus^2) * si_plus +
- r_minus/(rc^2 + r_minus^2) * si_minus)
- v2 = circulation/(2 * pi) * ( r_plus /(rc^2 + r_plus^2) * co_plus +
- r_minus/(rc^2 + r_minus^2) * co_minus )
+ v1 = -circulation / (2 * pi) * (r_plus / (rc^2 + r_plus^2) * si_plus +
+ r_minus / (rc^2 + r_minus^2) * si_minus)
+ v2 = circulation / (2 * pi) * (r_plus / (rc^2 + r_plus^2) * co_plus +
+ r_minus / (rc^2 + r_minus^2) * co_minus)
- return SVector(v1, v2)
+ return SVector(v1, v2)
end
-
# Initial condition of the flow simulation. Uses constant density rho0 and analytical velocities.
# The pressure is calculated using the given speed of sound c0 and Bernoulli's principle
-struct InitialCondition{RealT<:Real}
- vortex_pair::VortexPair{RealT}
+struct InitialCondition{RealT <: Real}
+ vortex_pair::VortexPair{RealT}
end
-function (initial_condition::InitialCondition)(x, t, equations::CompressibleEulerEquations2D)
- @unpack vortex_pair = initial_condition
- @unpack rho0, c0 = vortex_pair
- gamma = equations.gamma
+function (initial_condition::InitialCondition)(x, t,
+ equations::CompressibleEulerEquations2D)
+ @unpack vortex_pair = initial_condition
+ @unpack rho0, c0 = vortex_pair
+ gamma = equations.gamma
- v = velocity(x, t, vortex_pair)
- p0 = rho0 * c0^2 / gamma
- p = p0 - 0.5 * (gamma-1)/gamma * sum(v.^2) # Bernoulli's principle
+ v = velocity(x, t, vortex_pair)
+ p0 = rho0 * c0^2 / gamma
+ p = p0 - 0.5 * (gamma - 1) / gamma * sum(v .^ 2) # Bernoulli's principle
- prim = SVector(rho0, v[1], v[2], p)
- return prim2cons(prim, equations)
+ prim = SVector(rho0, v[1], v[2], p)
+ return prim2cons(prim, equations)
end
-
# For both the flow and acoustics solvers, a sponge layer is used to dampen the density
# and pressure towards the freestream values (for the flow solver) and the perturbed pressure
# to zero (for the acoustics solver).
-struct SpongeLayer{RealT<:Real, uEltype<:Real, N, SourceTerms}
- sponge_layer_min::NTuple{4, RealT} # (-x,+x,-y,+y) min coordinates of sponge layer per direction
- sponge_layer_max::NTuple{4, RealT} # (-x,+x,-y,+y) max coordinates of sponge layer per direction
- reference_values::NTuple{N, uEltype} # reference values for variables affected by sponge layer
- source_terms::SourceTerms # source terms to be used outside the sponge zone
+struct SpongeLayer{RealT <: Real, uEltype <: Real, N, SourceTerms}
+ sponge_layer_min::NTuple{4, RealT} # (-x,+x,-y,+y) min coordinates of sponge layer per direction
+ sponge_layer_max::NTuple{4, RealT} # (-x,+x,-y,+y) max coordinates of sponge layer per direction
+ reference_values::NTuple{N, uEltype} # reference values for variables affected by sponge layer
+ source_terms::SourceTerms # source terms to be used outside the sponge zone
end
-function SpongeLayer(; sponge_layer_min, sponge_layer_max, reference_values, source_terms=nothing)
- return SpongeLayer(sponge_layer_min, sponge_layer_max, reference_values, source_terms)
+function SpongeLayer(; sponge_layer_min, sponge_layer_max, reference_values,
+ source_terms = nothing)
+ return SpongeLayer(sponge_layer_min, sponge_layer_max, reference_values, source_terms)
end
function (sponge_layer::SpongeLayer)(u, x, t, equations)
- @unpack sponge_layer_min, sponge_layer_max, reference_values, source_terms = sponge_layer
-
- if lies_in_sponge_layer(x, sponge_layer_min, sponge_layer_max)
- return source_term_sponge_layer(u, x, t, equations, sponge_layer_min, sponge_layer_max,
- reference_values)
- elseif source_terms !== nothing
- return source_terms(u, x, t, equations)
- else
- return SVector(ntuple(v -> zero(eltype(u)), Val(nvariables(equations))))
- end
+ @unpack sponge_layer_min, sponge_layer_max, reference_values, source_terms = sponge_layer
+
+ if lies_in_sponge_layer(x, sponge_layer_min, sponge_layer_max)
+ return source_term_sponge_layer(u, x, t, equations, sponge_layer_min,
+ sponge_layer_max,
+ reference_values)
+ elseif source_terms !== nothing
+ return source_terms(u, x, t, equations)
+ else
+ return SVector(ntuple(v -> zero(eltype(u)), Val(nvariables(equations))))
+ end
end
function lies_in_sponge_layer(x, sponge_layer_min, sponge_layer_max)
- return (sponge_layer_min[1] <= x[1] <= sponge_layer_max[1]) || # -x direction
- (sponge_layer_min[2] <= x[1] <= sponge_layer_max[2]) || # +x direction
- (sponge_layer_min[3] <= x[2] <= sponge_layer_max[3]) || # -y direction
- (sponge_layer_min[4] <= x[2] <= sponge_layer_max[4]) # +y direction
+ return (sponge_layer_min[1] <= x[1] <= sponge_layer_max[1]) || # -x direction
+ (sponge_layer_min[2] <= x[1] <= sponge_layer_max[2]) || # +x direction
+ (sponge_layer_min[3] <= x[2] <= sponge_layer_max[3]) || # -y direction
+ (sponge_layer_min[4] <= x[2] <= sponge_layer_max[4]) # +y direction
end
function source_term_sponge_layer(u, x, t, equations::AcousticPerturbationEquations2D,
sponge_layer_min::NTuple{4}, sponge_layer_max::NTuple{4},
reference_values)
- # Perturbed pressure source is -alpha^2 * (u - reference_value) where alpha in [0,1] is a damping
- # factor depending on the position inside the sponge layer
+ # Perturbed pressure source is -alpha^2 * (u - reference_value) where alpha in [0,1] is a damping
+ # factor depending on the position inside the sponge layer
- # Calculate the damping factors for each direction (=0 if x is not in the corresponding sponge
- # zone) and take the maximum. This ensures proper damping if x lies in a corner where the sponge
- # zones for two directions overlap
- alphas = ntuple(i -> calc_damping_factor(x, i, sponge_layer_min, sponge_layer_max),
- Val(2*ndims(equations)))
- alpha_square = maximum(alphas)^2
+ # Calculate the damping factors for each direction (=0 if x is not in the corresponding sponge
+ # zone) and take the maximum. This ensures proper damping if x lies in a corner where the sponge
+ # zones for two directions overlap
+ alphas = ntuple(i -> calc_damping_factor(x, i, sponge_layer_min, sponge_layer_max),
+ Val(2 * ndims(equations)))
+ alpha_square = maximum(alphas)^2
- return SVector(0, 0, -alpha_square*(u[3] - reference_values[1]/u[6]^2), 0, 0, 0, 0)
+ return SVector(0, 0, -alpha_square * (u[3] - reference_values[1] / u[6]^2), 0, 0, 0, 0)
end
function source_term_sponge_layer(u, x, t, equations::CompressibleEulerEquations2D,
sponge_layer_min::NTuple{4}, sponge_layer_max::NTuple{4},
reference_values)
- # Calculate the damping factors for each direction (=0 if x is not in the corresponding sponge
- # zone) and take the maximum. This ensures proper damping if x lies in a corner where the sponge
- # zones for two directions overlap
- alphas = ntuple(i -> calc_damping_factor(x, i, sponge_layer_min, sponge_layer_max),
- Val(2*ndims(equations)))
- alpha_square = maximum(alphas)^2
-
- u_prim = cons2prim(u, equations)
- s = SVector(-alpha_square*(u_prim[1] - reference_values[1]), 0, 0,
- -alpha_square*(u_prim[4] - reference_values[2]))
-
- return prim2cons(s, equations)
+ # Calculate the damping factors for each direction (=0 if x is not in the corresponding sponge
+ # zone) and take the maximum. This ensures proper damping if x lies in a corner where the sponge
+ # zones for two directions overlap
+ alphas = ntuple(i -> calc_damping_factor(x, i, sponge_layer_min, sponge_layer_max),
+ Val(2 * ndims(equations)))
+ alpha_square = maximum(alphas)^2
+
+ u_prim = cons2prim(u, equations)
+ s = SVector(-alpha_square * (u_prim[1] - reference_values[1]), 0, 0,
+ -alpha_square * (u_prim[4] - reference_values[2]))
+
+ return prim2cons(s, equations)
end
function calc_damping_factor(x, direction, sponge_layer_min, sponge_layer_max)
- # Damping factor alpha grows linearly from 0 to 1 depending on how deep x lies in the sponge layer
- # If x does not lie in the sponge layer, this returns 0
-
- # Get the coordinate that determines how deep we are in the sponge zone
- if direction in (1, 2)
- pos = x[1]
- else
- pos = x[2]
- end
-
- # Determine where the sponge layer begins/ends to allow calculating the damping factor
- if iseven(direction)
- sponge_begin = sponge_layer_min[direction]
- sponge_end = sponge_layer_max[direction]
- else
- sponge_begin = sponge_layer_max[direction]
- sponge_end = sponge_layer_min[direction]
- end
-
- alpha = (pos - sponge_begin) / (sponge_end - sponge_begin)
-
- # alpha lies in [0, 1] if and only if x lies in the sponge zone
- if 0 <= alpha <= 1
- return alpha
- else
- return zero(alpha)
- end
+ # Damping factor alpha grows linearly from 0 to 1 depending on how deep x lies in the sponge layer
+ # If x does not lie in the sponge layer, this returns 0
+
+ # Get the coordinate that determines how deep we are in the sponge zone
+ if direction in (1, 2)
+ pos = x[1]
+ else
+ pos = x[2]
+ end
+
+ # Determine where the sponge layer begins/ends to allow calculating the damping factor
+ if iseven(direction)
+ sponge_begin = sponge_layer_min[direction]
+ sponge_end = sponge_layer_max[direction]
+ else
+ sponge_begin = sponge_layer_max[direction]
+ sponge_end = sponge_layer_min[direction]
+ end
+
+ alpha = (pos - sponge_begin) / (sponge_end - sponge_begin)
+
+ # alpha lies in [0, 1] if and only if x lies in the sponge zone
+ if 0 <= alpha <= 1
+ return alpha
+ else
+ return zero(alpha)
+ end
end
-
# Boundary condition for the flow problem: The sponge layer dampens density and pressure towards the
# freestream values. The freestream values (converted into conservative variables) are therefore
# used as a Dirichlet boundary
struct BoundaryCondition{uEltype}
- rho::uEltype
- rho_e::uEltype
+ rho::uEltype
+ rho_e::uEltype
end
function (bc::BoundaryCondition)(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::CompressibleEulerEquations2D)
- u_boundary = SVector(bc.rho, zero(bc.rho), zero(bc.rho), bc.rho_e)
+ u_boundary = SVector(bc.rho, zero(bc.rho), zero(bc.rho), bc.rho_e)
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- end
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ end
- return flux
+ return flux
end
end # module
-
import .VortexPairSetup
-
###############################################################################
# shared parameters, mesh and solver for both semidiscretizations
# Parameters of the vortex pair
-Mach = 1/9
+Mach = 1 / 9
c0 = 1.0
r0 = 1.0
circulation = 4 * pi * r0 * c0 * Mach
rho = 1.0
-rc = 2/9 * r0 * 1.0
+rc = 2 / 9 * r0 * 1.0
T_r = 8 * pi^2 * r0^2 / circulation # Rotational period of the vortex pair
T_a = T_r / 2 # Acoustic period of the vortex pair
@@ -223,24 +219,22 @@ T_a = T_r / 2 # Acoustic period of the vortex pair
vortex_pair = VortexPairSetup.VortexPair(r0, rc, c0, circulation, rho)
# Shared mesh for both semidiscretizations
-coordinates_min = (-135*r0, -135*r0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 135*r0, 135*r0) # maximum coordinates (max(x), max(y))
-refinement_patches = (
- (type="sphere", center=(0.0, 0.0), radius=85.0*r0),
- (type="sphere", center=(0.0, 0.0), radius=20.0*r0),
- (type="sphere", center=(0.0, 0.0), radius=10.0*r0),
- (type="sphere", center=(0.0, 0.0), radius=5.0*r0)
-)
-initial_refinement_level=7
-n_cells_max=500_000
+coordinates_min = (-135 * r0, -135 * r0) # minimum coordinates (min(x), min(y))
+coordinates_max = (135 * r0, 135 * r0) # maximum coordinates (max(x), max(y))
+refinement_patches = ((type = "sphere", center = (0.0, 0.0), radius = 85.0 * r0),
+ (type = "sphere", center = (0.0, 0.0), radius = 20.0 * r0),
+ (type = "sphere", center = (0.0, 0.0), radius = 10.0 * r0),
+ (type = "sphere", center = (0.0, 0.0), radius = 5.0 * r0))
+initial_refinement_level = 7
+n_cells_max = 500_000
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=initial_refinement_level,
- refinement_patches=refinement_patches,
- n_cells_max=n_cells_max, # set maximum capacity of tree data structure
- periodicity=false)
+ initial_refinement_level = initial_refinement_level,
+ refinement_patches = refinement_patches,
+ n_cells_max = n_cells_max, # set maximum capacity of tree data structure
+ periodicity = false)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
###############################################################################
# semidiscretization Euler equations
@@ -250,24 +244,37 @@ equations_euler = CompressibleEulerEquations2D(gamma)
initial_condition_euler = VortexPairSetup.InitialCondition(vortex_pair)
-sponge_layer_euler = VortexPairSetup.SpongeLayer(sponge_layer_min=(-135*r0, 115*r0, -135*r0, 115*r0),
- sponge_layer_max=(-115*r0, 135*r0, -115*r0, 135*r0),
- reference_values=(rho, rho * c0^2 / gamma)) # (rho0, p0)
+sponge_layer_euler = VortexPairSetup.SpongeLayer(sponge_layer_min = (-135 * r0, 115 * r0,
+ -135 * r0, 115 * r0),
+ sponge_layer_max = (-115 * r0, 135 * r0,
+ -115 * r0, 135 * r0),
+ reference_values = (rho,
+ rho * c0^2 / gamma)) # (rho0, p0)
-boundary_condition_euler = VortexPairSetup.BoundaryCondition(rho, (rho * c0^2 / gamma) / (gamma-1))
+boundary_condition_euler = VortexPairSetup.BoundaryCondition(rho,
+ (rho * c0^2 / gamma) /
+ (gamma - 1))
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition_euler, solver,
- boundary_conditions=boundary_condition_euler,
- source_terms=sponge_layer_euler)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition_euler,
+ solver,
+ boundary_conditions = boundary_condition_euler,
+ source_terms = sponge_layer_euler)
###############################################################################
# semidiscretization acoustic perturbation equations
-equations_acoustics = AcousticPerturbationEquations2D(v_mean_global=(13.0, 26.0), c_mean_global=39.0,
- rho_mean_global=52.0) # global mean values will be overwritten
-
-sponge_layer_acoustics = VortexPairSetup.SpongeLayer(sponge_layer_min=(-135*r0, 100*r0, -135*r0, 100*r0),
- sponge_layer_max=(-100*r0, 135*r0, -100*r0, 135*r0),
- reference_values=(0.0,))
+equations_acoustics = AcousticPerturbationEquations2D(v_mean_global = (13.0, 26.0),
+ c_mean_global = 39.0,
+ rho_mean_global = 52.0) # global mean values will be overwritten
+
+sponge_layer_acoustics = VortexPairSetup.SpongeLayer(sponge_layer_min = (-135 * r0,
+ 100 * r0,
+ -135 * r0,
+ 100 * r0),
+ sponge_layer_max = (-100 * r0,
+ 135 * r0,
+ -100 * r0,
+ 135 * r0),
+ reference_values = (0.0,))
"""
boundary_condition_zero(u_inner, orientation, direction, x, t, surface_flux_function,
@@ -276,24 +283,27 @@ sponge_layer_acoustics = VortexPairSetup.SpongeLayer(sponge_layer_min=(-135*r0,
Boundary condition that uses a boundary state where the state variables are zero and the mean
variables are the same as in `u_inner`.
"""
-function boundary_condition_zero(u_inner, orientation, direction, x, t, surface_flux_function,
+function boundary_condition_zero(u_inner, orientation, direction, x, t,
+ surface_flux_function,
equations::AcousticPerturbationEquations2D)
- value = zero(eltype(u_inner))
- u_boundary = SVector(value, value, value, cons2mean(u_inner, equations)...)
+ value = zero(eltype(u_inner))
+ u_boundary = SVector(value, value, value, cons2mean(u_inner, equations)...)
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- end
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ end
- return flux
+ return flux
end
-semi_acoustics = SemidiscretizationHyperbolic(mesh, equations_acoustics, initial_condition_constant,
- solver, boundary_conditions=boundary_condition_zero,
- source_terms=sponge_layer_acoustics)
+semi_acoustics = SemidiscretizationHyperbolic(mesh, equations_acoustics,
+ initial_condition_constant,
+ solver,
+ boundary_conditions = boundary_condition_zero,
+ source_terms = sponge_layer_acoustics)
###############################################################################
# ODE solvers, callbacks etc. for averaging the flow field
@@ -307,12 +317,12 @@ ode_averaging = semidiscretize(semi_euler, tspan1)
summary_callback = SummaryCallback()
analysis_interval = 5000
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
tspan_averaging = (50.0, 400.0)
averaging_callback = AveragingCallback(semi_euler, tspan_averaging)
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
callbacks_averaging = CallbackSet(summary_callback, alive_callback, averaging_callback,
stepsize_callback)
@@ -321,14 +331,13 @@ callbacks_averaging = CallbackSet(summary_callback, alive_callback, averaging_ca
# run simulation for averaging the flow field
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol_averaging = solve(ode_averaging, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks_averaging);
+sol_averaging = solve(ode_averaging, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks_averaging);
# Print the timer summary
summary_callback()
-
###############################################################################
# set up coupled semidiscretization
@@ -337,13 +346,13 @@ source_region(x) = sum(abs2, x) < 6.0^2 # calculate sources within radius 6 arou
weights(x) = sum(abs2, x) < 5.0^2 ? 1.0 : cospi(0.5 * (norm(x) - 5.0))
semi = SemidiscretizationEulerAcoustics(semi_acoustics, semi_euler,
- source_region=source_region, weights=weights)
+ source_region = source_region, weights = weights)
###############################################################################
# ODE solvers, callbacks etc. for the coupled simulation
# Create ODE problem
-tspan = (0.0, 7.0*T_a)
+tspan = (0.0, 7.0 * T_a)
ode = semidiscretize(semi, tspan)
# We need an additional ODE for the pure flow problem
ode_euler = semidiscretize(semi.semi_euler, tspan)
@@ -351,28 +360,30 @@ ode_euler = semidiscretize(semi.semi_euler, tspan)
# Set up coupling callback
cfl_acoustics = 0.8
cfl_euler = 0.8
-euler_acoustics_coupling = EulerAcousticsCouplingCallback(
- ode_euler, "out/averaging.h5", CarpenterKennedy2N54(williamson_condition=false),
- cfl_acoustics, cfl_euler, callback=SaveRestartCallback(interval=2300, output_directory="out/euler/"))
+euler_acoustics_coupling = EulerAcousticsCouplingCallback(ode_euler, "out/averaging.h5",
+ CarpenterKennedy2N54(williamson_condition = false),
+ cfl_acoustics, cfl_euler,
+ callback = SaveRestartCallback(interval = 2300,
+ output_directory = "out/euler/"))
# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
# and resets the timers
summary_callback = SummaryCallback()
analysis_interval = 5000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
output_directory = "out/"
-save_solution = SaveSolutionCallback(interval=2300, output_directory=output_directory)
-save_restart = SaveRestartCallback(interval=2300, output_directory=output_directory)
+save_solution = SaveSolutionCallback(interval = 2300, output_directory = output_directory)
+save_restart = SaveRestartCallback(interval = 2300, output_directory = output_directory)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback, save_solution,
save_restart, euler_acoustics_coupling)
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
-summary_callback()
\ No newline at end of file
+summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl
index d423b800fd0..bc4859e5760 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_ec.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4),
gas_constants = (0.4, 0.4))
initial_condition = initial_condition_convergence_test
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,27 +31,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl
index 62c5bab51ea..771343937a4 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_convergence_es.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4),
gas_constants = (0.4, 0.4))
initial_condition = initial_condition_convergence_test
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,27 +31,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl b/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl
index 0715dfe35d6..d912a280e49 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_ec.jl
@@ -4,26 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations2D(gammas = 1.4,
+equations = CompressibleEulerMulticomponentEquations2D(gammas = 1.4,
gas_constants = 0.4)
-
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,28 +31,27 @@ summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(Trixi.density,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (Trixi.density,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_es.jl b/examples/tree_2d_dgsem/elixir_eulermulti_es.jl
index a3e5580b572..470e533ab8d 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_es.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_es.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler multicomponent equations
-equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4, 1.4, 1.4),
+equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.4, 1.4, 1.4),
gas_constants = (0.4, 0.4, 0.4, 0.4))
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
-
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,30 +30,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl
index 38510446cb1..f5ef51c108a 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble.jl
@@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the compressible Euler multicomponent equations
# 1) Dry Air 2) Helium + 28% Air
-equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.648),
+equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.648),
gas_constants = (0.287, 1.578))
"""
@@ -16,124 +16,126 @@ A shock-bubble testcase for multicomponent Euler equations
Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations
[arXiv: 1904.00972](https://arxiv.org/abs/1904.00972)
"""
-function initial_condition_shock_bubble(x, t, equations::CompressibleEulerMulticomponentEquations2D{5, 2})
- # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972
- # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf
- # typical domain is rectangular, we change it to a square, as Trixi can only do squares
- @unpack gas_constants = equations
-
- # Positivity Preserving Parameter, can be set to zero if scheme is positivity preserving
- delta = 0.03
-
- # Region I
- rho1_1 = delta
- rho2_1 = 1.225 * gas_constants[1]/gas_constants[2] - delta
- v1_1 = zero(delta)
- v2_1 = zero(delta)
- p_1 = 101325
-
- # Region II
- rho1_2 = 1.225-delta
- rho2_2 = delta
- v1_2 = zero(delta)
- v2_2 = zero(delta)
- p_2 = 101325
-
- # Region III
- rho1_3 = 1.6861 - delta
- rho2_3 = delta
- v1_3 = -113.5243
- v2_3 = zero(delta)
- p_3 = 159060
-
- # Set up Region I & II:
- inicenter = SVector(zero(delta), zero(delta))
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- if (x[1] > 0.50)
- # Set up Region III
- rho1 = rho1_3
- rho2 = rho2_3
- v1 = v1_3
- v2 = v2_3
- p = p_3
- elseif (r < 0.25)
- # Set up Region I
- rho1 = rho1_1
- rho2 = rho2_1
- v1 = v1_1
- v2 = v2_1
- p = p_1
- else
- # Set up Region II
- rho1 = rho1_2
- rho2 = rho2_2
- v1 = v1_2
- v2 = v2_2
- p = p_2
- end
-
- return prim2cons(SVector(v1, v2, p, rho1, rho2), equations)
+function initial_condition_shock_bubble(x, t,
+ equations::CompressibleEulerMulticomponentEquations2D{
+ 5,
+ 2
+ })
+ # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972
+ # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf
+ # typical domain is rectangular, we change it to a square, as Trixi can only do squares
+ @unpack gas_constants = equations
+
+ # Positivity Preserving Parameter, can be set to zero if scheme is positivity preserving
+ delta = 0.03
+
+ # Region I
+ rho1_1 = delta
+ rho2_1 = 1.225 * gas_constants[1] / gas_constants[2] - delta
+ v1_1 = zero(delta)
+ v2_1 = zero(delta)
+ p_1 = 101325
+
+ # Region II
+ rho1_2 = 1.225 - delta
+ rho2_2 = delta
+ v1_2 = zero(delta)
+ v2_2 = zero(delta)
+ p_2 = 101325
+
+ # Region III
+ rho1_3 = 1.6861 - delta
+ rho2_3 = delta
+ v1_3 = -113.5243
+ v2_3 = zero(delta)
+ p_3 = 159060
+
+ # Set up Region I & II:
+ inicenter = SVector(zero(delta), zero(delta))
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ if (x[1] > 0.50)
+ # Set up Region III
+ rho1 = rho1_3
+ rho2 = rho2_3
+ v1 = v1_3
+ v2 = v2_3
+ p = p_3
+ elseif (r < 0.25)
+ # Set up Region I
+ rho1 = rho1_1
+ rho2 = rho2_1
+ v1 = v1_1
+ v2 = v2_1
+ p = p_1
+ else
+ # Set up Region II
+ rho1 = rho1_2
+ rho2 = rho2_2
+ v1 = v1_2
+ v2 = v2_2
+ p = p_2
+ end
+
+ return prim2cons(SVector(v1, v2, p, rho1, rho2), equations)
end
initial_condition = initial_condition_shock_bubble
-surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
-basis = LobattoLegendreBasis(3)
-indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
-volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-solver = DGSEM(basis, surface_flux, volume_integral)
-
-coordinates_min = (-2.25, -2.225)
-coordinates_max = ( 2.20, 2.225)
-mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=1_000_000)
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
+surface_flux = flux_lax_friedrichs
+volume_flux = flux_ranocha
+basis = LobattoLegendreBasis(3)
+indicator_sc = IndicatorHennemannGassner(equations, basis,
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
+volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+solver = DGSEM(basis, surface_flux, volume_integral)
+
+coordinates_min = (-2.25, -2.225)
+coordinates_max = (2.20, 2.225)
+mesh = TreeMesh(coordinates_min, coordinates_max,
+ initial_refinement_level = 3,
+ n_cells_max = 1_000_000)
+
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
###############################################################################
# ODE solvers, callbacks etc.
-tspan = (0.0, 0.01)
-ode = semidiscretize(semi, tspan)
-
-summary_callback = SummaryCallback()
+tspan = (0.0, 0.01)
+ode = semidiscretize(semi, tspan)
-analysis_interval = 300
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(Trixi.density,))
+summary_callback = SummaryCallback()
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_interval = 300
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (Trixi.density,))
-save_solution = SaveSolutionCallback(interval=300,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-stepsize_callback = StepsizeCallback(cfl=0.3)
+save_solution = SaveSolutionCallback(interval = 300,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-callbacks = CallbackSet(summary_callback,
- analysis_callback,
- alive_callback,
- save_solution,
- stepsize_callback)
+stepsize_callback = StepsizeCallback(cfl = 0.3)
+callbacks = CallbackSet(summary_callback,
+ analysis_callback,
+ alive_callback,
+ save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false,
- callback=callbacks,
- maxiters=1e5);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false,
+ callback = callbacks,
+ maxiters = 1e5);
+summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl
index 1c6cbef533e..4a8a70b5663 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_minmax.jl
@@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the compressible Euler multicomponent equations
# 1) Dry Air 2) Helium + 28% Air
-equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.648),
+equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.648),
gas_constants = (0.287, 1.578))
"""
@@ -16,126 +16,130 @@ A shock-bubble testcase for multicomponent Euler equations
Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations
[arXiv: 1904.00972](https://arxiv.org/abs/1904.00972)
"""
-function initial_condition_shock_bubble(x, t, equations::CompressibleEulerMulticomponentEquations2D{5, 2})
- # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972
- # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf
- # typical domain is rectangular, we change it to a square, as Trixi can only do squares
- @unpack gas_constants = equations
-
- # Positivity Preserving Parameter, can be set to zero if scheme is positivity preserving
- delta = 0.03
-
- # Region I
- rho1_1 = delta
- rho2_1 = 1.225 * gas_constants[1]/gas_constants[2] - delta
- v1_1 = zero(delta)
- v2_1 = zero(delta)
- p_1 = 101325
-
- # Region II
- rho1_2 = 1.225-delta
- rho2_2 = delta
- v1_2 = zero(delta)
- v2_2 = zero(delta)
- p_2 = 101325
-
- # Region III
- rho1_3 = 1.6861 - delta
- rho2_3 = delta
- v1_3 = -113.5243
- v2_3 = zero(delta)
- p_3 = 159060
-
- # Set up Region I & II:
- inicenter = SVector(zero(delta), zero(delta))
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- if (x[1] > 0.50)
- # Set up Region III
- rho1 = rho1_3
- rho2 = rho2_3
- v1 = v1_3
- v2 = v2_3
- p = p_3
- elseif (r < 0.25)
- # Set up Region I
- rho1 = rho1_1
- rho2 = rho2_1
- v1 = v1_1
- v2 = v2_1
- p = p_1
- else
- # Set up Region II
- rho1 = rho1_2
- rho2 = rho2_2
- v1 = v1_2
- v2 = v2_2
- p = p_2
- end
-
- return prim2cons(SVector(v1, v2, p, rho1, rho2), equations)
+function initial_condition_shock_bubble(x, t,
+ equations::CompressibleEulerMulticomponentEquations2D{
+ 5,
+ 2
+ })
+ # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972
+ # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf
+ # typical domain is rectangular, we change it to a square, as Trixi can only do squares
+ @unpack gas_constants = equations
+
+ # Positivity Preserving Parameter, can be set to zero if scheme is positivity preserving
+ delta = 0.03
+
+ # Region I
+ rho1_1 = delta
+ rho2_1 = 1.225 * gas_constants[1] / gas_constants[2] - delta
+ v1_1 = zero(delta)
+ v2_1 = zero(delta)
+ p_1 = 101325
+
+ # Region II
+ rho1_2 = 1.225 - delta
+ rho2_2 = delta
+ v1_2 = zero(delta)
+ v2_2 = zero(delta)
+ p_2 = 101325
+
+ # Region III
+ rho1_3 = 1.6861 - delta
+ rho2_3 = delta
+ v1_3 = -113.5243
+ v2_3 = zero(delta)
+ p_3 = 159060
+
+ # Set up Region I & II:
+ inicenter = SVector(zero(delta), zero(delta))
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ if (x[1] > 0.50)
+ # Set up Region III
+ rho1 = rho1_3
+ rho2 = rho2_3
+ v1 = v1_3
+ v2 = v2_3
+ p = p_3
+ elseif (r < 0.25)
+ # Set up Region I
+ rho1 = rho1_1
+ rho2 = rho2_1
+ v1 = v1_1
+ v2 = v2_1
+ p = p_1
+ else
+ # Set up Region II
+ rho1 = rho1_2
+ rho2 = rho2_2
+ v1 = v1_2
+ v2 = v2_2
+ p = p_2
+ end
+
+ return prim2cons(SVector(v1, v2, p, rho1, rho2), equations)
end
initial_condition = initial_condition_shock_bubble
-surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
-basis = LobattoLegendreBasis(3)
+surface_flux = flux_lax_friedrichs
+volume_flux = flux_ranocha
+basis = LobattoLegendreBasis(3)
limiter_idp = SubcellLimiterIDP(equations, basis;
- local_minmax_variables_cons=[(i+3 for i in eachcomponent(equations))...],
- spec_entropy=false,
- bar_states=true)
+ local_minmax_variables_cons = [
+ (i + 3 for i in eachcomponent(equations))...,
+ ],
+ spec_entropy = false,
+ bar_states = true)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
-coordinates_min = (-2.25, -2.225)
-coordinates_max = ( 2.20, 2.225)
-mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=1_000_000)
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
+coordinates_min = (-2.25, -2.225)
+coordinates_max = (2.20, 2.225)
+mesh = TreeMesh(coordinates_min, coordinates_max,
+ initial_refinement_level = 3,
+ n_cells_max = 1_000_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
###############################################################################
# ODE solvers, callbacks etc.
-tspan = (0.0, 0.01)
-ode = semidiscretize(semi, tspan)
-
-summary_callback = SummaryCallback()
+tspan = (0.0, 0.01)
+ode = semidiscretize(semi, tspan)
-analysis_interval = 300
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(Trixi.density,))
+summary_callback = SummaryCallback()
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_interval = 300
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (Trixi.density,))
-save_solution = SaveSolutionCallback(interval=600,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+save_solution = SaveSolutionCallback(interval = 600,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-callbacks = CallbackSet(summary_callback,
- analysis_callback,
- alive_callback,
- save_solution,
- stepsize_callback)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
+callbacks = CallbackSet(summary_callback,
+ analysis_callback,
+ alive_callback,
+ save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
-stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors=false))
+stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback(save_errors = false))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl
index f817a91a58f..5f6cdb1e9c0 100644
--- a/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl
+++ b/examples/tree_2d_dgsem/elixir_eulermulti_shock_bubble_shockcapturing_subcell_positivity.jl
@@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the compressible Euler multicomponent equations
# 1) Dry Air 2) Helium + 28% Air
-equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.648),
+equations = CompressibleEulerMulticomponentEquations2D(gammas = (1.4, 1.648),
gas_constants = (0.287, 1.578))
"""
@@ -16,131 +16,136 @@ A shock-bubble testcase for multicomponent Euler equations
Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations
[arXiv: 1904.00972](https://arxiv.org/abs/1904.00972)
"""
-function initial_condition_shock_bubble(x, t, equations::CompressibleEulerMulticomponentEquations2D{5, 2})
- # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972
- # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf
- # typical domain is rectangular, we change it to a square, as Trixi can only do squares
- @unpack gas_constants = equations
-
- # Positivity Preserving Parameter, can be set to zero if scheme is positivity preserving
- delta = 0.03
-
- # Region I
- rho1_1 = delta
- rho2_1 = 1.225 * gas_constants[1]/gas_constants[2] - delta
- v1_1 = zero(delta)
- v2_1 = zero(delta)
- p_1 = 101325
-
- # Region II
- rho1_2 = 1.225-delta
- rho2_2 = delta
- v1_2 = zero(delta)
- v2_2 = zero(delta)
- p_2 = 101325
-
- # Region III
- rho1_3 = 1.6861 - delta
- rho2_3 = delta
- v1_3 = -113.5243
- v2_3 = zero(delta)
- p_3 = 159060
-
- # Set up Region I & II:
- inicenter = SVector(zero(delta), zero(delta))
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- if (x[1] > 0.50)
- # Set up Region III
- rho1 = rho1_3
- rho2 = rho2_3
- v1 = v1_3
- v2 = v2_3
- p = p_3
- elseif (r < 0.25)
- # Set up Region I
- rho1 = rho1_1
- rho2 = rho2_1
- v1 = v1_1
- v2 = v2_1
- p = p_1
- else
- # Set up Region II
- rho1 = rho1_2
- rho2 = rho2_2
- v1 = v1_2
- v2 = v2_2
- p = p_2
- end
-
- return prim2cons(SVector(v1, v2, p, rho1, rho2), equations)
+function initial_condition_shock_bubble(x, t,
+ equations::CompressibleEulerMulticomponentEquations2D{
+ 5,
+ 2
+ })
+ # bubble test case, see Gouasmi et al. https://arxiv.org/pdf/1904.00972
+ # other reference: https://www.researchgate.net/profile/Pep_Mulet/publication/222675930_A_flux-split_algorithm_applied_to_conservative_models_for_multicomponent_compressible_flows/links/568da54508aeaa1481ae7af0.pdf
+ # typical domain is rectangular, we change it to a square, as Trixi can only do squares
+ @unpack gas_constants = equations
+
+ # Positivity Preserving Parameter, can be set to zero if scheme is positivity preserving
+ delta = 0.03
+
+ # Region I
+ rho1_1 = delta
+ rho2_1 = 1.225 * gas_constants[1] / gas_constants[2] - delta
+ v1_1 = zero(delta)
+ v2_1 = zero(delta)
+ p_1 = 101325
+
+ # Region II
+ rho1_2 = 1.225 - delta
+ rho2_2 = delta
+ v1_2 = zero(delta)
+ v2_2 = zero(delta)
+ p_2 = 101325
+
+ # Region III
+ rho1_3 = 1.6861 - delta
+ rho2_3 = delta
+ v1_3 = -113.5243
+ v2_3 = zero(delta)
+ p_3 = 159060
+
+ # Set up Region I & II:
+ inicenter = SVector(zero(delta), zero(delta))
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ if (x[1] > 0.50)
+ # Set up Region III
+ rho1 = rho1_3
+ rho2 = rho2_3
+ v1 = v1_3
+ v2 = v2_3
+ p = p_3
+ elseif (r < 0.25)
+ # Set up Region I
+ rho1 = rho1_1
+ rho2 = rho2_1
+ v1 = v1_1
+ v2 = v2_1
+ p = p_1
+ else
+ # Set up Region II
+ rho1 = rho1_2
+ rho2 = rho2_2
+ v1 = v1_2
+ v2 = v2_2
+ p = p_2
+ end
+
+ return prim2cons(SVector(v1, v2, p, rho1, rho2), equations)
end
initial_condition = initial_condition_shock_bubble
-surface_flux = flux_lax_friedrichs
-volume_flux = flux_ranocha
-basis = LobattoLegendreBasis(3)
+surface_flux = flux_lax_friedrichs
+volume_flux = flux_ranocha
+basis = LobattoLegendreBasis(3)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[(i+3 for i in eachcomponent(equations))...],
- positivity_variables_nonlinear=(),
- positivity_correction_factor=0.1,
- spec_entropy=false,
- bar_states=false)
+ positivity_variables_cons = [
+ (i + 3 for i in eachcomponent(equations))...,
+ ],
+ positivity_variables_nonlinear = (),
+ positivity_correction_factor = 0.1,
+ spec_entropy = false,
+ bar_states = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
-coordinates_min = (-2.25, -2.225)
-coordinates_max = ( 2.20, 2.225)
-mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=1_000_000)
-
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
+coordinates_min = (-2.25, -2.225)
+coordinates_max = (2.20, 2.225)
+mesh = TreeMesh(coordinates_min, coordinates_max,
+ initial_refinement_level = 3,
+ n_cells_max = 1_000_000)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
###############################################################################
# ODE solvers, callbacks etc.
-tspan = (0.0, 0.01)
-ode = semidiscretize(semi, tspan)
-
-summary_callback = SummaryCallback()
+tspan = (0.0, 0.01)
+ode = semidiscretize(semi, tspan)
-analysis_interval = 300
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(Trixi.density,))
+summary_callback = SummaryCallback()
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_interval = 300
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (Trixi.density,))
-save_solution = SaveSolutionCallback(interval=300,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+save_solution = SaveSolutionCallback(interval = 300,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-callbacks = CallbackSet(summary_callback,
- analysis_callback,
- alive_callback,
- save_solution,
- stepsize_callback)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
+callbacks = CallbackSet(summary_callback,
+ analysis_callback,
+ alive_callback,
+ save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
output_directory = "out"
stage_callbacks = (SubcellLimiterIDPCorrection(),
- BoundsCheckCallback(save_errors=true, interval=100, output_directory=output_directory))
+ BoundsCheckCallback(save_errors = true, interval = 100,
+ output_directory = output_directory))
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl b/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl
index abf9735fd28..1700957d900 100644
--- a/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl
+++ b/examples/tree_2d_dgsem/elixir_hypdiff_godunov.jl
@@ -8,51 +8,50 @@ using Trixi
equations = HyperbolicDiffusionEquations2D()
function initial_condition_poisson_periodic(x, t, equations::HyperbolicDiffusionEquations2D)
- # elliptic equation: -νΔϕ = f
- # depending on initial constant state, c, for phi this converges to the solution ϕ + c
- if iszero(t)
- phi = 0.0
- q1 = 0.0
- q2 = 0.0
- else
- phi = sin(2.0*pi*x[1])*sin(2.0*pi*x[2])
- q1 = 2*pi*cos(2.0*pi*x[1])*sin(2.0*pi*x[2])
- q2 = 2*pi*sin(2.0*pi*x[1])*cos(2.0*pi*x[2])
- end
- return SVector(phi, q1, q2)
+ # elliptic equation: -νΔϕ = f
+ # depending on initial constant state, c, for phi this converges to the solution ϕ + c
+ if iszero(t)
+ phi = 0.0
+ q1 = 0.0
+ q2 = 0.0
+ else
+ phi = sin(2.0 * pi * x[1]) * sin(2.0 * pi * x[2])
+ q1 = 2 * pi * cos(2.0 * pi * x[1]) * sin(2.0 * pi * x[2])
+ q2 = 2 * pi * sin(2.0 * pi * x[1]) * cos(2.0 * pi * x[2])
+ end
+ return SVector(phi, q1, q2)
end
initial_condition = initial_condition_poisson_periodic
-@inline function source_terms_poisson_periodic(u, x, t, equations::HyperbolicDiffusionEquations2D)
- # elliptic equation: -νΔϕ = f
- # analytical solution: phi = sin(2πx)*sin(2πy) and f = -8νπ^2 sin(2πx)*sin(2πy)
- @unpack inv_Tr = equations
- C = -8 * equations.nu * pi^2
-
- x1, x2 = x
- tmp1 = sinpi(2 * x1)
- tmp2 = sinpi(2 * x2)
- du1 = -C*tmp1*tmp2
- du2 = -inv_Tr * u[2]
- du3 = -inv_Tr * u[3]
-
- return SVector(du1, du2, du3)
+@inline function source_terms_poisson_periodic(u, x, t,
+ equations::HyperbolicDiffusionEquations2D)
+ # elliptic equation: -νΔϕ = f
+ # analytical solution: phi = sin(2πx)*sin(2πy) and f = -8νπ^2 sin(2πx)*sin(2πy)
+ @unpack inv_Tr = equations
+ C = -8 * equations.nu * pi^2
+
+ x1, x2 = x
+ tmp1 = sinpi(2 * x1)
+ tmp2 = sinpi(2 * x2)
+ du1 = -C * tmp1 * tmp2
+ du2 = -inv_Tr * u[2]
+ du3 = -inv_Tr * u[3]
+
+ return SVector(du1, du2, du3)
end
volume_flux = flux_central
-solver = DGSEM(polydeg=4, surface_flux=flux_godunov,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = flux_godunov,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_poisson_periodic)
-
+ source_terms = source_terms_poisson_periodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -63,30 +62,29 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
index c144ef47a63..e70b91906b1 100644
--- a/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
+++ b/examples/tree_2d_dgsem/elixir_hypdiff_harmonic_nonperiodic.jl
@@ -7,44 +7,43 @@ using Trixi
equations = HyperbolicDiffusionEquations2D()
-@inline function initial_condition_harmonic_nonperiodic(x, t, equations::HyperbolicDiffusionEquations2D)
- # elliptic equation: -ν Δϕ = 0 in Ω, u = g on ∂Ω
- if t == 0.0
- phi = 1.0
- q1 = 1.0
- q2 = 1.0
- else
- C = inv(sinh(pi))
- sinpi_x1, cospi_x1 = sincos(pi*x[1])
- sinpi_x2, cospi_x2 = sincos(pi*x[2])
- sinh_pix1 = sinh(pi*x[1])
- cosh_pix1 = cosh(pi*x[1])
- sinh_pix2 = sinh(pi*x[2])
- cosh_pix2 = cosh(pi*x[2])
- phi = C * (sinh_pix1 * sinpi_x2 + sinh_pix2 * sinpi_x1)
- q1 = C * pi * (cosh_pix1 * sinpi_x2 + sinh_pix2 * cospi_x1)
- q2 = C * pi * (sinh_pix1 * cospi_x2 + cosh_pix2 * sinpi_x1)
- end
- return SVector(phi, q1, q2)
+@inline function initial_condition_harmonic_nonperiodic(x, t,
+ equations::HyperbolicDiffusionEquations2D)
+ # elliptic equation: -ν Δϕ = 0 in Ω, u = g on ∂Ω
+ if t == 0.0
+ phi = 1.0
+ q1 = 1.0
+ q2 = 1.0
+ else
+ C = inv(sinh(pi))
+ sinpi_x1, cospi_x1 = sincos(pi * x[1])
+ sinpi_x2, cospi_x2 = sincos(pi * x[2])
+ sinh_pix1 = sinh(pi * x[1])
+ cosh_pix1 = cosh(pi * x[1])
+ sinh_pix2 = sinh(pi * x[2])
+ cosh_pix2 = cosh(pi * x[2])
+ phi = C * (sinh_pix1 * sinpi_x2 + sinh_pix2 * sinpi_x1)
+ q1 = C * pi * (cosh_pix1 * sinpi_x2 + sinh_pix2 * cospi_x1)
+ q2 = C * pi * (sinh_pix1 * cospi_x2 + cosh_pix2 * sinpi_x1)
+ end
+ return SVector(phi, q1, q2)
end
initial_condition = initial_condition_harmonic_nonperiodic
boundary_conditions = BoundaryConditionDirichlet(initial_condition)
-solver = DGSEM(polydeg=4, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 4, surface_flux = flux_godunov)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000,
- periodicity=false)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions,
- source_terms=source_terms_harmonic)
-
+ boundary_conditions = boundary_conditions,
+ source_terms = source_terms_harmonic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -55,30 +54,29 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl b/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl
index d0d706981a2..a1a0397a46c 100644
--- a/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl
+++ b/examples/tree_2d_dgsem/elixir_hypdiff_lax_friedrichs.jl
@@ -8,49 +8,48 @@ using Trixi
equations = HyperbolicDiffusionEquations2D()
function initial_condition_poisson_periodic(x, t, equations::HyperbolicDiffusionEquations2D)
- # elliptic equation: -νΔϕ = f
- # depending on initial constant state, c, for phi this converges to the solution ϕ + c
- if iszero(t)
- phi = 0.0
- q1 = 0.0
- q2 = 0.0
- else
- phi = sin(2.0*pi*x[1])*sin(2.0*pi*x[2])
- q1 = 2*pi*cos(2.0*pi*x[1])*sin(2.0*pi*x[2])
- q2 = 2*pi*sin(2.0*pi*x[1])*cos(2.0*pi*x[2])
- end
- return SVector(phi, q1, q2)
+ # elliptic equation: -νΔϕ = f
+ # depending on initial constant state, c, for phi this converges to the solution ϕ + c
+ if iszero(t)
+ phi = 0.0
+ q1 = 0.0
+ q2 = 0.0
+ else
+ phi = sin(2.0 * pi * x[1]) * sin(2.0 * pi * x[2])
+ q1 = 2 * pi * cos(2.0 * pi * x[1]) * sin(2.0 * pi * x[2])
+ q2 = 2 * pi * sin(2.0 * pi * x[1]) * cos(2.0 * pi * x[2])
+ end
+ return SVector(phi, q1, q2)
end
initial_condition = initial_condition_poisson_periodic
-@inline function source_terms_poisson_periodic(u, x, t, equations::HyperbolicDiffusionEquations2D)
- # elliptic equation: -νΔϕ = f
- # analytical solution: phi = sin(2πx)*sin(2πy) and f = -8νπ^2 sin(2πx)*sin(2πy)
- @unpack inv_Tr = equations
- C = -8 * equations.nu * pi^2
-
- x1, x2 = x
- tmp1 = sinpi(2 * x1)
- tmp2 = sinpi(2 * x2)
- du1 = -C*tmp1*tmp2
- du2 = -inv_Tr * u[2]
- du3 = -inv_Tr * u[3]
-
- return SVector(du1, du2, du3)
+@inline function source_terms_poisson_periodic(u, x, t,
+ equations::HyperbolicDiffusionEquations2D)
+ # elliptic equation: -νΔϕ = f
+ # analytical solution: phi = sin(2πx)*sin(2πy) and f = -8νπ^2 sin(2πx)*sin(2πy)
+ @unpack inv_Tr = equations
+ C = -8 * equations.nu * pi^2
+
+ x1, x2 = x
+ tmp1 = sinpi(2 * x1)
+ tmp2 = sinpi(2 * x2)
+ du1 = -C * tmp1 * tmp2
+ du2 = -inv_Tr * u[2]
+ du3 = -inv_Tr * u[3]
+
+ return SVector(du1, du2, du3)
end
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_poisson_periodic)
-
+ source_terms = source_terms_poisson_periodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -61,31 +60,30 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
sol = Trixi.solve(ode, Trixi.HypDiffN3Erk3Sstar52(),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl
index fc825660f1e..1396481a3f1 100644
--- a/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl
+++ b/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl
@@ -9,25 +9,23 @@ equations = HyperbolicDiffusionEquations2D()
initial_condition = initial_condition_poisson_nonperiodic
# 1 => -x, 2 => +x, 3 => -y, 4 => +y as usual for orientations
-boundary_conditions = (x_neg=boundary_condition_poisson_nonperiodic,
- x_pos=boundary_condition_poisson_nonperiodic,
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic)
+boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic,
+ x_pos = boundary_condition_poisson_nonperiodic,
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic)
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000,
- periodicity=(false, true))
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000,
+ periodicity = (false, true))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions,
- source_terms=source_terms_poisson_nonperiodic)
-
+ boundary_conditions = boundary_conditions,
+ source_terms = source_terms_poisson_nonperiodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -38,30 +36,29 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_kpp.jl b/examples/tree_2d_dgsem/elixir_kpp.jl
index f3cbc1cb664..b48bde0d155 100644
--- a/examples/tree_2d_dgsem/elixir_kpp.jl
+++ b/examples/tree_2d_dgsem/elixir_kpp.jl
@@ -25,22 +25,25 @@ end
@inline function Trixi.flux_ec(u_ll, u_rr, orientation::Integer, ::KPPEquation2D)
# The tolerance of 1e-12 is based on experience and somewhat arbitrarily chosen
if abs(u_ll[1] - u_rr[1]) < 1e-12
- return 0.5 * (flux(u_ll, orientation, KPPEquation2D()) + flux(u_rr, orientation, KPPEquation2D()))
+ return 0.5 * (flux(u_ll, orientation, KPPEquation2D()) +
+ flux(u_rr, orientation, KPPEquation2D()))
else
factor = 1.0 / (u_rr[1] - u_ll[1])
if orientation == 1
- return SVector(factor*(-cos(u_rr[1]) + cos(u_ll[1])))
+ return SVector(factor * (-cos(u_rr[1]) + cos(u_ll[1])))
else
- return SVector(factor*(sin(u_rr[1]) - sin(u_ll[1])))
+ return SVector(factor * (sin(u_rr[1]) - sin(u_ll[1])))
end
end
end
# Wavespeeds
@inline wavespeed(::KPPEquation2D) = 1.0
-@inline Trixi.max_abs_speeds(u, equation::KPPEquation2D) = (wavespeed(equation), wavespeed(equation))
+@inline Trixi.max_abs_speeds(u, equation::KPPEquation2D) = (wavespeed(equation),
+ wavespeed(equation))
@inline Trixi.max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equation::KPPEquation2D) = wavespeed(equation)
-@inline Trixi.max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equation::KPPEquation2D) = wavespeed(equation) * norm(normal_direction)
+@inline Trixi.max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equation::KPPEquation2D) = wavespeed(equation) *
+ norm(normal_direction)
# Compute entropy: we use the square entropy
@inline Trixi.entropy(u::Real, ::KPPEquation2D) = 0.5 * u^2
@@ -74,24 +77,25 @@ volume_flux = flux_ec
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
shock_indicator = IndicatorHennemannGassner(equation, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=first)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = first)
volume_integral = VolumeIntegralShockCapturingHG(shock_indicator;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
###############################################################################
# Set up the tree mesh (initially a Cartesian grid of [-2,2]^2)
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=6,
- periodicity=true,
- n_cells_max=500_000)
+ initial_refinement_level = 6,
+ periodicity = true,
+ n_cells_max = 500_000)
###############################################################################
# Create the semi discretization object
@@ -100,23 +104,24 @@ semi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_kpp, solve
###############################################################################
# Set up adaptive mesh refinement
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0001,
- alpha_smooth=false,
- variable=first)
+ alpha_max = 1.0,
+ alpha_min = 0.0001,
+ alpha_smooth = false,
+ variable = first)
max_refinement_level = 8
amr_controller = ControllerThreeLevelCombined(semi, amr_indicator, shock_indicator,
- base_level=2,
- med_level=0, med_threshold=0.0003,
- max_level=max_refinement_level, max_threshold=0.003,
- max_threshold_secondary=shock_indicator.alpha_max)
+ base_level = 2,
+ med_level = 0, med_threshold = 0.0003,
+ max_level = max_refinement_level,
+ max_threshold = 0.003,
+ max_threshold_secondary = shock_indicator.alpha_max)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
###############################################################################
# ODE solvers, callbacks etc.
@@ -125,14 +130,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-analysis_callback = AnalysisCallback(semi, interval=200)
+analysis_callback = AnalysisCallback(semi, interval = 200)
-alive_callback = AliveCallback(analysis_interval=200)
+alive_callback = AliveCallback(analysis_interval = 200)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2cons)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2cons)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -140,6 +145,6 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); ode_default_options()..., callback = callbacks)
summary_callback() # Print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_lbm_constant.jl b/examples/tree_2d_dgsem/elixir_lbm_constant.jl
index 40b16f41ef6..5a4f3074e4e 100644
--- a/examples/tree_2d_dgsem/elixir_lbm_constant.jl
+++ b/examples/tree_2d_dgsem/elixir_lbm_constant.jl
@@ -5,22 +5,20 @@ using Trixi
###############################################################################
# semidiscretization of the Lattice-Boltzmann equations for the D2Q9 scheme
-equations = LatticeBoltzmannEquations2D(Ma=0.1, Re=Inf)
+equations = LatticeBoltzmannEquations2D(Ma = 0.1, Re = Inf)
initial_condition = initial_condition_constant
-solver = DGSEM(polydeg=3, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 3, surface_flux = flux_godunov)
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,19 +28,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2macroscopic)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2macroscopic)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
collision_callback = LBMCollisionCallback()
@@ -52,11 +50,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
collision_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_lbm_couette.jl b/examples/tree_2d_dgsem/elixir_lbm_couette.jl
index 6a33b2fb0ee..1ba040405d1 100644
--- a/examples/tree_2d_dgsem/elixir_lbm_couette.jl
+++ b/examples/tree_2d_dgsem/elixir_lbm_couette.jl
@@ -5,7 +5,7 @@ using Trixi
###############################################################################
# semidiscretization of the Lattice-Boltzmann equations for the D2Q9 scheme
-equations = LatticeBoltzmannEquations2D(Ma=0.05, Re=2000)
+equations = LatticeBoltzmannEquations2D(Ma = 0.05, Re = 2000)
"""
initial_condition_couette_unsteady(x, t, equations::LatticeBoltzmannEquations2D)
@@ -16,19 +16,20 @@ incompressible Navier-Stokes equations. To be used in combination with
this setup will converge to the state set in [`initial_condition_couette_steady`](@ref).
"""
function initial_condition_couette_unsteady(x, t, equations::LatticeBoltzmannEquations2D)
- @unpack L, u0, rho0, nu = equations
+ @unpack L, u0, rho0, nu = equations
- x1, x2 = x
- v1 = u0*x2/L
- for m in 1:100
- lambda_m = m * pi / L
- v1 += 2 * u0 * (-1)^m/(lambda_m * L) * exp(-nu * lambda_m^2 * t) * sin(lambda_m * x2)
- end
+ x1, x2 = x
+ v1 = u0 * x2 / L
+ for m in 1:100
+ lambda_m = m * pi / L
+ v1 += 2 * u0 * (-1)^m / (lambda_m * L) * exp(-nu * lambda_m^2 * t) *
+ sin(lambda_m * x2)
+ end
- rho = 1
- v2 = 0
+ rho = 1
+ v2 = 0
- return equilibrium_distribution(rho, v1, v2, equations)
+ return equilibrium_distribution(rho, v1, v2, equations)
end
initial_condition = initial_condition_couette_unsteady
@@ -44,53 +45,49 @@ Moving *upper* wall boundary condition for a Couette flow setup. To be used in c
function boundary_condition_couette(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::LatticeBoltzmannEquations2D)
- return boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, t,
- surface_flux_function, equations)
+ return boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, t,
+ surface_flux_function, equations)
end
function boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::LatticeBoltzmannEquations2D)
- @assert direction == 4 "moving wall assumed in +y direction"
+ @assert direction==4 "moving wall assumed in +y direction"
- @unpack rho0, u0, weights, c_s = equations
- cs_squared = c_s^2
+ @unpack rho0, u0, weights, c_s = equations
+ cs_squared = c_s^2
- pdf1 = u_inner[3] + 2 * weights[1] * rho0 * u0 / cs_squared
- pdf2 = u_inner[2] # outgoing
- pdf3 = u_inner[1] + 2 * weights[3] * rho0 * (-u0) / cs_squared
- pdf4 = u_inner[2]
- pdf5 = u_inner[5] # outgoing
- pdf6 = u_inner[6] # outgoing
- pdf7 = u_inner[5] + 2 * weights[7] * rho0 * (-u0) / cs_squared
- pdf8 = u_inner[6] + 2 * weights[8] * rho0 * u0 / cs_squared
- pdf9 = u_inner[9]
+ pdf1 = u_inner[3] + 2 * weights[1] * rho0 * u0 / cs_squared
+ pdf2 = u_inner[2] # outgoing
+ pdf3 = u_inner[1] + 2 * weights[3] * rho0 * (-u0) / cs_squared
+ pdf4 = u_inner[2]
+ pdf5 = u_inner[5] # outgoing
+ pdf6 = u_inner[6] # outgoing
+ pdf7 = u_inner[5] + 2 * weights[7] * rho0 * (-u0) / cs_squared
+ pdf8 = u_inner[6] + 2 * weights[8] * rho0 * u0 / cs_squared
+ pdf9 = u_inner[9]
- u_boundary = SVector(pdf1, pdf2, pdf3, pdf4, pdf5, pdf6, pdf7, pdf8, pdf9)
+ u_boundary = SVector(pdf1, pdf2, pdf3, pdf4, pdf5, pdf6, pdf7, pdf8, pdf9)
- # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary)
- return surface_flux_function(u_inner, u_boundary, orientation, equations)
+ # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary)
+ return surface_flux_function(u_inner, u_boundary, orientation, equations)
end
-boundary_conditions = (
- x_neg=boundary_condition_periodic,
- x_pos=boundary_condition_periodic,
- y_neg=boundary_condition_noslip_wall,
- y_pos=boundary_condition_couette,
- )
+boundary_conditions = (x_neg = boundary_condition_periodic,
+ x_pos = boundary_condition_periodic,
+ y_neg = boundary_condition_noslip_wall,
+ y_pos = boundary_condition_couette)
-solver = DGSEM(polydeg=3, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 3, surface_flux = flux_godunov)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- periodicity=(true, false),
- n_cells_max=10_000,)
-
+ initial_refinement_level = 3,
+ periodicity = (true, false),
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -101,26 +98,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Custom solution variables: normalize velocities by reference speed `u0`
@inline function macroscopic_normalized(u, equations::LatticeBoltzmannEquations2D)
- macroscopic = cons2macroscopic(u, equations)
- rho, v1, v2, p = macroscopic
+ macroscopic = cons2macroscopic(u, equations)
+ rho, v1, v2, p = macroscopic
- # Use `typeof(macroscopic)` to avoid having to explicitly add `using StaticArrays`
- convert(typeof(macroscopic), (rho, v1/equations.u0, v2/equations.u0, p))
+ # Use `typeof(macroscopic)` to avoid having to explicitly add `using StaticArrays`
+ convert(typeof(macroscopic), (rho, v1 / equations.u0, v2 / equations.u0, p))
+end
+function Trixi.varnames(::typeof(macroscopic_normalized),
+ equations::LatticeBoltzmannEquations2D)
+ ("rho", "v1_normalized", "v2_normalized", "p")
end
-Trixi.varnames(::typeof(macroscopic_normalized), equations::LatticeBoltzmannEquations2D) = ("rho", "v1_normalized", "v2_normalized", "p")
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=macroscopic_normalized)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = macroscopic_normalized)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
collision_callback = LBMCollisionCallback()
@@ -130,11 +130,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
collision_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl b/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl
index a34e784e7ac..d00926cafad 100644
--- a/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl
+++ b/examples/tree_2d_dgsem/elixir_lbm_lid_driven_cavity.jl
@@ -5,7 +5,7 @@ using Trixi
###############################################################################
# semidiscretization of the Lattice-Boltzmann equations for the D2Q9 scheme
-equations = LatticeBoltzmannEquations2D(Ma=0.1, Re=1000)
+equations = LatticeBoltzmannEquations2D(Ma = 0.1, Re = 1000)
"""
initial_condition_lid_driven_cavity(x, t, equations::LatticeBoltzmannEquations2D)
@@ -14,13 +14,13 @@ Initial state for a lid-driven cavity flow setup. To be used in combination with
[`boundary_condition_lid_driven_cavity`](@ref) and [`boundary_condition_noslip_wall`](@ref).
"""
function initial_condition_lid_driven_cavity(x, t, equations::LatticeBoltzmannEquations2D)
- @unpack L, u0, nu = equations
+ @unpack L, u0, nu = equations
- rho = 1
- v1 = 0
- v2 = 0
+ rho = 1
+ v1 = 0
+ v2 = 0
- return equilibrium_distribution(rho, v1, v2, equations)
+ return equilibrium_distribution(rho, v1, v2, equations)
end
initial_condition = initial_condition_lid_driven_cavity
@@ -35,53 +35,49 @@ no-slip wall. To be used in combination with [`initial_condition_lid_driven_cavi
function boundary_condition_lid_driven_cavity(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::LatticeBoltzmannEquations2D)
- return boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, t,
- surface_flux_function, equations)
+ return boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, t,
+ surface_flux_function, equations)
end
function boundary_condition_moving_wall_ypos(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::LatticeBoltzmannEquations2D)
- @assert direction == 4 "moving wall assumed in +y direction"
+ @assert direction==4 "moving wall assumed in +y direction"
- @unpack rho0, u0, weights, c_s = equations
- cs_squared = c_s^2
+ @unpack rho0, u0, weights, c_s = equations
+ cs_squared = c_s^2
- pdf1 = u_inner[3] + 2 * weights[1] * rho0 * u0 / cs_squared
- pdf2 = u_inner[2] # outgoing
- pdf3 = u_inner[1] + 2 * weights[3] * rho0 * (-u0) / cs_squared
- pdf4 = u_inner[2]
- pdf5 = u_inner[5] # outgoing
- pdf6 = u_inner[6] # outgoing
- pdf7 = u_inner[5] + 2 * weights[7] * rho0 * (-u0) / cs_squared
- pdf8 = u_inner[6] + 2 * weights[8] * rho0 * u0 / cs_squared
- pdf9 = u_inner[9]
+ pdf1 = u_inner[3] + 2 * weights[1] * rho0 * u0 / cs_squared
+ pdf2 = u_inner[2] # outgoing
+ pdf3 = u_inner[1] + 2 * weights[3] * rho0 * (-u0) / cs_squared
+ pdf4 = u_inner[2]
+ pdf5 = u_inner[5] # outgoing
+ pdf6 = u_inner[6] # outgoing
+ pdf7 = u_inner[5] + 2 * weights[7] * rho0 * (-u0) / cs_squared
+ pdf8 = u_inner[6] + 2 * weights[8] * rho0 * u0 / cs_squared
+ pdf9 = u_inner[9]
- u_boundary = SVector(pdf1, pdf2, pdf3, pdf4, pdf5, pdf6, pdf7, pdf8, pdf9)
+ u_boundary = SVector(pdf1, pdf2, pdf3, pdf4, pdf5, pdf6, pdf7, pdf8, pdf9)
- # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary)
- return surface_flux_function(u_inner, u_boundary, orientation, equations)
+ # Calculate boundary flux (u_inner is "left" of boundary, u_boundary is "right" of boundary)
+ return surface_flux_function(u_inner, u_boundary, orientation, equations)
end
-boundary_conditions = (
- x_neg=boundary_condition_noslip_wall,
- x_pos=boundary_condition_noslip_wall,
- y_neg=boundary_condition_noslip_wall,
- y_pos=boundary_condition_lid_driven_cavity,
- )
+boundary_conditions = (x_neg = boundary_condition_noslip_wall,
+ x_pos = boundary_condition_noslip_wall,
+ y_neg = boundary_condition_noslip_wall,
+ y_pos = boundary_condition_lid_driven_cavity)
-solver = DGSEM(polydeg=5, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 5, surface_flux = flux_godunov)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- periodicity=false,
- n_cells_max=10_000,)
-
+ initial_refinement_level = 4,
+ periodicity = false,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -92,16 +88,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2macroscopic)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2macroscopic)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
collision_callback = LBMCollisionCallback()
@@ -111,11 +107,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
collision_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl b/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl
index 14459fa4cb8..93272833b74 100644
--- a/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl
+++ b/examples/tree_2d_dgsem/elixir_linearizedeuler_convergence.jl
@@ -4,25 +4,25 @@ using Trixi
###############################################################################
# semidiscretization of the linearized Euler equations
-equations = LinearizedEulerEquations2D(v_mean_global=(0.0, 0.0), c_mean_global=1.0, rho_mean_global=1.0)
+equations = LinearizedEulerEquations2D(v_mean_global = (0.0, 0.0), c_mean_global = 1.0,
+ rho_mean_global = 1.0)
initial_condition = initial_condition_convergence_test
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -37,28 +37,29 @@ summary_callback = SummaryCallback()
analysis_interval = 100
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=analysis_interval, solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = analysis_interval,
+ solution_variables = cons2prim)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.8)
+stepsize_callback = StepsizeCallback(cfl = 0.8)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, alive_callback, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, alive_callback,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# print the timer summary
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl
index 14fe201a291..fad03fab6ef 100644
--- a/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl
+++ b/examples/tree_2d_dgsem/elixir_linearizedeuler_gauss_wall.jl
@@ -5,33 +5,32 @@ using Trixi
###############################################################################
# semidiscretization of the linearized Euler equations
-equations = LinearizedEulerEquations2D(v_mean_global=(0.5, 0.0), c_mean_global=1.0,
- rho_mean_global=1.0)
+equations = LinearizedEulerEquations2D(v_mean_global = (0.5, 0.0), c_mean_global = 1.0,
+ rho_mean_global = 1.0)
# Create DG solver with polynomial degree = 5 and upwind flux as surface flux
-solver = DGSEM(polydeg=5, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 5, surface_flux = flux_godunov)
coordinates_min = (-100.0, 0.0) # minimum coordinates (min(x), min(y))
coordinates_max = (100.0, 200.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=100_000,
- periodicity=false)
+ initial_refinement_level = 4,
+ n_cells_max = 100_000,
+ periodicity = false)
function initial_condition_gauss_wall(x, t, equations::LinearizedEulerEquations2D)
- v1_prime = 0.0
- v2_prime = 0.0
- rho_prime = p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25)
- return SVector(rho_prime, v1_prime, v2_prime, p_prime)
+ v1_prime = 0.0
+ v2_prime = 0.0
+ rho_prime = p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25)
+ return SVector(rho_prime, v1_prime, v2_prime, p_prime)
end
initial_condition = initial_condition_gauss_wall
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition_wall)
-
+ boundary_conditions = boundary_condition_wall)
###############################################################################
# ODE solvers, callbacks etc.
@@ -45,24 +44,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100)
+save_solution = SaveSolutionCallback(interval = 100)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=0.7)
+stepsize_callback = StepsizeCallback(cfl = 0.7)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks)
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl
index d9e59160e7d..377a07e947e 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl
@@ -4,25 +4,24 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_central, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,22 +31,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.5
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -56,11 +58,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl
index 11dfeacde6a..229360f266e 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl
@@ -4,25 +4,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
-refinement_patches = (
- (type="box", coordinates_min=0.25 .* coordinates_max,
- coordinates_max=0.75 .* coordinates_max),
-)
+refinement_patches = ((type = "box", coordinates_min = 0.25 .* coordinates_max,
+ coordinates_max = 0.75 .* coordinates_max),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- refinement_patches=refinement_patches,
- n_cells_max=10_000,)
+ initial_refinement_level = 4,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -35,22 +33,25 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -62,7 +63,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl
index af05fffaf54..a0909ca7580 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_blast_wave.jl
@@ -16,52 +16,50 @@ An MHD blast wave taken from
[doi: 10.1365/s13291-018-0178-9](https://doi.org/10.1365/s13291-018-0178-9)
"""
function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D)
- # setup taken from Derigs et al. DMV article (2018)
- # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4
- r = sqrt(x[1]^2 + x[2]^2)
- f = (0.1 - r)/0.01
- if r <= 0.09
- p = 1000.0
- elseif r >= 0.1
- p = 0.1
- else
- p = 0.1 + 999.9*f
- end
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- B1 = 100.0/sqrt(4.0*pi)
- B2 = 0.0
- B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
+ # setup taken from Derigs et al. DMV article (2018)
+ # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4
+ r = sqrt(x[1]^2 + x[2]^2)
+ f = (0.1 - r) / 0.01
+ if r <= 0.09
+ p = 1000.0
+ elseif r >= 0.1
+ p = 0.1
+ else
+ p = 0.1 + 999.9 * f
+ end
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ B1 = 100.0 / sqrt(4.0 * pi)
+ B2 = 0.0
+ B3 = 0.0
+ psi = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_central, flux_nonconservative_powell)
+volume_flux = (flux_central, flux_nonconservative_powell)
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-0.5, -0.5)
-coordinates_max = ( 0.5, 0.5)
+coordinates_max = (0.5, 0.5)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -71,32 +69,32 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=7,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 7,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
cfl = 0.8
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -109,7 +107,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhd_ec.jl b/examples/tree_2d_dgsem/elixir_mhd_ec.jl
index 5873388f798..173d3ed448f 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_ec.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_ec.jl
@@ -10,19 +10,18 @@ equations = IdealGlmMhdEquations2D(1.4)
initial_condition = initial_condition_weak_blast_wave
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hindenlang_gassner, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,19 +31,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -53,11 +52,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl b/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl
index 460b24e02b2..7f26f270d6e 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_orszag_tang.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
"""
@@ -16,44 +16,42 @@ The classical Orszag-Tang vortex test case. Here, the setup is taken from
[doi: 10.1365/s13291-018-0178-9](https://doi.org/10.1365/s13291-018-0178-9)
"""
function initial_condition_orszag_tang(x, t, equations::IdealGlmMhdEquations2D)
- # setup taken from Derigs et al. DMV article (2018)
- # domain must be [0, 1] x [0, 1], γ = 5/3
- rho = 1.0
- v1 = -sin(2.0*pi*x[2])
- v2 = sin(2.0*pi*x[1])
- v3 = 0.0
- p = 1.0 / equations.gamma
- B1 = -sin(2.0*pi*x[2]) / equations.gamma
- B2 = sin(4.0*pi*x[1]) / equations.gamma
- B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
+ # setup taken from Derigs et al. DMV article (2018)
+ # domain must be [0, 1] x [0, 1], γ = 5/3
+ rho = 1.0
+ v1 = -sin(2.0 * pi * x[2])
+ v2 = sin(2.0 * pi * x[1])
+ v3 = 0.0
+ p = 1.0 / equations.gamma
+ B1 = -sin(2.0 * pi * x[2]) / equations.gamma
+ B2 = sin(4.0 * pi * x[1]) / equations.gamma
+ B3 = 0.0
+ psi = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end
initial_condition = initial_condition_orszag_tang
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_central, flux_nonconservative_powell)
+volume_flux = (flux_central, flux_nonconservative_powell)
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -63,32 +61,32 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=6,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 6,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
cfl = 1.25
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -101,7 +99,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl
index c6d880e9e9d..3109b1ce303 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_rotor.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_rotor.jl
@@ -2,7 +2,6 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
equations = IdealGlmMhdEquations2D(1.4)
@@ -16,59 +15,57 @@ The classical MHD rotor test case. Here, the setup is taken from
[doi: 10.1365/s13291-018-0178-9](https://doi.org/10.1365/s13291-018-0178-9)
"""
function initial_condition_rotor(x, t, equations::IdealGlmMhdEquations2D)
- # setup taken from Derigs et al. DMV article (2018)
- # domain must be [0, 1] x [0, 1], γ = 1.4
- dx = x[1] - 0.5
- dy = x[2] - 0.5
- r = sqrt(dx^2 + dy^2)
- f = (0.115 - r)/0.015
- if r <= 0.1
- rho = 10.0
- v1 = -20.0*dy
- v2 = 20.0*dx
- elseif r >= 0.115
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- else
- rho = 1.0 + 9.0*f
- v1 = -20.0*f*dy
- v2 = 20.0*f*dx
- end
- v3 = 0.0
- p = 1.0
- B1 = 5.0/sqrt(4.0*pi)
- B2 = 0.0
- B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
+ # setup taken from Derigs et al. DMV article (2018)
+ # domain must be [0, 1] x [0, 1], γ = 1.4
+ dx = x[1] - 0.5
+ dy = x[2] - 0.5
+ r = sqrt(dx^2 + dy^2)
+ f = (0.115 - r) / 0.015
+ if r <= 0.1
+ rho = 10.0
+ v1 = -20.0 * dy
+ v2 = 20.0 * dx
+ elseif r >= 0.115
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ else
+ rho = 1.0 + 9.0 * f
+ v1 = -20.0 * f * dy
+ v2 = 20.0 * f * dx
+ end
+ v3 = 0.0
+ p = 1.0
+ B1 = 5.0 / sqrt(4.0 * pi)
+ B2 = 0.0
+ B3 = 0.0
+ psi = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end
initial_condition = initial_condition_rotor
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -78,32 +75,32 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=6,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 6,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
cfl = 0.35
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -116,7 +113,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl
index 2e6429ad9b0..84361ef4f87 100644
--- a/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl
+++ b/examples/tree_2d_dgsem/elixir_mhd_shockcapturing_subcell.jl
@@ -17,59 +17,57 @@ An MHD blast wave modified from:
This setup needs a positivity limiter for the density.
"""
function initial_condition_blast_wave(x, t, equations::IdealGlmMhdEquations2D)
- # setup taken from Derigs et al. DMV article (2018)
- # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4
- r = sqrt(x[1]^2 + x[2]^2)
-
- pmax = 10.0
- pmin = 0.01
- rhomax = 1.0
- rhomin = 0.01
- if r <= 0.09
- p = pmax
- rho = rhomax
- elseif r >= 0.1
- p = pmin
- rho = rhomin
- else
- p = pmin + (0.1 - r) * (pmax - pmin) / 0.01
- rho = rhomin + (0.1 - r) * (rhomax - rhomin) / 0.01
- end
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- B1 = 1.0/sqrt(4.0*pi)
- B2 = 0.0
- B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
+ # setup taken from Derigs et al. DMV article (2018)
+ # domain must be [-0.5, 0.5] x [-0.5, 0.5], γ = 1.4
+ r = sqrt(x[1]^2 + x[2]^2)
+
+ pmax = 10.0
+ pmin = 0.01
+ rhomax = 1.0
+ rhomin = 0.01
+ if r <= 0.09
+ p = pmax
+ rho = rhomax
+ elseif r >= 0.1
+ p = pmin
+ rho = rhomin
+ else
+ p = pmin + (0.1 - r) * (pmax - pmin) / 0.01
+ rho = rhomin + (0.1 - r) * (rhomax - rhomin) / 0.01
+ end
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ B1 = 1.0 / sqrt(4.0 * pi)
+ B2 = 0.0
+ B3 = 0.0
+ psi = 0.0
+ return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end
initial_condition = initial_condition_blast_wave
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell_local_symmetric)
-volume_flux = (flux_derigs_etal, flux_nonconservative_powell_local_symmetric)
+volume_flux = (flux_derigs_etal, flux_nonconservative_powell_local_symmetric)
basis = LobattoLegendreBasis(3)
limiter_idp = SubcellLimiterIDP(equations, basis;
- positivity_variables_cons=[1],
- positivity_variables_nonlinear=[pressure],
- positivity_correction_factor=0.1,
- bar_states=false)
+ positivity_variables_cons = [1],
+ positivity_variables_nonlinear = [pressure],
+ positivity_correction_factor = 0.1,
+ bar_states = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-0.5, -0.5)
-coordinates_max = ( 0.5, 0.5)
+coordinates_max = (0.5, 0.5)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -79,19 +77,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 0.4
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -104,7 +102,7 @@ callbacks = CallbackSet(summary_callback,
# run the simulation
stage_callbacks = (SubcellLimiterIDPCorrection(), BoundsCheckCallback())
-sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks);
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks = stage_callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl
index a7551f48937..4f1f8c5f2b7 100644
--- a/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl
+++ b/examples/tree_2d_dgsem/elixir_mhdmulti_convergence.jl
@@ -5,25 +5,24 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdMulticomponentEquations2D(gammas = (5/3, 5/3, 5/3),
- gas_constants = (2.08, 2.08, 2.08))
+equations = IdealGlmMhdMulticomponentEquations2D(gammas = (5 / 3, 5 / 3, 5 / 3),
+ gas_constants = (2.08, 2.08, 2.08))
initial_condition = initial_condition_convergence_test
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2), sqrt(2))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,19 +32,20 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -54,11 +54,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl
index ec2f3c21cdd..a7db9eeee96 100644
--- a/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl
+++ b/examples/tree_2d_dgsem/elixir_mhdmulti_ec.jl
@@ -5,25 +5,24 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdMulticomponentEquations2D(gammas = (1.4, 1.4),
- gas_constants = (1.0, 1.0))
+equations = IdealGlmMhdMulticomponentEquations2D(gammas = (1.4, 1.4),
+ gas_constants = (1.0, 1.0))
initial_condition = initial_condition_weak_blast_wave
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hindenlang_gassner, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,19 +32,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -54,11 +53,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl
index 3cd9c621ae3..fcaabdc7a58 100644
--- a/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl
+++ b/examples/tree_2d_dgsem/elixir_mhdmulti_es.jl
@@ -5,25 +5,24 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdMulticomponentEquations2D(gammas = (5/3, 5/3),
- gas_constants = (0.2, 0.2))
+equations = IdealGlmMhdMulticomponentEquations2D(gammas = (5 / 3, 5 / 3),
+ gas_constants = (0.2, 0.2))
initial_condition = initial_condition_weak_blast_wave
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
-coordinates_max = ( 2.0, 2.0)
+coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -33,19 +32,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -54,11 +53,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl
index 55a4004f794..5ca21cc5e9c 100644
--- a/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl
+++ b/examples/tree_2d_dgsem/elixir_mhdmulti_rotor.jl
@@ -2,10 +2,9 @@
using OrdinaryDiffEq
using Trixi
-
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdMulticomponentEquations2D(gammas = (1.4, 1.4),
+equations = IdealGlmMhdMulticomponentEquations2D(gammas = (1.4, 1.4),
gas_constants = (1.0, 1.0))
"""
@@ -14,62 +13,60 @@ equations = IdealGlmMhdMulticomponentEquations2D(gammas = (1.4, 1.4),
The classical MHD rotor test case adapted to two density components.
"""
function initial_condition_rotor(x, t, equations::IdealGlmMhdMulticomponentEquations2D)
- # setup taken from Derigs et al. DMV article (2018)
- # domain must be [0, 1] x [0, 1], γ = 1.4
- dx = x[1] - 0.5
- dy = x[2] - 0.5
- r = sqrt(dx^2 + dy^2)
- f = (0.115 - r)/0.015
- if r <= 0.1
- rho1 = 10.0
- rho2 = 5.0
- v1 = -20.0*dy
- v2 = 20.0*dx
- elseif r >= 0.115
- rho1 = 1.0
- rho2 = 0.5
- v1 = 0.0
- v2 = 0.0
- else
- rho1 = 1.0 + 9.0*f
- rho2 = 0.5 + 4.5*f
- v1 = -20.0*f*dy
- v2 = 20.0*f*dx
- end
- v3 = 0.0
- p = 1.0
- B1 = 5.0/sqrt(4.0*pi)
- B2 = 0.0
- B3 = 0.0
- psi = 0.0
- return prim2cons(SVector(v1, v2, v3, p, B1, B2, B3, psi, rho1, rho2), equations)
+ # setup taken from Derigs et al. DMV article (2018)
+ # domain must be [0, 1] x [0, 1], γ = 1.4
+ dx = x[1] - 0.5
+ dy = x[2] - 0.5
+ r = sqrt(dx^2 + dy^2)
+ f = (0.115 - r) / 0.015
+ if r <= 0.1
+ rho1 = 10.0
+ rho2 = 5.0
+ v1 = -20.0 * dy
+ v2 = 20.0 * dx
+ elseif r >= 0.115
+ rho1 = 1.0
+ rho2 = 0.5
+ v1 = 0.0
+ v2 = 0.0
+ else
+ rho1 = 1.0 + 9.0 * f
+ rho2 = 0.5 + 4.5 * f
+ v1 = -20.0 * f * dy
+ v2 = 20.0 * f * dx
+ end
+ v3 = 0.0
+ p = 1.0
+ B1 = 5.0 / sqrt(4.0 * pi)
+ B2 = 0.0
+ B3 = 0.0
+ psi = 0.0
+ return prim2cons(SVector(v1, v2, v3, p, B1, B2, B3, psi, rho1, rho2), equations)
end
initial_condition = initial_condition_rotor
surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.8,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.8,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -79,32 +76,32 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=4,
- max_level =6, max_threshold=0.01)
+ base_level = 4,
+ max_level = 6, max_threshold = 0.01)
amr_callback = AMRCallback(semi, amr_controller,
- interval=6,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 6,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -117,7 +114,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl b/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl
index b68e9e6c97e..57558224854 100644
--- a/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl
+++ b/examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl
@@ -8,163 +8,170 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- periodicity=(true, false),
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 4,
+ periodicity = (true, false),
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion2D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion2D`)
# and by the initial condition (which passes in `CompressibleEulerEquations2D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Amplitude and shift
- A = 0.5
- c = 2.0
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0)) ) * cos(pi_t)
- v2 = v1
- p = rho^2
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ v1 = sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A * (x[2] - 1.0))) * cos(pi_t)
+ v2 = v1
+ p = rho^2
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- y = x[2]
-
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Same settings as in `initial_condition`
- # Amplitude and shift
- A = 0.5
- c = 2.0
-
- # convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_t = pi * t
-
- # compute the manufactured solution and all necessary derivatives
- rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
- rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
- rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
- rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
- rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
-
- v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
- v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_y = sin(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
- v1_xy = pi * cos(pi_x) * (A * log(y + 2.0) * exp(-A * (y - 1.0)) + (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
- v1_yy = (sin(pi_x) * ( 2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0)
- - A * A * log(y + 2.0) * exp(-A * (y - 1.0))
- - (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_xx = v1_xx
- v2_xy = v1_xy
- v2_yy = v1_yy
-
- p = rho * rho
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
- p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
-
- # Note this simplifies slightly because the ansatz assumes that v1 = v2
- E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
- E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
-
- # Some convenience constants
- T_const = equations.gamma * inv_gamma_minus_one / Pr
- inv_rho_cubed = 1.0 / (rho^3)
-
- # compute the source terms
- # density equation
- du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
-
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- # stress tensor from x-direction
- - 4.0 / 3.0 * v1_xx * mu_
- + 2.0 / 3.0 * v2_xy * mu_
- - v1_yy * mu_
- - v2_xy * mu_ )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- # stress tensor from y-direction
- - v1_xy * mu_
- - v2_xx * mu_
- - 4.0 / 3.0 * v2_yy * mu_
- + 2.0 / 3.0 * v1_xy * mu_ )
- # total energy equation
- du4 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- # stress tensor and temperature gradient terms from x-direction
- - 4.0 / 3.0 * v1_xx * v1 * mu_
- + 2.0 / 3.0 * v2_xy * v1 * mu_
- - 4.0 / 3.0 * v1_x * v1_x * mu_
- + 2.0 / 3.0 * v2_y * v1_x * mu_
- - v1_xy * v2 * mu_
- - v2_xx * v2 * mu_
- - v1_y * v2_x * mu_
- - v2_x * v2_x * mu_
- - T_const * inv_rho_cubed * ( p_xx * rho * rho
- - 2.0 * p_x * rho * rho_x
- + 2.0 * p * rho_x * rho_x
- - p * rho * rho_xx ) * mu_
- # stress tensor and temperature gradient terms from y-direction
- - v1_yy * v1 * mu_
- - v2_xy * v1 * mu_
- - v1_y * v1_y * mu_
- - v2_x * v1_y * mu_
- - 4.0 / 3.0 * v2_yy * v2 * mu_
- + 2.0 / 3.0 * v1_xy * v2 * mu_
- - 4.0 / 3.0 * v2_y * v2_y * mu_
- + 2.0 / 3.0 * v1_x * v2_y * mu_
- - T_const * inv_rho_cubed * ( p_yy * rho * rho
- - 2.0 * p_y * rho * rho_y
- + 2.0 * p * rho_y * rho_y
- - p * rho * rho_yy ) * mu_ )
-
- return SVector(du1, du2, du3, du4)
+ y = x[2]
+
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Same settings as in `initial_condition`
+ # Amplitude and shift
+ A = 0.5
+ c = 2.0
+
+ # convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_t = pi * t
+
+ # compute the manufactured solution and all necessary derivatives
+ rho = c + A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_t = -pi * A * sin(pi_x) * cos(pi_y) * sin(pi_t)
+ rho_x = pi * A * cos(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_y = -pi * A * sin(pi_x) * sin(pi_y) * cos(pi_t)
+ rho_xx = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+ rho_yy = -pi * pi * A * sin(pi_x) * cos(pi_y) * cos(pi_t)
+
+ v1 = sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_t = -pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * sin(pi_t)
+ v1_x = pi * cos(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_y = sin(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_xx = -pi * pi * sin(pi_x) * log(y + 2.0) * (1.0 - exp(-A * (y - 1.0))) * cos(pi_t)
+ v1_xy = pi * cos(pi_x) *
+ (A * log(y + 2.0) * exp(-A * (y - 1.0)) +
+ (1.0 - exp(-A * (y - 1.0))) / (y + 2.0)) * cos(pi_t)
+ v1_yy = (sin(pi_x) *
+ (2.0 * A * exp(-A * (y - 1.0)) / (y + 2.0) -
+ A * A * log(y + 2.0) * exp(-A * (y - 1.0)) -
+ (1.0 - exp(-A * (y - 1.0))) / ((y + 2.0) * (y + 2.0))) * cos(pi_t))
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_xx = v1_xx
+ v2_xy = v1_xy
+ v2_yy = v1_yy
+
+ p = rho * rho
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_xx = 2.0 * rho * rho_xx + 2.0 * rho_x * rho_x
+ p_yy = 2.0 * rho * rho_yy + 2.0 * rho_y * rho_y
+
+ # Note this simplifies slightly because the ansatz assumes that v1 = v2
+ E = p * inv_gamma_minus_one + 0.5 * rho * (v1^2 + v2^2)
+ E_t = p_t * inv_gamma_minus_one + rho_t * v1^2 + 2.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + rho_x * v1^2 + 2.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + rho_y * v1^2 + 2.0 * rho * v1 * v1_y
+
+ # Some convenience constants
+ T_const = equations.gamma * inv_gamma_minus_one / Pr
+ inv_rho_cubed = 1.0 / (rho^3)
+
+ # compute the source terms
+ # density equation
+ du1 = rho_t + rho_x * v1 + rho * v1_x + rho_y * v2 + rho * v2_y
+
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y -
+ # stress tensor from x-direction
+ 4.0 / 3.0 * v1_xx * mu_ +
+ 2.0 / 3.0 * v2_xy * mu_ -
+ v1_yy * mu_ -
+ v2_xy * mu_)
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y -
+ # stress tensor from y-direction
+ v1_xy * mu_ -
+ v2_xx * mu_ -
+ 4.0 / 3.0 * v2_yy * mu_ +
+ 2.0 / 3.0 * v1_xy * mu_)
+ # total energy equation
+ du4 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y) -
+ # stress tensor and temperature gradient terms from x-direction
+ 4.0 / 3.0 * v1_xx * v1 * mu_ +
+ 2.0 / 3.0 * v2_xy * v1 * mu_ -
+ 4.0 / 3.0 * v1_x * v1_x * mu_ +
+ 2.0 / 3.0 * v2_y * v1_x * mu_ -
+ v1_xy * v2 * mu_ -
+ v2_xx * v2 * mu_ -
+ v1_y * v2_x * mu_ -
+ v2_x * v2_x * mu_ -
+ T_const * inv_rho_cubed *
+ (p_xx * rho * rho -
+ 2.0 * p_x * rho * rho_x +
+ 2.0 * p * rho_x * rho_x -
+ p * rho * rho_xx) * mu_ -
+ # stress tensor and temperature gradient terms from y-direction
+ v1_yy * v1 * mu_ -
+ v2_xy * v1 * mu_ -
+ v2_x * v1_y * mu_ -
+ 4.0 / 3.0 * v2_yy * v2 * mu_ +
+ 2.0 / 3.0 * v1_xy -
+ 4.0 / 3.0 * v2_y * v2_y * mu_ +
+ 2.0 / 3.0 * v1_x * v2_y * mu_
+ -
+ -
+ (p_yy * rho * rho -
+ 2.0 * p_y * rho * rho_y + - -
+ p * rho * rho_yy) * mu_)
+
+ return SVector(du1, du2, du3, du4)
end
initial_condition = initial_condition_navier_stokes_convergence_test
@@ -175,23 +182,26 @@ velocity_bc_top_bottom = NoSlip() do x, t, equations
return SVector(u[2], u[3])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = (; x_neg = boundary_condition_periodic,
- x_pos = boundary_condition_periodic,
- y_neg = boundary_condition_slip_wall,
- y_pos = boundary_condition_slip_wall)
+ x_pos = boundary_condition_periodic,
+ y_neg = boundary_condition_slip_wall,
+ y_pos = boundary_condition_slip_wall)
# define viscous boundary conditions
boundary_conditions_parabolic = (; x_neg = boundary_condition_periodic,
- x_pos = boundary_condition_periodic,
- y_neg = boundary_condition_top_bottom,
- y_pos = boundary_condition_top_bottom)
+ x_pos = boundary_condition_periodic,
+ y_neg = boundary_condition_top_bottom,
+ y_pos = boundary_condition_top_bottom)
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -201,16 +211,15 @@ tspan = (0.0, 0.5)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl b/examples/tree_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl
index 3314343ccca..7bd1ec0c647 100644
--- a/examples/tree_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl
+++ b/examples/tree_2d_dgsem/elixir_navierstokes_lid_driven_cavity.jl
@@ -9,28 +9,27 @@ prandtl_number() = 0.72
mu() = 0.001
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
-coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))
+coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
# Create a uniformly refined mesh
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- periodicity=false,
- n_cells_max=30_000) # set maximum capacity of tree data structure
-
+ initial_refinement_level = 4,
+ periodicity = false,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
function initial_condition_cavity(x, t, equations::CompressibleEulerEquations2D)
- Ma = 0.1
- rho = 1.0
- u, v = 0.0, 0.0
- p = 1.0 / (Ma^2 * equations.gamma)
- return prim2cons(SVector(rho, u, v, p), equations)
+ Ma = 0.1
+ rho = 1.0
+ u, v = 0.0, 0.0
+ p = 1.0 / (Ma^2 * equations.gamma)
+ return prim2cons(SVector(rho, u, v, p), equations)
end
initial_condition = initial_condition_cavity
@@ -45,15 +44,15 @@ boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity
boundary_conditions = boundary_condition_slip_wall
boundary_conditions_parabolic = (; x_neg = boundary_condition_cavity,
- y_neg = boundary_condition_cavity,
- y_pos = boundary_condition_lid,
- x_pos = boundary_condition_cavity)
+ y_neg = boundary_condition_cavity,
+ y_pos = boundary_condition_lid,
+ x_pos = boundary_condition_cavity)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver;
- boundary_conditions=(boundary_conditions,
- boundary_conditions_parabolic))
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -63,17 +62,15 @@ tspan = (0.0, 25.0)
ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=100)
+alive_callback = AliveCallback(alive_interval = 100)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
-
diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl b/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl
index 06e8f06d3ca..4d92ea261e9 100644
--- a/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl
+++ b/examples/tree_2d_dgsem/elixir_navierstokes_shearlayer_amr.jl
@@ -7,11 +7,11 @@ using Trixi
# TODO: parabolic; unify names of these accessor functions
prandtl_number() = 0.72
-mu() = 1.0/3.0 * 10^(-5) # equivalent to Re = 30,000
+mu() = 1.0 / 3.0 * 10^(-5) # equivalent to Re = 30,000
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number())
"""
A compressible version of the double shear layer initial condition. Adapted from
@@ -22,32 +22,31 @@ Brown and Minion (1995).
[DOI: 10.1006/jcph.1995.1205](https://doi.org/10.1006/jcph.1995.1205)
"""
function initial_condition_shear_layer(x, t, equations::CompressibleEulerEquations2D)
- # Shear layer parameters
- k = 80
- delta = 0.05
- u0 = 1.0
-
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = x[2] <= 0.5 ? u0 * tanh(k*(x[2] - 0.25)) : u0 * tanh(k*(0.75 -x[2]))
- v2 = u0 * delta * sin(2*pi*(x[1]+ 0.25))
- p = (u0 / Ms)^2 * rho / equations.gamma # scaling to get Ms
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Shear layer parameters
+ k = 80
+ delta = 0.05
+ u0 = 1.0
+
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = x[2] <= 0.5 ? u0 * tanh(k * (x[2] - 0.25)) : u0 * tanh(k * (0.75 - x[2]))
+ v2 = u0 * delta * sin(2 * pi * (x[1] + 0.25))
+ p = (u0 / Ms)^2 * rho / equations.gamma # scaling to get Ms
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_shear_layer
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=100_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver)
@@ -61,26 +60,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 2000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval,)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# This uses velocity-based AMR
@inline function v1(u, equations::CompressibleEulerEquations2D)
- rho, rho_v1, _, _ = u
- return rho_v1 / rho
+ rho, rho_v1, _, _ = u
+ return rho_v1 / rho
end
-amr_indicator = IndicatorLöhner(semi, variable=v1)
+amr_indicator = IndicatorLöhner(semi, variable = v1)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
base_level = 3,
- med_level = 5, med_threshold=0.2,
- max_level = 7, max_threshold=0.5)
+ med_level = 5, med_threshold = 0.2,
+ max_level = 7, max_threshold = 0.5)
amr_callback = AMRCallback(semi, amr_controller,
- interval=50,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 50,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -91,7 +90,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
index c3cbc858f7b..a3e38bf6d92 100644
--- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
+++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
@@ -10,8 +10,8 @@ prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600
equations = CompressibleEulerEquations2D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
+ Prandtl = prandtl_number())
"""
initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D)
@@ -22,30 +22,30 @@ This forms the basis behind the 3D case found for instance in
Simulation of the Compressible Taylor Green Vortex using High-Order Flux Reconstruction Schemes
[DOI: 10.2514/6.2014-3210](https://doi.org/10.2514/6.2014-3210)
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2])
- v2 = -A * cos(x[1]) * sin(x[2])
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/4.0 * A^2 * rho * (cos(2*x[1]) + cos(2*x[2]))
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations2D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2])
+ v2 = -A * cos(x[1]) * sin(x[2])
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p + 1.0 / 4.0 * A^2 * rho * (cos(2 * x[1]) + cos(2 * x[2]))
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0) .* pi
-coordinates_max = ( 1.0, 1.0) .* pi
+coordinates_max = (1.0, 1.0) .* pi
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=100_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver)
@@ -59,11 +59,12 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval,)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -73,6 +74,6 @@ callbacks = CallbackSet(summary_callback,
# run the simulation
time_int_tol = 1e-9
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
+summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl b/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl
index 7c60e35b03e..349b3741869 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_conical_island.jl
@@ -7,7 +7,7 @@ using Trixi
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=1.4)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 1.4)
"""
initial_condition_conical_island(x, t, equations::ShallowWaterEquations2D)
@@ -21,29 +21,29 @@ boundary condition with the initial values. Due to the dry cells at the boundary
effect of an outflow which can be seen in the simulation.
"""
function initial_condition_conical_island(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
+ # Set the background values
- v1 = 0.0
- v2 = 0.0
+ v1 = 0.0
+ v2 = 0.0
- x1, x2 = x
- b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2))
+ x1, x2 = x
+ b = max(0.1, 1.0 - 4.0 * sqrt(x1^2 + x2^2))
- # use a logistic function to transfer water height value smoothly
- L = equations.H0 # maximum of function
- x0 = 0.3 # center point of function
- k = -25.0 # sharpness of transfer
+ # use a logistic function to transfer water height value smoothly
+ L = equations.H0 # maximum of function
+ x0 = 0.3 # center point of function
+ k = -25.0 # sharpness of transfer
- H = max(b, L/(1.0 + exp(-k*(sqrt(x1^2+x2^2) - x0))))
+ H = max(b, L / (1.0 + exp(-k * (sqrt(x1^2 + x2^2) - x0))))
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_conical_island
@@ -53,19 +53,20 @@ boundary_conditions = BoundaryConditionDirichlet(initial_condition)
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -75,13 +76,13 @@ solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-1.0, -1.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 4,
+ n_cells_max = 10_000,
+ periodicity = false)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solver
@@ -95,22 +96,22 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
###############################################################################
# run the simulation
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl b/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl
index eed0a350e7e..bc528ae7756 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl
@@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
# Note, this initial condition is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_ec_discontinuous_bottom` below.
@@ -16,17 +16,18 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=4, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4,
+ surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -46,45 +47,48 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the TreeMesh2D with initial_refinement_level=2.
-function initial_condition_ec_discontinuous_bottom(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.7, 0.7)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Set the background values
- H = 4.25
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # setup the discontinuous water height and velocities
- if element_id == 10
- H = 5.0
- v1 = 0.1882 * cos_phi
- v2 = 0.1882 * sin_phi
- end
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_ec_discontinuous_bottom(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set up polar coordinates
+ inicenter = SVector(0.7, 0.7)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Set the background values
+ H = 4.25
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # setup the discontinuous water height and velocities
+ if element_id == 10
+ H = 5.0
+ v1 = 0.1882 * cos_phi
+ v2 = 0.1882 * sin_phi
+ end
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_ec_discontinuous_bottom(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_ec_discontinuous_bottom(x_node, first(tspan), element,
+ equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -93,15 +97,15 @@ end
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(dt=0.2,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(dt = 0.2,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -109,7 +113,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl b/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
index 03dcf017266..2008019cc31 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
@@ -7,7 +7,7 @@ using Trixi
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
"""
initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations2D)
@@ -28,27 +28,27 @@ The particular setup below is taken from Section 6.2 of
curvilinear meshes with wet/dry fronts accelerated by GPUs
[DOI: 10.1016/j.jcp.2018.08.038](https://doi.org/10.1016/j.jcp.2018.08.038).
"""
-function initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations2D)
- a = 1.0
- h_0 = 0.1
- sigma = 0.5
- ω = sqrt(2 * equations.gravity * h_0) / a
-
- v1 = -sigma * ω * sin(ω * t)
- v2 = sigma * ω * cos(ω * t)
-
- b = h_0 * ((x[1])^2 + (x[2])^2) / a^2
-
- H = sigma * h_0 / a^2 * (2 * x[1] * cos(ω * t) + 2 * x[2] * sin(ω * t) - sigma) + h_0
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_parabolic_bowl(x, t, equations::ShallowWaterEquations2D)
+ a = 1.0
+ h_0 = 0.1
+ sigma = 0.5
+ ω = sqrt(2 * equations.gravity * h_0) / a
+
+ v1 = -sigma * ω * sin(ω * t)
+ v2 = sigma * ω * cos(ω * t)
+
+ b = h_0 * ((x[1])^2 + (x[2])^2) / a^2
+
+ H = sigma * h_0 / a^2 * (2 * x[1] * cos(ω * t) + 2 * x[2] * sin(ω * t) - sigma) + h_0
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_parabolic_bowl
@@ -56,23 +56,23 @@ initial_condition = initial_condition_parabolic_bowl
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(7)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.6,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.6,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
-
###############################################################################
# Create the TreeMesh for the domain [-2, 2]^2
@@ -80,8 +80,8 @@ coordinates_min = (-2.0, -2.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=10_000)
+ initial_refinement_level = 5,
+ n_cells_max = 10_000)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -95,19 +95,20 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
@@ -115,6 +116,6 @@ stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterh
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl
index 6d4f6fe518c..c92e885c161 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl
@@ -5,17 +5,17 @@ using Trixi
###############################################################################
# semidiscretization of the shallow water equations
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test # MMS EOC test
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -23,13 +23,13 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservativ
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,13 +40,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -54,6 +54,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl
index c3da957b764..f7544b1e32e 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_source_terms_dirichlet.jl
@@ -5,7 +5,7 @@ using Trixi
###############################################################################
# Semidiscretization of the shallow water equations
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test
@@ -15,8 +15,9 @@ boundary_condition = BoundaryConditionDirichlet(initial_condition)
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -24,14 +25,14 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservativ
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=false)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = false)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
boundary_conditions = boundary_condition,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -42,13 +43,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -56,6 +57,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl
index 402361c8823..f7c8ab3a249 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl
@@ -5,7 +5,8 @@ using Trixi
###############################################################################
# Semidiscretization of the two-layer shallow water equations
-equations = ShallowWaterTwoLayerEquations2D(gravity_constant=10.0, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 10.0, rho_upper = 0.9,
+ rho_lower = 1.0)
initial_condition = initial_condition_convergence_test
@@ -13,9 +14,9 @@ initial_condition = initial_condition_convergence_test
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
-
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -23,13 +24,13 @@ solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservativ
coordinates_min = (0.0, 0.0)
coordinates_max = (sqrt(2.0), sqrt(2.0))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=20_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 20_000,
+ periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,13 +41,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=500,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 500,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -54,6 +55,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-8, reltol=1.0e-8,
-save_everystep=false, callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(), abstol = 1.0e-8, reltol = 1.0e-8,
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
index ba4bcd25774..1495e6d8568 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
@@ -6,21 +6,24 @@ using Trixi
# Semidiscretization of the two-layer shallow water equations with a bottom topography function
# to test well-balancedness
-equations = ShallowWaterTwoLayerEquations2D(gravity_constant=9.81, H0=0.6, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 9.81, H0 = 0.6,
+ rho_upper = 0.9, rho_lower = 1.0)
# An initial condition with constant total water height, zero velocities and a bottom topography to
# test well-balancedness
function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEquations2D)
- H_lower = 0.5
- H_upper = 0.6
- v1_upper = 0.0
- v2_upper = 0.0
- v1_lower = 0.0
- v2_lower = 0.0
- b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] +
- -0.5)^2)) + 1) : 0.0)
-
- return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations)
+ H_lower = 0.5
+ H_upper = 0.6
+ v1_upper = 0.0
+ v2_upper = 0.0
+ v1_lower = 0.0
+ v2_lower = 0.0
+ b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ?
+ 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] +
+ -0.5)^2)) + 1) : 0.0)
+
+ return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b),
+ equations)
end
initial_condition = initial_condition_well_balanced
@@ -30,8 +33,8 @@ initial_condition = initial_condition_well_balanced
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=3, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -39,9 +42,9 @@ solver = DGSEM(polydeg=3, surface_flux=surface_flux,
coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000,
+ periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -55,16 +58,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -72,7 +75,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced.jl b/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced.jl
index 23efdcb7366..13023dfaba2 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced.jl
@@ -6,21 +6,21 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=3.25)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 3.25)
# An initial condition with constant total water height and zero velocities to test well-balancedness.
# Note, this routine is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_discontinuous_well_balancedness` below.
function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
- x1, x2 = x
- b = ( 1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
- + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
+ x1, x2 = x
+ b = (1.5 / exp(0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2)))
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_well_balancedness
@@ -30,17 +30,17 @@ initial_condition = initial_condition_well_balancedness
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=4, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -61,30 +61,33 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the TreeMesh2D with initial_refinement_level=2.
-function initial_condition_discontinuous_well_balancedness(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_discontinuous_well_balancedness(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan),
+ element, equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -93,16 +96,16 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -110,7 +113,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wall.jl b/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wall.jl
index 66cd27f6864..f50bd4e4f65 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wall.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wall.jl
@@ -5,21 +5,21 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=3.25)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 3.25)
# An initial condition with constant total water height and zero velocities to test well-balancedness.
# Note, this routine is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_discontinuous_well_balancedness` below.
function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
- x1, x2 = x
- b = ( 1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
- + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
+ x1, x2 = x
+ b = (1.5 / exp(0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2)))
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_well_balancedness
@@ -31,8 +31,8 @@ boundary_condition = boundary_condition_slip_wall
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=4, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the TreeMesh and setup a periodic mesh
@@ -40,8 +40,8 @@ solver = DGSEM(polydeg=4, surface_flux=surface_flux,
coordinates_min = (-1.0, -1.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000,
+ initial_refinement_level = 2,
+ n_cells_max = 10_000,
periodicity = false)
# create the semi discretization object
@@ -64,30 +64,33 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the TreeMesh2D with initial_refinement_level=2.
-function initial_condition_discontinuous_well_balancedness(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_discontinuous_well_balancedness(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan),
+ element, equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -96,16 +99,16 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -113,7 +116,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl b/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
index 6fede2fa4ea..034411c2b54 100644
--- a/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
+++ b/examples/tree_2d_dgsem/elixir_shallowwater_well_balanced_wet_dry.jl
@@ -8,7 +8,7 @@ using Printf: @printf, @sprintf
#
# TODO: TrixiShallowWater: wet/dry example elixir
-equations = ShallowWaterEquations2D(gravity_constant=9.812)
+equations = ShallowWaterEquations2D(gravity_constant = 9.812)
"""
initial_condition_well_balanced_chen_noelle(x, t, equations:: ShallowWaterEquations2D)
@@ -23,28 +23,29 @@ The initial condition is taken from Section 5.2 of the paper:
A new hydrostatic reconstruction scheme based on subcell reconstructions
[DOI:10.1137/15M1053074](https://dx.doi.org/10.1137/15M1053074)
"""
-function initial_condition_complex_bottom_well_balanced(x, t, equations::ShallowWaterEquations2D)
- v1 = 0
- v2 = 0
- b = sin(4 * pi * x[1]) + 3
-
- if x[1] >= 0.5
- b = sin(4 * pi * x[1]) + 1
- end
-
- H = max(b, 2.5)
- if x[1] >= 0.5
- H = max(b, 1.5)
- end
-
- # It is mandatory to shift the water level at dry areas to make sure the water height h
- # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
- # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
- # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
- # for the ShallowWaterEquations and added to the initial condition if h = 0.
- # This default value can be changed within the constructor call depending on the simulation setup.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_complex_bottom_well_balanced(x, t,
+ equations::ShallowWaterEquations2D)
+ v1 = 0
+ v2 = 0
+ b = sin(4 * pi * x[1]) + 3
+
+ if x[1] >= 0.5
+ b = sin(4 * pi * x[1]) + 1
+ end
+
+ H = max(b, 2.5)
+ if x[1] >= 0.5
+ H = max(b, 1.5)
+ end
+
+ # It is mandatory to shift the water level at dry areas to make sure the water height h
+ # stays positive. The system would not be stable for h set to a hard 0 due to division by h in
+ # the computation of velocity, e.g., (h v1) / h. Therefore, a small dry state threshold
+ # with a default value of 500*eps() ≈ 1e-13 in double precision, is set in the constructor above
+ # for the ShallowWaterEquations and added to the initial condition if h = 0.
+ # This default value can be changed within the constructor call depending on the simulation setup.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_complex_bottom_well_balanced
@@ -53,19 +54,20 @@ initial_condition = initial_condition_complex_bottom_well_balanced
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -76,8 +78,8 @@ coordinates_min = (0.0, 0.0)
coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -102,18 +104,20 @@ ode = semidiscretize(semi, tspan)
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
- # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
- if i == 1
- x_node = SVector(nextfloat(x_node[1]) , x_node[2])
- elseif i == nnodes(semi.solver)
- x_node = SVector(prevfloat(x_node[1]) , x_node[2])
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
+ # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
+ if i == 1
+ x_node = SVector(nextfloat(x_node[1]), x_node[2])
+ elseif i == nnodes(semi.solver)
+ x_node = SVector(prevfloat(x_node[1]), x_node[2])
+ end
+ u_node = initial_condition_complex_bottom_well_balanced(x_node, first(tspan),
+ equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
end
- u_node = initial_condition_complex_bottom_well_balanced(x_node, first(tspan), equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
end
###############################################################################
@@ -122,27 +126,27 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
-
-stepsize_callback = StepsizeCallback(cfl=2.0)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
+stepsize_callback = StepsizeCallback(cfl = 2.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(stage_limiter!); dt=1.0,
- ode_default_options()..., callback=callbacks, adaptive=false);
+sol = solve(ode, SSPRK43(stage_limiter!); dt = 1.0,
+ ode_default_options()..., callback = callbacks, adaptive = false);
summary_callback() # print the timer summary
@@ -157,34 +161,38 @@ summary_callback() # print the timer summary
function lake_at_rest_error_two_level(u, x, equations::ShallowWaterEquations2D)
h, _, _, b = u
- # For well-balancedness testing with possible wet/dry regions the reference
- # water height `H0` accounts for the possibility that the bottom topography
- # can emerge out of the water as well as for the threshold offset to avoid
- # division by a "hard" zero water heights as well.
+ # For well-balancedness testing with possible wet/dry regions the reference
+ # water height `H0` accounts for the possibility that the bottom topography
+ # can emerge out of the water as well as for the threshold offset to avoid
+ # division by a "hard" zero water heights as well.
- if x[1] < 0.5
- H0_wet_dry = max( 2.5 , b + equations.threshold_limiter )
- else
- H0_wet_dry = max( 1.5 , b + equations.threshold_limiter )
- end
+ if x[1] < 0.5
+ H0_wet_dry = max(2.5, b + equations.threshold_limiter)
+ else
+ H0_wet_dry = max(1.5, b + equations.threshold_limiter)
+ end
- return abs(H0_wet_dry - (h + b))
+ return abs(H0_wet_dry - (h + b))
end
# point to the data we want to analyze
u = Trixi.wrap_array(sol[end], semi)
# Perform the actual integration of the well-balancedness error over the domain
-l1_well_balance_error = Trixi.integrate_via_indices(u, mesh, equations, semi.solver, semi.cache; normalize=true) do u, i, j, element, equations, solver
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, solver, i, j, element)
- # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
- # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
- if i == 1
- x_node = SVector(nextfloat(x_node[1]) , x_node[2])
- elseif i == nnodes(semi.solver)
- x_node = SVector(prevfloat(x_node[1]) , x_node[2])
- end
- u_local = Trixi.get_node_vars(u, equations, solver, i, j, element)
- return lake_at_rest_error_two_level(u_local, x_node, equations)
+l1_well_balance_error = Trixi.integrate_via_indices(u, mesh, equations, semi.solver,
+ semi.cache;
+ normalize = true) do u, i, j, element,
+ equations, solver
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, solver,
+ i, j, element)
+ # We know that the discontinuity is a vertical line. Slightly augment the x value by a factor
+ # of unit roundoff to avoid the repeted value from the LGL nodes at at interface.
+ if i == 1
+ x_node = SVector(nextfloat(x_node[1]), x_node[2])
+ elseif i == nnodes(semi.solver)
+ x_node = SVector(prevfloat(x_node[1]), x_node[2])
+ end
+ u_local = Trixi.get_node_vars(u, equations, solver, i, j, element)
+ return lake_at_rest_error_two_level(u_local, x_node, equations)
end
# report the well-balancedness lake-at-rest error to the screen
diff --git a/examples/tree_2d_fdsbp/elixir_advection_extended.jl b/examples/tree_2d_fdsbp/elixir_advection_extended.jl
index 6e599d9f42d..8716a9a6b78 100644
--- a/examples/tree_2d_fdsbp/elixir_advection_extended.jl
+++ b/examples/tree_2d_fdsbp/elixir_advection_extended.jl
@@ -13,22 +13,21 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
initial_condition = initial_condition_convergence_test
D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
- derivative_order=1, accuracy_order=4,
- xmin=0.0, xmax=1.0, N=100)
+ derivative_order = 1, accuracy_order = 4,
+ xmin = 0.0, xmax = 1.0, N = 100)
solver = FDSBP(D_SBP,
- surface_integral=SurfaceIntegralStrongForm(flux_lax_friedrichs),
- volume_integral=VolumeIntegralStrongForm())
+ surface_integral = SurfaceIntegralStrongForm(flux_lax_friedrichs),
+ volume_integral = VolumeIntegralStrongForm())
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=1,
- n_cells_max=30_000,
- periodicity=true)
+ initial_refinement_level = 1,
+ n_cells_max = 30_000,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -38,19 +37,18 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(energy_total,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (energy_total,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-9, reltol=1.0e-9,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-9, reltol = 1.0e-9,
+ ode_default_options()..., callback = callbacks)
summary_callback()
diff --git a/examples/tree_2d_fdsbp/elixir_euler_convergence.jl b/examples/tree_2d_fdsbp/elixir_euler_convergence.jl
index 2a6c291f0bf..123be02bd17 100644
--- a/examples/tree_2d_fdsbp/elixir_euler_convergence.jl
+++ b/examples/tree_2d_fdsbp/elixir_euler_convergence.jl
@@ -13,23 +13,24 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_steger_warming
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 30_000,
+ periodicity = true)
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, source_terms = source_terms_convergence_test)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,15 +41,15 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(energy_total,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (energy_total,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -58,6 +59,6 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-9, reltol=1.0e-9,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); abstol = 1.0e-9, reltol = 1.0e-9,
+ ode_default_options()..., callback = callbacks)
summary_callback()
diff --git a/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl b/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl
index e63343852ab..4c41b84af33 100644
--- a/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl
+++ b/examples/tree_2d_fdsbp/elixir_euler_kelvin_helmholtz_instability.jl
@@ -9,42 +9,42 @@ using Trixi
equations = CompressibleEulerEquations2D(1.4)
-function initial_condition_kelvin_helmholtz_instability(x, t, equations::CompressibleEulerEquations2D)
- # change discontinuity to tanh
- # typical resolution 128^2, 256^2
- # domain size is [-1,+1]^2
- slope = 15
- amplitude = 0.02
- B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
- rho = 0.5 + 0.75 * B
- v1 = 0.5 * (B - 1)
- v2 = 0.1 * sin(2 * pi * x[1])
- p = 1.0
- return prim2cons(SVector(rho, v1, v2, p), equations)
+function initial_condition_kelvin_helmholtz_instability(x, t,
+ equations::CompressibleEulerEquations2D)
+ # change discontinuity to tanh
+ # typical resolution 128^2, 256^2
+ # domain size is [-1,+1]^2
+ slope = 15
+ amplitude = 0.02
+ B = tanh(slope * x[2] + 7.5) - tanh(slope * x[2] - 7.5)
+ rho = 0.5 + 0.75 * B
+ v1 = 0.5 * (B - 1)
+ v2 = 0.1 * sin(2 * pi * x[1])
+ p = 1.0
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_kelvin_helmholtz_instability
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_vanleer_haenel
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = (-1.0, -1.0)
-coordinates_max = ( 1.0, 1.0)
+coordinates_max = (1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000,
- periodicity=true)
+ initial_refinement_level = 4,
+ n_cells_max = 30_000,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -54,27 +54,26 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(entropy,
- energy_total,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (entropy,
+ energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback,
save_solution,
alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-6, reltol=1.0e-6, dt=1e-3,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); abstol = 1.0e-6, reltol = 1.0e-6, dt = 1e-3,
+ ode_default_options()..., callback = callbacks)
summary_callback()
diff --git a/examples/tree_2d_fdsbp/elixir_euler_vortex.jl b/examples/tree_2d_fdsbp/elixir_euler_vortex.jl
index c1bee8f9c4d..d0847cc8016 100644
--- a/examples/tree_2d_fdsbp/elixir_euler_vortex.jl
+++ b/examples/tree_2d_fdsbp/elixir_euler_vortex.jl
@@ -19,62 +19,61 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
- # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
- # for error convergence: make sure that the end time is such that the is back at the initial state!!
- # for the current velocity and domain size: t_end should be a multiple of 20s
- # initial center of the vortex
- inicenter = SVector(0.0, 0.0)
- # size and strength of the vortex
- iniamplitude = 5.0
- # base flow
- rho = 1.0
- v1 = 1.0
- v2 = 1.0
- vel = SVector(v1, v2)
- p = 25.0
- rt = p / rho # ideal gas equation
- t_loc = 0.0
- cent = inicenter + vel*t_loc # advection of center
- # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
-
- cent = x - cent # distance to center point
-
- #cent=cross(iniaxis,cent) # distance to axis, tangent vector, length r
- # cross product with iniaxis = [0, 0, 1]
- cent = SVector(-cent[2], cent[1])
- r2 = cent[1]^2 + cent[2]^2
- du = iniamplitude/(2*π)*exp(0.5*(1-r2)) # vel. perturbation
- dtemp = -(equations.gamma-1)/(2*equations.gamma*rt)*du^2 # isentropic
- rho = rho * (1+dtemp)^(1/(equations.gamma-1))
- vel = vel + du*cent
- v1, v2 = vel
- p = p * (1+dtemp)^(equations.gamma/(equations.gamma-1))
- prim = SVector(rho, v1, v2, p)
- return prim2cons(prim, equations)
+ # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
+ # for error convergence: make sure that the end time is such that the is back at the initial state!!
+ # for the current velocity and domain size: t_end should be a multiple of 20s
+ # initial center of the vortex
+ inicenter = SVector(0.0, 0.0)
+ # size and strength of the vortex
+ iniamplitude = 5.0
+ # base flow
+ rho = 1.0
+ v1 = 1.0
+ v2 = 1.0
+ vel = SVector(v1, v2)
+ p = 25.0
+ rt = p / rho # ideal gas equation
+ t_loc = 0.0
+ cent = inicenter + vel * t_loc # advection of center
+ # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
+
+ cent = x - cent # distance to center point
+
+ #cent=cross(iniaxis,cent) # distance to axis, tangent vector, length r
+ # cross product with iniaxis = [0, 0, 1]
+ cent = SVector(-cent[2], cent[1])
+ r2 = cent[1]^2 + cent[2]^2
+ du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
+ dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
+ rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
+ vel = vel + du * cent
+ v1, v2 = vel
+ p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
+ prim = SVector(rho, v1, v2, p)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_steger_warming
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = (-10.0, -10.0)
-coordinates_max = ( 10.0, 10.0)
+coordinates_max = (10.0, 10.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000,
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 30_000,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -84,24 +83,23 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback,
save_solution,
alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-6, reltol=1.0e-6, dt=1e-3,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); abstol = 1.0e-6, reltol = 1.0e-6, dt = 1e-3,
+ ode_default_options()..., callback = callbacks)
summary_callback()
diff --git a/examples/tree_3d_dgsem/elixir_advection_amr.jl b/examples/tree_3d_dgsem/elixir_advection_amr.jl
index 67664eed563..19a9bd18a8a 100644
--- a/examples/tree_3d_dgsem/elixir_advection_amr.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_amr.jl
@@ -9,18 +9,16 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
initial_condition = initial_condition_gauss
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0, -5.0)
-coordinates_max = ( 5.0, 5.0, 5.0)
+coordinates_max = (5.0, 5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=30_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,26 +28,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=0.1,
- max_level=6, max_threshold=0.6)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 0.1,
+ max_level = 6, max_threshold = 0.6)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -61,7 +59,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_advection_basic.jl b/examples/tree_3d_dgsem/elixir_advection_basic.jl
index da91a70fe6d..3ea50423be7 100644
--- a/examples/tree_3d_dgsem/elixir_advection_basic.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_basic.jl
@@ -9,19 +9,19 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 3,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# A semidiscretization collects data structures and functions for the spatial discretization
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
-
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,26 +34,26 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
#
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
-
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl b/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl
index 0fab685b642..6a8f8d02590 100644
--- a/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_diffusion_amr.jl
@@ -11,27 +11,28 @@ equations = LinearScalarAdvectionEquation3D(advection_velocity)
diffusivity() = 5.0e-4
equations_parabolic = LaplaceDiffusion3D(diffusivity(), equations)
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
+coordinates_max = (1.0, 1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=80_000)
+ initial_refinement_level = 4,
+ n_cells_max = 80_000)
# Define initial condition
-function initial_condition_diffusive_convergence_test(x, t, equation::LinearScalarAdvectionEquation3D)
- # Store translated coordinate for easy use of exact solution
- x_trans = x - equation.advection_velocity * t
-
- nu = diffusivity()
- c = 1.0
- A = 0.5
- L = 2
- f = 1/L
- omega = 2 * pi * f
- scalar = c + A * sin(omega * sum(x_trans)) * exp(-2 * nu * omega^2 * t)
- return SVector(scalar)
+function initial_condition_diffusive_convergence_test(x, t,
+ equation::LinearScalarAdvectionEquation3D)
+ # Store translated coordinate for easy use of exact solution
+ x_trans = x - equation.advection_velocity * t
+
+ nu = diffusivity()
+ c = 1.0
+ A = 0.5
+ L = 2
+ f = 1 / L
+ omega = 2 * pi * f
+ scalar = c + A * sin(omega * sum(x_trans)) * exp(-2 * nu * omega^2 * t)
+ return SVector(scalar)
end
initial_condition = initial_condition_diffusive_convergence_test
@@ -43,9 +44,8 @@ boundary_conditions_parabolic = boundary_condition_periodic
semi = SemidiscretizationHyperbolicParabolic(mesh,
(equations, equations_parabolic),
initial_condition, solver;
- boundary_conditions=(boundary_conditions,
- boundary_conditions_parabolic))
-
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -56,26 +56,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=3,
- med_level=4, med_threshold=1.2,
- max_level=5, max_threshold=1.45)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 3,
+ med_level = 4, med_threshold = 1.2,
+ max_level = 5, max_threshold = 1.45)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -87,7 +87,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
-summary_callback() # print the timer summary
\ No newline at end of file
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
+summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl b/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl
index 5dc6e6338a7..4c30406680a 100644
--- a/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_diffusion_nonperiodic.jl
@@ -10,16 +10,16 @@ equations = LinearScalarAdvectionEquation3D(advection_velocity)
equations_parabolic = LaplaceDiffusion3D(diffusivity(), equations)
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -0.5, -0.25) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 0.0, 0.5, 0.25) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (0.0, 0.5, 0.25) # maximum coordinates (max(x), max(y), max(z))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- periodicity=false,
- n_cells_max=30_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 3,
+ periodicity = false,
+ n_cells_max = 30_000) # set maximum capacity of tree data structure
# Example setup taken from
# - Truman Ellis, Jesse Chan, and Leszek Demkowicz (2016).
@@ -28,24 +28,24 @@ mesh = TreeMesh(coordinates_min, coordinates_max,
# to numerical partial differential equations.
# [DOI](https://doi.org/10.1007/978-3-319-41640-3_6).
function initial_condition_eriksson_johnson(x, t, equations)
- l = 4
- epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt
- lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
- r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
- u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
- cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
- return SVector{1}(u)
+ l = 4
+ epsilon = diffusivity() # TODO: this requires epsilon < .6 due to sqrt
+ lambda_1 = (-1 + sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ lambda_2 = (-1 - sqrt(1 - 4 * epsilon * l)) / (-2 * epsilon)
+ r1 = (1 + sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ s1 = (1 - sqrt(1 + 4 * pi^2 * epsilon^2)) / (2 * epsilon)
+ u = exp(-l * t) * (exp(lambda_1 * x[1]) - exp(lambda_2 * x[1])) +
+ cos(pi * x[2]) * (exp(s1 * x[1]) - exp(r1 * x[1])) / (exp(-s1) - exp(-r1))
+ return SVector{1}(u)
end
initial_condition = initial_condition_eriksson_johnson
boundary_conditions = (; x_neg = BoundaryConditionDirichlet(initial_condition),
- y_neg = BoundaryConditionDirichlet(initial_condition),
- z_neg = boundary_condition_do_nothing,
- y_pos = BoundaryConditionDirichlet(initial_condition),
- x_pos = boundary_condition_do_nothing,
- z_pos = boundary_condition_do_nothing)
+ y_neg = BoundaryConditionDirichlet(initial_condition),
+ z_neg = boundary_condition_do_nothing,
+ y_pos = BoundaryConditionDirichlet(initial_condition),
+ x_pos = boundary_condition_do_nothing,
+ z_pos = boundary_condition_do_nothing)
boundary_conditions_parabolic = BoundaryConditionDirichlet(initial_condition)
@@ -53,9 +53,8 @@ boundary_conditions_parabolic = BoundaryConditionDirichlet(initial_condition)
semi = SemidiscretizationHyperbolicParabolic(mesh,
(equations, equations_parabolic),
initial_condition, solver;
- boundary_conditions=(boundary_conditions,
- boundary_conditions_parabolic))
-
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic))
###############################################################################
# ODE solvers, callbacks etc.
@@ -70,22 +69,21 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
time_int_tol = 1.0e-11
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
# Print the timer summary
summary_callback()
diff --git a/examples/tree_3d_dgsem/elixir_advection_extended.jl b/examples/tree_3d_dgsem/elixir_advection_extended.jl
index d820f47f25c..efc20c64f6d 100644
--- a/examples/tree_3d_dgsem/elixir_advection_extended.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_extended.jl
@@ -18,21 +18,20 @@ initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000, # set maximum capacity of tree data structure
- periodicity=true)
+ initial_refinement_level = 3,
+ n_cells_max = 30_000, # set maximum capacity of tree data structure
+ periodicity = true)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -47,24 +46,24 @@ summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
# The AliveCallback prints short status information in regular intervals
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
# The SaveRestartCallback allows to save a file from which a Trixi simulation can be restarted
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback,
@@ -72,14 +71,13 @@ callbacks = CallbackSet(summary_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/tree_3d_dgsem/elixir_advection_mortar.jl b/examples/tree_3d_dgsem/elixir_advection_mortar.jl
index 7b24f152b6a..d27a19c7dcf 100644
--- a/examples/tree_3d_dgsem/elixir_advection_mortar.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_mortar.jl
@@ -9,23 +9,21 @@ advection_velocity = (0.2, -0.7, 0.5)
equations = LinearScalarAdvectionEquation3D(advection_velocity)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
-refinement_patches = (
- (type="box", coordinates_min=(0.0, -1.0, -1.0), coordinates_max=(1.0, 1.0, 1.0)),
- (type="box", coordinates_min=(0.0, -0.5, -0.5), coordinates_max=(0.5, 0.5, 0.5)),
-)
+coordinates_max = (1.0, 1.0, 1.0)
+refinement_patches = ((type = "box", coordinates_min = (0.0, -1.0, -1.0),
+ coordinates_max = (1.0, 1.0, 1.0)),
+ (type = "box", coordinates_min = (0.0, -0.5, -0.5),
+ coordinates_max = (0.5, 0.5, 0.5)))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- refinement_patches=refinement_patches,
- n_cells_max=10_000,)
-
+ initial_refinement_level = 2,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -35,17 +33,17 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.2)
+stepsize_callback = StepsizeCallback(cfl = 1.2)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -53,11 +51,10 @@ callbacks = CallbackSet(summary_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_advection_restart.jl b/examples/tree_3d_dgsem/elixir_advection_restart.jl
index b7835ed061f..f81e013fc0a 100644
--- a/examples/tree_3d_dgsem/elixir_advection_restart.jl
+++ b/examples/tree_3d_dgsem/elixir_advection_restart.jl
@@ -7,7 +7,6 @@ using Trixi
trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_advection_extended.jl"))
-
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -26,14 +25,13 @@ ode = semidiscretize(semi, tspan, restart_filename);
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
-integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Get the last time index and work with that.
load_timestep!(integrator, restart_filename)
-
###############################################################################
# run the simulation
diff --git a/examples/tree_3d_dgsem/elixir_euler_amr.jl b/examples/tree_3d_dgsem/elixir_euler_amr.jl
index f226a6b446d..9bd7f74c688 100644
--- a/examples/tree_3d_dgsem/elixir_euler_amr.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_amr.jl
@@ -14,30 +14,28 @@ A Gaussian pulse in the density with constant velocity and pressure; reduces the
compressible Euler equations to the linear advection equations.
"""
function initial_condition_density_pulse(x, t, equations::CompressibleEulerEquations3D)
- rho = 1 + exp(-(x[1]^2 + x[2]^2 + x[3]^2))/2
- v1 = 1
- v2 = 1
- v3 = 1
- rho_v1 = rho * v1
- rho_v2 = rho * v2
- rho_v3 = rho * v3
- p = 1
- rho_e = p/(equations.gamma - 1) + 1/2 * rho * (v1^2 + v2^2 + v3^2)
- return SVector(rho, rho_v1, rho_v2, rho_v3, rho_e)
+ rho = 1 + exp(-(x[1]^2 + x[2]^2 + x[3]^2)) / 2
+ v1 = 1
+ v2 = 1
+ v3 = 1
+ rho_v1 = rho * v1
+ rho_v2 = rho * v2
+ rho_v3 = rho * v3
+ p = 1
+ rho_e = p / (equations.gamma - 1) + 1 / 2 * rho * (v1^2 + v2^2 + v3^2)
+ return SVector(rho, rho_v1, rho_v2, rho_v3, rho_e)
end
initial_condition = initial_condition_density_pulse
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (-5.0, -5.0, -5.0)
-coordinates_max = ( 5.0, 5.0, 5.0)
+coordinates_max = (5.0, 5.0, 5.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=4,
- n_cells_max=10_000)
-
+ initial_refinement_level = 4,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -47,40 +45,39 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable=first),
- base_level=4,
- med_level=5, med_threshold=1.05,
- max_level=6, max_threshold=1.3)
+amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first),
+ base_level = 4,
+ med_level = 5, med_threshold = 1.05,
+ max_level = 6, max_threshold = 1.3)
amr_callback = AMRCallback(semi, amr_controller,
- interval=5,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 5,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
amr_callback, stepsize_callback);
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl
index a8d112f5b05..0ce886620cc 100644
--- a/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_blob_amr.jl
@@ -4,7 +4,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-gamma = 5/3
+gamma = 5 / 3
equations = CompressibleEulerEquations3D(gamma)
"""
@@ -16,63 +16,65 @@ The blob test case taken from
[arXiv: astro-ph/0610051](https://arxiv.org/abs/astro-ph/0610051)
"""
function initial_condition_blob(x, t, equations::CompressibleEulerEquations3D)
- # blob test case, see Agertz et al. https://arxiv.org/pdf/astro-ph/0610051.pdf
- # other reference: https://arxiv.org/pdf/astro-ph/0610051.pdf
- # change discontinuity to tanh
- # typical domain is rectangular, we change it to a square
- # resolution 128^3, 256^3
- # domain size is [-20.0,20.0]^3
- # gamma = 5/3 for this test case
- R = 1.0 # radius of the blob
- # background density
- rho = 1.0
- Chi = 10.0 # density contrast
- # reference time of characteristic growth of KH instability equal to 1.0
- tau_kh = 1.0
- tau_cr = tau_kh / 1.6 # crushing time
- # determine background velocity
- v1 = 2 * R * sqrt(Chi) / tau_cr
- v2 = 0.0
- v3 = 0.0
- Ma0 = 2.7 # background flow Mach number Ma=v/c
- c = v1 / Ma0 # sound speed
- # use perfect gas assumption to compute background pressure via the sound speed c^2 = gamma * pressure/density
- p = c * c * rho / equations.gamma
- # initial center of the blob
- inicenter = [-15, 0, 0]
- x_rel = x - inicenter
- r = sqrt(x_rel[1]^2 + x_rel[2]^2 + x_rel[3]^2)
- # steepness of the tanh transition zone
- slope = 2
- # density blob
- rho = rho + (Chi - 1) * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope *(r - R)) + 1)))
- # velocity blob is zero
- v1 = v1 - v1 * 0.5 * (1 + (tanh(slope *(r + R)) - (tanh(slope *(r - R)) + 1)))
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ # blob test case, see Agertz et al. https://arxiv.org/pdf/astro-ph/0610051.pdf
+ # other reference: https://arxiv.org/pdf/astro-ph/0610051.pdf
+ # change discontinuity to tanh
+ # typical domain is rectangular, we change it to a square
+ # resolution 128^3, 256^3
+ # domain size is [-20.0,20.0]^3
+ # gamma = 5/3 for this test case
+ R = 1.0 # radius of the blob
+ # background density
+ rho = 1.0
+ Chi = 10.0 # density contrast
+ # reference time of characteristic growth of KH instability equal to 1.0
+ tau_kh = 1.0
+ tau_cr = tau_kh / 1.6 # crushing time
+ # determine background velocity
+ v1 = 2 * R * sqrt(Chi) / tau_cr
+ v2 = 0.0
+ v3 = 0.0
+ Ma0 = 2.7 # background flow Mach number Ma=v/c
+ c = v1 / Ma0 # sound speed
+ # use perfect gas assumption to compute background pressure via the sound speed c^2 = gamma * pressure/density
+ p = c * c * rho / equations.gamma
+ # initial center of the blob
+ inicenter = [-15, 0, 0]
+ x_rel = x - inicenter
+ r = sqrt(x_rel[1]^2 + x_rel[2]^2 + x_rel[3]^2)
+ # steepness of the tanh transition zone
+ slope = 2
+ # density blob
+ rho = rho +
+ (Chi - 1) * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope * (r - R)) + 1)))
+ # velocity blob is zero
+ v1 = v1 - v1 * 0.5 * (1 + (tanh(slope * (r + R)) - (tanh(slope * (r - R)) + 1)))
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_blob
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-20.0, -20.0, -20.0)
-coordinates_max = ( 20.0, 20.0, 20.0)
-
-refinement_patches = (
- (type="box", coordinates_min=(-20.0, -10.0, -10.0), coordinates_max=(-10.0, 10.0, 10.0)),
- (type="box", coordinates_min=(-20.0, -5.0, -5.0), coordinates_max=(-10.0, 5.0, 5.0)),
- (type="box", coordinates_min=(-17.0, -2.0, -2.0), coordinates_max=(-13.0, 2.0, 2.0)),
- (type="box", coordinates_min=(-17.0, -2.0, -2.0), coordinates_max=(-13.0, 2.0, 2.0)),
-)
+coordinates_max = (20.0, 20.0, 20.0)
+
+refinement_patches = ((type = "box", coordinates_min = (-20.0, -10.0, -10.0),
+ coordinates_max = (-10.0, 10.0, 10.0)),
+ (type = "box", coordinates_min = (-20.0, -5.0, -5.0),
+ coordinates_max = (-10.0, 5.0, 5.0)),
+ (type = "box", coordinates_min = (-17.0, -2.0, -2.0),
+ coordinates_max = (-13.0, 2.0, 2.0)),
+ (type = "box", coordinates_min = (-17.0, -2.0, -2.0),
+ coordinates_max = (-13.0, 2.0, 2.0)))
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- refinement_patches=refinement_patches,
- n_cells_max=100_000,)
+ initial_refinement_level = 2,
+ refinement_patches = refinement_patches,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -82,41 +84,40 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 200
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=200,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 200,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorLöhner(semi,
- variable=Trixi.density)
+ variable = Trixi.density)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=1,
- med_level =0, med_threshold=0.1, # med_level = current level
- max_level =6, max_threshold=0.3)
+ base_level = 1,
+ med_level = 0, med_threshold = 0.1, # med_level = current level
+ max_level = 6, max_threshold = 0.3)
amr_callback = AMRCallback(semi, amr_controller,
- interval=3,
- adapt_initial_condition=false,
- adapt_initial_condition_only_refine=true)
+ interval = 3,
+ adapt_initial_condition = false,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.7)
+stepsize_callback = StepsizeCallback(cfl = 1.7)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
-stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(1.0e-4, 1.0e-4),
- variables=(Trixi.density, pressure))
+stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (1.0e-4, 1.0e-4),
+ variables = (Trixi.density, pressure))
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_convergence.jl b/examples/tree_3d_dgsem/elixir_euler_convergence.jl
index 2eeb280ae1f..170b292a42f 100644
--- a/examples/tree_3d_dgsem/elixir_euler_convergence.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_convergence.jl
@@ -9,19 +9,17 @@ equations = CompressibleEulerEquations3D(2.0)
initial_condition = initial_condition_eoc_test_coupled_euler_gravity
-solver = DGSEM(polydeg=3, surface_flux=flux_hll,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_hll,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_eoc_test_euler)
-
+ source_terms = source_terms_eoc_test_euler)
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,27 +30,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl b/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl
index dbf5747784c..4789b46dacc 100644
--- a/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_convergence_pure_fv.jl
@@ -9,19 +9,17 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralPureLGLFiniteVolume(flux_hllc))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralPureLGLFiniteVolume(flux_hllc))
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,27 +30,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl b/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl
index ee788321c66..cad8fc578c8 100644
--- a/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_density_pulse.jl
@@ -14,33 +14,31 @@ A Gaussian pulse in the density with constant velocity and pressure; reduces the
compressible Euler equations to the linear advection equations.
"""
function initial_condition_density_pulse(x, t, equations::CompressibleEulerEquations3D)
- rho = 1 + exp(-(x[1]^2 + x[2]^2 + x[3]^2))/2
- v1 = 1
- v2 = 1
- v3 = 1
- rho_v1 = rho * v1
- rho_v2 = rho * v2
- rho_v3 = rho * v3
- p = 1
- rho_e = p/(equations.gamma - 1) + 1/2 * rho * (v1^2 + v2^2 + v3^2)
- return SVector(rho, rho_v1, rho_v2, rho_v3, rho_e)
+ rho = 1 + exp(-(x[1]^2 + x[2]^2 + x[3]^2)) / 2
+ v1 = 1
+ v2 = 1
+ v3 = 1
+ rho_v1 = rho * v1
+ rho_v2 = rho * v2
+ rho_v3 = rho * v3
+ p = 1
+ rho_e = p / (equations.gamma - 1) + 1 / 2 * rho * (v1^2 + v2^2 + v3^2)
+ return SVector(rho, rho_v1, rho_v2, rho_v3, rho_e)
end
initial_condition = initial_condition_density_pulse
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0, -2.0)
-coordinates_max = ( 2.0, 2.0, 2.0)
+coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -50,30 +48,29 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_restart, save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_ec.jl b/examples/tree_3d_dgsem/elixir_euler_ec.jl
index 08fd1b998d5..88d7cbc7ba5 100644
--- a/examples/tree_3d_dgsem/elixir_euler_ec.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_ec.jl
@@ -10,19 +10,17 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0, -2.0)
-coordinates_max = ( 2.0, 2.0, 2.0)
+coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,27 +30,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_mortar.jl b/examples/tree_3d_dgsem/elixir_euler_mortar.jl
index c9fc2dfed50..cf103dc26cf 100644
--- a/examples/tree_3d_dgsem/elixir_euler_mortar.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_mortar.jl
@@ -8,22 +8,19 @@ using Trixi
equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
-refinement_patches = (
- (type="box", coordinates_min=(0.5, 0.5, 0.5), coordinates_max=(1.5, 1.5, 1.5)),
-)
+refinement_patches = ((type = "box", coordinates_min = (0.5, 0.5, 0.5),
+ coordinates_max = (1.5, 1.5, 1.5)),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- refinement_patches=refinement_patches,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -34,16 +31,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -53,7 +50,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl
index 3641878149a..87774ada266 100644
--- a/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_sedov_blast_wave.jl
@@ -19,34 +19,34 @@ based on
Should be used together with [`boundary_condition_sedov_self_gravity`](@ref).
"""
function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations3D)
- # Calculate radius as distance from origin
- r = sqrt(x[1]^2 + x[2]^2 + x[3]^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.25 # = 4.0 * smallest dx (for domain length=8 and max-ref=7)
- E = 1.0
- p_inner = (equations.gamma - 1) * E / (4/3 * pi * r0^3)
- p_ambient = 1e-5 # = true Sedov setup
-
- # Calculate primitive variables
- # use a logistic function to transfer density value smoothly
- L = 1.0 # maximum of function
- x0 = 1.0 # center point of function
- k = -50.0 # sharpness of transfer
- logistic_function_rho = L/(1.0 + exp(-k*(r - x0)))
- rho_ambient = 1e-5
- rho = max(logistic_function_rho, rho_ambient) # clip background density to not be so tiny
-
- # velocities are zero
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
-
- # use a logistic function to transfer pressure value smoothly
- logistic_function_p = p_inner/(1.0 + exp(-k*(r - r0)))
- p = max(logistic_function_p, p_ambient)
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ # Calculate radius as distance from origin
+ r = sqrt(x[1]^2 + x[2]^2 + x[3]^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.25 # = 4.0 * smallest dx (for domain length=8 and max-ref=7)
+ E = 1.0
+ p_inner = (equations.gamma - 1) * E / (4 / 3 * pi * r0^3)
+ p_ambient = 1e-5 # = true Sedov setup
+
+ # Calculate primitive variables
+ # use a logistic function to transfer density value smoothly
+ L = 1.0 # maximum of function
+ x0 = 1.0 # center point of function
+ k = -50.0 # sharpness of transfer
+ logistic_function_rho = L / (1.0 + exp(-k * (r - x0)))
+ rho_ambient = 1e-5
+ rho = max(logistic_function_rho, rho_ambient) # clip background density to not be so tiny
+
+ # velocities are zero
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+
+ # use a logistic function to transfer pressure value smoothly
+ logistic_function_p = p_inner / (1.0 + exp(-k * (r - r0)))
+ p = max(logistic_function_p, p_ambient)
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_sedov_self_gravity
@@ -64,26 +64,26 @@ based on
Should be used together with [`initial_condition_sedov_self_gravity`](@ref).
"""
function boundary_condition_sedov_self_gravity(u_inner, orientation, direction, x, t,
- surface_flux_function,
- equations::CompressibleEulerEquations3D)
- # velocities are zero, density/pressure are ambient values according to
- # initial_condition_sedov_self_gravity
- rho = 1e-5
- v1 = 0.0
- v2 = 0.0
- v3 = 0.0
- p = 1e-5
-
- u_boundary = prim2cons(SVector(rho, v1, v2, v3, p), equations)
-
- # Calculate boundary flux
- if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
- flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
- else # u_boundary is "left" of boundary, u_inner is "right" of boundary
- flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
- end
-
- return flux
+ surface_flux_function,
+ equations::CompressibleEulerEquations3D)
+ # velocities are zero, density/pressure are ambient values according to
+ # initial_condition_sedov_self_gravity
+ rho = 1e-5
+ v1 = 0.0
+ v2 = 0.0
+ v3 = 0.0
+ p = 1e-5
+
+ u_boundary = prim2cons(SVector(rho, v1, v2, v3, p), equations)
+
+ # Calculate boundary flux
+ if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
+ flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
+ else # u_boundary is "left" of boundary, u_inner is "right" of boundary
+ flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
+ end
+
+ return flux
end
boundary_conditions = boundary_condition_sedov_self_gravity
@@ -92,26 +92,24 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.7,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.7,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-4.0, -4.0, -4.0)
-coordinates_max = ( 4.0, 4.0, 4.0)
+coordinates_max = (4.0, 4.0, 4.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=1_000_000,
- periodicity=false)
-
+ initial_refinement_level = 2,
+ n_cells_max = 1_000_000,
+ periodicity = false)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -122,42 +120,41 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_max=1.0,
- alpha_min=0.0,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.0,
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=2,
- max_level =7, max_threshold=0.0003)
+ base_level = 2,
+ max_level = 7, max_threshold = 0.0003)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=0.35)
+stepsize_callback = StepsizeCallback(cfl = 0.35)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl b/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl
index 3015f6c50a4..0a90615016c 100644
--- a/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl
@@ -10,30 +10,28 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = flux_ranocha # OBS! Using a non-dissipative flux is only sensible to test EC,
- # but not for real shock simulations
+# but not for real shock simulations
volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0, -2.0)
-coordinates_max = ( 2.0, 2.0, 2.0)
+coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,27 +41,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.4)
+stepsize_callback = StepsizeCallback(cfl = 1.4)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl b/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl
index 3d338cd7f01..be31fbbc42c 100644
--- a/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_shockcapturing_amr.jl
@@ -10,30 +10,28 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = flux_ranocha # OBS! Using a non-dissipative flux is only sensible to test EC,
- # but not for real shock simulations
+# but not for real shock simulations
volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
coordinates_min = (-2.0, -2.0, -2.0)
-coordinates_max = ( 2.0, 2.0, 2.0)
+coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,41 +41,39 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
amr_indicator = IndicatorHennemannGassner(semi,
- alpha_smooth=false,
- variable=density_pressure)
+ alpha_smooth = false,
+ variable = density_pressure)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
- base_level=2,
- max_level =4, max_threshold=0.0003)
+ base_level = 2,
+ max_level = 4, max_threshold = 0.0003)
amr_callback = AMRCallback(semi, amr_controller,
- interval=1,
- adapt_initial_condition=true,
- adapt_initial_condition_only_refine=true)
+ interval = 1,
+ adapt_initial_condition = true,
+ adapt_initial_condition_only_refine = true)
-stepsize_callback = StepsizeCallback(cfl=1.3)
+stepsize_callback = StepsizeCallback(cfl = 1.3)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
amr_callback, stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
-
diff --git a/examples/tree_3d_dgsem/elixir_euler_source_terms.jl b/examples/tree_3d_dgsem/elixir_euler_source_terms.jl
index 3445e9fc433..f0246c30490 100644
--- a/examples/tree_3d_dgsem/elixir_euler_source_terms.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_source_terms.jl
@@ -9,19 +9,17 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,27 +30,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=0.6)
+stepsize_callback = StepsizeCallback(cfl = 0.6)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl
index 693f9ce9049..135ee673e44 100644
--- a/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl
+++ b/examples/tree_3d_dgsem/elixir_euler_taylor_green_vortex.jl
@@ -12,35 +12,37 @@ equations = CompressibleEulerEquations3D(1.4)
The classical inviscid Taylor-Green vortex.
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
- v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
- v3 = 0.0
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/16.0 * A^2 * rho * (cos(2*x[1])*cos(2*x[3]) + 2*cos(2*x[2]) + 2*cos(2*x[1]) + cos(2*x[2])*cos(2*x[3]))
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations3D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
+ v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
+ v3 = 0.0
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p +
+ 1.0 / 16.0 * A^2 * rho *
+ (cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
+ cos(2 * x[2]) * cos(2 * x[3]))
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0, -1.0) .* pi
-coordinates_max = ( 1.0, 1.0, 1.0) .* pi
+coordinates_max = (1.0, 1.0, 1.0) .* pi
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -50,27 +52,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.4)
+stepsize_callback = StepsizeCallback(cfl = 1.4)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl b/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl
index 6699ec9a4da..21ef661d0b6 100644
--- a/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl
+++ b/examples/tree_3d_dgsem/elixir_eulergravity_convergence.jl
@@ -15,12 +15,12 @@ solver_euler = DGSEM(polydeg, flux_hll)
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
-semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition, solver_euler,
- source_terms=source_terms_eoc_test_coupled_euler_gravity)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
+semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_condition,
+ solver_euler,
+ source_terms = source_terms_eoc_test_coupled_euler_gravity)
###############################################################################
# semidiscretization of the hyperbolic diffusion equations
@@ -28,22 +28,21 @@ equations_gravity = HyperbolicDiffusionEquations3D()
solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)
-semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition, solver_gravity,
- source_terms=source_terms_harmonic)
-
+semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_condition,
+ solver_gravity,
+ source_terms = source_terms_harmonic)
###############################################################################
# combining both semidiscretizations for Euler + self-gravity
-parameters = ParametersEulerGravity(background_density=2.0, # aka rho0
- gravitational_constant=1.0, # aka G
- cfl=1.5,
- resid_tol=1.0e-10,
- n_iterations_max=1000,
- timestep_gravity=timestep_gravity_erk52_3Sstar!)
+parameters = ParametersEulerGravity(background_density = 2.0, # aka rho0
+ gravitational_constant = 1.0, # aka G
+ cfl = 1.5,
+ resid_tol = 1.0e-10,
+ n_iterations_max = 1000,
+ timestep_gravity = timestep_gravity_erk52_3Sstar!)
semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
-
###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 0.5)
@@ -52,20 +51,20 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
- save_analysis=true)
+analysis_callback = AnalysisCallback(semi_euler, interval = analysis_interval,
+ save_analysis = true)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -74,11 +73,10 @@ callbacks = CallbackSet(summary_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
diff --git a/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl b/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl
index c7744ce23bd..7bba154a925 100644
--- a/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl
+++ b/examples/tree_3d_dgsem/elixir_hypdiff_lax_friedrichs.jl
@@ -8,53 +8,52 @@ using Trixi
equations = HyperbolicDiffusionEquations3D()
function initial_condition_poisson_periodic(x, t, equations::HyperbolicDiffusionEquations3D)
- # elliptic equation: -νΔϕ = f
- # depending on initial constant state, c, for phi this converges to the solution ϕ + c
- if iszero(t)
- phi = 0.0
- q1 = 0.0
- q2 = 0.0
- q3 = 0.0
- else
- phi = sin(2 * pi * x[1]) * sin(2 * pi * x[2]) * sin(2 * pi * x[3])
- q1 = 2 * pi * cos(2 * pi * x[1]) * sin(2 * pi * x[2]) * sin(2 * pi * x[3])
- q2 = 2 * pi * sin(2 * pi * x[1]) * cos(2 * pi * x[2]) * sin(2 * pi * x[3])
- q3 = 2 * pi * sin(2 * pi * x[1]) * sin(2 * pi * x[2]) * cos(2 * pi * x[3])
- end
- return SVector(phi, q1, q2, q3)
+ # elliptic equation: -νΔϕ = f
+ # depending on initial constant state, c, for phi this converges to the solution ϕ + c
+ if iszero(t)
+ phi = 0.0
+ q1 = 0.0
+ q2 = 0.0
+ q3 = 0.0
+ else
+ phi = sin(2 * pi * x[1]) * sin(2 * pi * x[2]) * sin(2 * pi * x[3])
+ q1 = 2 * pi * cos(2 * pi * x[1]) * sin(2 * pi * x[2]) * sin(2 * pi * x[3])
+ q2 = 2 * pi * sin(2 * pi * x[1]) * cos(2 * pi * x[2]) * sin(2 * pi * x[3])
+ q3 = 2 * pi * sin(2 * pi * x[1]) * sin(2 * pi * x[2]) * cos(2 * pi * x[3])
+ end
+ return SVector(phi, q1, q2, q3)
end
initial_condition = initial_condition_poisson_periodic
-@inline function source_terms_poisson_periodic(u, x, t, equations::HyperbolicDiffusionEquations3D)
- # elliptic equation: -νΔϕ = f
- # analytical solution: phi = sin(2πx)*sin(2πy) and f = -8νπ^2 sin(2πx)*sin(2πy)
- @unpack inv_Tr = equations
- C = -12 * equations.nu * pi^2
-
- x1, x2, x3 = x
- tmp1 = sinpi(2 * x1)
- tmp2 = sinpi(2 * x2)
- tmp3 = sinpi(2 * x3)
- du1 = -C*tmp1*tmp2*tmp3
- du2 = -inv_Tr * u[2]
- du3 = -inv_Tr * u[3]
- du4 = -inv_Tr * u[4]
-
- return SVector(du1, du2, du3, du4)
+@inline function source_terms_poisson_periodic(u, x, t,
+ equations::HyperbolicDiffusionEquations3D)
+ # elliptic equation: -νΔϕ = f
+ # analytical solution: phi = sin(2πx)*sin(2πy) and f = -8νπ^2 sin(2πx)*sin(2πy)
+ @unpack inv_Tr = equations
+ C = -12 * equations.nu * pi^2
+
+ x1, x2, x3 = x
+ tmp1 = sinpi(2 * x1)
+ tmp2 = sinpi(2 * x2)
+ tmp3 = sinpi(2 * x3)
+ du1 = -C * tmp1 * tmp2 * tmp3
+ du2 = -inv_Tr * u[2]
+ du3 = -inv_Tr * u[3]
+ du4 = -inv_Tr * u[4]
+
+ return SVector(du1, du2, du3, du4)
end
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (1.0, 1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=30_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 30_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_poisson_periodic)
-
+ source_terms = source_terms_poisson_periodic)
###############################################################################
# ODE solvers, callbacks etc.
@@ -65,20 +64,20 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 5.0e-12
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 200
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=2.4)
+stepsize_callback = StepsizeCallback(cfl = 2.4)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
@@ -89,6 +88,6 @@ callbacks = CallbackSet(summary_callback, steady_state_callback,
# run the simulation
sol = Trixi.solve(ode, Trixi.HypDiffN3Erk3Sstar52(),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl b/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl
index beefb22ea1e..831e01519b6 100644
--- a/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl
+++ b/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl
@@ -8,27 +8,25 @@ using Trixi
equations = HyperbolicDiffusionEquations3D()
initial_condition = initial_condition_poisson_nonperiodic
-boundary_conditions = (x_neg=boundary_condition_poisson_nonperiodic,
- x_pos=boundary_condition_poisson_nonperiodic,
- y_neg=boundary_condition_periodic,
- y_pos=boundary_condition_periodic,
- z_neg=boundary_condition_periodic,
- z_pos=boundary_condition_periodic)
+boundary_conditions = (x_neg = boundary_condition_poisson_nonperiodic,
+ x_pos = boundary_condition_poisson_nonperiodic,
+ y_neg = boundary_condition_periodic,
+ y_pos = boundary_condition_periodic,
+ z_neg = boundary_condition_periodic,
+ z_pos = boundary_condition_periodic)
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (1.0, 1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=30_000,
- periodicity=(false, true, true))
-
+ initial_refinement_level = 2,
+ n_cells_max = 30_000,
+ periodicity = (false, true, true))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_poisson_nonperiodic,
- boundary_conditions=boundary_conditions)
-
+ source_terms = source_terms_poisson_nonperiodic,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -39,31 +37,30 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
resid_tol = 1.0e-5
-steady_state_callback = SteadyStateCallback(abstol=resid_tol, reltol=0.0)
+steady_state_callback = SteadyStateCallback(abstol = resid_tol, reltol = 0.0)
analysis_interval = 200
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(entropy, energy_total))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (entropy, energy_total))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.8)
+stepsize_callback = StepsizeCallback(cfl = 1.8)
callbacks = CallbackSet(summary_callback, steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
sol = Trixi.solve(ode, Trixi.HypDiffN3Erk3Sstar52(),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_lbm_constant.jl b/examples/tree_3d_dgsem/elixir_lbm_constant.jl
index 269a0da2d50..ee38f62887d 100644
--- a/examples/tree_3d_dgsem/elixir_lbm_constant.jl
+++ b/examples/tree_3d_dgsem/elixir_lbm_constant.jl
@@ -5,22 +5,20 @@ using Trixi
###############################################################################
# semidiscretization of the Lattice-Boltzmann equations for the D3Q27 scheme
-equations = LatticeBoltzmannEquations3D(Ma=0.1, Re=Inf)
+equations = LatticeBoltzmannEquations3D(Ma = 0.1, Re = Inf)
initial_condition = initial_condition_constant
-solver = DGSEM(polydeg=3, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 3, surface_flux = flux_godunov)
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
+coordinates_max = (1.0, 1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000,)
-
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -30,19 +28,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=100,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 100,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2macroscopic)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2macroscopic)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
collision_callback = LBMCollisionCallback()
@@ -52,11 +50,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
collision_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl
index b3835eb1287..0980ee56be3 100644
--- a/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl
+++ b/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl
@@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the Lattice-Boltzmann equations for the D3Q27 scheme
L = 1.0 # reference length
-equations = LatticeBoltzmannEquations3D(Ma=0.1, Re=1600.0; L=L)
+equations = LatticeBoltzmannEquations3D(Ma = 0.1, Re = 1600.0; L = L)
"""
initial_condition_taylor_green_vortex(x, t, equations::LatticeBoltzmannEquations3D)
@@ -14,52 +14,51 @@ equations = LatticeBoltzmannEquations3D(Ma=0.1, Re=1600.0; L=L)
Initialize the flow field to the Taylor-Green vortex setup
"""
function initial_condition_taylor_green_vortex(x, t, equations::LatticeBoltzmannEquations3D)
- @unpack u0, rho0, L = equations
+ @unpack u0, rho0, L = equations
- v1 = u0 * sin(x[1] / L) * cos(x[2] / L) * cos(x[3] / L)
- v2 = -u0 * cos(x[1] / L) * sin(x[2] / L) * cos(x[3] / L)
- v3 = 0
- p0 = (pressure(rho0, equations) +
- rho0 * u0^2 / 16 * (cos(2 * x[1] / L) + cos(2 * x[2] / L)) * (cos(2 * x[3] / L) + 2))
- rho = density(p0, equations)
+ v1 = u0 * sin(x[1] / L) * cos(x[2] / L) * cos(x[3] / L)
+ v2 = -u0 * cos(x[1] / L) * sin(x[2] / L) * cos(x[3] / L)
+ v3 = 0
+ p0 = (pressure(rho0, equations) +
+ rho0 * u0^2 / 16 * (cos(2 * x[1] / L) + cos(2 * x[2] / L)) *
+ (cos(2 * x[3] / L) + 2))
+ rho = density(p0, equations)
- return equilibrium_distribution(rho, v1, v2, v3, equations)
+ return equilibrium_distribution(rho, v1, v2, v3, equations)
end
initial_condition = initial_condition_taylor_green_vortex
-solver = DGSEM(polydeg=3, surface_flux=flux_godunov)
+solver = DGSEM(polydeg = 3, surface_flux = flux_godunov)
-coordinates_min = (-pi*L, -pi*L, -pi*L)
-coordinates_max = ( pi*L, pi*L, pi*L)
+coordinates_min = (-pi * L, -pi * L, -pi * L)
+coordinates_max = (pi * L, pi * L, pi * L)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=5,
- n_cells_max=300_000,)
-
+ initial_refinement_level = 5,
+ n_cells_max = 300_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
-tspan = (0.0, 20*equations.L/equations.u0) # Final time is `20` in non-dimensional time
+tspan = (0.0, 20 * equations.L / equations.u0) # Final time is `20` in non-dimensional time
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 20
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(Trixi.energy_kinetic_nondimensional,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (Trixi.energy_kinetic_nondimensional,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2macroscopic)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2macroscopic)
-stepsize_callback = StepsizeCallback(cfl=0.3)
+stepsize_callback = StepsizeCallback(cfl = 0.3)
collision_callback = LBMCollisionCallback()
@@ -69,12 +68,11 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
collision_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks,
- save_start=false, alias_u0=true);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks,
+ save_start = false, alias_u0 = true);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl
index 191982bf2d6..9aab5e58788 100644
--- a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl
@@ -5,24 +5,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdEquations3D(5/3)
+equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_lax_friedrichs, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_lax_friedrichs, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
+coordinates_max = (1.0, 1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,18 +31,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.5
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -51,11 +50,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl
index e23f7ce5460..3ce166a7fa7 100644
--- a/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl
+++ b/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl
@@ -5,24 +5,22 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdEquations3D(5/3)
+equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
-refinement_patches = (
- (type="box", coordinates_min=(-0.5, -0.5, -0.5),
- coordinates_max=( 0.5, 0.5, 0.5)),
-)
+coordinates_max = (1.0, 1.0, 1.0)
+refinement_patches = ((type = "box", coordinates_min = (-0.5, -0.5, -0.5),
+ coordinates_max = (0.5, 0.5, 0.5)),)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- refinement_patches=refinement_patches,
- n_cells_max=10_000)
+ initial_refinement_level = 2,
+ refinement_patches = refinement_patches,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -35,18 +33,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -54,11 +52,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_mhd_ec.jl b/examples/tree_3d_dgsem/elixir_mhd_ec.jl
index 057ffcb031f..1f0088e82c9 100644
--- a/examples/tree_3d_dgsem/elixir_mhd_ec.jl
+++ b/examples/tree_3d_dgsem/elixir_mhd_ec.jl
@@ -10,19 +10,18 @@ equations = IdealGlmMhdEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=3, surface_flux=(flux_hindenlang_gassner, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3,
+ surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0, -2.0)
-coordinates_max = ( 2.0, 2.0, 2.0)
+coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
-
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -32,19 +31,19 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.4
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
@@ -52,11 +51,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl b/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
index 6b4f6e310ce..f8a72b6f452 100644
--- a/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
+++ b/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
@@ -10,25 +10,26 @@ equations = IdealGlmMhdEquations3D(1.4)
initial_condition = initial_condition_weak_blast_wave
surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
+volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
polydeg = 4
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
coordinates_min = (-2.0, -2.0, -2.0)
-coordinates_max = ( 2.0, 2.0, 2.0)
+coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=10_000)
+ initial_refinement_level = 3,
+ n_cells_max = 10_000)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -42,25 +43,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
cfl = 1.4
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl b/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl
index ebb0137a1bb..3ada9503c6a 100644
--- a/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl
+++ b/examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl
@@ -8,213 +8,215 @@ prandtl_number() = 0.72
mu() = 0.01
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(), Prandtl=prandtl_number(),
- gradient_variables=GradientVariablesPrimitive())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number(),
+ gradient_variables = GradientVariablesPrimitive())
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
-solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
- volume_integral=VolumeIntegralWeakForm())
+solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
+ volume_integral = VolumeIntegralWeakForm())
coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))
-coordinates_max = ( 1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
+coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))
# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- periodicity=(true, false, true),
- n_cells_max=50_000) # set maximum capacity of tree data structure
+ initial_refinement_level = 3,
+ periodicity = (true, false, true),
+ n_cells_max = 50_000) # set maximum capacity of tree data structure
# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion3D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion3D`)
# and by the initial condition (which passes in `CompressibleEulerEquations3D`).
# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
function initial_condition_navier_stokes_convergence_test(x, t, equations)
- # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) * cos(pi_t)
- v2 = v1
- v3 = v1
- p = rho^2
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+ # Constants. OBS! Must match those in `source_terms_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ v1 = A2 * sin(pi_x) * log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0))) * sin(pi_z) *
+ cos(pi_t)
+ v2 = v1
+ v3 = v1
+ p = rho^2
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
@inline function source_terms_navier_stokes_convergence_test(u, x, t, equations)
- # TODO: parabolic
- # we currently need to hardcode these parameters until we fix the "combined equation" issue
- # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
- inv_gamma_minus_one = inv(equations.gamma - 1)
- Pr = prandtl_number()
- mu_ = mu()
-
- # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
- c = 2.0
- A1 = 0.5
- A2 = 1.0
- A3 = 0.5
-
- # Convenience values for trig. functions
- pi_x = pi * x[1]
- pi_y = pi * x[2]
- pi_z = pi * x[3]
- pi_t = pi * t
-
- # Define auxiliary functions for the strange function of the y variable
- # to make expressions easier to read
- g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
- g_y = ( A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0))
- + (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0) )
- g_yy = ( 2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0)
- - (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2)
- - A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) )
-
- # Density and its derivatives
- rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
- rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
- rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
- rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
- rho_xx = -pi^2 * (rho - c)
- rho_yy = -pi^2 * (rho - c)
- rho_zz = -pi^2 * (rho - c)
-
- # Velocities and their derivatives
- # v1 terms
- v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
- v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
- v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_xx = -pi^2 * v1
- v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
- v1_zz = -pi^2 * v1
- v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
- v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
- v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
- # v2 terms (simplifies from ansatz)
- v2 = v1
- v2_t = v1_t
- v2_x = v1_x
- v2_y = v1_y
- v2_z = v1_z
- v2_xx = v1_xx
- v2_yy = v1_yy
- v2_zz = v1_zz
- v2_xy = v1_xy
- v2_yz = v1_yz
- # v3 terms (simplifies from ansatz)
- v3 = v1
- v3_t = v1_t
- v3_x = v1_x
- v3_y = v1_y
- v3_z = v1_z
- v3_xx = v1_xx
- v3_yy = v1_yy
- v3_zz = v1_zz
- v3_xz = v1_xz
- v3_yz = v1_yz
-
- # Pressure and its derivatives
- p = rho^2
- p_t = 2.0 * rho * rho_t
- p_x = 2.0 * rho * rho_x
- p_y = 2.0 * rho * rho_y
- p_z = 2.0 * rho * rho_z
-
- # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
- E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
- E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
- E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
- E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
- E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
-
- # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
- kappa = equations.gamma * inv_gamma_minus_one / Pr
- q_xx = kappa * rho_xx # kappa T_xx
- q_yy = kappa * rho_yy # kappa T_yy
- q_zz = kappa * rho_zz # kappa T_zz
-
- # Stress tensor and its derivatives (exploit symmetry)
- tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
- tau12 = v1_y + v2_x
- tau13 = v1_z + v3_x
- tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
- tau23 = v2_z + v3_y
- tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
-
- tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
- tau12_x = v1_xy + v2_xx
- tau13_x = v1_xz + v3_xx
-
- tau12_y = v1_yy + v2_xy
- tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
- tau23_y = v2_yz + v3_yy
-
- tau13_z = v1_zz + v3_xz
- tau23_z = v2_zz + v3_yz
- tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
-
- # Compute the source terms
- # Density equation
- du1 = ( rho_t + rho_x * v1 + rho * v1_x
- + rho_y * v2 + rho * v2_y
- + rho_z * v3 + rho * v3_z )
- # x-momentum equation
- du2 = ( rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
- + 2.0 * rho * v1 * v1_x
- + rho_y * v1 * v2
- + rho * v1_y * v2
- + rho * v1 * v2_y
- + rho_z * v1 * v3
- + rho * v1_z * v3
- + rho * v1 * v3_z
- - mu_ * (tau11_x + tau12_y + tau13_z) )
- # y-momentum equation
- du3 = ( rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
- + rho * v1_x * v2
- + rho * v1 * v2_x
- + rho_y * v2^2
- + 2.0 * rho * v2 * v2_y
- + rho_z * v2 * v3
- + rho * v2_z * v3
- + rho * v2 * v3_z
- - mu_ * (tau12_x + tau22_y + tau23_z) )
- # z-momentum equation
- du4 = ( rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
- + rho * v1_x * v3
- + rho * v1 * v3_x
- + rho_y * v2 * v3
- + rho * v2_y * v3
- + rho * v2 * v3_y
- + rho_z * v3^2
- + 2.0 * rho * v3 * v3_z
- - mu_ * (tau13_x + tau23_y + tau33_z) )
- # Total energy equation
- du5 = ( E_t + v1_x * (E + p) + v1 * (E_x + p_x)
- + v2_y * (E + p) + v2 * (E_y + p_y)
- + v3_z * (E + p) + v3 * (E_z + p_z)
- # stress tensor and temperature gradient from x-direction
- - mu_ * ( q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
- + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x)
- # stress tensor and temperature gradient terms from y-direction
- - mu_ * ( q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
- + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y)
- # stress tensor and temperature gradient terms from z-direction
- - mu_ * ( q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
- + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z) )
-
- return SVector(du1, du2, du3, du4, du5)
+ # TODO: parabolic
+ # we currently need to hardcode these parameters until we fix the "combined equation" issue
+ # see also https://github.com/trixi-framework/Trixi.jl/pull/1160
+ inv_gamma_minus_one = inv(equations.gamma - 1)
+ Pr = prandtl_number()
+ mu_ = mu()
+
+ # Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
+ c = 2.0
+ A1 = 0.5
+ A2 = 1.0
+ A3 = 0.5
+
+ # Convenience values for trig. functions
+ pi_x = pi * x[1]
+ pi_y = pi * x[2]
+ pi_z = pi * x[3]
+ pi_t = pi * t
+
+ # Define auxiliary functions for the strange function of the y variable
+ # to make expressions easier to read
+ g = log(x[2] + 2.0) * (1.0 - exp(-A3 * (x[2] - 1.0)))
+ g_y = (A3 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)) +
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / (x[2] + 2.0))
+ g_yy = (2.0 * A3 * exp(-A3 * (x[2] - 1.0)) / (x[2] + 2.0) -
+ (1.0 - exp(-A3 * (x[2] - 1.0))) / ((x[2] + 2.0)^2) -
+ A3^2 * log(x[2] + 2.0) * exp(-A3 * (x[2] - 1.0)))
+
+ # Density and its derivatives
+ rho = c + A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_t = -pi * A1 * sin(pi_x) * cos(pi_y) * sin(pi_z) * sin(pi_t)
+ rho_x = pi * A1 * cos(pi_x) * cos(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_y = -pi * A1 * sin(pi_x) * sin(pi_y) * sin(pi_z) * cos(pi_t)
+ rho_z = pi * A1 * sin(pi_x) * cos(pi_y) * cos(pi_z) * cos(pi_t)
+ rho_xx = -pi^2 * (rho - c)
+ rho_yy = -pi^2 * (rho - c)
+ rho_zz = -pi^2 * (rho - c)
+
+ # Velocities and their derivatives
+ # v1 terms
+ v1 = A2 * sin(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_t = -pi * A2 * sin(pi_x) * g * sin(pi_z) * sin(pi_t)
+ v1_x = pi * A2 * cos(pi_x) * g * sin(pi_z) * cos(pi_t)
+ v1_y = A2 * sin(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_z = pi * A2 * sin(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_xx = -pi^2 * v1
+ v1_yy = A2 * sin(pi_x) * g_yy * sin(pi_z) * cos(pi_t)
+ v1_zz = -pi^2 * v1
+ v1_xy = pi * A2 * cos(pi_x) * g_y * sin(pi_z) * cos(pi_t)
+ v1_xz = pi^2 * A2 * cos(pi_x) * g * cos(pi_z) * cos(pi_t)
+ v1_yz = pi * A2 * sin(pi_x) * g_y * cos(pi_z) * cos(pi_t)
+ # v2 terms (simplifies from ansatz)
+ v2 = v1
+ v2_t = v1_t
+ v2_x = v1_x
+ v2_y = v1_y
+ v2_z = v1_z
+ v2_xx = v1_xx
+ v2_yy = v1_yy
+ v2_zz = v1_zz
+ v2_xy = v1_xy
+ v2_yz = v1_yz
+ # v3 terms (simplifies from ansatz)
+ v3 = v1
+ v3_t = v1_t
+ v3_x = v1_x
+ v3_y = v1_y
+ v3_z = v1_z
+ v3_xx = v1_xx
+ v3_yy = v1_yy
+ v3_zz = v1_zz
+ v3_xz = v1_xz
+ v3_yz = v1_yz
+
+ # Pressure and its derivatives
+ p = rho^2
+ p_t = 2.0 * rho * rho_t
+ p_x = 2.0 * rho * rho_x
+ p_y = 2.0 * rho * rho_y
+ p_z = 2.0 * rho * rho_z
+
+ # Total energy and its derivatives; simiplifies from ansatz that v2 = v1 and v3 = v1
+ E = p * inv_gamma_minus_one + 1.5 * rho * v1^2
+ E_t = p_t * inv_gamma_minus_one + 1.5 * rho_t * v1^2 + 3.0 * rho * v1 * v1_t
+ E_x = p_x * inv_gamma_minus_one + 1.5 * rho_x * v1^2 + 3.0 * rho * v1 * v1_x
+ E_y = p_y * inv_gamma_minus_one + 1.5 * rho_y * v1^2 + 3.0 * rho * v1 * v1_y
+ E_z = p_z * inv_gamma_minus_one + 1.5 * rho_z * v1^2 + 3.0 * rho * v1 * v1_z
+
+ # Divergence of Fick's law ∇⋅∇q = kappa ∇⋅∇T; simplifies because p = rho², so T = p/rho = rho
+ kappa = equations.gamma * inv_gamma_minus_one / Pr
+ q_xx = kappa * rho_xx # kappa T_xx
+ q_yy = kappa * rho_yy # kappa T_yy
+ q_zz = kappa * rho_zz # kappa T_zz
+
+ # Stress tensor and its derivatives (exploit symmetry)
+ tau11 = 4.0 / 3.0 * v1_x - 2.0 / 3.0 * (v2_y + v3_z)
+ tau12 = v1_y + v2_x
+ tau13 = v1_z + v3_x
+ tau22 = 4.0 / 3.0 * v2_y - 2.0 / 3.0 * (v1_x + v3_z)
+ tau23 = v2_z + v3_y
+ tau33 = 4.0 / 3.0 * v3_z - 2.0 / 3.0 * (v1_x + v2_y)
+
+ tau11_x = 4.0 / 3.0 * v1_xx - 2.0 / 3.0 * (v2_xy + v3_xz)
+ tau12_x = v1_xy + v2_xx
+ tau13_x = v1_xz + v3_xx
+
+ tau12_y = v1_yy + v2_xy
+ tau22_y = 4.0 / 3.0 * v2_yy - 2.0 / 3.0 * (v1_xy + v3_yz)
+ tau23_y = v2_yz + v3_yy
+
+ tau13_z = v1_zz + v3_xz
+ tau23_z = v2_zz + v3_yz
+ tau33_z = 4.0 / 3.0 * v3_zz - 2.0 / 3.0 * (v1_xz + v2_yz)
+
+ # Compute the source terms
+ # Density equation
+ du1 = (rho_t + rho_x * v1 + rho * v1_x
+ + rho_y * v2 + rho * v2_y
+ + rho_z * v3 + rho * v3_z)
+ # x-momentum equation
+ du2 = (rho_t * v1 + rho * v1_t + p_x + rho_x * v1^2
+ + 2.0 * rho * v1 * v1_x
+ + rho_y * v1 * v2
+ + rho * v1_y * v2
+ + rho * v1 * v2_y
+ + rho_z * v1 * v3
+ + rho * v1_z * v3
+ + rho * v1 * v3_z -
+ mu_ * (tau11_x + tau12_y + tau13_z))
+ # y-momentum equation
+ du3 = (rho_t * v2 + rho * v2_t + p_y + rho_x * v1 * v2
+ + rho * v1_x * v2
+ + rho * v1 * v2_x
+ + rho_y * v2^2
+ + 2.0 * rho * v2 * v2_y
+ + rho_z * v2 * v3
+ + rho * v2_z * v3
+ + rho * v2 * v3_z -
+ mu_ * (tau12_x + tau22_y + tau23_z))
+ # z-momentum equation
+ du4 = (rho_t * v3 + rho * v3_t + p_z + rho_x * v1 * v3
+ + rho * v1_x * v3
+ + rho * v1 * v3_x
+ + rho_y * v2 * v3
+ + rho * v2_y * v3
+ + rho * v2 * v3_y
+ + rho_z * v3^2
+ + 2.0 * rho * v3 * v3_z -
+ mu_ * (tau13_x + tau23_y + tau33_z))
+ # Total energy equation
+ du5 = (E_t + v1_x * (E + p) + v1 * (E_x + p_x)
+ + v2_y * (E + p) + v2 * (E_y + p_y)
+ + v3_z * (E + p) + v3 * (E_z + p_z) -
+ # stress tensor and temperature gradient from x-direction
+ mu_ * (q_xx + v1_x * tau11 + v2_x * tau12 + v3_x * tau13
+ + v1 * tau11_x + v2 * tau12_x + v3 * tau13_x) -
+ # stress tensor and temperature gradient terms from y-direction
+ mu_ * (q_yy + v1_y * tau12 + v2_y * tau22 + v3_y * tau23
+ + v1 * tau12_y + v2 * tau22_y + v3 * tau23_y) -
+ # stress tensor and temperature gradient terms from z-direction
+ mu_ * (q_zz + v1_z * tau13 + v2_z * tau23 + v3_z * tau33
+ + v1 * tau13_z + v2 * tau23_z + v3 * tau33_z))
+
+ return SVector(du1, du2, du3, du4, du5)
end
initial_condition = initial_condition_navier_stokes_convergence_test
@@ -222,30 +224,33 @@ initial_condition = initial_condition_navier_stokes_convergence_test
# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
u = initial_condition_navier_stokes_convergence_test(x, t, equations)
- return SVector(u[2], u[3], u[4])
+ return SVector(u[2], u[3], u[4])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
-boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)
+boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
+ heat_bc_top_bottom)
# define inviscid boundary conditions
boundary_conditions = (; x_neg = boundary_condition_periodic,
- x_pos = boundary_condition_periodic,
- y_neg = boundary_condition_slip_wall,
- y_pos = boundary_condition_slip_wall,
- z_neg = boundary_condition_periodic,
- z_pos = boundary_condition_periodic)
+ x_pos = boundary_condition_periodic,
+ y_neg = boundary_condition_slip_wall,
+ y_pos = boundary_condition_slip_wall,
+ z_neg = boundary_condition_periodic,
+ z_pos = boundary_condition_periodic)
# define viscous boundary conditions
boundary_conditions_parabolic = (; x_neg = boundary_condition_periodic,
- x_pos = boundary_condition_periodic,
- y_neg = boundary_condition_top_bottom,
- y_pos = boundary_condition_top_bottom,
- z_neg = boundary_condition_periodic,
- z_pos = boundary_condition_periodic)
-
-semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
- boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
- source_terms=source_terms_navier_stokes_convergence_test)
+ x_pos = boundary_condition_periodic,
+ y_neg = boundary_condition_top_bottom,
+ y_pos = boundary_condition_top_bottom,
+ z_neg = boundary_condition_periodic,
+ z_pos = boundary_condition_periodic)
+
+semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
+ initial_condition, solver;
+ boundary_conditions = (boundary_conditions,
+ boundary_conditions_parabolic),
+ source_terms = source_terms_navier_stokes_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -255,16 +260,15 @@ tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
-alive_callback = AliveCallback(alive_interval=10)
+alive_callback = AliveCallback(alive_interval = 10)
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
-
diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
index 5556831a59d..65bd9aa133d 100644
--- a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
+++ b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl
@@ -10,8 +10,8 @@ prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600
equations = CompressibleEulerEquations3D(1.4)
-equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(),
- Prandtl=prandtl_number())
+equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
+ Prandtl = prandtl_number())
"""
initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
@@ -22,31 +22,34 @@ The classical viscous Taylor-Green vortex, as found for instance in
Simulation of the Compressible Taylor Green Vortex using High-Order Flux Reconstruction Schemes
[DOI: 10.2514/6.2014-3210](https://doi.org/10.2514/6.2014-3210)
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
- v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
- v3 = 0.0
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/16.0 * A^2 * rho * (cos(2*x[1])*cos(2*x[3]) + 2*cos(2*x[2]) + 2*cos(2*x[1]) + cos(2*x[2])*cos(2*x[3]))
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations3D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
+ v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
+ v3 = 0.0
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p +
+ 1.0 / 16.0 * A^2 * rho *
+ (cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
+ cos(2 * x[2]) * cos(2 * x[3]))
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=3, surface_flux=flux_hllc,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-1.0, -1.0, -1.0) .* pi
-coordinates_max = ( 1.0, 1.0, 1.0) .* pi
+coordinates_max = (1.0, 1.0, 1.0) .* pi
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=3,
- n_cells_max=100_000)
-
+ initial_refinement_level = 3,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver)
@@ -60,12 +63,13 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 50
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal,
- enstrophy))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal,
+ enstrophy))
-alive_callback = AliveCallback(analysis_interval=analysis_interval,)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -75,6 +79,6 @@ callbacks = CallbackSet(summary_callback,
# run the simulation
time_int_tol = 1e-8
-sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_fdsbp/elixir_advection_extended.jl b/examples/tree_3d_fdsbp/elixir_advection_extended.jl
index 241e0698649..22085a63510 100644
--- a/examples/tree_3d_fdsbp/elixir_advection_extended.jl
+++ b/examples/tree_3d_fdsbp/elixir_advection_extended.jl
@@ -13,22 +13,21 @@ equations = LinearScalarAdvectionEquation3D(advection_velocity)
initial_condition = initial_condition_convergence_test
D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
- derivative_order=1, accuracy_order=4,
- xmin=0.0, xmax=1.0, N=10)
+ derivative_order = 1, accuracy_order = 4,
+ xmin = 0.0, xmax = 1.0, N = 10)
solver = FDSBP(D_SBP,
- surface_integral=SurfaceIntegralStrongForm(flux_lax_friedrichs),
- volume_integral=VolumeIntegralStrongForm())
+ surface_integral = SurfaceIntegralStrongForm(flux_lax_friedrichs),
+ volume_integral = VolumeIntegralStrongForm())
coordinates_min = (-1.0, -1.0, -1.0)
-coordinates_max = ( 1.0, 1.0, 1.0)
+coordinates_max = (1.0, 1.0, 1.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=1,
- n_cells_max=30_000,
- periodicity=true)
+ initial_refinement_level = 1,
+ n_cells_max = 30_000,
+ periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -38,19 +37,18 @@ ode = semidiscretize(semi, tspan);
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(energy_total,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (energy_total,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-9, reltol=1.0e-9,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-9, reltol = 1.0e-9,
+ ode_default_options()..., callback = callbacks)
summary_callback()
diff --git a/examples/tree_3d_fdsbp/elixir_euler_convergence.jl b/examples/tree_3d_fdsbp/elixir_euler_convergence.jl
index 6aafa1b5cc1..aa5b231ee13 100644
--- a/examples/tree_3d_fdsbp/elixir_euler_convergence.jl
+++ b/examples/tree_3d_fdsbp/elixir_euler_convergence.jl
@@ -11,24 +11,23 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_steger_warming
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = (0.0, 0.0, 0.0)
coordinates_max = (2.0, 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=10_000)
+ initial_refinement_level = 2,
+ n_cells_max = 10_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
-
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -39,27 +38,26 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
-stepsize_callback = StepsizeCallback(cfl=1.1)
+stepsize_callback = StepsizeCallback(cfl = 1.1)
callbacks = CallbackSet(summary_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl b/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl
index d2495cff5cd..0354200ae42 100644
--- a/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl
+++ b/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl
@@ -14,40 +14,43 @@ equations = CompressibleEulerEquations3D(1.4)
The classical inviscid Taylor-Green vortex.
"""
-function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)
- A = 1.0 # magnitude of speed
- Ms = 0.1 # maximum Mach number
-
- rho = 1.0
- v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
- v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
- v3 = 0.0
- p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
- p = p + 1.0/16.0 * A^2 * rho * (cos(2*x[1])*cos(2*x[3]) + 2*cos(2*x[2]) + 2*cos(2*x[1]) + cos(2*x[2])*cos(2*x[3]))
-
- return prim2cons(SVector(rho, v1, v2, v3, p), equations)
+function initial_condition_taylor_green_vortex(x, t,
+ equations::CompressibleEulerEquations3D)
+ A = 1.0 # magnitude of speed
+ Ms = 0.1 # maximum Mach number
+
+ rho = 1.0
+ v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
+ v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
+ v3 = 0.0
+ p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
+ p = p +
+ 1.0 / 16.0 * A^2 * rho *
+ (cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
+ cos(2 * x[2]) * cos(2 * x[3]))
+
+ return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
- derivative_order=1,
- accuracy_order=4,
- xmin=-1.0, xmax=1.0,
- N=16)
+ derivative_order = 1,
+ accuracy_order = 4,
+ xmin = -1.0, xmax = 1.0,
+ N = 16)
flux_splitting = splitting_steger_warming
solver = FDSBP(D_upw,
- surface_integral=SurfaceIntegralUpwind(flux_splitting),
- volume_integral=VolumeIntegralUpwind(flux_splitting))
+ surface_integral = SurfaceIntegralUpwind(flux_splitting),
+ volume_integral = VolumeIntegralUpwind(flux_splitting))
coordinates_min = (-1.0, -1.0, -1.0) .* pi
-coordinates_max = ( 1.0, 1.0, 1.0) .* pi
+coordinates_max = (1.0, 1.0, 1.0) .* pi
mesh = TreeMesh(coordinates_min, coordinates_max,
- initial_refinement_level=2,
- n_cells_max=100_000)
+ initial_refinement_level = 2,
+ n_cells_max = 100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
-
###############################################################################
# ODE solvers, callbacks etc.
@@ -57,28 +60,27 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(energy_total,
- energy_kinetic,
- energy_internal,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback,
save_solution)
-
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks)
+sol = solve(ode, SSPRK43(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl
index 2f8228dffb8..8f8e867dca8 100644
--- a/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl
+++ b/examples/unstructured_2d_dgsem/elixir_acoustics_gauss_wall.jl
@@ -6,16 +6,18 @@ using Trixi
###############################################################################
# semidiscretization of the acoustic perturbation equations
-equations = AcousticPerturbationEquations2D(v_mean_global=(0.0, -0.5), c_mean_global=1.0,
- rho_mean_global=1.0)
+equations = AcousticPerturbationEquations2D(v_mean_global = (0.0, -0.5),
+ c_mean_global = 1.0,
+ rho_mean_global = 1.0)
# Create DG solver with polynomial degree = 4 and (local) Lax-Friedrichs/Rusanov flux
-solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 4, surface_flux = flux_lax_friedrichs)
# Create unstructured quadrilateral mesh from a file
default_mesh_file = joinpath(@__DIR__, "mesh_five_circles_in_circle.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/3c79baad6b4d73bb26ec6420b5d16f45/raw/22aefc4ec2107cf0bffc40e81dfbc52240c625b1/mesh_five_circles_in_circle.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/3c79baad6b4d73bb26ec6420b5d16f45/raw/22aefc4ec2107cf0bffc40e81dfbc52240c625b1/mesh_five_circles_in_circle.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = UnstructuredMesh2D(mesh_file)
@@ -27,27 +29,26 @@ A Gaussian pulse, used in the `gauss_wall` example elixir in combination with
[`boundary_condition_wall`](@ref). Uses the global mean values from `equations`.
"""
function initial_condition_gauss_wall(x, t, equations::AcousticPerturbationEquations2D)
- v1_prime = 0.0
- v2_prime = 0.0
- p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25)
+ v1_prime = 0.0
+ v2_prime = 0.0
+ p_prime = exp(-log(2) * (x[1]^2 + (x[2] - 25)^2) / 25)
- prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...)
+ prim = SVector(v1_prime, v2_prime, p_prime, global_mean_vars(equations)...)
- return prim2cons(prim, equations)
+ return prim2cons(prim, equations)
end
initial_condition = initial_condition_gauss_wall
-boundary_conditions = Dict( :OuterCircle => boundary_condition_slip_wall,
- :InnerCircle1 => boundary_condition_slip_wall,
- :InnerCircle2 => boundary_condition_slip_wall,
- :InnerCircle3 => boundary_condition_slip_wall,
- :InnerCircle4 => boundary_condition_slip_wall,
- :InnerCircle5 => boundary_condition_slip_wall )
+boundary_conditions = Dict(:OuterCircle => boundary_condition_slip_wall,
+ :InnerCircle1 => boundary_condition_slip_wall,
+ :InnerCircle2 => boundary_condition_slip_wall,
+ :InnerCircle3 => boundary_condition_slip_wall,
+ :InnerCircle4 => boundary_condition_slip_wall,
+ :InnerCircle5 => boundary_condition_slip_wall)
# A semidiscretization collects data structures and functions for the spatial discretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
-
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -61,10 +62,10 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=50, solution_variables=cons2state)
+save_solution = SaveSolutionCallback(interval = 50, solution_variables = cons2state)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
callbacks = CallbackSet(summary_callback, analysis_callback, save_solution)
@@ -73,7 +74,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, save_solution)
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
+ ode_default_options()..., callback = callbacks);
# Print the timer summary
summary_callback()
diff --git a/examples/unstructured_2d_dgsem/elixir_advection_basic.jl b/examples/unstructured_2d_dgsem/elixir_advection_basic.jl
index 274978d48b0..afef6c2c38f 100644
--- a/examples/unstructured_2d_dgsem/elixir_advection_basic.jl
+++ b/examples/unstructured_2d_dgsem/elixir_advection_basic.jl
@@ -12,22 +12,24 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
###############################################################################
# Get the DG approximation space
-solver = DGSEM(polydeg=6, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 6, surface_flux = flux_lax_friedrichs)
###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
###############################################################################
# create the semi discretization object
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
+ solver)
###############################################################################
# ODE solvers, callbacks etc.
@@ -40,22 +42,23 @@ ode = semidiscretize(semi, (0.0, 1.0));
summary_callback = SummaryCallback()
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
-analysis_callback = AnalysisCallback(semi, interval=100)
+analysis_callback = AnalysisCallback(semi, interval = 100)
# The SaveSolutionCallback allows to save the solution to a file in regular intervals
-save_solution = SaveSolutionCallback(interval=100,
- solution_variables=cons2prim)
+save_solution = SaveSolutionCallback(interval = 100,
+ solution_variables = cons2prim)
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
-stepsize_callback = StepsizeCallback(cfl=1.6)
+stepsize_callback = StepsizeCallback(cfl = 1.6)
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver
-callbacks = CallbackSet(summary_callback, analysis_callback, save_solution, stepsize_callback)
+callbacks = CallbackSet(summary_callback, analysis_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_basic.jl b/examples/unstructured_2d_dgsem/elixir_euler_basic.jl
index 9fbea47a9d5..cd6a1995757 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_basic.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_basic.jl
@@ -12,23 +12,24 @@ initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict( :Slant => boundary_condition_convergence_test,
- :Bezier => boundary_condition_convergence_test,
- :Right => boundary_condition_convergence_test,
- :Bottom => boundary_condition_convergence_test,
- :Top => boundary_condition_convergence_test )
+boundary_conditions = Dict(:Slant => boundary_condition_convergence_test,
+ :Bezier => boundary_condition_convergence_test,
+ :Right => boundary_condition_convergence_test,
+ :Bottom => boundary_condition_convergence_test,
+ :Top => boundary_condition_convergence_test)
###############################################################################
# Get the DG approximation space
-solver = DGSEM(polydeg=8, surface_flux=flux_lax_friedrichs)
+solver = DGSEM(polydeg = 8, surface_flux = flux_lax_friedrichs)
###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_trixi_unstructured_mesh_docs.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = UnstructuredMesh2D(mesh_file)
@@ -37,8 +38,8 @@ mesh = UnstructuredMesh2D(mesh_file)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms,
- boundary_conditions=boundary_conditions)
+ source_terms = source_terms,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -49,18 +50,18 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_restart = SaveRestartCallback(interval=50,
- save_final_restart=true)
+save_restart = SaveRestartCallback(interval = 50,
+ save_final_restart = true)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=0.9)
+stepsize_callback = StepsizeCallback(cfl = 0.9)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -72,7 +73,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_ec.jl b/examples/unstructured_2d_dgsem/elixir_euler_ec.jl
index 2725142fd17..0f53aa62a18 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_ec.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_ec.jl
@@ -6,7 +6,7 @@ using Trixi
###############################################################################
# semidiscretization of the compressible Euler equations
-equations = CompressibleEulerEquations2D(5/3)
+equations = CompressibleEulerEquations2D(5 / 3)
initial_condition = initial_condition_weak_blast_wave
@@ -14,18 +14,19 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
volume_flux = flux_ranocha
-solver = DGSEM(polydeg=6, surface_flux=flux_ranocha,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 6, surface_flux = flux_ranocha,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the curved quad mesh from a file
default_mesh_file = joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
###############################################################################
# create the semi discretization object
@@ -41,15 +42,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -60,7 +61,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl b/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl
index 36e119ab794..a2fec1a320a 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_free_stream.jl
@@ -11,25 +11,26 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_constant
boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition)
-boundary_conditions = Dict( :Body => boundary_condition_free_stream,
- :Button1 => boundary_condition_free_stream,
- :Button2 => boundary_condition_free_stream,
- :Eye1 => boundary_condition_free_stream,
- :Eye2 => boundary_condition_free_stream,
- :Smile => boundary_condition_free_stream,
- :Bowtie => boundary_condition_free_stream )
+boundary_conditions = Dict(:Body => boundary_condition_free_stream,
+ :Button1 => boundary_condition_free_stream,
+ :Button2 => boundary_condition_free_stream,
+ :Eye1 => boundary_condition_free_stream,
+ :Eye2 => boundary_condition_free_stream,
+ :Smile => boundary_condition_free_stream,
+ :Bowtie => boundary_condition_free_stream)
###############################################################################
# Get the DG approximation space
-solver = DGSEM(polydeg=6, surface_flux=flux_hll)
+solver = DGSEM(polydeg = 6, surface_flux = flux_hll)
###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_gingerbread_man.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/2c6440b5f8a57db131061ad7aa78ee2b/raw/1f89fdf2c874ff678c78afb6fe8dc784bdfd421f/mesh_gingerbread_man.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/2c6440b5f8a57db131061ad7aa78ee2b/raw/1f89fdf2c874ff678c78afb6fe8dc784bdfd421f/mesh_gingerbread_man.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = UnstructuredMesh2D(mesh_file)
@@ -38,7 +39,7 @@ mesh = UnstructuredMesh2D(mesh_file)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -49,15 +50,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -65,7 +66,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_periodic.jl b/examples/unstructured_2d_dgsem/elixir_euler_periodic.jl
index 796c99987a2..afd177f0740 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_periodic.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_periodic.jl
@@ -15,24 +15,25 @@ boundary_conditions = boundary_condition_periodic
###############################################################################
# Get the DG approximation space
-solver = DGSEM(polydeg=6, surface_flux=FluxRotated(flux_hll))
+solver = DGSEM(polydeg = 6, surface_flux = FluxRotated(flux_hll))
###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
###############################################################################
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms,
- boundary_conditions=boundary_conditions)
+ source_terms = source_terms,
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,14 +44,14 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)
###############################################################################
# run the simulation
-sol = solve(ode, SSPRK43(); ode_default_options()..., callback=callbacks);
+sol = solve(ode, SSPRK43(); ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_restart.jl b/examples/unstructured_2d_dgsem/elixir_euler_restart.jl
index 6653f8662d9..4d6af65b8a4 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_restart.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_restart.jl
@@ -7,7 +7,6 @@ using Trixi
trixi_include(@__MODULE__, joinpath(@__DIR__, "elixir_euler_basic.jl"))
-
###############################################################################
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
@@ -18,8 +17,8 @@ restart_filename = joinpath("out", "restart_000050.h5")
mesh = load_mesh(restart_filename)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms,
- boundary_conditions=boundary_conditions)
+ source_terms = source_terms,
+ boundary_conditions = boundary_conditions)
tspan = (load_time(restart_filename), 1.0)
dt = load_dt(restart_filename)
@@ -28,17 +27,15 @@ ode = semidiscretize(semi, tspan, restart_filename);
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
save_solution.condition.save_initial_solution = false
-integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=dt, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
# Get the last time index and work with that.
load_timestep!(integrator, restart_filename)
-
###############################################################################
# run the simulation
sol = solve!(integrator)
summary_callback() # print the timer summary
-
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl
index 570a2084691..e1cc0932969 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_sedov.jl
@@ -14,25 +14,25 @@ The Sedov blast wave setup based on Flash
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.0, 0.0)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
- r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
- E = 1.0
- p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
- p0_outer = 1.0e-5 # = true Sedov setup
-
- # Calculate primitive variables
- rho = 1.0
- v1 = 0.0
- v2 = 0.0
- p = r > r0 ? p0_outer : p0_inner
-
- return prim2cons(SVector(rho, v1, v2, p), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.0, 0.0)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
+ r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
+ E = 1.0
+ p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
+ p0_outer = 1.0e-5 # = true Sedov setup
+
+ # Calculate primitive variables
+ rho = 1.0
+ v1 = 0.0
+ v2 = 0.0
+ p = r > r0 ? p0_outer : p0_inner
+
+ return prim2cons(SVector(rho, v1, v2, p), equations)
end
initial_condition = initial_condition_sedov_blast_wave
@@ -43,23 +43,25 @@ volume_flux = flux_ranocha
polydeg = 6
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=1.0,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=density_pressure)
+ alpha_max = 1.0,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
# Get the curved quad mesh from a file
default_mesh_file = joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# create the semidiscretization
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -73,15 +75,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 300
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=300,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 300,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=0.5)
+stepsize_callback = StepsizeCallback(cfl = 0.5)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -92,7 +94,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl b/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl
index 5bfe1ae4e0e..b2abefe7eeb 100644
--- a/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl
+++ b/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl
@@ -10,40 +10,41 @@ equations = CompressibleEulerEquations2D(1.4)
@inline function uniform_flow_state(x, t, equations::CompressibleEulerEquations2D)
- # set the freestream flow parameters
- rho_freestream = 1.0
- u_freestream = 0.3
- p_freestream = inv(equations.gamma)
-
- theta = pi / 90.0 # analogous with a two degree angle of attack
- si, co = sincos(theta)
- v1 = u_freestream * co
- v2 = u_freestream * si
-
- prim = SVector(rho_freestream, v1, v2, p_freestream)
- return prim2cons(prim, equations)
+ # set the freestream flow parameters
+ rho_freestream = 1.0
+ u_freestream = 0.3
+ p_freestream = inv(equations.gamma)
+
+ theta = pi / 90.0 # analogous with a two degree angle of attack
+ si, co = sincos(theta)
+ v1 = u_freestream * co
+ v2 = u_freestream * si
+
+ prim = SVector(rho_freestream, v1, v2, p_freestream)
+ return prim2cons(prim, equations)
end
initial_condition = uniform_flow_state
boundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state)
-boundary_conditions = Dict( :Bottom => boundary_condition_uniform_flow,
- :Top => boundary_condition_uniform_flow,
- :Right => boundary_condition_uniform_flow,
- :Left => boundary_condition_uniform_flow,
- :Circle => boundary_condition_slip_wall )
+boundary_conditions = Dict(:Bottom => boundary_condition_uniform_flow,
+ :Top => boundary_condition_uniform_flow,
+ :Right => boundary_condition_uniform_flow,
+ :Left => boundary_condition_uniform_flow,
+ :Circle => boundary_condition_slip_wall)
###############################################################################
# Get the DG approximation space
-solver = DGSEM(polydeg=4, surface_flux=flux_hll)
+solver = DGSEM(polydeg = 4, surface_flux = flux_hll)
###############################################################################
# Get the curved quad mesh from a file
default_mesh_file = joinpath(@__DIR__, "mesh_box_around_circle.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8b9b11a1eedfa54b215c122c3d17b271/raw/0d2b5d98c87e67a6f384693a8b8e54b4c9fcbf3d/mesh_box_around_circle.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8b9b11a1eedfa54b215c122c3d17b271/raw/0d2b5d98c87e67a6f384693a8b8e54b4c9fcbf3d/mesh_box_around_circle.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = UnstructuredMesh2D(mesh_file)
@@ -52,7 +53,7 @@ mesh = UnstructuredMesh2D(mesh_file)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solvers, callbacks etc.
@@ -63,22 +64,23 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=10,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 10,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution, stepsize_callback)
+callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
+ stepsize_callback)
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl b/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl
index 6b31776b297..fdafed98c8d 100644
--- a/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl
+++ b/examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl
@@ -5,22 +5,23 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-gamma = 5/3
+gamma = 5 / 3
equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test
volume_flux = (flux_central, flux_nonconservative_powell)
-solver = DGSEM(polydeg=7, surface_flux=(flux_hll, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 7, surface_flux = (flux_hll, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -33,21 +34,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
-
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
+
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 0.9
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -56,11 +60,10 @@ callbacks = CallbackSet(summary_callback,
stepsize_callback,
glm_speed_callback)
-
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl
index d75079bb8d7..a40f92cac02 100644
--- a/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl
+++ b/examples/unstructured_2d_dgsem/elixir_mhd_ec.jl
@@ -6,40 +6,42 @@ using Trixi
###############################################################################
# semidiscretization of the compressible ideal GLM-MHD equations
-equations = IdealGlmMhdEquations2D(5/3)
+equations = IdealGlmMhdEquations2D(5 / 3)
function initial_condition_shifted_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)
- # Adapted MHD version of the weak blast wave from Hennemann & Gassner JCP paper 2020 (Sec. 6.3)
- # Shift blastwave to center of domain
- inicenter = (sqrt(2)/2, sqrt(2)/2)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
-
- # Calculate primitive variables
- rho = r > 0.5 ? 1.0 : 1.1691
- v1 = r > 0.5 ? 0.0 : 0.1882 * cos(phi)
- v2 = r > 0.5 ? 0.0 : 0.1882 * sin(phi)
- p = r > 0.5 ? 1.0 : 1.245
-
- return prim2cons(SVector(rho, v1, v2, 0.0, p, 1.0, 1.0, 1.0, 0.0), equations)
+ # Adapted MHD version of the weak blast wave from Hennemann & Gassner JCP paper 2020 (Sec. 6.3)
+ # Shift blastwave to center of domain
+ inicenter = (sqrt(2) / 2, sqrt(2) / 2)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+
+ # Calculate primitive variables
+ rho = r > 0.5 ? 1.0 : 1.1691
+ v1 = r > 0.5 ? 0.0 : 0.1882 * cos(phi)
+ v2 = r > 0.5 ? 0.0 : 0.1882 * sin(phi)
+ p = r > 0.5 ? 1.0 : 1.245
+
+ return prim2cons(SVector(rho, v1, v2, 0.0, p, 1.0, 1.0, 1.0, 0.0), equations)
end
initial_condition = initial_condition_shifted_weak_blast_wave
# Get the DG approximation space
volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
-solver = DGSEM(polydeg=6, surface_flux=(flux_hindenlang_gassner, flux_nonconservative_powell),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 6,
+ surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -53,21 +55,24 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(entropy, energy_total,
- energy_kinetic, energy_internal,
- energy_magnetic, cross_helicity))
-
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
-
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true,
- solution_variables=cons2prim)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (entropy, energy_total,
+ energy_kinetic,
+ energy_internal,
+ energy_magnetic,
+ cross_helicity))
+
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
+
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true,
+ solution_variables = cons2prim)
cfl = 1.0
-stepsize_callback = StepsizeCallback(cfl=cfl)
+stepsize_callback = StepsizeCallback(cfl = cfl)
-glm_speed_callback = GlmSpeedCallback(glm_scale=0.5, cfl=cfl)
+glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)
callbacks = CallbackSet(summary_callback,
analysis_callback,
@@ -79,7 +84,7 @@ callbacks = CallbackSet(summary_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_dirichlet.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_dirichlet.jl
index 044b2549b01..1148f25fae3 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_dirichlet.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_dirichlet.jl
@@ -7,47 +7,48 @@ using Trixi
# semidiscretization of the shallow water equations with a continuous
# bottom topography function (set in the initial conditions)
-equations = ShallowWaterEquations2D(gravity_constant=1.0, H0=3.0)
+equations = ShallowWaterEquations2D(gravity_constant = 1.0, H0 = 3.0)
# An initial condition with constant total water height and zero velocities to test well-balancedness.
function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
- x1, x2 = x
- b = ( 1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
- + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
+ x1, x2 = x
+ b = (1.5 / exp(0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2)))
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_well_balancedness
boundary_condition_constant = BoundaryConditionDirichlet(initial_condition)
-boundary_condition = Dict( :OuterCircle => boundary_condition_constant )
+boundary_condition = Dict(:OuterCircle => boundary_condition_constant)
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup is for the curved, split form well-balancedness testing
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_outer_circle.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/9beddd9cd00e2a0a15865129eeb24928/raw/be71e67fa48bc4e1e97f5f6cd77c3ed34c6ba9be/mesh_outer_circle.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/9beddd9cd00e2a0a15865129eeb24928/raw/be71e67fa48bc4e1e97f5f6cd77c3ed34c6ba9be/mesh_outer_circle.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = UnstructuredMesh2D(mesh_file)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition)
+ boundary_conditions = boundary_condition)
###############################################################################
# ODE solvers, callbacks, etc.
@@ -58,15 +59,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- save_analysis=true,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = true,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -74,6 +75,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-11, reltol=1.0e-11,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-11, reltol = 1.0e-11,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl
index 138b256c08b..8e9d396d826 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec.jl
@@ -7,7 +7,7 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
# Note, this initial condition is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_ec_discontinuous_bottom` below.
@@ -17,19 +17,21 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-solver = DGSEM(polydeg=6, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 6,
+ surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup is for the curved, split form entropy conservation testing (needs periodic BCs)
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -49,45 +51,48 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the specific mesh loaded above!
-function initial_condition_ec_discontinuous_bottom(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.7, 0.7)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Set the background values
- H = 3.25
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # setup the discontinuous water height and velocities
- if element_id == 10
- H = 4.0
- v1 = 0.1882 * cos_phi
- v2 = 0.1882 * sin_phi
- end
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_ec_discontinuous_bottom(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set up polar coordinates
+ inicenter = SVector(0.7, 0.7)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Set the background values
+ H = 3.25
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # setup the discontinuous water height and velocities
+ if element_id == 10
+ H = 4.0
+ v1 = 0.1882 * cos_phi
+ v2 = 0.1882 * sin_phi
+ end
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_ec_discontinuous_bottom(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_ec_discontinuous_bottom(x_node, first(tspan), element,
+ equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -96,15 +101,15 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -112,7 +117,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl
index ee3650f3bb5..94202b81df0 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_ec_shockcapturing.jl
@@ -7,7 +7,7 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
# Note, this initial condition is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_ec_discontinuous_bottom` below.
@@ -17,17 +17,17 @@ initial_condition = initial_condition_weak_blast_wave
# Get the DG approximation space
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
+volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
polydeg = 6
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
###############################################################################
@@ -35,11 +35,12 @@ solver = DGSEM(basis, surface_flux, volume_integral)
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -59,45 +60,48 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the specific mesh loaded above!
-function initial_condition_ec_discontinuous_bottom(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.7, 0.7)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
- phi = atan(y_norm, x_norm)
- sin_phi, cos_phi = sincos(phi)
-
- # Set the background values
- H = 3.25
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # setup the discontinuous water height and velocities
- if element_id == 10
- H = 4.0
- v1 = 0.1882 * cos_phi
- v2 = 0.1882 * sin_phi
- end
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_ec_discontinuous_bottom(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set up polar coordinates
+ inicenter = SVector(0.7, 0.7)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+ phi = atan(y_norm, x_norm)
+ sin_phi, cos_phi = sincos(phi)
+
+ # Set the background values
+ H = 3.25
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # setup the discontinuous water height and velocities
+ if element_id == 10
+ H = 4.0
+ v1 = 0.1882 * cos_phi
+ v2 = 0.1882 * sin_phi
+ end
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_ec_discontinuous_bottom(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_ec_discontinuous_bottom(x_node, first(tspan), element,
+ equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -106,11 +110,11 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback,
stepsize_callback)
@@ -118,7 +122,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback,
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_source_terms.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_source_terms.jl
index e0b64802ff8..07668688406 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_source_terms.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_source_terms.jl
@@ -7,7 +7,7 @@ using Trixi
# semidiscretization of the shallow water equations with a periodic
# bottom topography function (set in the initial conditions)
-equations = ShallowWaterEquations2D(gravity_constant=9.81)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81)
initial_condition = initial_condition_convergence_test
@@ -16,23 +16,24 @@ initial_condition = initial_condition_convergence_test
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=6, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 6, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup is for the curved, split form convergence test on a periodic domain
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,15 +44,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -59,7 +60,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl
index 65b0fcae462..6164f9d4a55 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_three_mound_dam_break.jl
@@ -8,10 +8,8 @@ using Trixi
#
# TODO: TrixiShallowWater: wet/dry example elixir
-
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=1.875,
- threshold_limiter=1e-12, threshold_wet=1e-14)
-
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 1.875,
+ threshold_limiter = 1e-12, threshold_wet = 1e-14)
"""
initial_condition_three_mounds(x, t, equations::ShallowWaterEquations2D)
@@ -28,66 +26,68 @@ The initial conditions is taken from Section 6.3 of the paper:
"""
function initial_condition_three_mounds(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
- v1 = 0.0
- v2 = 0.0
+ # Set the background values
+ v1 = 0.0
+ v2 = 0.0
- x1, x2 = x
- M_1 = 1 - 0.1 * sqrt( (x1 - 30.0)^2 + (x2 - 22.5)^2 )
- M_2 = 1 - 0.1 * sqrt( (x1 - 30.0)^2 + (x2 - 7.5)^2 )
- M_3 = 2.8 - 0.28 * sqrt( (x1 - 47.5)^2 + (x2 - 15.0)^2 )
+ x1, x2 = x
+ M_1 = 1 - 0.1 * sqrt((x1 - 30.0)^2 + (x2 - 22.5)^2)
+ M_2 = 1 - 0.1 * sqrt((x1 - 30.0)^2 + (x2 - 7.5)^2)
+ M_3 = 2.8 - 0.28 * sqrt((x1 - 47.5)^2 + (x2 - 15.0)^2)
- b = max(0.0, M_1, M_2, M_3)
+ b = max(0.0, M_1, M_2, M_3)
- # use a logistic function to transfer water height value smoothly
- L = equations.H0 # maximum of function
- x0 = 8 # center point of function
- k = -75.0 # sharpness of transfer
+ # use a logistic function to transfer water height value smoothly
+ L = equations.H0 # maximum of function
+ x0 = 8 # center point of function
+ k = -75.0 # sharpness of transfer
- H = max(b, L / (1.0 + exp(-k * (x1 - x0))))
+ H = max(b, L / (1.0 + exp(-k * (x1 - x0))))
- # Avoid division by zero by adjusting the initial condition with a small dry state threshold
- # that defaults to 500*eps() ≈ 1e-13 in double precision and is set in the constructor above
- # for the ShallowWaterEquations struct.
- H = max(H, b + equations.threshold_limiter)
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Avoid division by zero by adjusting the initial condition with a small dry state threshold
+ # that defaults to 500*eps() ≈ 1e-13 in double precision and is set in the constructor above
+ # for the ShallowWaterEquations struct.
+ H = max(H, b + equations.threshold_limiter)
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_three_mounds
function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, x, t,
- surface_flux_function, equations::ShallowWaterEquations2D)
- # Impulse and bottom from inside, height from external state
- u_outer = SVector(equations.threshold_wet, u_inner[2], u_inner[3], u_inner[4])
+ surface_flux_function,
+ equations::ShallowWaterEquations2D)
+ # Impulse and bottom from inside, height from external state
+ u_outer = SVector(equations.threshold_wet, u_inner[2], u_inner[3], u_inner[4])
- # calculate the boundary flux
- flux = surface_flux_function(u_inner, u_outer, normal_direction, equations)
+ # calculate the boundary flux
+ flux = surface_flux_function(u_inner, u_outer, normal_direction, equations)
- return flux
+ return flux
end
-boundary_conditions = Dict( :Bottom => boundary_condition_slip_wall,
- :Top => boundary_condition_slip_wall,
- :Right => boundary_condition_outflow,
- :Left => boundary_condition_slip_wall )
+boundary_conditions = Dict(:Bottom => boundary_condition_slip_wall,
+ :Top => boundary_condition_slip_wall,
+ :Right => boundary_condition_outflow,
+ :Left => boundary_condition_slip_wall)
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle, hydrostatic_reconstruction_chen_noelle),
+surface_flux = (FluxHydrostaticReconstruction(flux_hll_chen_noelle,
+ hydrostatic_reconstruction_chen_noelle),
flux_nonconservative_chen_noelle)
basis = LobattoLegendreBasis(4)
indicator_sc = IndicatorHennemannGassnerShallowWater(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=waterheight_pressure)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)
@@ -96,8 +96,9 @@ solver = DGSEM(basis, surface_flux, volume_integral)
default_meshfile = joinpath(@__DIR__, "mesh_three_mound.mesh")
-isfile(default_meshfile) || download("https://gist.githubusercontent.com/svengoldberg/c3c87fecb3fc6e46be7f0d1c7cb35f83/raw/e817ecd9e6c4686581d63c46128f9b6468d396d3/mesh_three_mound.mesh",
- default_meshfile)
+isfile(default_meshfile) ||
+ download("https://gist.githubusercontent.com/svengoldberg/c3c87fecb3fc6e46be7f0d1c7cb35f83/raw/e817ecd9e6c4686581d63c46128f9b6468d396d3/mesh_three_mound.mesh",
+ default_meshfile)
meshfile = default_meshfile
@@ -105,7 +106,7 @@ mesh = UnstructuredMesh2D(meshfile)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
- boundary_conditions=boundary_conditions)
+ boundary_conditions = boundary_conditions)
###############################################################################
# ODE solver
@@ -119,21 +120,21 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
###############################################################################
# run the simulation
-stage_limiter! = PositivityPreservingLimiterShallowWater(variables=(Trixi.waterheight,))
+stage_limiter! = PositivityPreservingLimiterShallowWater(variables = (Trixi.waterheight,))
sol = solve(ode, SSPRK43(stage_limiter!);
- ode_default_options()..., callback=callbacks);
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl
index d9e71e4aa44..2cab68b1cb5 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_convergence.jl
@@ -7,7 +7,8 @@ using Trixi
# Semidiscretization of the two-layer shallow water equations with a periodic
# bottom topography function (set in the initial conditions)
-equations = ShallowWaterTwoLayerEquations2D(gravity_constant=10.0, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 10.0, rho_upper = 0.9,
+ rho_lower = 1.0)
initial_condition = initial_condition_convergence_test
@@ -16,23 +17,24 @@ initial_condition = initial_condition_convergence_test
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=6, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 6, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup is for the curved, split form convergence test on a periodic domain
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# Create the semidiscretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- source_terms=source_terms_convergence_test)
+ source_terms = source_terms_convergence_test)
###############################################################################
# ODE solvers, callbacks etc.
@@ -43,15 +45,15 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval)
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=500,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 500,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -59,7 +61,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl
index 4295f93b342..9d70e9287cf 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_dam_break.jl
@@ -7,62 +7,64 @@ using Trixi
# Semidiscretization of the two-layer shallow water equations for a dam break test with a
# discontinuous bottom topography function to test energy conservation
-equations = ShallowWaterTwoLayerEquations2D(gravity_constant=1.0, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 1.0, rho_upper = 0.9,
+ rho_lower = 1.0)
# This test case uses a special work around to setup a truly discontinuous bottom topography
# function and initial condition for this academic testcase of entropy conservation. First, a
# dummy initial_condition_dam_break is introduced to create the semidiscretization. Then the initial
# condition is reset with the true discontinuous values from initial_condition_discontinuous_dam_break.
-function initial_condition_dam_break(x, t,equations::ShallowWaterTwoLayerEquations2D)
- if x[1] < sqrt(2)/2
- H_upper = 1.0
- H_lower = 0.6
- b = 0.1
- else
- H_upper = 0.9
- H_lower = 0.5
- b = 0.0
- end
-
- v1_upper = 0.0
- v2_upper = 0.0
- v1_lower = 0.0
- v2_lower = 0.0
- return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations)
+function initial_condition_dam_break(x, t, equations::ShallowWaterTwoLayerEquations2D)
+ if x[1] < sqrt(2) / 2
+ H_upper = 1.0
+ H_lower = 0.6
+ b = 0.1
+ else
+ H_upper = 0.9
+ H_lower = 0.5
+ b = 0.0
+ end
+
+ v1_upper = 0.0
+ v2_upper = 0.0
+ v1_lower = 0.0
+ v2_lower = 0.0
+ return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b),
+ equations)
end
initial_condition = initial_condition_dam_break
boundary_condition_constant = BoundaryConditionDirichlet(initial_condition_dam_break)
-
###############################################################################
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux= (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=6, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
+solver = DGSEM(polydeg = 6, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=false)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = false)
# Boundary conditions
-boundary_condition = Dict(:Top => boundary_condition_slip_wall,
- :Left => boundary_condition_slip_wall,
- :Right => boundary_condition_slip_wall,
+boundary_condition = Dict(:Top => boundary_condition_slip_wall,
+ :Left => boundary_condition_slip_wall,
+ :Right => boundary_condition_slip_wall,
:Bottom => boundary_condition_slip_wall)
# Create the semi discretization object
-semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition,
- solver, boundary_conditions=boundary_condition)
+semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition,
+ solver, boundary_conditions = boundary_condition)
###############################################################################
# ODE solver
@@ -79,58 +81,63 @@ ode = semidiscretize(semi, tspan)
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the specific mesh loaded above!
-function initial_condition_discontinuous_dam_break(x, t, element_id,
+function initial_condition_discontinuous_dam_break(x, t, element_id,
equations::ShallowWaterTwoLayerEquations2D)
- # Constant values
- v1_upper = 0.0
- v2_upper = 0.0
- v1_lower = 0.0
- v2_lower = 0.0
-
- # Left side of discontinuity
- IDs = [1, 2, 5, 6, 9, 10, 13, 14]
- if element_id in IDs
- H_upper = 1.0
- H_lower = 0.6
- b = 0.0
- # Right side of discontinuity
- else
- H_upper = 0.9
- H_lower = 0.5
- b = 0.1
- end
-
- return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations)
+ # Constant values
+ v1_upper = 0.0
+ v2_upper = 0.0
+ v1_lower = 0.0
+ v2_lower = 0.0
+
+ # Left side of discontinuity
+ IDs = [1, 2, 5, 6, 9, 10, 13, 14]
+ if element_id in IDs
+ H_upper = 1.0
+ H_lower = 0.6
+ b = 0.0
+ # Right side of discontinuity
+ else
+ H_upper = 0.9
+ H_lower = 0.5
+ b = 0.1
+ end
+
+ return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b),
+ equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_discontinuous_dam_break(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_discontinuous_dam_break(x_node, first(tspan), element,
+ equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
-
###############################################################################
# Callbacks
summary_callback = SummaryCallback()
analysis_interval = 500
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,save_analysis=false,
- extra_analysis_integrals=(energy_total, energy_kinetic, energy_internal,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_total,
+ energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=500,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 500,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -138,7 +145,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
index 40bc9f2ab42..35b027c3a81 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_twolayer_well_balanced.jl
@@ -7,22 +7,25 @@ using Trixi
# Semidiscretization of the two-layer shallow water equations with a discontinuous bottom
# topography to test well-balancedness
-equations = ShallowWaterTwoLayerEquations2D(gravity_constant=1.0, H0=0.6, rho_upper=0.9, rho_lower=1.0)
+equations = ShallowWaterTwoLayerEquations2D(gravity_constant = 1.0, H0 = 0.6,
+ rho_upper = 0.9, rho_lower = 1.0)
# An initial condition with constant total water height, zero velocities and a bottom topography to
# test well-balancedness
function initial_condition_well_balanced(x, t, equations::ShallowWaterTwoLayerEquations2D)
- H_lower = 0.5
- H_upper = 0.6
- v1_upper = 0.0
- v2_upper = 0.0
- v1_lower = 0.0
- v2_lower = 0.0
-
- # Bottom Topography
- b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ? 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] +
- -0.5)^2)) + 1) : 0.0)
- return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b), equations)
+ H_lower = 0.5
+ H_upper = 0.6
+ v1_upper = 0.0
+ v2_upper = 0.0
+ v1_lower = 0.0
+ v2_lower = 0.0
+
+ # Bottom Topography
+ b = (((x[1] - 0.5)^2 + (x[2] - 0.5)^2) < 0.04 ?
+ 0.2 * (cos(4 * pi * sqrt((x[1] - 0.5)^2 + (x[2] +
+ -0.5)^2)) + 1) : 0.0)
+ return prim2cons(SVector(H_upper, v1_upper, v2_upper, H_lower, v1_lower, v2_lower, b),
+ equations)
end
initial_condition = initial_condition_well_balanced
@@ -32,19 +35,20 @@ initial_condition = initial_condition_well_balanced
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=6, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+solver = DGSEM(polydeg = 6, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup is for the curved, split form well-balancedness testing
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -58,16 +62,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-stepsize_callback = StepsizeCallback(cfl=1.0)
+stepsize_callback = StepsizeCallback(cfl = 1.0)
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -75,7 +79,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl
index 4700724c520..76b9642d595 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_wall_bc_shockcapturing.jl
@@ -7,63 +7,66 @@ using Trixi
# semidiscretization of the shallow water equations with a continuous
# bottom topography function
-equations = ShallowWaterEquations2D(gravity_constant=9.812, H0=2.0)
+equations = ShallowWaterEquations2D(gravity_constant = 9.812, H0 = 2.0)
function initial_condition_stone_throw(x, t, equations::ShallowWaterEquations2D)
- # Set up polar coordinates
- inicenter = SVector(0.15, 0.15)
- x_norm = x[1] - inicenter[1]
- y_norm = x[2] - inicenter[2]
- r = sqrt(x_norm^2 + y_norm^2)
-
- # Calculate primitive variables
- H = equations.H0
- v1 = r < 0.6 ? 2.0 : 0.0
- v2 = r < 0.6 ? -2.0 : 0.0
- # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
- x1, x2 = x
- b = ( 1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
- + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Set up polar coordinates
+ inicenter = SVector(0.15, 0.15)
+ x_norm = x[1] - inicenter[1]
+ y_norm = x[2] - inicenter[2]
+ r = sqrt(x_norm^2 + y_norm^2)
+
+ # Calculate primitive variables
+ H = equations.H0
+ v1 = r < 0.6 ? 2.0 : 0.0
+ v2 = r < 0.6 ? -2.0 : 0.0
+ # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
+ x1, x2 = x
+ b = (1.5 / exp(0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2)))
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_stone_throw
-boundary_condition = Dict( :OuterCircle => boundary_condition_slip_wall )
+boundary_condition = Dict(:OuterCircle => boundary_condition_slip_wall)
###############################################################################
# Get the DG approximation space
-surface_flux=(FluxHydrostaticReconstruction(flux_hll, hydrostatic_reconstruction_audusse_etal),
- flux_nonconservative_audusse_etal)
+surface_flux = (FluxHydrostaticReconstruction(flux_hll,
+ hydrostatic_reconstruction_audusse_etal),
+ flux_nonconservative_audusse_etal)
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
polydeg = 6
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
- alpha_max=0.5,
- alpha_min=0.001,
- alpha_smooth=true,
- variable=Trixi.waterheight)
+ alpha_max = 0.5,
+ alpha_min = 0.001,
+ alpha_smooth = true,
+ variable = Trixi.waterheight)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
- volume_flux_dg=volume_flux,
- volume_flux_fv=surface_flux)
+ volume_flux_dg = volume_flux,
+ volume_flux_fv = surface_flux)
-solver = DGSEM(polydeg=polydeg, surface_flux=surface_flux, volume_integral=volume_integral)
+solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
+ volume_integral = volume_integral)
###############################################################################
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_outer_circle.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/9beddd9cd00e2a0a15865129eeb24928/raw/be71e67fa48bc4e1e97f5f6cd77c3ed34c6ba9be/mesh_outer_circle.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/9beddd9cd00e2a0a15865129eeb24928/raw/be71e67fa48bc4e1e97f5f6cd77c3ed34c6ba9be/mesh_outer_circle.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
mesh = UnstructuredMesh2D(mesh_file)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
- boundary_conditions=boundary_condition)
+ boundary_conditions = boundary_condition)
###############################################################################
# ODE solvers, callbacks, etc.
@@ -74,15 +77,16 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_interval = 100
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
- extra_analysis_integrals=(energy_kinetic,
- energy_internal))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ save_analysis = false,
+ extra_analysis_integrals = (energy_kinetic,
+ energy_internal))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=100,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 100,
+ save_initial_solution = true,
+ save_final_solution = true)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution)
@@ -90,6 +94,6 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
# run the simulation
# use a Runge-Kutta method with automatic (error based) time step size control
-sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-8, reltol=1.0e-8,
- ode_default_options()..., callback=callbacks);
+sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8,
+ ode_default_options()..., callback = callbacks);
summary_callback() # print the timer summary
diff --git a/examples/unstructured_2d_dgsem/elixir_shallowwater_well_balanced.jl b/examples/unstructured_2d_dgsem/elixir_shallowwater_well_balanced.jl
index 645f985d10d..bf4d0be682a 100644
--- a/examples/unstructured_2d_dgsem/elixir_shallowwater_well_balanced.jl
+++ b/examples/unstructured_2d_dgsem/elixir_shallowwater_well_balanced.jl
@@ -7,21 +7,21 @@ using Trixi
# semidiscretization of the shallow water equations with a discontinuous
# bottom topography function (set in the initial conditions)
-equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=3.0)
+equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 3.0)
# An initial condition with constant total water height and zero velocities to test well-balancedness.
# Note, this routine is used to compute errors in the analysis callback but the initialization is
# overwritten by `initial_condition_discontinuous_well_balancedness` below.
function initial_condition_well_balancedness(x, t, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
- x1, x2 = x
- b = ( 1.5 / exp( 0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2) )
- + 0.75 / exp( 0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2) ) )
- return prim2cons(SVector(H, v1, v2, b), equations)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ # bottom topography taken from Pond.control in [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
+ x1, x2 = x
+ b = (1.5 / exp(0.5 * ((x1 - 1.0)^2 + (x2 - 1.0)^2)) +
+ 0.75 / exp(0.5 * ((x1 + 1.0)^2 + (x2 + 1.0)^2)))
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
initial_condition = initial_condition_well_balancedness
@@ -30,20 +30,21 @@ initial_condition = initial_condition_well_balancedness
# Get the DG approximation space
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
-surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
-solver = DGSEM(polydeg=6, surface_flux=surface_flux,
- volume_integral=VolumeIntegralFluxDifferencing(volume_flux))
+surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
+solver = DGSEM(polydeg = 6, surface_flux = surface_flux,
+ volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
###############################################################################
# This setup is for the curved, split form well-balancedness testing
# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "mesh_alfven_wave_with_twist_and_flip.mesh")
-isfile(default_mesh_file) || download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
- default_mesh_file)
+isfile(default_mesh_file) ||
+ download("https://gist.githubusercontent.com/andrewwinters5000/8f8cd23df27fcd494553f2a89f3c1ba4/raw/85e3c8d976bbe57ca3d559d653087b0889535295/mesh_alfven_wave_with_twist_and_flip.mesh",
+ default_mesh_file)
mesh_file = default_mesh_file
-mesh = UnstructuredMesh2D(mesh_file, periodicity=true)
+mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
@@ -64,30 +65,33 @@ ode = semidiscretize(semi, tspan)
# In contrast to the usual signature of initial conditions, this one get passed the
# `element_id` explicitly. In particular, this initial conditions works as intended
# only for the specific mesh loaded above!
-function initial_condition_discontinuous_well_balancedness(x, t, element_id, equations::ShallowWaterEquations2D)
- # Set the background values
- H = equations.H0
- v1 = 0.0
- v2 = 0.0
- b = 0.0
-
- # Setup a discontinuous bottom topography using the element id number
- if element_id == 7
- b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
- end
-
- return prim2cons(SVector(H, v1, v2, b), equations)
+function initial_condition_discontinuous_well_balancedness(x, t, element_id,
+ equations::ShallowWaterEquations2D)
+ # Set the background values
+ H = equations.H0
+ v1 = 0.0
+ v2 = 0.0
+ b = 0.0
+
+ # Setup a discontinuous bottom topography using the element id number
+ if element_id == 7
+ b = 2.0 + 0.5 * sin(2.0 * pi * x[1]) + 0.5 * cos(2.0 * pi * x[2])
+ end
+
+ return prim2cons(SVector(H, v1, v2, b), equations)
end
# point to the data we want to augment
u = Trixi.wrap_array(ode.u0, semi)
# reset the initial condition
for element in eachelement(semi.solver, semi.cache)
- for j in eachnode(semi.solver), i in eachnode(semi.solver)
- x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations, semi.solver, i, j, element)
- u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan), element, equations)
- Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
- end
+ for j in eachnode(semi.solver), i in eachnode(semi.solver)
+ x_node = Trixi.get_node_coords(semi.cache.elements.node_coordinates, equations,
+ semi.solver, i, j, element)
+ u_node = initial_condition_discontinuous_well_balancedness(x_node, first(tspan),
+ element, equations)
+ Trixi.set_node_vars!(u, u_node, equations, semi.solver, i, j, element)
+ end
end
###############################################################################
@@ -96,16 +100,16 @@ end
summary_callback = SummaryCallback()
analysis_interval = 1000
-analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
- extra_analysis_integrals=(lake_at_rest_error,))
+analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
+ extra_analysis_integrals = (lake_at_rest_error,))
-alive_callback = AliveCallback(analysis_interval=analysis_interval)
+alive_callback = AliveCallback(analysis_interval = analysis_interval)
-save_solution = SaveSolutionCallback(interval=1000,
- save_initial_solution=true,
- save_final_solution=true)
+save_solution = SaveSolutionCallback(interval = 1000,
+ save_initial_solution = true,
+ save_final_solution = true)
-stepsize_callback = StepsizeCallback(cfl=3.0)
+stepsize_callback = StepsizeCallback(cfl = 3.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
@@ -113,7 +117,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav
###############################################################################
# run the simulation
-sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
- dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
- save_everystep=false, callback=callbacks);
+sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
+ dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
+ save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
diff --git a/src/callbacks_stage/subcell_bounds_check.jl b/src/callbacks_stage/subcell_bounds_check.jl
index 0722e77d730..527bcb0750a 100644
--- a/src/callbacks_stage/subcell_bounds_check.jl
+++ b/src/callbacks_stage/subcell_bounds_check.jl
@@ -118,8 +118,6 @@ function init_callback(callback::BoundsCheckCallback, semi, limiter::SubcellLimi
return nothing
end
- # TODO: Revise Bounds Check for MCL
-
@unpack output_directory = callback
mkpath(output_directory)
open("$output_directory/deviations.txt", "a") do f
@@ -128,7 +126,7 @@ function init_callback(callback::BoundsCheckCallback, semi, limiter::SubcellLimi
if limiter.PressurePositivityLimiterKuzmin
print(f, ", pressure_min")
end
- # No check for entropy limiting rn
+ # TODO: Bounds check for entropy limiting
println(f)
end
@@ -192,21 +190,23 @@ end
@inline function finalize_callback(callback::BoundsCheckCallback, semi,
limiter::SubcellLimiterMCL)
- @unpack idp_bounds_delta = limiter.cache
-
- # TODO: Revise bounds check for MCL
+ @unpack mcl_bounds_delta = limiter.cache
println("─"^100)
println("Maximum deviation from bounds:")
println("─"^100)
variables = varnames(cons2cons, semi.equations)
for v in eachvariable(semi.equations)
- println(variables[v], ":\n- lower bound: ", idp_bounds_delta[1, v],
- "\n- upper bound: ", idp_bounds_delta[2, v])
+ println(variables[v], ":\n- lower bound: ", mcl_bounds_delta[2, 1, v],
+ "\n- upper bound: ", mcl_bounds_delta[2, 2, v])
end
if limiter.PressurePositivityLimiterKuzmin
- println("pressure:\n- lower bound: ",
- idp_bounds_delta[1, nvariables(semi.equations) + 1])
+ println("pressure:\n- positivity: ",
+ mcl_bounds_delta[2, 1, nvariables(semi.equations) + 1])
+ end
+ if limiter.SemiDiscEntropyLimiter
+ # TODO: Bounds check for entropy limiting
+ println("\nWARNING: No bounds check for the entropy limiter.")
end
println("─"^100 * "\n")
diff --git a/src/callbacks_stage/subcell_bounds_check_2d.jl b/src/callbacks_stage/subcell_bounds_check_2d.jl
index 963f9a938ab..cf47c0fc534 100644
--- a/src/callbacks_stage/subcell_bounds_check_2d.jl
+++ b/src/callbacks_stage/subcell_bounds_check_2d.jl
@@ -131,24 +131,21 @@ end
time, iter, output_directory, save_errors)
(; var_min, var_max) = limiter.cache.subcell_limiter_coefficients
(; bar_states1, bar_states2, lambda1, lambda2) = limiter.cache.container_bar_states
- (; idp_bounds_delta) = limiter.cache
+ (; mcl_bounds_delta) = limiter.cache
(; antidiffusive_flux1_L, antidiffusive_flux2_L) = cache.antidiffusive_fluxes
- # TODO: Revise Bounds Check for MCL
-
n_vars = nvariables(equations)
- deviation_min = zeros(eltype(u), n_vars + limiter.PressurePositivityLimiterKuzmin)
- deviation_max = zeros(eltype(u), n_vars)
-
if limiter.DensityLimiter
# New solution u^{n+1}
for element in eachelement(solver, cache)
for j in eachnode(solver), i in eachnode(solver)
- deviation_min[1] = max(deviation_min[1],
- var_min[1, i, j, element] - u[1, i, j, element])
- deviation_max[1] = max(deviation_max[1],
- u[1, i, j, element] - var_max[1, i, j, element])
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1],
+ var_min[1, i, j, element] -
+ u[1, i, j, element])
+ mcl_bounds_delta[1, 2, 1] = max(mcl_bounds_delta[1, 2, 1],
+ u[1, i, j, element] -
+ var_max[1, i, j, element])
end
end
@@ -162,34 +159,34 @@ end
rho_limited = bar_states1[1, i, j, element] -
antidiffusive_flux1_L[1, i, j, element] /
lambda1[i, j, element]
- deviation_min[1] = max(deviation_min[1],
- var_min[1, i, j, element] - rho_limited)
- deviation_max[1] = max(deviation_max[1],
- rho_limited - var_max[1, i, j, element])
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1],
+ var_min[1, i, j, element] - rho_limited)
+ mcl_bounds_delta[1, 2, 1] = max(mcl_bounds_delta[1, 2, 1],
+ rho_limited - var_max[1, i, j, element])
# +x
rho_limited = bar_states1[1, i + 1, j, element] +
antidiffusive_flux1_L[1, i + 1, j, element] /
lambda1[i + 1, j, element]
- deviation_min[1] = max(deviation_min[1],
- var_min[1, i, j, element] - rho_limited)
- deviation_max[1] = max(deviation_max[1],
- rho_limited - var_max[1, i, j, element])
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1],
+ var_min[1, i, j, element] - rho_limited)
+ mcl_bounds_delta[1, 2, 1] = max(mcl_bounds_delta[1, 2, 1],
+ rho_limited - var_max[1, i, j, element])
# -y
rho_limited = bar_states2[1, i, j, element] -
antidiffusive_flux2_L[1, i, j, element] /
lambda2[i, j, element]
- deviation_min[1] = max(deviation_min[1],
- var_min[1, i, j, element] - rho_limited)
- deviation_max[1] = max(deviation_max[1],
- rho_limited - var_max[1, i, j, element])
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1],
+ var_min[1, i, j, element] - rho_limited)
+ mcl_bounds_delta[1, 2, 1] = max(mcl_bounds_delta[1, 2, 1],
+ rho_limited - var_max[1, i, j, element])
# +y
rho_limited = bar_states2[1, i, j + 1, element] +
antidiffusive_flux2_L[1, i, j + 1, element] /
lambda2[i, j + 1, element]
- deviation_min[1] = max(deviation_min[1],
- var_min[1, i, j, element] - rho_limited)
- deviation_max[1] = max(deviation_max[1],
- rho_limited - var_max[1, i, j, element])
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1],
+ var_min[1, i, j, element] - rho_limited)
+ mcl_bounds_delta[1, 2, 1] = max(mcl_bounds_delta[1, 2, 1],
+ rho_limited - var_max[1, i, j, element])
end
end
end # limiter.DensityLimiter
@@ -200,17 +197,20 @@ end
for j in eachnode(solver), i in eachnode(solver)
for v in 2:n_vars
var_limited = u[v, i, j, element] / u[1, i, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] - var_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited - var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited -
+ var_max[v, i, j, element])
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure = 0.5 *
(u[2, i, j, element]^2 + u[3, i, j, element]^2) -
u[1, i, j, element] * u[4, i, j, element]
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
end
end
end
@@ -221,8 +221,8 @@ end
# \bar{phi}^{min} <= \bar{phi}^{Lim} / \bar{rho}^{Lim} <= \bar{phi}^{max}
# - pressure (p):
# \bar{rho}^{Lim} \bar{rho * E}^{Lim} >= |\bar{rho * v}^{Lim}|^2 / 2
- var_limited = zero(eltype(idp_bounds_delta))
- error_pressure = zero(eltype(idp_bounds_delta))
+ var_limited = zero(eltype(mcl_bounds_delta))
+ error_pressure = zero(eltype(mcl_bounds_delta))
for element in eachelement(solver, cache)
for j in eachnode(solver), i in eachnode(solver)
# -x
@@ -233,21 +233,22 @@ end
var_limited = bar_states1[v, i, j, element] -
antidiffusive_flux1_L[v, i, j, element] /
lambda1[i, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] -
- var_limited / rho_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited / rho_limited -
- var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited / rho_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited / rho_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
# +x
rho_limited = bar_states1[1, i + 1, j, element] +
@@ -257,21 +258,22 @@ end
var_limited = bar_states1[v, i + 1, j, element] +
antidiffusive_flux1_L[v, i + 1, j, element] /
lambda1[i + 1, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] -
- var_limited / rho_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited / rho_limited -
- var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited / rho_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited / rho_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
# -y
rho_limited = bar_states2[1, i, j, element] -
@@ -281,21 +283,22 @@ end
var_limited = bar_states2[v, i, j, element] -
antidiffusive_flux2_L[v, i, j, element] /
lambda2[i, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] -
- var_limited / rho_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited / rho_limited -
- var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited / rho_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited / rho_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
# +y
rho_limited = bar_states2[1, i, j + 1, element] +
@@ -305,21 +308,22 @@ end
var_limited = bar_states2[v, i, j + 1, element] +
antidiffusive_flux2_L[v, i, j + 1, element] /
lambda2[i, j + 1, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] -
- var_limited / rho_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited / rho_limited -
- var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited / rho_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited / rho_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
end
end
@@ -328,19 +332,20 @@ end
for element in eachelement(solver, cache)
for j in eachnode(solver), i in eachnode(solver)
for v in 2:n_vars
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] -
- u[v, i, j, element])
- deviation_max[v] = max(deviation_max[v],
- u[v, i, j, element] -
- var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ u[v, i, j, element])
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ u[v, i, j, element] -
+ var_max[v, i, j, element])
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure = 0.5 *
(u[2, i, j, element]^2 + u[3, i, j, element]^2) -
u[1, i, j, element] * u[4, i, j, element]
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
end
end
end
@@ -351,8 +356,8 @@ end
# \bar{rho*phi}^{min} <= \bar{rho*phi}^{Lim} <= \bar{rho*phi}^{max}
# - pressure (p):
# \bar{rho}^{Lim} \bar{rho * E}^{Lim} >= |\bar{rho * v}^{Lim}|^2 / 2
- var_limited = zero(eltype(idp_bounds_delta))
- error_pressure = zero(eltype(idp_bounds_delta))
+ var_limited = zero(eltype(mcl_bounds_delta))
+ error_pressure = zero(eltype(mcl_bounds_delta))
for element in eachelement(solver, cache)
for j in eachnode(solver), i in eachnode(solver)
# -x
@@ -363,19 +368,22 @@ end
var_limited = bar_states1[v, i, j, element] -
antidiffusive_flux1_L[v, i, j, element] /
lambda1[i, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] - var_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited - var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
# +x
rho_limited = bar_states1[1, i + 1, j, element] +
@@ -385,19 +393,22 @@ end
var_limited = bar_states1[v, i + 1, j, element] +
antidiffusive_flux1_L[v, i + 1, j, element] /
lambda1[i + 1, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] - var_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited - var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
# -y
rho_limited = bar_states2[1, i, j, element] -
@@ -407,19 +418,22 @@ end
var_limited = bar_states2[v, i, j, element] -
antidiffusive_flux2_L[v, i, j, element] /
lambda2[i, j, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] - var_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited - var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
# +y
rho_limited = bar_states2[1, i, j + 1, element] +
@@ -429,19 +443,22 @@ end
var_limited = bar_states2[v, i, j + 1, element] +
antidiffusive_flux2_L[v, i, j + 1, element] /
lambda2[i, j + 1, element]
- deviation_min[v] = max(deviation_min[v],
- var_min[v, i, j, element] - var_limited)
- deviation_max[v] = max(deviation_max[v],
- var_limited - var_max[v, i, j, element])
+ mcl_bounds_delta[1, 1, v] = max(mcl_bounds_delta[1, 1, v],
+ var_min[v, i, j, element] -
+ var_limited)
+ mcl_bounds_delta[1, 2, v] = max(mcl_bounds_delta[1, 2, v],
+ var_limited -
+ var_max[v, i, j, element])
if limiter.PressurePositivityLimiterKuzmin && (v == 2 || v == 3)
error_pressure += 0.5 * var_limited^2
end
end
if limiter.PressurePositivityLimiterKuzmin
error_pressure -= var_limited * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
- error_pressure = zero(eltype(idp_bounds_delta))
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
+ error_pressure = zero(eltype(mcl_bounds_delta))
end
end
end
@@ -451,8 +468,9 @@ end
for j in eachnode(solver), i in eachnode(solver)
error_pressure = 0.5 * (u[2, i, j, element]^2 + u[3, i, j, element]^2) -
u[1, i, j, element] * u[4, i, j, element]
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
end
end
@@ -477,8 +495,9 @@ end
(bar_states1[4, i, j, element] -
antidiffusive_flux1_L[4, i, j, element] /
lambda1[i, j, element]) * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
# +x
rho_limited = bar_states1[1, i + 1, j, element] +
antidiffusive_flux1_L[1, i + 1, j, element] /
@@ -494,8 +513,9 @@ end
(bar_states1[4, i + 1, j, element] +
antidiffusive_flux1_L[4, i + 1, j, element] /
lambda1[i + 1, j, element]) * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
# -y
rho_limited = bar_states2[1, i, j, element] -
antidiffusive_flux2_L[1, i, j, element] /
@@ -511,8 +531,9 @@ end
(bar_states2[4, i, j, element] -
antidiffusive_flux2_L[4, i, j, element] /
lambda2[i, j, element]) * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
# +y
rho_limited = bar_states2[1, i, j + 1, element] +
antidiffusive_flux2_L[1, i, j + 1, element] /
@@ -528,8 +549,9 @@ end
(bar_states2[4, i, j + 1, element] +
antidiffusive_flux2_L[4, i, j + 1, element] /
lambda2[i, j + 1, element]) * rho_limited
- deviation_min[n_vars + 1] = max(deviation_min[n_vars + 1],
- error_pressure)
+ mcl_bounds_delta[1, 1, n_vars + 1] = max(mcl_bounds_delta[1, 1,
+ n_vars + 1],
+ error_pressure)
end
end
end # limiter.PressurePositivityLimiterKuzmin
@@ -538,7 +560,8 @@ end
# New solution u^{n+1}
for element in eachelement(solver, cache)
for j in eachnode(solver), i in eachnode(solver)
- deviation_min[1] = max(deviation_min[1], -u[1, i, j, element])
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1],
+ -u[1, i, j, element])
end
end
@@ -553,33 +576,35 @@ end
rho_limited = (1 - beta) * bar_states1[1, i, j, element] -
antidiffusive_flux1_L[1, i, j, element] /
lambda1[i, j, element]
- deviation_min[1] = max(deviation_min[1], -rho_limited)
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1], -rho_limited)
# +x
rho_limited = (1 - beta) * bar_states1[1, i + 1, j, element] +
antidiffusive_flux1_L[1, i + 1, j, element] /
lambda1[i + 1, j, element]
- deviation_min[1] = max(deviation_min[1], -rho_limited)
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1], -rho_limited)
# -y
rho_limited = (1 - beta) * bar_states2[1, i, j, element] -
antidiffusive_flux2_L[1, i, j, element] /
lambda2[i, j, element]
- deviation_min[1] = max(deviation_min[1], -rho_limited)
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1], -rho_limited)
# +y
rho_limited = (1 - beta) * bar_states2[1, i, j + 1, element] +
antidiffusive_flux2_L[1, i, j + 1, element] /
lambda2[i, j + 1, element]
- deviation_min[1] = max(deviation_min[1], -rho_limited)
+ mcl_bounds_delta[1, 1, 1] = max(mcl_bounds_delta[1, 1, 1], -rho_limited)
end
end
end # limiter.DensityPositivityLimiter
for v in eachvariable(equations)
- idp_bounds_delta[1, v] = max(idp_bounds_delta[1, v], deviation_min[v])
- idp_bounds_delta[2, v] = max(idp_bounds_delta[2, v], deviation_max[v])
+ mcl_bounds_delta[2, 1, v] = max(mcl_bounds_delta[2, 1, v],
+ mcl_bounds_delta[1, 1, v])
+ mcl_bounds_delta[2, 2, v] = max(mcl_bounds_delta[2, 2, v],
+ mcl_bounds_delta[1, 2, v])
end
if limiter.PressurePositivityLimiterKuzmin
- idp_bounds_delta[1, n_vars + 1] = max(idp_bounds_delta[1, n_vars + 1],
- deviation_min[n_vars + 1])
+ mcl_bounds_delta[2, 1, n_vars + 1] = max(mcl_bounds_delta[2, 1, n_vars + 1],
+ mcl_bounds_delta[1, 1, n_vars + 1])
end
if !save_errors
@@ -588,13 +613,20 @@ end
open("$output_directory/deviations.txt", "a") do f
print(f, iter, ", ", time)
for v in eachvariable(equations)
- print(f, ", ", deviation_min[v], ", ", deviation_max[v])
+ print(f, ", ", mcl_bounds_delta[1, 1, v], ", ", mcl_bounds_delta[1, 2, v])
end
if limiter.PressurePositivityLimiterKuzmin
- print(f, ", ", deviation_min[n_vars + 1])
+ print(f, ", ", mcl_bounds_delta[1, 1, n_vars + 1])
end
println(f)
end
+ for v in eachvariable(equations)
+ mcl_bounds_delta[1, 1, v] = zero(eltype(mcl_bounds_delta))
+ mcl_bounds_delta[1, 2, v] = zero(eltype(mcl_bounds_delta))
+ end
+ if limiter.PressurePositivityLimiterKuzmin
+ mcl_bounds_delta[1, 1, n_vars + 1] = zero(eltype(mcl_bounds_delta))
+ end
return nothing
end
diff --git a/src/solvers/dgsem_tree/subcell_limiters_2d.jl b/src/solvers/dgsem_tree/subcell_limiters_2d.jl
index 1c27a5d5dcd..c724ada5041 100644
--- a/src/solvers/dgsem_tree/subcell_limiters_2d.jl
+++ b/src/solvers/dgsem_tree/subcell_limiters_2d.jl
@@ -725,9 +725,11 @@ function create_cache(limiter::Type{SubcellLimiterMCL}, equations::AbstractEquat
nvariables(equations),
nnodes(basis))
- idp_bounds_delta = zeros(real(basis), 2,
+ # Memory for bounds checking routine with `BoundsCheckCallback`.
+ # [maximum since the last export / total maximum, min / max, variable]
+ mcl_bounds_delta = zeros(real(basis), 2, 2,
nvariables(equations) + PressurePositivityLimiterKuzmin)
- return (; subcell_limiter_coefficients, container_bar_states, idp_bounds_delta)
+ return (; subcell_limiter_coefficients, container_bar_states, mcl_bounds_delta)
end
end # @muladd
diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl
index 9944e45e120..77df1ba45bf 100644
--- a/test/test_tree_2d_euler.jl
+++ b/test/test_tree_2d_euler.jl
@@ -525,6 +525,32 @@ end
end
end
+@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
+ @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
+ l2=[
+ 0.35267161504176747,
+ 0.17218309138797958,
+ 0.17218307467125854,
+ 0.6236143054619037,
+ ],
+ linf=[
+ 2.77484045816607,
+ 1.8281111268370718,
+ 1.8281110470490887,
+ 6.24263735888126,
+ ],
+ tspan=(0.0, 0.5),
+ surface_flux=flux_hlle)
+ # Ensure that we do not have excessive memory allocations
+ # (e.g., from type instabilities)
+ let
+ t = sol.t[end]
+ u_ode = sol.u[end]
+ du_ode = similar(u_ode)
+ @test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
+ end
+end
+
@trixi_testset "elixir_euler_sedov_blast_wave_sc_subcell.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_euler_sedov_blast_wave_sc_subcell.jl"),
@@ -554,6 +580,7 @@ end
end
@trixi_testset "elixir_euler_sedov_blast_wave_MCL.jl" begin
+ rm("out/deviations.txt", force = true)
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave_MCL.jl"),
l2=[
0.4740321851943766,
@@ -570,6 +597,10 @@ end
tspan=(0.0, 1.0),
initial_refinement_level=4,
coverage_override=(maxiters = 6,))
+ lines = readlines("out/deviations.txt")
+ @test lines[1] ==
+ "# iter, simu_time, rho_min, rho_max, rho_v1_min, rho_v1_max, rho_v2_min, rho_v2_max, rho_e_min, rho_e_max, pressure_min"
+ @test startswith(lines[end], "349") || startswith(lines[end], "1")
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let