diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml
new file mode 100644
index 00000000000..8518d202812
--- /dev/null
+++ b/.JuliaFormatter.toml
@@ -0,0 +1,8 @@
+# Use SciML style: https://github.com/SciML/SciMLStyle
+style = "sciml"
+
+# Python style alignment. See https://github.com/domluna/JuliaFormatter.jl/pull/732.
+yas_style_nesting = true
+
+# Align struct fields for better readability of large struct definitions
+align_struct_field = true
diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml
index 5d9632b1653..6b557960c89 100644
--- a/.github/workflows/Documenter.yml
+++ b/.github/workflows/Documenter.yml
@@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
- version: '1.8'
+ version: '1.9'
show-versioninfo: true
- uses: julia-actions/julia-buildpkg@v1
env:
diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml
new file mode 100644
index 00000000000..628d938dd76
--- /dev/null
+++ b/.github/workflows/FormatCheck.yml
@@ -0,0 +1,44 @@
+name: format-check
+
+on:
+ push:
+ branches:
+ - 'main'
+ tags: '*'
+ pull_request:
+
+jobs:
+ check-format:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ julia-version: [1]
+ julia-arch: [x86]
+ os: [ubuntu-latest]
+ steps:
+ - uses: julia-actions/setup-julia@latest
+ with:
+ version: ${{ matrix.julia-version }}
+
+ - uses: actions/checkout@v3
+ - name: Install JuliaFormatter and format
+ # This will use the latest version by default but you can set the version like so:
+ #
+ # julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version = "0.13.0"))'
+ #
+ # TODO: Change the call below to
+ # format(".")
+ run: |
+ julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter"))'
+ julia -e 'using JuliaFormatter; format(["benchmark", "ext", "src", "utils"])'
+ - name: Format check
+ run: |
+ julia -e '
+ out = Cmd(`git diff --name-only`) |> read |> String
+ if out == ""
+ exit(0)
+ else
+ @error "Some files have not been formatted !!!"
+ write(stdout, out)
+ exit(1)
+ end'
diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml
new file mode 100644
index 00000000000..bc324c689bc
--- /dev/null
+++ b/.github/workflows/SpellCheck.yml
@@ -0,0 +1,13 @@
+name: Spell Check
+
+on: [pull_request, workflow_dispatch]
+
+jobs:
+ typos-check:
+ name: Spell Check with Typos
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Actions Repository
+ uses: actions/checkout@v3
+ - name: Check spelling
+ uses: crate-ci/typos@v1.15.0
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
index 01a6c99e843..c5c95558c8c 100644
--- a/.github/workflows/benchmark.yml
+++ b/.github/workflows/benchmark.yml
@@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-latest
version:
- - '1.8'
+ - '1.9'
arch:
- x64
steps:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8956c32ee06..b0a2c93db3c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -52,7 +52,8 @@ jobs:
fail-fast: false
matrix:
version:
- - '1.8'
+ - '1.9'
+ # - '~1.9.0-0' # including development versions
# - 'nightly'
os:
- ubuntu-latest
@@ -73,23 +74,28 @@ jobs:
- paper_self_gravitating_gas_dynamics
- misc_part1
- misc_part2
- - misc_part3
+ - performance_specializations_part1
+ - performance_specializations_part2
- mpi
- threaded
include:
- version: '1.8'
+ os: ubuntu-latest
+ arch: x64
+ trixi_test: threaded_legacy
+ - version: '1.9'
os: macOS-latest
arch: x64
trixi_test: mpi
- - version: '1.8'
+ - version: '1.9'
os: macOS-latest
arch: x64
trixi_test: threaded
- - version: '1.8'
+ - version: '1.9'
os: windows-latest
arch: x64
trixi_test: mpi
- - version: '1.8'
+ - version: '1.9'
os: windows-latest
arch: x64
trixi_test: threaded
@@ -120,7 +126,7 @@ jobs:
TRIXI_TEST: ${{ matrix.trixi_test }}
- uses: julia-actions/julia-processcoverage@v1
with:
- directories: src,examples
+ directories: src,examples,ext
- uses: codecov/codecov-action@v3
with:
file: ./lcov.info
diff --git a/.gitignore b/.gitignore
index 2f294fbc911..3132b9af38b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,8 @@ coverage_report/
.vscode/
.DS_Store
+
+run
+run/*
+
+LocalPreferences.toml
diff --git a/.typos.toml b/.typos.toml
new file mode 100644
index 00000000000..1b16de97c27
--- /dev/null
+++ b/.typos.toml
@@ -0,0 +1,4 @@
+[default.extend-words]
+rcall = "rcall"
+claus = "claus"
+dum = "dum"
diff --git a/AUTHORS.md b/AUTHORS.md
index 97f625b3ceb..973e311920b 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,14 +1,14 @@
# Authors
-Trixi's development is coordinated by a group of *principal developers*,
+Trixi.jl's development is coordinated by a group of *principal developers*,
who are also its main contributors and who can be contacted in case of
-questions about Trixi. In addition, there are *contributors* who have
+questions about Trixi.jl. In addition, there are *contributors* who have
provided substantial additions or modifications. Together, these two groups form
-"The Trixi Authors" as mentioned in the [LICENSE.md](LICENSE.md) file.
+"The Trixi.jl Authors" as mentioned in the [LICENSE.md](LICENSE.md) file.
## Principal Developers
* [Michael Schlottke-Lakemper](https://lakemper.eu),
- RWTH Aachen University, Germany
+ RWTH Aachen University/High-Performance Computing Center Stuttgart (HLRS), Germany
* [Gregor Gassner](https://www.mi.uni-koeln.de/NumSim/gregor-gassner),
University of Cologne, Germany
* [Hendrik Ranocha](https://ranocha.de),
@@ -19,7 +19,7 @@ provided substantial additions or modifications. Together, these two groups form
Rice University, US
## Contributors
-The following people contributed major additions or modifications to Trixi and
+The following people contributed major additions or modifications to Trixi.jl and
are listed in alphabetical order:
* Maximilian D. Bertrand
@@ -27,12 +27,14 @@ are listed in alphabetical order:
* Jesse Chan
* Lars Christmann
* Christof Czernik
+* Patrick Ersing
* Erik Faulhaber
* Gregor Gassner
* Lucas Gemein
* Sven Goldberg
* Joshua Lampert
* Julia Odenthal
+* Sigrun Ortleb
* Hendrik Ranocha
* Andrés M. Rueda-Ramírez
* Felipe Santillan
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5255ba33218..c3ad581062e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,12 +1,12 @@
# Contributing
-Trixi is an open-source project and we are very happy to accept contributions
+Trixi.jl is an open-source project and we are very happy to accept contributions
from the community. Please feel free to open issues or submit patches (preferably
as pull requests) any time. For planned larger contributions, it is often
beneficial to get in contact with one of the principal developers first (see
[AUTHORS.md](AUTHORS.md)).
-Trixi and its contributions are licensed under the MIT license (see
+Trixi.jl and its contributions are licensed under the MIT license (see
[LICENSE.md](LICENSE.md)). As a contributor, you certify that all your
contributions are in conformance with the *Developer Certificate of Origin
(Version 1.1)*, which is reproduced below.
diff --git a/LICENSE.md b/LICENSE.md
index 72700cbe42f..83ebae5239a 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2020-present The Trixi Authors (see [AUTHORS.md](AUTHORS.md))
+Copyright (c) 2020-present The Trixi.jl Authors (see [AUTHORS.md](AUTHORS.md))
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/NEWS.md b/NEWS.md
index 2ae6d46aa03..9b46ba565fe 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -167,7 +167,7 @@ for human readability.
`flux_lax_friedrichs(u_ll, u_rr, orientation, equations::LatticeBoltzmannEquations3D)`
were actually using the logic of `flux_godunov`. Thus, they were renamed accordingly
in [#493](https://github.com/trixi-framework/Trixi.jl/pull/493). This is considered a bugfix
- (released in Trixi v0.3.22).
+ (released in Trixi.jl v0.3.22).
- The required Julia version is updated to v1.6.
#### Deprecated
diff --git a/Project.toml b/Project.toml
index 71c197d7b84..9d51e4dcffc 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,11 +1,12 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper
- - - - - - - - - - - - - - +
This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) diff --git a/benchmark/README.md b/benchmark/README.md index 2bb0310938b..e299ab4c950 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -2,7 +2,7 @@ This folder contains some benchmark setups based on [PkgBenchmark.jl](https://github.com/JuliaCI/PkgBenchmark.jl) -as described in the [documentation of Trixi](https://trixi-framework.github.io/Trixi.jl/stable) +as described in the [documentation of Trixi.jl](https://trixi-framework.github.io/Trixi.jl/stable) in the "Performance" section. Additionally, it contains subdirectories dedicated to specific micro benchmarks -used when developing Trixi, e.g. `multiply_dimensionwise`. +used when developing Trixi.jl, e.g. `multiply_dimensionwise`. diff --git a/benchmark/benchmark_ec.jl b/benchmark/benchmark_ec.jl index f714d933b77..5bd20b41111 100644 --- a/benchmark/benchmark_ec.jl +++ b/benchmark/benchmark_ec.jl @@ -1,50 +1,50 @@ using Printf, BenchmarkTools, Trixi -function run_benchmarks(benchmark_run; levels=0:5, polydeg=3) - runtimes = zeros(length(levels)) - for (idx,initial_refinement_level) in enumerate(levels) - result = benchmark_run(; initial_refinement_level, polydeg) - display(result) - runtimes[idx] = result |> median |> time # in nanoseconds - end - return (; levels, runtimes, polydeg) +function run_benchmarks(benchmark_run; levels = 0:5, polydeg = 3) + runtimes = zeros(length(levels)) + for (idx, initial_refinement_level) in enumerate(levels) + result = benchmark_run(; initial_refinement_level, polydeg) + display(result) + runtimes[idx] = result |> median |> time # in nanoseconds + end + return (; levels, runtimes, polydeg) end function tabulate_benchmarks(args...; kwargs...) - result = run_benchmarks(args...; kwargs...) - println("#Elements | Runtime in seconds") - for (level,runtime) in zip(result.levels, result.runtimes) - @printf("%9d | %.2e\n", 4^level, 1.0e-9 * runtime) - end - for (level,runtime) in zip(result.levels, result.runtimes) - @printf("%.16e\n", 1.0e-9 * runtime) - end + result = run_benchmarks(args...; kwargs...) + println("#Elements | Runtime in seconds") + for (level, runtime) in zip(result.levels, result.runtimes) + @printf("%9d | %.2e\n", 4^level, 1.0e-9*runtime) + end + for (level, runtime) in zip(result.levels, result.runtimes) + @printf("%.16e\n", 1.0e-9*runtime) + end end -function benchmark_euler(; initial_refinement_level=1, polydeg=3) +function benchmark_euler(; initial_refinement_level = 1, polydeg = 3) + γ = 1.4 + equations = CompressibleEulerEquations2D(γ) - γ = 1.4 - equations = CompressibleEulerEquations2D(γ) + surface_flux = flux_ranocha + volume_flux = flux_ranocha + solver = DGSEM(polydeg, surface_flux, VolumeIntegralFluxDifferencing(volume_flux)) - surface_flux = flux_ranocha - volume_flux = flux_ranocha - solver = DGSEM(polydeg, surface_flux, VolumeIntegralFluxDifferencing(volume_flux)) + coordinates_min = (-2.0, -2.0) + coordinates_max = (2.0, 2.0) + mesh = TreeMesh(coordinates_min, coordinates_max, + initial_refinement_level = initial_refinement_level, + n_cells_max = 100_000) - coordinates_min = (-2.0, -2.0) - coordinates_max = ( 2.0, 2.0) - mesh = TreeMesh(coordinates_min, coordinates_max, - initial_refinement_level=initial_refinement_level, - n_cells_max=100_000) + semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_weak_blast_wave, + solver) - semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_weak_blast_wave, solver) + t0 = 0.0 + u0 = compute_coefficients(t0, semi) + du = similar(u0) - t0 = 0.0 - u0 = compute_coefficients(t0, semi) - du = similar(u0) - - @benchmark Trixi.rhs!($du, $u0, $semi, $t0) + @benchmark Trixi.rhs!($du, $u0, $semi, $t0) end # versioninfo(verbose=true) @show Threads.nthreads() -tabulate_benchmarks(benchmark_euler, levels=0:8) +tabulate_benchmarks(benchmark_euler, levels = 0:8) diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index edaeed63577..a3f7d1d2569 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -1,3 +1,6 @@ +# Disable formatting this file since it contains highly unusual formatting for better +# readability +#! format: off using BenchmarkTools using Trixi diff --git a/benchmark/elixir_2d_euler_vortex_p4est.jl b/benchmark/elixir_2d_euler_vortex_p4est.jl index 6c151842ebb..3ee97cc752f 100644 --- a/benchmark/elixir_2d_euler_vortex_p4est.jl +++ b/benchmark/elixir_2d_euler_vortex_p4est.jl @@ -17,43 +17,42 @@ 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] - # make sure that the inicenter does not exit the domain, e.g. T=10.0 - # initial center of the vortex - inicenter = SVector(0.0, 0.0) - # size and strength of the vortex - iniamplitude = 0.2 - # base flow - rho = 1.0 - v1 = 1.0 - v2 = 1.0 - vel = SVector(v1, v2) - p = 10.0 - rt = p / rho # ideal gas equation - cent = inicenter + vel*t # advection of center - cent = x - cent # distance to centerpoint - #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 # isentrop - 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] + # make sure that the inicenter does not exit the domain, e.g. T=10.0 + # initial center of the vortex + inicenter = SVector(0.0, 0.0) + # size and strength of the vortex + iniamplitude = 0.2 + # base flow + rho = 1.0 + v1 = 1.0 + v2 = 1.0 + vel = SVector(v1, v2) + p = 10.0 + rt = p / rho # ideal gas equation + cent = inicenter + vel * t # advection of center + cent = x - cent # distance to centerpoint + #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 # isentrop + 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) -mesh = P4estMesh((1, 1), polydeg=Trixi.polydeg(solver), - coordinates_min=coordinates_min, coordinates_max=coordinates_max, - initial_refinement_level=4) - +coordinates_max = (10.0, 10.0) +mesh = P4estMesh((1, 1), polydeg = Trixi.polydeg(solver), + coordinates_min = coordinates_min, coordinates_max = coordinates_max, + initial_refinement_level = 4) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) @@ -66,19 +65,20 @@ 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) callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) - ############################################################################### # run the simulation sol = solve(ode, BS3(), - save_everystep=false, callback=callbacks); + save_everystep = false, callback = callbacks); summary_callback() # print the timer summary diff --git a/benchmark/elixir_2d_euler_vortex_structured.jl b/benchmark/elixir_2d_euler_vortex_structured.jl index 344ac2d20c8..5627049c9e2 100644 --- a/benchmark/elixir_2d_euler_vortex_structured.jl +++ b/benchmark/elixir_2d_euler_vortex_structured.jl @@ -17,43 +17,42 @@ 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] - # make sure that the inicenter does not exit the domain, e.g. T=10.0 - # initial center of the vortex - inicenter = SVector(0.0, 0.0) - # size and strength of the vortex - iniamplitude = 0.2 - # base flow - rho = 1.0 - v1 = 1.0 - v2 = 1.0 - vel = SVector(v1, v2) - p = 10.0 - rt = p / rho # ideal gas equation - cent = inicenter + vel*t # advection of center - cent = x - cent # distance to centerpoint - #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 # isentrop - 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] + # make sure that the inicenter does not exit the domain, e.g. T=10.0 + # initial center of the vortex + inicenter = SVector(0.0, 0.0) + # size and strength of the vortex + iniamplitude = 0.2 + # base flow + rho = 1.0 + v1 = 1.0 + v2 = 1.0 + vel = SVector(v1, v2) + p = 10.0 + rt = p / rho # ideal gas equation + cent = inicenter + vel * t # advection of center + cent = x - cent # distance to centerpoint + #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 # isentrop + 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) cells_per_dimension = (16, 16) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) - semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) ############################################################################### @@ -65,19 +64,20 @@ 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) callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) - ############################################################################### # run the simulation sol = solve(ode, BS3(), - save_everystep=false, callback=callbacks); + save_everystep = false, callback = callbacks); summary_callback() # print the timer summary diff --git a/benchmark/elixir_2d_euler_vortex_tree.jl b/benchmark/elixir_2d_euler_vortex_tree.jl index b3873b4e01b..68e207c5344 100644 --- a/benchmark/elixir_2d_euler_vortex_tree.jl +++ b/benchmark/elixir_2d_euler_vortex_tree.jl @@ -17,43 +17,42 @@ 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] - # make sure that the inicenter does not exit the domain, e.g. T=10.0 - # initial center of the vortex - inicenter = SVector(0.0, 0.0) - # size and strength of the vortex - iniamplitude = 0.2 - # base flow - rho = 1.0 - v1 = 1.0 - v2 = 1.0 - vel = SVector(v1, v2) - p = 10.0 - rt = p / rho # ideal gas equation - cent = inicenter + vel*t # advection of center - cent = x - cent # distance to centerpoint - #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 # isentrop - 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] + # make sure that the inicenter does not exit the domain, e.g. T=10.0 + # initial center of the vortex + inicenter = SVector(0.0, 0.0) + # size and strength of the vortex + iniamplitude = 0.2 + # base flow + rho = 1.0 + v1 = 1.0 + v2 = 1.0 + vel = SVector(v1, v2) + p = 10.0 + rt = p / rho # ideal gas equation + cent = inicenter + vel * t # advection of center + cent = x - cent # distance to centerpoint + #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 # isentrop + 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) @@ -66,19 +65,20 @@ 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) callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) - ############################################################################### # run the simulation sol = solve(ode, BS3(), - save_everystep=false, callback=callbacks); + save_everystep = false, callback = callbacks); summary_callback() # print the timer summary diff --git a/benchmark/elixir_2d_euler_vortex_unstructured.jl b/benchmark/elixir_2d_euler_vortex_unstructured.jl index bd0ab4a8040..082b6648abf 100644 --- a/benchmark/elixir_2d_euler_vortex_unstructured.jl +++ b/benchmark/elixir_2d_euler_vortex_unstructured.jl @@ -18,42 +18,43 @@ 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] - # make sure that the inicenter does not exit the domain, e.g. T=10.0 - # initial center of the vortex - inicenter = SVector(0.0, 0.0) - # size and strength of the vortex - iniamplitude = 0.2 - # base flow - rho = 1.0 - v1 = 1.0 - v2 = 1.0 - vel = SVector(v1, v2) - p = 10.0 - rt = p / rho # ideal gas equation - cent = inicenter + vel*t # advection of center - cent = x - cent # distance to centerpoint - #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 # isentrop - 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] + # make sure that the inicenter does not exit the domain, e.g. T=10.0 + # initial center of the vortex + inicenter = SVector(0.0, 0.0) + # size and strength of the vortex + iniamplitude = 0.2 + # base flow + rho = 1.0 + v1 = 1.0 + v2 = 1.0 + vel = SVector(v1, v2) + p = 10.0 + rt = p / rho # ideal gas equation + cent = inicenter + vel * t # advection of center + cent = x - cent # distance to centerpoint + #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 # isentrop + 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) default_mesh_file = joinpath(@__DIR__, "mesh_uniform_cartesian.mesh") -isfile(default_mesh_file) || download("https://gist.githubusercontent.com/ranocha/f4ea19ba3b62348968c971db43d7798b/raw/a506abb9479c020920cf6068c142670fc1a9aadc/mesh_uniform_cartesian.mesh", default_mesh_file) +isfile(default_mesh_file) || + download("https://gist.githubusercontent.com/ranocha/f4ea19ba3b62348968c971db43d7798b/raw/a506abb9479c020920cf6068c142670fc1a9aadc/mesh_uniform_cartesian.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) @@ -66,19 +67,20 @@ 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) callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) - ############################################################################### # run the simulation sol = solve(ode, BS3(), - save_everystep=false, callback=callbacks); + save_everystep = false, callback = callbacks); summary_callback() # print the timer summary diff --git a/benchmark/elixir_3d_euler_source_terms_structured.jl b/benchmark/elixir_3d_euler_source_terms_structured.jl index 9a284653f6f..b44eb0caa7c 100644 --- a/benchmark/elixir_3d_euler_source_terms_structured.jl +++ b/benchmark/elixir_3d_euler_source_terms_structured.jl @@ -9,17 +9,15 @@ 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) cells_per_dimension = (4, 4, 4) 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. @@ -30,16 +28,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) callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) - ############################################################################### # run the simulation sol = solve(ode, BS3(), - save_everystep=false, callback=callbacks); + save_everystep = false, callback = callbacks); summary_callback() # print the timer summary diff --git a/benchmark/elixir_3d_euler_source_terms_tree.jl b/benchmark/elixir_3d_euler_source_terms_tree.jl index 6a182da91e6..369b9359580 100644 --- a/benchmark/elixir_3d_euler_source_terms_tree.jl +++ b/benchmark/elixir_3d_euler_source_terms_tree.jl @@ -9,18 +9,16 @@ 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) 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. @@ -31,16 +29,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) callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) - ############################################################################### # run the simulation sol = solve(ode, BS3(), - save_everystep=false, callback=callbacks); + save_everystep = false, callback = callbacks); summary_callback() # print the timer summary diff --git a/benchmark/multiply_dimensionwise/benchmark_multiply_dimensionwise.jl b/benchmark/multiply_dimensionwise/benchmark_multiply_dimensionwise.jl index e270941cbe9..e6dd0d47448 100644 --- a/benchmark/multiply_dimensionwise/benchmark_multiply_dimensionwise.jl +++ b/benchmark/multiply_dimensionwise/benchmark_multiply_dimensionwise.jl @@ -1,3 +1,7 @@ +# Disable formatting this file since it contains highly unusual formatting for better +# readability +#! format: off + import Pkg; Pkg.activate(@__DIR__); Pkg.instantiate() using BenchmarkTools diff --git a/benchmark/run_benchmarks.jl b/benchmark/run_benchmarks.jl index 9c2b3ccc6f2..3a92a9ba700 100644 --- a/benchmark/run_benchmarks.jl +++ b/benchmark/run_benchmarks.jl @@ -3,18 +3,17 @@ using PkgBenchmark using Trixi let results = judge(Trixi, - BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`), # target - BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`, id="main") # baseline - ) - - export_markdown(joinpath(pathof(Trixi) |> dirname |> dirname, "benchmark", "results_$(gethostname())_threads1.md"), results) + BenchmarkConfig(juliacmd = `$(Base.julia_cmd()) --check-bounds=no --threads=1`), # target + BenchmarkConfig(juliacmd = `$(Base.julia_cmd()) --check-bounds=no --threads=1`, + id = "main")) + export_markdown(pkgdir(Trixi, "benchmark", "results_$(gethostname())_threads1.md"), + results) end - let results = judge(Trixi, - BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=2`), # target - BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=2`, id="main") # baseline - ) - - export_markdown(joinpath(pathof(Trixi) |> dirname |> dirname, "benchmark", "results_$(gethostname())_threads2.md"), results) + BenchmarkConfig(juliacmd = `$(Base.julia_cmd()) --check-bounds=no --threads=2`), # target + BenchmarkConfig(juliacmd = `$(Base.julia_cmd()) --check-bounds=no --threads=2`, + id = "main")) + export_markdown(pkgdir(Trixi, "benchmark", "results_$(gethostname())_threads2.md"), + results) end diff --git a/docs/literate/make.jl b/docs/literate/make.jl index 68763164eb6..b620f85c975 100644 --- a/docs/literate/make.jl +++ b/docs/literate/make.jl @@ -25,7 +25,7 @@ function create_files(title, file, repo_src, pages_dir, notebooks_dir; folder="" # Generate notebook file function preprocess_notebook(content) warning = "# **Note:** To improve responsiveness via caching, the notebooks are updated only once a week. They are only - # available for the latest stable release of Trixi at the time of caching.\n\n" + # available for the latest stable release of Trixi.jl at the time of caching.\n\n" return string("# # $title\n\n", warning, content) end Literate.notebook(joinpath(repo_src, folder, file), joinpath(notebooks_dir, folder); execute=false, preprocess=preprocess_notebook, credit=false) @@ -68,7 +68,7 @@ function create_tutorials(files) # Create markdown and notebook files for tutorials for (i, (title, filename)) in enumerate(files) - # Several files of one topic are created seperately and pushed to `pages` together. + # Several files of one topic are created separately and pushed to `pages` together. if filename isa Vector vector = [] for j in eachindex(filename) diff --git a/docs/literate/src/files/DGMulti_1.jl b/docs/literate/src/files/DGMulti_1.jl index 2deb2abb431..0d78e79907c 100644 --- a/docs/literate/src/files/DGMulti_1.jl +++ b/docs/literate/src/files/DGMulti_1.jl @@ -92,8 +92,8 @@ alive_callback = AliveCallback(alive_interval=10) analysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg)) callbacks = CallbackSet(analysis_callback, alive_callback); -sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, - callback=callbacks, save_everystep=false); +sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, + ode_default_options()..., callback=callbacks); #- using Plots pd = PlotData2D(sol) @@ -132,8 +132,8 @@ alive_callback = AliveCallback(alive_interval=10) analysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg)) callbacks = CallbackSet(analysis_callback, alive_callback); -sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, - callback=callbacks, save_everystep=false); +sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, + ode_default_options()..., callback=callbacks); #- using Plots pd = PlotData2D(sol) @@ -144,7 +144,7 @@ plot!(getmesh(pd)) # ## Triangular meshes on non-Cartesian domains -# To use triangular meshes on a non-Cartesian domain, Trixi uses the package [StartUpDG.jl](https://github.com/jlchan/StartUpDG.jl). +# To use triangular meshes on a non-Cartesian domain, Trixi.jl uses the package [StartUpDG.jl](https://github.com/jlchan/StartUpDG.jl). # The following example is based on [`elixir_euler_triangulate_pkg_mesh.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl) # and uses a pre-defined mesh from StartUpDG.jl. using Trixi, OrdinaryDiffEq @@ -167,7 +167,7 @@ dg = DGMulti(polydeg = 3, element_type = Tri(), meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole()); # The pre-defined Triangulate geometry in StartUpDG has integer boundary tags. With [`DGMultiMesh`](@ref) -# we assign boundary faces based on these integer boundary tags and create a mesh compatible with Trixi. +# we assign boundary faces based on these integer boundary tags and create a mesh compatible with Trixi.jl. mesh = DGMultiMesh(meshIO, dg, Dict(:outer_boundary=>1, :inner_boundary=>2)) #- boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition) diff --git a/docs/literate/src/files/DGSEM_FluxDiff.jl b/docs/literate/src/files/DGSEM_FluxDiff.jl index 3bd4995fd49..cf3b0a1dbd4 100644 --- a/docs/literate/src/files/DGSEM_FluxDiff.jl +++ b/docs/literate/src/files/DGSEM_FluxDiff.jl @@ -61,7 +61,7 @@ # This is called the summation-by-parts (SBP) property since it mimics integration by parts on a # discrete level ([Gassner (2013)](https://doi.org/10.1137/120890144)). -# The explicit definitions of the operators and the contruction of the 1D algorithm can be found +# The explicit definitions of the operators and the construction of the 1D algorithm can be found # for instance in the tutorial [introduction to DG methods](@ref scalar_linear_advection_1d) # or in more detail in [Kopriva (2009)](https://link.springer.com/book/10.1007/978-90-481-2261-5). @@ -115,7 +115,7 @@ -# ## [Implementation in Trixi](@id fluxDiffExample) +# ## [Implementation in Trixi.jl](@id fluxDiffExample) # Now, we have a look at the implementation of DGSEM with flux differencing with [Trixi.jl](https://github.com/trixi-framework/Trixi.jl). using OrdinaryDiffEq, Trixi @@ -146,10 +146,10 @@ equations = CompressibleEulerEquations2D(gamma) # ``` # with $\phi = \tan^{-1}(\frac{x_2}{x_1})$. -# This initial condition is implemented in Trixi under the name [`initial_condition_weak_blast_wave`](@ref). +# This initial condition is implemented in Trixi.jl under the name [`initial_condition_weak_blast_wave`](@ref). initial_condition = initial_condition_weak_blast_wave -# In Trixi, flux differencing for the volume integral can be implemented with +# In Trixi.jl, flux differencing for the volume integral can be implemented with # [`VolumeIntegralFluxDifferencing`](@ref) using symmetric two-point volume fluxes. # First, we set up a simulation with the entropy conserving and kinetic energy preserving # flux [`flux_ranocha`](@ref) by [Hendrik Ranocha (2018)](https://cuvillier.de/en/shop/publications/7743) @@ -161,7 +161,7 @@ volume_flux = flux_ranocha # = f_vol solver = DGSEM(polydeg=3, surface_flux=volume_flux, volume_integral=VolumeIntegralFluxDifferencing(volume_flux)) -# Now, we implement Trixi's `mesh`, `semi` and `ode` in a simple framework. For more information please +# Now, we implement Trixi.jl's `mesh`, `semi` and `ode` in a simple framework. For more information please # have a look at the documentation, the basic tutorial [introduction to DG methods](@ref scalar_linear_advection_1d) # or some basic elixirs. coordinates_min = (-2.0, -2.0) @@ -183,8 +183,8 @@ ode = semidiscretize(semi, tspan); analysis_callback = AnalysisCallback(semi, interval=100); # We now run the simulation using `flux_ranocha` for both surface and volume flux. -sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, - callback=analysis_callback, save_everystep=false); +sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, + ode_default_options()..., callback=analysis_callback); # A look at the change in entropy $\sum \partial S/\partial U \cdot U_t$ in the analysis callback # confirms that the flux is entropy conserving since the change is about machine precision. @@ -222,8 +222,8 @@ ode = semidiscretize(semi, tspan); analysis_callback = AnalysisCallback(semi, interval=100); # We now run the simulation using the volume flux `flux_ranocha` and surface flux `flux_lax_friedrichs`. -sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, - callback=analysis_callback, save_everystep=false); +sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, + ode_default_options()..., callback=analysis_callback); # The change in entropy confirms the expected entropy stability. using Plots @@ -232,7 +232,7 @@ plot(sol) # Of course, you can use more than these two fluxes in Trixi. Here, we will give a short list # of possible fluxes for the compressible Euler equations. -# For the volume flux Trixi provides for example [`flux_ranocha`](@ref), [`flux_shima_etal`](@ref), +# For the volume flux Trixi.jl provides for example [`flux_ranocha`](@ref), [`flux_shima_etal`](@ref), # [`flux_chandrashekar`](@ref), [`flux_kennedy_gruber`](@ref). # As surface flux you can use all volume fluxes and additionally for instance [`flux_lax_friedrichs`](@ref), # [`flux_hll`](@ref), [`flux_hllc`](@ref). diff --git a/docs/literate/src/files/adaptive_mesh_refinement.jl b/docs/literate/src/files/adaptive_mesh_refinement.jl index f4611e4a891..d6150e887a8 100644 --- a/docs/literate/src/files/adaptive_mesh_refinement.jl +++ b/docs/literate/src/files/adaptive_mesh_refinement.jl @@ -5,10 +5,10 @@ # of the domain, we want the simulation to use elements with smaller mesh sizes compared to other # regions. This should be automatically and dynamically adapted during the run of the simulation. -# # Implementation in Trixi +# # Implementation in Trixi.jl # In [Trixi.jl](https://github.com/trixi-framework/Trixi.jl), AMR is possible for the mesh types # [`TreeMesh`](@ref) and [`P4estMesh`](@ref). Both meshes are organized in a tree structure -# and therefore, each element can be refined independently. In Trixi, AMR is restricted +# and therefore, each element can be refined independently. In Trixi.jl, AMR is restricted # to a 2:1 refinement ratio between neighbor elements. This means that the maximum resolution # difference of neighboring elements is a factor of two. @@ -17,7 +17,7 @@ # ### Indicators # An indicator estimates the current accuracy of the numerical approximation. It indicates which regions -# of the domain need finer or coarser resolutions. In Trixi, you can use for instance +# of the domain need finer or coarser resolutions. In Trixi.jl, you can use for instance # [`IndicatorLöhner`](@ref) and [`IndicatorHennemannGassner`](@ref). # `IndicatorLöhner` (also callable with `IndicatorLoehner`) is an interpretation and adaptation of @@ -45,7 +45,7 @@ # Another indicator is the very basic `IndicatorMax`. It indicates the maximal value of a variable # and is therefore mostly used for verification and testing. But it might be useful for the basic -# understanding of the implementation of indicators and AMR in Trixi. +# understanding of the implementation of indicators and AMR in Trixi.jl. # ````julia # amr_indicator = IndicatorMax(semi, variable=variable) # ```` @@ -57,12 +57,12 @@ # For instance, a mesh element of level `3` has double resolution in each direction compared to # another element with level `2`. -# To map specific indicator values to a desired level of refinement, Trixi uses controllers. +# To map specific indicator values to a desired level of refinement, Trixi.jl uses controllers. # They are build in three levels: There is a base level of refinement `base_level`, which is the # minimum allowed refinement level. Then, there is a medium level `med_level`, which corresponds # to the initial level of refinement, for indicator values above the threshold `med_threshold` # and equally, a maximal level `max_level` for values above `max_threshold`. -# This variant of controller is called [`ControllerThreeLevel`](@ref) in Trixi. +# This variant of controller is called [`ControllerThreeLevel`](@ref) in Trixi.jl. # ````julia # amr_controller = ControllerThreeLevel(semi, amr_indicator; # base_level=4, @@ -164,13 +164,13 @@ plot!(getmesh(pd)) # # More examples -# Trixi provides many elixirs using AMR. We want to give some examples for different mesh types: +# Trixi.jl provides many elixirs using AMR. We want to give some examples for different mesh types: # - `elixir_euler_blast_wave_amr.jl` for [`TreeMesh`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_euler_blast_wave_amr.jl) # and [`P4estMesh`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl) # - [`elixir_euler_kelvin_helmholtz_instability_amr.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_euler_kelvin_helmholtz_instability_amr.jl) for `TreeMesh` # - [`elixir_euler_double_mach_amr.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl) for `P4estMesh` -# Animations of more interesting and complicated AMR simulations can be found below and on Trixi's youtube channel +# Animations of more interesting and complicated AMR simulations can be found below and on Trixi.jl's youtube channel # ["Trixi Framework"](https://www.youtube.com/channel/UCpd92vU2HjjTPup-AIN0pkg). # First, we give a [purely hyperbolic simulation of a Sedov blast wave with self-gravity](https://www.youtube.com/watch?v=dxgzgteJdOA). @@ -186,7 +186,7 @@ plot!(getmesh(pd)) # --> # # ``` -# Source: Trixi's YouTube channel [`Trixi Framework`](https://www.youtube.com/channel/UCpd92vU2HjjTPup-AIN0pkg) +# Source: Trixi.jl's YouTube channel [`Trixi Framework`](https://www.youtube.com/channel/UCpd92vU2HjjTPup-AIN0pkg) # The next example is a numerical simulation of an [ideal MHD rotor on an unstructured AMR mesh](https://www.youtube.com/watch?v=Iei7e9oQ0hs). # The used mesh type is a `P4estMesh`. @@ -199,6 +199,6 @@ plot!(getmesh(pd)) # --> # # ``` -# Source: Trixi's YouTube channel [`Trixi Framework`](https://www.youtube.com/channel/UCpd92vU2HjjTPup-AIN0pkg) +# Source: Trixi.jl's YouTube channel [`Trixi Framework`](https://www.youtube.com/channel/UCpd92vU2HjjTPup-AIN0pkg) # For more information, please have a look at the respective links. diff --git a/docs/literate/src/files/adding_new_parabolic_terms.jl b/docs/literate/src/files/adding_new_parabolic_terms.jl index a6cecb351be..882f73f66ff 100644 --- a/docs/literate/src/files/adding_new_parabolic_terms.jl +++ b/docs/literate/src/files/adding_new_parabolic_terms.jl @@ -152,8 +152,8 @@ tspan = (0.0, 2.0) ode = semidiscretize(semi, tspan) callbacks = CallbackSet(SummaryCallback()) time_int_tol = 1.0e-6 -sol = solve(ode, RDPK3SpFSAL49(), abstol=time_int_tol, reltol=time_int_tol, - save_everystep=false, callback=callbacks); +sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, + ode_default_options()..., callback=callbacks); using Plots plot(sol) diff --git a/docs/literate/src/files/adding_new_scalar_equations.jl b/docs/literate/src/files/adding_new_scalar_equations.jl index f5c2eae3693..fec7bcf667a 100644 --- a/docs/literate/src/files/adding_new_scalar_equations.jl +++ b/docs/literate/src/files/adding_new_scalar_equations.jl @@ -1,6 +1,6 @@ #src # Adding a new equation: scalar conservation laws -# If you want to use Trixi for your own research, you might be interested in +# If you want to use Trixi.jl for your own research, you might be interested in # a new physics model that's not already included in Trixi.jl. In this tutorial, # we will implement the cubic conservation law # ```math @@ -66,10 +66,10 @@ summary_callback = SummaryCallback() callbacks = CallbackSet(summary_callback) ## OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks -sol = solve(ode, SSPRK43(), - save_everystep=false, callback=callbacks); +sol = solve(ode, SSPRK43(); + ode_default_options()..., callback=callbacks); -# That's it, you ran your first simulation using your new equation with Trixi! Now, we can plot +# That's it, you ran your first simulation using your new equation with Trixi.jl! Now, we can plot # the solution at the final time using Plots.jl. using Plots plot(sol) @@ -94,7 +94,7 @@ plot(sol) ## A new setup with dissipation semi = remake(semi, solver=DGSEM(3, flux_godunov)) ode = semidiscretize(semi, tspan) -sol = solve(ode, SSPRK43(), save_everystep=false) +sol = solve(ode, SSPRK43(); ode_default_options()...) plot!(sol) # You can see that there are fewer oscillations, in particular around steep edges. @@ -103,7 +103,7 @@ plot!(sol) ## A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12) semi = remake(semi, mesh=TreeMesh(-1.0, 1.0, initial_refinement_level=8, n_cells_max=10^5)) ode = semidiscretize(semi, (0.0, 0.5) #= tspan =#) -sol = solve(ode, SSPRK43(), save_everystep=false) +sol = solve(ode, SSPRK43(); ode_default_options()...) plot(sol) # You can observe that nonclassical shocks develop and are stable under grid refinement, @@ -121,7 +121,7 @@ end ## Let's use a provably entropy-dissipative semidiscretization semi = remake(semi, solver=DGSEM(3, flux_godunov, VolumeIntegralFluxDifferencing(flux_ec))) ode = semidiscretize(semi, (0.0, 0.5)) -sol = solve(ode, SSPRK43(), save_everystep=false); +sol = solve(ode, SSPRK43(); ode_default_options()...); plot(sol) # Possible next steps could be @@ -132,7 +132,7 @@ plot(sol) # - to experiment with shock-capturing volume integrals [`VolumeIntegralShockCapturingHG`](@ref) # and adaptive mesh refinement [`AMRCallback`](@ref) -# For further reading, Trixi provides another example on adding a scalar equation. In the +# For further reading, Trixi.jl provides another example on adding a scalar equation. In the # [elixir about the KPP problem](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_kpp.jl), # the 2D scalar "KPP equation" from [Kurganov, Petrova, Popov (2007)](https://doi.org/10.1137/040614189) is # implemented. @@ -188,26 +188,26 @@ tspan = (0.0, 0.1) ode = semidiscretize(semi, tspan) ## OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks -sol = solve(ode, SSPRK43(), save_everystep=false) +sol = solve(ode, SSPRK43(); ode_default_options()...) plot(sol) ## A new setup with dissipation semi = remake(semi, solver=DGSEM(3, flux_godunov)) ode = semidiscretize(semi, tspan) -sol = solve(ode, SSPRK43(), save_everystep=false) +sol = solve(ode, SSPRK43(); ode_default_options()...) plot!(sol) ## A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12) semi = remake(semi, mesh=TreeMesh(-1.0, 1.0, initial_refinement_level=8, n_cells_max=10^5)) ode = semidiscretize(semi, (0.0, 0.5)) -sol = solve(ode, SSPRK43(), save_everystep=false) +sol = solve(ode, SSPRK43(); ode_default_options()...) plot(sol) ## Let's use a provably entropy-dissipative semidiscretization semi = remake(semi, solver=DGSEM(3, flux_godunov, VolumeIntegralFluxDifferencing(flux_ec))) ode = semidiscretize(semi, (0.0, 0.5)) -sol = solve(ode, SSPRK43(), save_everystep=false) +sol = solve(ode, SSPRK43(); ode_default_options()...) plot(sol) diff --git a/docs/literate/src/files/adding_nonconservative_equation.jl b/docs/literate/src/files/adding_nonconservative_equation.jl index d75c5bca1b9..08dd631058e 100644 --- a/docs/literate/src/files/adding_nonconservative_equation.jl +++ b/docs/literate/src/files/adding_nonconservative_equation.jl @@ -1,7 +1,7 @@ #src # Adding a new equation: nonconservative linear advection using Test: @test #src -# If you want to use Trixi for your own research, you might be interested in +# If you want to use Trixi.jl for your own research, you might be interested in # a new physics model that is not present in Trixi.jl. In this tutorial, # we will implement the nonconservative linear advection equation in a periodic domain # ```math diff --git a/docs/literate/src/files/differentiable_programming.jl b/docs/literate/src/files/differentiable_programming.jl index d7b5db8715b..ecc09d05dcf 100644 --- a/docs/literate/src/files/differentiable_programming.jl +++ b/docs/literate/src/files/differentiable_programming.jl @@ -13,7 +13,7 @@ using Test: @test #src # ## Forward mode automatic differentiation -# Trixi integrates well with [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) +# Trixi.jl integrates well with [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) # for forward mode AD. @@ -124,7 +124,7 @@ condition_number = cond(V) # ### Computing other derivatives -# It is also possible to compute derivatives of other dependencies using AD in Trixi. For example, +# It is also possible to compute derivatives of other dependencies using AD in Trixi.jl. For example, # you can compute the gradient of an entropy-dissipative semidiscretization with respect to the # ideal gas constant of the compressible Euler equations as described in the following. This example # is also available as the elixir @@ -208,7 +208,7 @@ round.(extrema(J), sigdigits=2) norm(J[1:4:end]) @test norm(J[1:4:end]) == 0.0 #src -# Here, we used some knowledge about the internal memory layout of Trixi, an array of structs +# Here, we used some knowledge about the internal memory layout of Trixi.jl, an array of structs # with the conserved variables as fastest-varying index in memory. @@ -322,12 +322,12 @@ end; # The semidiscretization `semi` uses some internal caches to avoid repeated allocations # and speed up the computations, e.g. for numerical fluxes at interfaces. Thus, we -# need to tell Trixi to allow `ForwardDiff.Dual` numbers in these caches. That's what +# need to tell Trixi.jl to allow `ForwardDiff.Dual` numbers in these caches. That's what # the keyword argument `uEltype=typeof(k)` in semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, uEltype=typeof(k)); -# does. This is basically the only part where you need to modify your standard Trixi +# does. This is basically the only part where you need to modify your standard Trixi.jl # code to enable automatic differentiation. From there on, the remaining steps ode = semidiscretize(semi, (0.0, 1.0)) sol = solve(ode, BS3(), save_everystep=false) @@ -343,7 +343,7 @@ round(Trixi.integrate(energy_total, sol.u[end], semi), sigdigits=5) # [![Error bars by Randall Munroe](https://imgs.xkcd.com/comics/error_bars.png)](https://xkcd.com/2110/) # "Error bars" by Randall Munroe, linked from https://xkcd.com/2110 -# Similar to AD, Trixi also allows propagating uncertainties using linear error propagation +# Similar to AD, Trixi.jl also allows propagating uncertainties using linear error propagation # theory via [Measurements.jl](https://github.com/JuliaPhysics/Measurements.jl). # As an example, let's create a system representing the linear advection equation # in 1D with an uncertain velocity. Then, we create a semidiscretization using a @@ -381,7 +381,7 @@ plot(sol) # ## Finite difference approximations -# Trixi provides the convenience function [`jacobian_fd`](@ref) to approximate the Jacobian +# Trixi.jl provides the convenience function [`jacobian_fd`](@ref) to approximate the Jacobian # via central finite differences. using Trixi, LinearAlgebra @@ -413,7 +413,7 @@ relative_difference = norm(J_fd - J_ad) / size(J_fd, 1) # \partial_t u(t) = A u(t) + b, # ``` -# where `A` is a linear operator ("matrix") and `b` is a vector. Trixi allows you +# where `A` is a linear operator ("matrix") and `b` is a vector. Trixi.jl allows you # to obtain this linear structure in a matrix-free way by using [`linear_structure`](@ref). # The resulting operator `A` can be used in multiplication, e.g. `mul!` from # LinearAlgebra, converted to a sparse matrix using `sparse` from SparseArrays, diff --git a/docs/literate/src/files/hohqmesh_tutorial.jl b/docs/literate/src/files/hohqmesh_tutorial.jl index 2e54ecb3981..87076108d91 100644 --- a/docs/literate/src/files/hohqmesh_tutorial.jl +++ b/docs/literate/src/files/hohqmesh_tutorial.jl @@ -41,7 +41,7 @@ end #hide #md # This will compute a smooth, manufactured solution test case for the 2D compressible Euler equations # on the curved quadrilateral mesh described in the -# [Trixi documentation](https://trixi-framework.github.io/Trixi.jl/stable/meshes/unstructured_quad_mesh/). +# [Trixi.jl documentation](https://trixi-framework.github.io/Trixi.jl/stable/meshes/unstructured_quad_mesh/). # Apart from the usual error and timing output provided by the Trixi.jl run, it is useful to visualize and inspect # the solution. One option available in the Trixi.jl framework to visualize the solution on @@ -49,7 +49,7 @@ end #hide #md # Trixi.jl output file(s) with the [`Trixi2Vtk`](https://github.com/trixi-framework/Trixi2Vtk.jl) tool # and plotting them with [ParaView](https://www.paraview.org/download/). -# To convert the HDF5-formatted `.h5` output file(s) from Trixi into VTK format execute the following +# To convert the HDF5-formatted `.h5` output file(s) from Trixi.jl into VTK format execute the following using Trixi2Vtk redirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide #md @@ -173,7 +173,7 @@ end # available if you wish to also save a collection of mesh statistics. For this example it is deactivated. # These file names given within `RUN_PARAMETERS` **should match** that of the control file, and although this is not required by # HOHQMesh, it is a useful style convention. -# The mesh file format `ISM-v2` in the format currently required by Trixi. The `polynomial order` prescribes the order +# The mesh file format `ISM-v2` in the format currently required by Trixi.jl. The `polynomial order` prescribes the order # of an interpolant constructed on the Chebyshev-Gauss-Lobatto nodes that is used to represent any curved boundaries on a particular element. # The plot file format of `skeleton` means that visualizing the plot file will only draw the element boundaries (and no internal nodes). # Alternatively, the format can be set to `sem` to visualize the interior nodes of the approximation as well. @@ -497,7 +497,7 @@ output = generate_mesh(control_file); # We can reuse much of the elixir file to setup the uniform flow over an ice cream cone from the # previous part of this tutorial. The only component of the elixir file that must be changed is the boundary condition -# dictionary because we now have a boundary named `OuterCirle` instead of four edges of a bounding box. +# dictionary because we now have a boundary named `OuterCircle` instead of four edges of a bounding box. ## boundary condition dictionary boundary_conditions = Dict( :OuterCircle => boundary_condition_uniform_flow, @@ -535,7 +535,7 @@ mesh = UnstructuredMesh2D(mesh_file); # Now, you can create a `P4estMesh` from your mesh file. It is described in detail in the # [P4est-based mesh](https://trixi-framework.github.io/Trixi.jl/stable/meshes/p4est_mesh/#P4est-based-mesh) -# part of the Trixi docs. +# part of the Trixi.jl docs. # ```julia # using Trixi # mesh_file = joinpath("out", "ice_cream_straight_sides.inp") @@ -543,7 +543,7 @@ mesh = UnstructuredMesh2D(mesh_file); # ``` # Since `P4estMesh` supports AMR, we just have to extend the setup from the first example by the -# standard AMR procedure. For more information about AMR in Trixi, see the [matching tutorial](@ref adaptive_mesh_refinement). +# standard AMR procedure. For more information about AMR in Trixi.jl, see the [matching tutorial](@ref adaptive_mesh_refinement). # ```julia # amr_indicator = IndicatorLöhner(semi, variable=density) diff --git a/docs/literate/src/files/index.jl b/docs/literate/src/files/index.jl index 899c18ff8d7..5b669881502 100644 --- a/docs/literate/src/files/index.jl +++ b/docs/literate/src/files/index.jl @@ -10,7 +10,7 @@ # You can download the raw notebooks from GitHub via ![](https://camo.githubusercontent.com/aea75103f6d9f690a19cb0e17c06f984ab0f472d9e6fe4eadaa0cc438ba88ada/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f776e6c6f61642d6e6f7465626f6f6b2d627269676874677265656e). # **Note:** To improve responsiveness via caching, the notebooks are updated only once a week. They are only -# available for the latest stable release of Trixi at the time of caching. +# available for the latest stable release of Trixi.jl at the time of caching. # There are tutorials for the following topics: @@ -25,19 +25,19 @@ #- # To improve stability often the flux differencing formulation of the DGSEM (split form) is used. # We want to present the idea and formulation on a basic 1D level. Then, we show how this formulation -# can be implemented in Trixi and analyse entropy conservation for two different flux combinations. +# can be implemented in Trixi.jl and analyse entropy conservation for two different flux combinations. # ### [3 Shock capturing with flux differencing and stage limiter](@ref shock_capturing) #- # Using the flux differencing formulation, a simple procedure to capture shocks is a hybrid blending # of a high-order DG method and a low-order subcell finite volume (FV) method. We present the idea on a -# very basic level and show the implementation in Trixi. Then, a positivity preserving limiter is +# very basic level and show the implementation in Trixi.jl. Then, a positivity preserving limiter is # explained and added to an exemplary simulation of the Sedov blast wave with the 2D compressible Euler # equations. # ### [4 Non-periodic boundary conditions](@ref non_periodic_boundaries) #- -# Thus far, all examples used periodic boundaries. In Trixi, you can also set up a simulation with +# Thus far, all examples used periodic boundaries. In Trixi.jl, you can also set up a simulation with # non-periodic boundaries. This tutorial presents the implementation of the classical Dirichlet # boundary condition with a following example. Then, other non-periodic boundaries are mentioned. @@ -79,13 +79,13 @@ # ### [10 Adaptive mesh refinement](@ref adaptive_mesh_refinement) #- # Adaptive mesh refinement (AMR) helps to increase the accuracy in sensitive or turbolent regions while -# not wasting ressources for less interesting parts of the domain. This leads to much more efficient -# simulations. This tutorial presents the implementation strategy of AMR in Trixi, including the use of +# not wasting resources for less interesting parts of the domain. This leads to much more efficient +# simulations. This tutorial presents the implementation strategy of AMR in Trixi.jl, including the use of # different indicators and controllers. # ### [11 Structured mesh with curvilinear mapping](@ref structured_mesh_mapping) #- -# In this tutorial, the use of Trixi's structured curved mesh type [`StructuredMesh`](@ref) is explained. +# In this tutorial, the use of Trixi.jl's structured curved mesh type [`StructuredMesh`](@ref) is explained. # We present the two basic option to initialize such a mesh. First, the curved domain boundaries # of a circular cylinder are set by explicit boundary functions. Then, a fully curved mesh is # defined by passing the transformation mapping. @@ -100,7 +100,7 @@ # In the end, the tutorial briefly explains how to simulate an example using AMR via `P4estMesh`. # ### [13 Explicit time stepping](@ref time_stepping) -# - +#- # This tutorial is about time integration using [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl). # It explains how to use their algorithms and presents two types of time step choices - with error-based # and CFL-based adaptive step size control. @@ -114,8 +114,8 @@ -# ## Examples in Trixi -# Trixi already contains several more coding examples, the so-called `elixirs`. You can find them +# ## Examples in Trixi.jl +# Trixi.jl already contains several more coding examples, the so-called `elixirs`. You can find them # in the folder [`examples`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/). # They are structured by the underlying mesh type and the respective number of spatial dimensions. # The name of an elixir is composed of the underlying system of conservation equations (for instance diff --git a/docs/literate/src/files/non_periodic_boundaries.jl b/docs/literate/src/files/non_periodic_boundaries.jl index 9517fbfcfae..54da88a64aa 100644 --- a/docs/literate/src/files/non_periodic_boundaries.jl +++ b/docs/literate/src/files/non_periodic_boundaries.jl @@ -104,7 +104,7 @@ end # # Other available example elixirs with non-trivial BC -# Moreover, there are other boundary conditions in Trixi. For instance, you can use the slip wall +# Moreover, there are other boundary conditions in Trixi.jl. For instance, you can use the slip wall # boundary condition [`boundary_condition_slip_wall`](@ref). # Trixi.jl provides some interesting examples with different combinations of boundary conditions, e.g. @@ -123,7 +123,7 @@ end # --> # # ``` -# Source: [`Video`](https://www.youtube.com/watch?v=glAug1aIxio) on Trixi's YouTube channel [`Trixi Framework`](https://www.youtube.com/watch?v=WElqqdMhY4A) +# Source: [`Video`](https://www.youtube.com/watch?v=glAug1aIxio) on Trixi.jl's YouTube channel [`Trixi Framework`](https://www.youtube.com/watch?v=WElqqdMhY4A) # A double Mach reflection problem for the 2D compressible Euler equations # [`elixir_euler_double_mach_amr.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl) @@ -138,7 +138,7 @@ end # --> # # ``` -# Source: [`Video`](https://www.youtube.com/watch?v=WElqqdMhY4A) on Trixi's YouTube channel [`Trixi Framework`](https://www.youtube.com/watch?v=WElqqdMhY4A) +# Source: [`Video`](https://www.youtube.com/watch?v=WElqqdMhY4A) on Trixi.jl's YouTube channel [`Trixi Framework`](https://www.youtube.com/watch?v=WElqqdMhY4A) # A channel flow around a cylinder at Mach 3 # [`elixir_euler_supersonic_cylinder.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl) @@ -154,4 +154,4 @@ end # --> # # ``` -# Source: [`Video`](https://www.youtube.com/watch?v=w0A9X38cSe4) on Trixi's YouTube channel [`Trixi Framework`](https://www.youtube.com/watch?v=WElqqdMhY4A) +# Source: [`Video`](https://www.youtube.com/watch?v=w0A9X38cSe4) on Trixi.jl's YouTube channel [`Trixi Framework`](https://www.youtube.com/watch?v=WElqqdMhY4A) diff --git a/docs/literate/src/files/parabolic_terms.jl b/docs/literate/src/files/parabolic_terms.jl index aeceb7b7e6f..bac0098f8e9 100644 --- a/docs/literate/src/files/parabolic_terms.jl +++ b/docs/literate/src/files/parabolic_terms.jl @@ -78,8 +78,8 @@ tspan = (0.0, 1.5) ode = semidiscretize(semi, tspan) callbacks = CallbackSet(SummaryCallback()) time_int_tol = 1.0e-6 -sol = solve(ode, RDPK3SpFSAL49(), abstol=time_int_tol, reltol=time_int_tol, - save_everystep=false, callback=callbacks); +sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, + ode_default_options()..., callback=callbacks); # We can now visualize the solution, which develops a boundary layer at the outflow boundaries. diff --git a/docs/literate/src/files/scalar_linear_advection_1d.jl b/docs/literate/src/files/scalar_linear_advection_1d.jl index 59b4e814993..42c831c98ba 100644 --- a/docs/literate/src/files/scalar_linear_advection_1d.jl +++ b/docs/literate/src/files/scalar_linear_advection_1d.jl @@ -44,16 +44,17 @@ dx = (coordinates_max - coordinates_min) / n_elements # length of one element # ``` # Here, $J$ is the Jacobian determinant of the transformation. -# Using this transformation, we can transform our equation for all elements $Q_l$. +# Using this transformation, we can transform our equation for each element $Q_l$. # ```math # \frac{dx}{2} u_t^{Q_l} + u_\xi^{Q_l} = 0 \text{, for }t\in\mathbb{R}^+,\; \xi\in[-1, 1] # ``` +# Here, $u_t^{Q_l}$ and $u_\xi^{Q_l}$ denote the time and spatial derivatives of the solution on the element $Q_l$. # ### ii. Polynomial approach # Now, we want to approximate the solution in each element $Q_l$ by a polynomial of degree $N$. Since we transformed # the equation, we can use the same polynomial approach for the reference coordinate $\xi\in[-1, 1]$ in every -# physical element $Q_l$. This saves a lot of ressources by reducing the amount of calculations needed +# physical element $Q_l$. This saves a lot of resources by reducing the amount of calculations needed # and storing less information. # For DGSEM we choose [Lagrange basis functions](https://en.wikipedia.org/wiki/Lagrange_polynomial) @@ -63,7 +64,7 @@ dx = (coordinates_max - coordinates_min) / n_elements # length of one element # u(x(\xi), t)\big|_{Q_l} \approx u^{Q_l}(\xi, t) = \sum_{j=0}^N u_j^{Q_l}(t) l_j(\xi) # ``` # with $N+1$ coefficients $\{u_j^{Q_l}\}_{j=0}^N$. -# By contruction the Lagrange basis has some useful advantages. This basis is defined by $N+1$ nodes, which +# By construction the Lagrange basis has some useful advantages. This basis is defined by $N+1$ nodes, which # fulfill a Kronecker property at the exact same nodes. Let $\{\xi_i\}_{i=0}^N$ be these nodes. # ```math # l_j(\xi_i) = \delta_{i,j} = @@ -186,7 +187,7 @@ M = diagm(weights) # is called mass lumping and has the big advantage of an easy invertation of the matrix. # #### Term II: -# We use spatial partial intergration for the second term: +# We use spatial partial integration for the second term: # ```math # \int_{-1}^1 u'(\xi, t) l_i(\xi) d\xi = [u l_i]_{-1}^1 - \int_{-1}^1 u l_i'd\xi # ``` @@ -298,7 +299,7 @@ function rhs!(du, u, x, t) ## Calculate interface and boundary fluxes, $u^* = (u^*|_{-1}, 0, ..., 0, u^*|^1)^T$ ## Since we use the flux Lax-Friedrichs from Trixi.jl, we have to pass some extra arguments. - ## Trixi needs the equation we are dealing with and an additional `1`, that indicates the + ## Trixi.jl needs the equation we are dealing with and an additional `1`, that indicates the ## first coordinate direction. equations = LinearScalarAdvectionEquation1D(1.0) for element in 2:n_elements-1 @@ -341,7 +342,7 @@ using OrdinaryDiffEq tspan = (0.0, 2.0) ode = ODEProblem(rhs!, u0, tspan, x) -sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, save_everystep=false) +sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...) @test maximum(abs.(u0 - sol.u[end])) < 5e-5 #src plot(vec(x), vec(sol.u[end]), label="solution at t=$(tspan[2])", legend=:topleft, lw=3) @@ -374,7 +375,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, n_cells_max=30_000) # set maximum capacity of tree data structure (only needed for AMR) # A semidiscretization collects data structures and functions for the spatial discretization. -# In Trixi, an initial condition has the following parameter structure and is of the type `SVector`. +# In Trixi.jl, an initial condition has the following parameter structure and is of the type `SVector`. initial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t))) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver) @@ -384,7 +385,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave tspan = (0.0, 2.0) ode_trixi = semidiscretize(semi, tspan) -sol_trixi = solve(ode_trixi, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, save_everystep=false); +sol_trixi = solve(ode_trixi, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...); # We add a plot of the new approximated solution to the one calculated before. plot!(sol_trixi, label="solution at t=$(tspan[2]) with Trixi.jl", legend=:topleft, linestyle=:dash, lw=2) @@ -475,7 +476,7 @@ tspan = (0.0, 2.0) ode = ODEProblem(rhs!, u0, tspan, x) ## solve -sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, save_everystep=false) +sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...) @test maximum(abs.(vec(u0) - sol_trixi.u[end])) ≈ maximum(abs.(u0 - sol.u[end])) #src plot(vec(x), vec(sol.u[end]), label="solution at t=$(tspan[2])", legend=:topleft, lw=3) @@ -506,7 +507,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave ## solve tspan = (0.0, 2.0) ode_trixi = semidiscretize(semi, tspan) -sol_trixi = solve(ode_trixi, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6, save_everystep=false); +sol_trixi = solve(ode_trixi, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...); plot!(sol_trixi, label="solution at t=$(tspan[2]) with Trixi.jl", legend=:topleft, linestyle=:dash, lw=2) @test maximum(abs.(vec(u0) - sol_trixi.u[end])) ≈ maximum(abs.(u0 - sol.u[end])) #src diff --git a/docs/literate/src/files/shock_capturing.jl b/docs/literate/src/files/shock_capturing.jl index 7ee1146117e..b165f7ec8bd 100644 --- a/docs/literate/src/files/shock_capturing.jl +++ b/docs/literate/src/files/shock_capturing.jl @@ -22,7 +22,7 @@ # Since the surface integral is equal for both the DG and the subcell FV method, only the volume integral divides # between the two methods. -# This strategy for the volume integral is implemented in Trixi under the name of +# This strategy for the volume integral is implemented in Trixi.jl under the name of # [`VolumeIntegralShockCapturingHG`](@ref) with the three parameters of the indicator and the volume fluxes for # the DG and the subcell FV method. @@ -74,7 +74,7 @@ # `density`, `pressure` or both with `density_pressure` for the compressible Euler equations. # For every equation there is also the option to use the first conservation variable with `first`. -# This indicator is implemented in Trixi and called [`IndicatorHennemannGassner`](@ref) with the parameters +# This indicator is implemented in Trixi.jl and called [`IndicatorHennemannGassner`](@ref) with the parameters # `equations`, `basis`, `alpha_max`, `alpha_min`, `alpha_smooth` and `variable`. # ````julia # indicator_sc = IndicatorHennemannGassner(equations, basis, @@ -92,7 +92,7 @@ # or density for the compressible Euler equations. This often results in crashed simulations since # the calculation of numerical fluxes or stable time steps uses mathematical operations like roots or # logarithms. One option to avoid these cases are a-posteriori positivity preserving limiters. -# Trixi provides the fully-discrete positivity-preserving limiter of +# Trixi.jl provides the fully-discrete positivity-preserving limiter of # [Zhang, Shu (2011)](https://doi.org/10.1098/rspa.2011.0153). # It works the following way. For every passed (scalar) variable and for every DG element we calculate @@ -117,7 +117,7 @@ # compressible Euler equations `density`, `pressure` or the combined variable `density_pressure` # are a reasonable choice. -# You can implement the limiter in Trixi using [`PositivityPreservingLimiterZhangShu`](@ref) with parameters +# You can implement the limiter in Trixi.jl using [`PositivityPreservingLimiterZhangShu`](@ref) with parameters # `threshold` and `variables`. # ````julia # stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=thresholds, @@ -191,7 +191,7 @@ volume_integral = VolumeIntegralShockCapturingHG(indicator_sc; volume_flux_dg=volume_flux, volume_flux_fv=surface_flux) -# We finalize the discretization by implementing Trixi's `solver`, `mesh`, `semi` and `ode`, +# We finalize the discretization by implementing Trixi.jl's `solver`, `mesh`, `semi` and `ode`, # while `solver` now has the extra parameter `volume_integral`. solver = DGSEM(basis, surface_flux, volume_integral) diff --git a/docs/literate/src/files/structured_mesh_mapping.jl b/docs/literate/src/files/structured_mesh_mapping.jl index a7ed8eb4304..0ae9cf723f8 100644 --- a/docs/literate/src/files/structured_mesh_mapping.jl +++ b/docs/literate/src/files/structured_mesh_mapping.jl @@ -1,11 +1,11 @@ #src # Structured mesh with curvilinear mapping -# Here, we want to introduce another mesh type of [Trixi](https://github.com/trixi-framework/Trixi.jl). +# Here, we want to introduce another mesh type of [Trixi.jl](https://github.com/trixi-framework/Trixi.jl). # More precisely, this tutorial is about the curved mesh type [`StructuredMesh`](@ref) supporting # curved meshes. # # Creating a curved mesh -# There are two basic options to define a curved [`StructuredMesh`](@ref) in Trixi. You can +# There are two basic options to define a curved [`StructuredMesh`](@ref) in Trixi.jl. You can # implement curves for the domain boundaries, or alternatively, set up directly the complete # transformation mapping. We now present one short example each. @@ -17,7 +17,7 @@ using Trixi equations = CompressibleEulerEquations2D(1.4) -# We start with a pressure perturbation at `(xs, 0.0)` as initial condtition. +# We start with a pressure perturbation at `(xs, 0.0)` as initial condition. function initial_condition_pressure_perturbation(x, t, equations::CompressibleEulerEquations2D) xs = 1.5 # location of the initial disturbance on the x axis w = 1/8 # half width @@ -197,7 +197,7 @@ plot!(getmesh(pd)) # For more curved mesh mappings, please have a look at some # [elixirs for `StructuredMesh`](https://github.com/trixi-framework/Trixi.jl/tree/main/examples). -# For another curved mesh type, there is a [tutorial](@ref hohqmesh_tutorial) about Trixi's +# For another curved mesh type, there is a [tutorial](@ref hohqmesh_tutorial) about Trixi.jl's # unstructured mesh type [`UnstructuredMesh2D`] and its use of the # [High-Order Hex-Quad Mesh (HOHQMesh) generator](https://github.com/trixi-framework/HOHQMesh), # created and developed by David Kopriva. diff --git a/docs/literate/src/files/time_stepping.jl b/docs/literate/src/files/time_stepping.jl index 3a09fec452b..d400c4a94be 100644 --- a/docs/literate/src/files/time_stepping.jl +++ b/docs/literate/src/files/time_stepping.jl @@ -7,7 +7,7 @@ # ````julia # solve(ode, alg; kwargs...) # ```` -# In Trixi, the ODE problem is created by `semidiscretize(semi, tspan)` for a semidiscretization +# In Trixi.jl, the ODE problem is created by `semidiscretize(semi, tspan)` for a semidiscretization # `semi` and the time span `tspan`. In particular, [`semidiscretize`](@ref) returns an `ODEProblem` # used by OrdinaryDiffEq.jl. @@ -18,7 +18,7 @@ # and [low-storage methods](https://diffeq.sciml.ai/stable/solvers/ode_solve/#Low-Storage-Methods). # There are some differences regarding the choice of the used time step. -# # Error-based adaptive step sizes +# # [Error-based adaptive step sizes](@id adaptive_step_sizes) # First, we treat time integration algorithms with adaptive step sizes, such as `SSPRK43`. It is used in # some elixirs, like [`elixir_euler_colliding_flow.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_euler_colliding_flow.jl) # or [`elixir_euler_astro_jet_amr.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_euler_astro_jet_amr.jl). @@ -30,6 +30,9 @@ # a starting step size. If this heuristic fails in your case, you can specify an appropriately # small initial step size as keyword argument `dt=...` of `solve`. +# If you run Trixi in parallel with MPI you need to pass `internalnorm=ode_norm` and you should pass `unstable_check=ode_unstable_check` +# to enable MPI aware error-based adaptive step size control. These keyword arguments are also included in [`ode_default_options`](@ref). + # # CFL-based step size control # The SciML ecosystem also provides time integration algorithms without adaptive time stepping on @@ -49,7 +52,7 @@ # We compute $\Delta x_i$ by scaling the element size by a factor of $1/(N+1)$, cf. # [Gassner and Kopriva (2011)](https://doi.org/10.1137/100807211), Section 5. -# Trixi provides such a CFL-based step size control. It is implemented as the callback +# Trixi.jl provides such a CFL-based step size control. It is implemented as the callback # [`StepsizeCallback`](@ref). # ````julia # stepsize_callback = StepsizeCallback(; cfl=1.0) diff --git a/docs/make.jl b/docs/make.jl index 0e76ea79b86..5069e4dc49a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,7 +9,7 @@ end using Trixi using Trixi2Vtk -# Get Trixi root directory +# Get Trixi.jl root directory trixi_root_dir = dirname(@__DIR__) include(joinpath(trixi_root_dir, "docs", "literate", "make.jl")) @@ -75,7 +75,7 @@ tutorials = create_tutorials(files) makedocs( # Specify modules for which docstrings should be shown modules = [Trixi, Trixi2Vtk], - # Set sitename to Trixi + # Set sitename to Trixi.jl sitename="Trixi.jl", # Provide additional formatting options format = Documenter.HTML( diff --git a/docs/src/callbacks.md b/docs/src/callbacks.md index 14682d56721..a85f8e8191b 100644 --- a/docs/src/callbacks.md +++ b/docs/src/callbacks.md @@ -1,14 +1,14 @@ # [Callbacks](@id callbacks-id) -Many of the advanced features of Trixi, such as adaptive mesh refinement, are implemented as +Many of the advanced features of Trixi.jl, such as adaptive mesh refinement, are implemented as callbacks. A callback is an algorithmic entity that gets passed to the ODE solver and -is called at specific points during execution to perform certain tasks. Callbacks in Trixi are +is called at specific points during execution to perform certain tasks. Callbacks in Trixi.jl are either called after each time step (*step callbacks*) or after each stage of the ODE solver (*stage callbacks*). ![callbacks_illustration](https://user-images.githubusercontent.com/65298011/108088616-f690c000-7078-11eb-9dd1-b673eac6cecf.png) -The advantage of callbacks over hard-coding all features is that it allows to extend Trixi without -modifying the internal source code. Trixi provides callbacks for time step +The advantage of callbacks over hard-coding all features is that it allows to extend Trixi.jl without +modifying the internal source code. Trixi.jl provides callbacks for time step control, adaptive mesh refinement, I/O, and more. ## Step callbacks @@ -18,7 +18,7 @@ Time step control can be performed with a [`StepsizeCallback`](@ref). An example of this can be found at [examples/tree_2d_dgsem/elixir\_advection\_basic.jl](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_advection_basic.jl) ### Adaptive mesh refinement -Trixi uses a hierarchical Cartesian mesh which can be locally refined in a solution-adaptive way. +Trixi.jl uses a hierarchical Cartesian mesh which can be locally refined in a solution-adaptive way. This can be used to speed up simulations with minimal loss in overall accuracy. Adaptive mesh refinement (AMR) can be used by passing an [`AMRCallback`](@ref) to the ODE solver. The `AMRCallback` requires a controller such as [`ControllerThreeLevel`](@ref) or [`ControllerThreeLevelCombined`](@ref) to tell the AMR @@ -43,7 +43,7 @@ An example showing how to restart a simulation from a restart file can be found [examples/tree_2d_dgsem/elixir\_advection\_restart.jl](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_advection_restart.jl). #### Time series -Sometimes it is useful to record the evoluation of state variables over time at +Sometimes it is useful to record the evaluations of state variables over time at a given set of points. This can be achieved by the [`TimeSeriesCallback`](@ref), which is used, e.g., in [examples/tree_2d_dgsem/elixir\_acoustics\_gaussian\_source.jl](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl). @@ -110,7 +110,7 @@ will yield the following plot: via [`trixi_include`](@ref). ### Equation-specific callbacks -Some callbacks provided by Trixi implement specific features for certain equations: +Some callbacks provided by Trixi.jl implement specific features for certain equations: * The [`LBMCollisionCallback`](@ref) implements the Lattice-Boltzmann method (LBM) collision operator and should only be used when solving the Lattice-Boltzmann equations. See e.g. [examples/tree_2d_dgsem/elixir\_lbm\_constant.jl](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_lbm_constant.jl) @@ -141,7 +141,7 @@ more callbacks, you need to turn them into a `CallbackSet` first by calling * `VisualizationCallback` should be called before the mesh is adapted * Callbacks that belong to the next time step: * `AMRCallback` - * `StepsizeCallback` must be called after `AMRCallback` to accomodate potential changes to + * `StepsizeCallback` must be called after `AMRCallback` to accommodate potential changes to the mesh * `GlmSpeedCallback` must be called after `StepsizeCallback` because the step size affects the value of `c_h` @@ -155,7 +155,7 @@ physical constraints. An example elixir using this feature can be found at [examples/tree_2d_dgsem/elixir\_euler\_positivity.jl](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_euler_positivity.jl). ## Implementing new callbacks -Since Trixi is compatible with [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl), +Since Trixi.jl is compatible with [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl), both packages share the same callback interface. A detailed description of it can be found in the OrdinaryDiffEq.jl [documentation](https://diffeq.sciml.ai/latest/). Step callbacks are just called [callbacks](https://diffeq.sciml.ai/latest/features/callback_functions/). diff --git a/docs/src/contributing.md b/docs/src/contributing.md index cf120354937..5f996477215 100644 --- a/docs/src/contributing.md +++ b/docs/src/contributing.md @@ -1,12 +1,12 @@ # Contributing -Trixi is an open-source project and we are very happy to accept contributions +Trixi.jl is an open-source project and we are very happy to accept contributions from the community. Please feel free to open issues or submit patches (preferably as merge requests) any time. For planned larger contributions, it is often beneficial to get in contact with one of the principal developers first (see [Authors](@ref)). -Trixi and its contributions are licensed under the MIT license (see +Trixi.jl and its contributions are licensed under the MIT license (see [License](@ref)). As a contributor, you certify that all your contributions are in conformance with the *Developer Certificate of Origin (Version 1.1)*, which is reproduced below. diff --git a/docs/src/conventions.md b/docs/src/conventions.md index 2884451363e..dab1b8533a5 100644 --- a/docs/src/conventions.md +++ b/docs/src/conventions.md @@ -78,14 +78,14 @@ set via the keywords To allow adaptive mesh refinement efficiently when using time integrators from [OrdinaryDiffEq](https://github.com/SciML/OrdinaryDiffEq.jl), -Trixi allows to represent numerical solutions in two different ways. Some discussion +Trixi.jl allows to represent numerical solutions in two different ways. Some discussion can be found [online](https://github.com/SciML/OrdinaryDiffEq.jl/pull/1275) and in form of comments describing `Trixi.wrap_array` and `Trixi.wrap_array_native` -in the source code of Trixi. +in the source code of Trixi.jl. The flexibility introduced by this possible wrapping enables additional [performance optimizations](https://github.com/trixi-framework/Trixi.jl/pull/509). However, it comes at the cost of some additional abstractions (and needs to be -used with caution, as described in the source code of Trixi). Thus, we use the +used with caution, as described in the source code of Trixi.jl). Thus, we use the following conventions to distinguish between arrays visible to the time integrator and wrapped arrays mainly used internally. diff --git a/docs/src/development.md b/docs/src/development.md index 483ddc785ff..cead713d0d1 100644 --- a/docs/src/development.md +++ b/docs/src/development.md @@ -7,20 +7,20 @@ incurs an overhead each time a program is run. For proper packages and commands executed in the REPL (= "return-eval-print loop", which is what the Julia community calls the interactive command-line prompt that opens when executing `julia` without any files as arguments), however, the previously compiled functions are -cached. Therefore, Trixi should generally always be used interactively from the +cached. Therefore, Trixi.jl should generally always be used interactively from the REPL without closing Julia during development, as it allows much faster turnaround times. -If you naively run Trixi from the REPL, you will not be able to change your -Trixi source files and then run the changed code without restarting the REPL, +If you naively run Trixi.jl from the REPL, you will not be able to change your +Trixi.jl source files and then run the changed code without restarting the REPL, which destroys any potential benefits from caching. However, restarting Julia can be avoided by using the [Revise.jl](https://github.com/timholy/Revise.jl) package, which tracks changed files and re-loads them automatically. Therefore, it is *highly recommended* to first install Revise with the following command in Julia: To enter the package REPL mode, press `]` in the standard Julia REPL mode. Then, execute ```julia-repl -(@v1.8) pkg> add Revise +(@v1.9) pkg> add Revise ``` -Now you are able to run Trixi from the REPL, change Trixi code between runs, +Now you are able to run Trixi.jl from the REPL, change Trixi.jl code between runs, **and** enjoy the advantages of the compilation cache! Before you start using Revise regularly, please be aware of some of the [Pitfalls when using Revise](@ref). @@ -28,15 +28,15 @@ Another recommended package for working from the REPL is [OhMyREPL.jl](https://github.com/KristofferC/OhMyREPL.jl). It can be installed by running ```julia-repl -(@v1.8) pkg> add OhMyREPL +(@v1.9) pkg> add OhMyREPL ``` and adds syntax highlighting, bracket highlighting, and other helpful improvements for using Julia interactively. To automatically use OhMyREPL when starting the REPL, follow the instructions given in the official [documentation](https://kristofferc.github.io/OhMyREPL.jl/latest/). -### Running Trixi interactively in the global environment -If you've installed Trixi and Revise in your default environment, +### Running Trixi.jl interactively in the global environment +If you've installed Trixi.jl and Revise in your default environment, begin by executing: ```bash julia @@ -54,15 +54,15 @@ modern workstation. Most of the time is spent on compilation of Julia code etc. If you execute the last command again in the same REPL, it will finish within a few milliseconds (maybe ~45 on a modern workstation). This demonstrates the second reason for using the REPL: the compilation cache. That is, those parts -of the code that do not change between two Trixi runs do not need to be +of the code that do not change between two Trixi.jl runs do not need to be recompiled and thus execute much faster after the first run. -### Manually starting Trixi in the local environment +### Manually starting Trixi.jl in the local environment If you followed the [installation instructions for developers](@ref for-developers), execute Julia with the project directory set to the `run` directory of the program/tool you want to use. -For example, to run Trixi this way, you need to start the REPL with +For example, to run Trixi.jl this way, you need to start the REPL with ```bash julia --project=path/to/Trixi.jl/run ``` @@ -70,10 +70,10 @@ and execute ```julia-repl julia> using Revise; using Trixi ``` -to load Revise and Trixi. You can then proceed with the usual commands and run Trixi as in +to load Revise and Trixi.jl. You can then proceed with the usual commands and run Trixi.jl as in the example [above](#Running-Trixi-interactively-in-the-global-environment-1). -The `--project` flag is required such that Julia can properly load Trixi and all dependencies -if Trixi is not installed in the global environment. The same procedure also +The `--project` flag is required such that Julia can properly load Trixi.jl and all dependencies +if Trixi.jl is not installed in the global environment. The same procedure also applies should you opt to install the postprocessing tool [Trixi2Vtk](https://github.com/trixi-framework/Trixi2Vtk.jl) manually such that you can modify their implementations. @@ -82,7 +82,7 @@ manually such that you can modify their implementations. ### Pitfalls when using Revise While Revise is a great help for developing Julia code, there are a few situations to watch out for when using Revise. The following list of potential -issues is based on personal experiences of the Trixi developers and probably +issues is based on personal experiences of the Trixi.jl developers and probably incomplete. Further information on limitations and possible issues with Revise can be found in the official [documentation](https://timholy.github.io/Revise.jl/stable/). @@ -98,7 +98,7 @@ Revise does not stop on syntax errors, e.g., when you accidentally write to use the old version of your files**! This is especially dangerous for syntax errors, as they are detected while Revise reloads changed code, which happens in the beginning of a new execution. Thus, the syntax error message quickly -disappears from the terminal once Trixi starts writing output to the screen and +disappears from the terminal once Trixi.jl starts writing output to the screen and you might not even have noticed that an error occurred at all. Therefore, when you are deep in a coding/debugging session and wonder why your @@ -107,7 +107,7 @@ check if you missed earlier syntax errors, or - if in doubt - restart your REPL. #### Files are not tracked after changing branches Sometimes, Revise stops tracking files when changing the Git branch. That is, -modifications to Trixi's source files will not be reloaded by Revise and thus +modifications to Trixi.jl's source files will not be reloaded by Revise and thus have no effect of a currently running REPL session. This issue is particularly annoying for a developer, since it **does not come with any warning**! Therefore, it is good practice to always restart the REPL after @@ -138,7 +138,7 @@ than can increase your productivity in the Julia REPL. include the file elixir and evaluate its content in the global scope of module mod. You can override specific assignments in elixir by supplying keyword arguments. It's basic purpose is to make it easier to modify some - parameters while running Trixi from the REPL. Additionally, this is used in tests to reduce the computational + parameters while running Trixi.jl from the REPL. Additionally, this is used in tests to reduce the computational burden for CI while still providing examples with sensible default values for users. Examples @@ -233,7 +233,7 @@ Julia offers several options for debugging. A classical debugger is available wi [Debugger.jl](https://github.com/JuliaDebug/Debugger.jl) package or in the [Julia extension for VS Code](https://www.julia-vscode.org/docs/stable/userguide/debugging/). However, it can be quite slow and, at the time of writing (January 2023), currently does not work -properly with Trixi. The [Infiltrator.jl](https://github.com/JuliaDebug/Infiltrator.jl) package on +properly with Trixi.jl. The [Infiltrator.jl](https://github.com/JuliaDebug/Infiltrator.jl) package on the other hand does not offer all features of a full debugger, but is a fast and simple tool that allows users to set breakpoints to open a local REPL session and access the call stack and variables. @@ -244,7 +244,7 @@ see the call stack, and execute statements. The package can be installed in the Julia REPL by executing ```julia-repl -(@v1.8) pkg> add Infiltrator +(@v1.9) pkg> add Infiltrator ``` To load the package in the Julia REPL execute @@ -256,17 +256,13 @@ Breakpoints can be set by adding a line with the ```@infiltrate``` macro at the in the code. Use [Revise](@ref interactive-use-of-julia) if you want to set and delete breakpoints in your package without having to restart Julia. -!!! note - When running Julia inside a package environment, the ```@infiltrate``` macro only works if `Infiltrator` - has been added to the dependencies. Another work around when using Revise is to first load the - package and then add breakpoints with `Main.@infiltrate` to the code. If this is not - desired, the functional form - ```julia - if isdefined(Main, :Infiltrator) - Main.Infiltrator.infiltrate(@__MODULE__, Base.@locals, @__FILE__, @__LINE__) - end - ``` - can be used to set breakpoints when working with Trixi or other packages. +!!! note "Use `@autoinfiltrate` when debugging Trixi.jl" + When running Julia inside a package environment, e.g., inside the source + code of Trixi.jl itself, the `@infiltrate` macro only works if + `Infiltrator` has been added to the package dependencies. To avoid this, + you can use the (non-exported) `@autoinfiltrate` macro + in Trixi.jl, which only requires Infiltrator.jl to be available in the + current environment stack and will auto-load it for you. Triggering the breakpoint starts a REPL session where it is possible to interact with the current local scope. Possible commands are: @@ -285,7 +281,7 @@ Limitations of using Infiltrator.jl are that local variables cannot be changed, possible to step into further calls or access other function scopes. -## Releasing a new version of Trixi, Trixi2Vtk +## Releasing a new version of Trixi.jl, Trixi2Vtk - Check whether everything is okay, tests pass etc. - Set the new version number in `Project.toml` according to the Julian version of semver. @@ -295,15 +291,15 @@ possible to step into further calls or access other function scopes. Wait for it to be merged. - Increment the version number in `Project.toml` again with suffix `-pre`. For example, if you have released version `v0.2.0`, use `v0.2.1-pre` as new version number. -- When a new version of Trixi was released, check whether the `[compat]` entries +- When a new version of Trixi.jl was released, check whether the `[compat]` entries in `test/Project.toml` in Trixi2Vtk should be updated. When a new version of Trixi2Vtk was released, check whether the `[compat]` - entries in `docs/Project.toml` in Trixi should be updated. + entries in `docs/Project.toml` in Trixi.jl should be updated. These entries will also be checked regularly by CompatHelper (once a day). Hence, if everything was released correctly, you should only need to do these checks manually if new minor versions with changes in the docs of Trixi2Vtk were released - but no new version of Trixi was released afterwards. + but no new version of Trixi.jl was released afterwards. @@ -320,17 +316,17 @@ For PRs triggered from branches inside the Trixi.jl main repository previews of the new documentation are generated at `https://trixi-framework.github.io/Trixi.jl/previews/PRXXX`, where `XXX` is the number of the PR. This does not work for PRs from forks for security reasons (since anyone could otherwise push -arbitrary stuff to the Trixi website, including malicious code). +arbitrary stuff to the Trixi.jl website, including malicious code). ## [Developing Trixi2Vtk](@id trixi2vtk-dev) -Trixi2Vtk has Trixi as dependency and uses Trixi's implementation to, e.g., load mesh files. -When developing Trixi2Vtk, one may want to change functions in Trixi to allow them to be reused +Trixi2Vtk has Trixi.jl as dependency and uses Trixi.jl's implementation to, e.g., load mesh files. +When developing Trixi2Vtk, one may want to change functions in Trixi.jl to allow them to be reused in Trixi2Vtk. -To use a locally modified Trixi clone instead of a Trixi release, one can tell Pkg -to use the local source code of Trixi instead of a registered version by running +To use a locally modified Trixi.jl clone instead of a Trixi.jl release, one can tell Pkg +to use the local source code of Trixi.jl instead of a registered version by running ```julia-repl -(@v1.8) pkg> develop path/to/Trixi.jl +(@v1.9) pkg> develop path/to/Trixi.jl ``` diff --git a/docs/src/github-git.md b/docs/src/github-git.md index 79e5db793b3..ad5991d87af 100644 --- a/docs/src/github-git.md +++ b/docs/src/github-git.md @@ -1,10 +1,10 @@ # GitHub & Git -This page contains information on how to use GitHub and Git when developing Trixi. +This page contains information on how to use GitHub and Git when developing Trixi.jl. ## Development workflow -For adding modifications to Trixi, we generally follow these steps: +For adding modifications to Trixi.jl, we generally follow these steps: ### Create an issue (optional) In many cases it makes sense to start by creating an issue on GitHub. For @@ -53,7 +53,7 @@ changes or dive in and change something themselves. !!! warning "Avoid committing unwanted files" When you use `git add .` or similar catch-all versions, make sure you do not - accidentally commit unwanted files (e.g., Trixi output files, images or + accidentally commit unwanted files (e.g., Trixi.jl output files, images or videos etc.). If it happens anyways, you can undo the last commit (also multiple times) by running `git reset HEAD~` (see also [Undo last commit](@ref)). However, this strategy only works if you have **not yet @@ -114,7 +114,7 @@ person developing changes: We try to review all code before it gets added to `main`, even from the most experienced developers. This is good practice and helps to keep the error rate low while ensuring the the code is developed in a consistent fashion. Furthermore, do not take criticism of your code personally - -we just try to keep Trixi as accessible and easy to use for everyone. +we just try to keep Trixi.jl as accessible and easy to use for everyone. ### Merge branch Once your branch is reviewed and declared ready for merging by the reviewer, @@ -165,7 +165,7 @@ let us know as fast as possible, since the effort to fix the repository grows considerably over time. #### Remove large file from repository -If a large file was accidentally committed **and pushed** to the Trixi +If a large file was accidentally committed **and pushed** to the Trixi.jl repository, please talk to one of the core developers as soon as possible so that they can fix it. !!! danger "Large files" diff --git a/docs/src/index.md b/docs/src/index.md index f7e5d51d783..3af785bc681 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -14,7 +14,7 @@ is a numerical simulation framework for hyperbolic conservation laws written in [Julia](https://julialang.org). A key objective for the framework is to be useful to both scientists and students. Therefore, next to -having an extensible design with a fast implementation, Trixi is +having an extensible design with a fast implementation, Trixi.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures. Its features include: @@ -29,7 +29,7 @@ installation and postprocessing procedures. Its features include: * Kinetic energy-preserving and entropy-stable methods based on flux differencing * Entropy-stable shock capturing * Positivity-preserving limiting - * Finite difference summation by parts (SBP) methods + * [Finite difference summation by parts (SBP) methods](https://github.com/ranocha/SummationByPartsOperators.jl) * Compatible with the [SciML ecosystem for ordinary differential equations](https://diffeq.sciml.ai/latest/) * [Explicit low-storage Runge-Kutta time integration](https://diffeq.sciml.ai/latest/solvers/ode_solve/#Low-Storage-Methods) * [Strong stability preserving methods](https://diffeq.sciml.ai/latest/solvers/ode_solve/#Explicit-Strong-Stability-Preserving-Runge-Kutta-Methods-for-Hyperbolic-PDEs-(Conservation-Laws)) @@ -57,12 +57,12 @@ installation and postprocessing procedures. Its features include: ## Installation If you have not yet installed Julia, please [follow the instructions for your -operating system](https://julialang.org/downloads/platform/). Trixi works -with Julia v1.8. +operating system](https://julialang.org/downloads/platform/). Trixi.jl works +with Julia v1.8 and newer. We recommend using the latest stable release of Julia. ### For users -Trixi and its related tools are registered Julia packages. Hence, you -can install Trixi, the visualization tool +Trixi.jl and its related tools are registered Julia packages. Hence, you +can install Trixi.jl, the visualization tool [Trixi2Vtk](https://github.com/trixi-framework/Trixi2Vtk.jl), [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl), and [Plots.jl](https://github.com/JuliaPlots/Plots.jl) @@ -75,13 +75,13 @@ julia> Pkg.add(["Trixi", "Trixi2Vtk", "OrdinaryDiffEq", "Plots"]) You can copy and paste all commands to the REPL *including* the leading `julia>` prompts - they will automatically be stripped away by Julia. The package [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) -provides time integration schemes used by Trixi, while +provides time integration schemes used by Trixi.jl, while [Plots.jl](https://github.com/JuliaPlots/Plots.jl) can be used to directly -visualize Trixi's results from the REPL. +visualize Trixi.jl's results from the REPL. -*Note on package versions:* If some of the examples for how to use Trixi do not -work, verify that you are using a recent Trixi release by comparing the -installed Trixi version from +*Note on package versions:* If some of the examples for how to use Trixi.jl do not +work, verify that you are using a recent Trixi.jl release by comparing the +installed Trixi.jl version from ```julia julia> using Pkg; Pkg.update("Trixi"); Pkg.status("Trixi") ``` @@ -89,11 +89,11 @@ to the [latest release](https://github.com/trixi-framework/Trixi.jl/releases/lat If the installed version does not match the current release, please check the [Troubleshooting](@ref old-release) section. -The commands above can also be used to update Trixi. A brief list of notable -changes to Trixi is available in [`NEWS.md`](https://github.com/trixi-framework/Trixi.jl/NEWS.md). +The commands above can also be used to update Trixi.jl. A brief list of notable +changes to Trixi.jl is available in [`NEWS.md`](https://github.com/trixi-framework/Trixi.jl/NEWS.md). ### [For developers](@id for-developers) -If you plan on editing Trixi itself, you can download Trixi to a local folder +If you plan on editing Trixi.jl itself, you can download Trixi.jl to a local folder and use the code from the cloned directory: ```bash git clone git@github.com:trixi-framework/Trixi.jl.git @@ -102,7 +102,7 @@ mkdir run cd run julia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=".."))' ``` -If you installed Trixi this way, you always have to start Julia with the `--project` +If you installed Trixi.jl this way, you always have to start Julia with the `--project` flag set to your `run` directory, e.g., ```bash julia --project=. @@ -129,7 +129,7 @@ can be omitted. -### Example: Installing Trixi as a package +### Example: Installing Trixi.jl as a package ```@raw html