From f83586a12ad27ae7085d735180f9fa359b4528a9 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Wed, 13 Mar 2024 11:52:33 +0000 Subject: [PATCH] build based on 006811c --- previews/PR1624/.documenter-siteinfo.json | 2 +- previews/PR1624/authors/index.html | 2 +- previews/PR1624/callbacks/index.html | 2 +- previews/PR1624/code_of_conduct/index.html | 2 +- previews/PR1624/contributing/index.html | 2 +- previews/PR1624/conventions/index.html | 2 +- previews/PR1624/development/index.html | 2 +- previews/PR1624/github-git/index.html | 2 +- previews/PR1624/index.html | 2 +- previews/PR1624/license/index.html | 2 +- .../PR1624/meshes/dgmulti_mesh/index.html | 2 +- previews/PR1624/meshes/p4est_mesh/index.html | 2 +- .../PR1624/meshes/structured_mesh/index.html | 2 +- previews/PR1624/meshes/tree_mesh/index.html | 2 +- .../meshes/unstructured_quad_mesh/index.html | 2 +- .../PR1624/multi-physics_coupling/index.html | 2 +- previews/PR1624/objects.inv | Bin 15268 -> 15345 bytes previews/PR1624/overview/index.html | 2 +- previews/PR1624/parallelization/index.html | 2 +- previews/PR1624/performance/index.html | 2 +- previews/PR1624/reference-trixi/index.html | 302 +- .../PR1624/reference-trixi2vtk/index.html | 2 +- .../PR1624/reference-trixibase/index.html | 2 +- previews/PR1624/restart/index.html | 2 +- previews/PR1624/search_index.js | 2 +- previews/PR1624/styleguide/index.html | 2 +- previews/PR1624/testing/index.html | 2 +- previews/PR1624/time_integration/index.html | 2 +- previews/PR1624/troubleshooting/index.html | 2 +- .../DGMulti_1/{14ff62ef.svg => 32c730a1.svg} | 230 +- .../DGMulti_1/{a2206217.svg => 4f2d02a8.svg} | 3650 ++--- .../DGMulti_1/{8705badf.svg => 5a98715b.svg} | 230 +- .../DGMulti_1/{20dac91b.svg => 89397947.svg} | 230 +- .../DGMulti_1/{5397da78.svg => 90b2bf4d.svg} | 8254 +++++------ .../DGMulti_1/{5dde0c2a.svg => a7c56f44.svg} | 12350 ++++++++-------- .../PR1624/tutorials/DGMulti_1/index.html | 98 +- .../PR1624/tutorials/DGMulti_2/index.html | 2 +- .../{2377c765.svg => b17d3038.svg} | 230 +- .../{268fccc7.svg => e17adda9.svg} | 230 +- .../tutorials/DGSEM_FluxDiff/index.html | 30 +- .../{50222a0c.svg => dd5d7cce.svg} | 878 +- .../adaptive_mesh_refinement/index.html | 4 +- .../{2c4d1b0f.svg => 5d504898.svg} | 62 +- .../adding_new_parabolic_terms/index.html | 4 +- .../{2a6d7435.svg => 245e7ebd.svg} | 56 +- .../{6cdd03d1.svg => 2f11a2e5.svg} | 64 +- .../{2d45a4b3.svg => 77cc22ec.svg} | 56 +- .../{c22119b2.svg => e48e1a2d.svg} | 56 +- .../{f7073dd5.svg => fc58b3fa.svg} | 58 +- .../adding_new_scalar_equations/index.html | 12 +- .../{b6c347e4.svg => b38e5b1f.svg} | 122 +- .../index.html | 4 +- .../{5167c470.svg => 73dc2d5a.svg} | 68 +- .../index.html | 2 +- .../{49e341de.svg => 0144130c.svg} | 72 +- .../{5051b8ca.svg => 0c7275a4.svg} | 68 +- .../{80c2f02a.svg => 35162c10.svg} | 72 +- .../{7fdbc3c2.svg => a480584b.svg} | 72 +- .../{6eb03de2.svg => b8bcd239.svg} | 64 +- .../custom_semidiscretization/index.html | 148 +- .../{3e716af2.svg => 01b9d310.svg} | 64 +- .../{ca93b49c.svg => 0319eca6.svg} | 64 +- .../{a1e43ac4.svg => 6c284349.svg} | 4172 +++--- .../{7263db4c.svg => 714f10e2.svg} | 3136 ++-- .../{e9aef6cc.svg => 86812c35.svg} | 586 +- .../{445478a3.svg => a12050e4.svg} | 1594 +- .../{89f46729.svg => ccf5d932.svg} | 1588 +- .../{112514ab.svg => d9122d29.svg} | 2126 +-- .../differentiable_programming/index.html | 18 +- .../first_steps/changing_trixi/index.html | 2 +- .../{1f04e7ce.svg => 5919d287.svg} | 62 +- .../{e1130c13.svg => 69147f7b.svg} | 554 +- .../first_steps/create_first_setup/index.html | 116 +- .../{bdd2f27f.svg => c969fd89.svg} | 230 +- .../{3c6f59b6.svg => fd752d13.svg} | 230 +- .../first_steps/getting_started/index.html | 66 +- .../tutorials/hohqmesh_tutorial/index.html | 2 +- .../PR1624/tutorials/introduction/index.html | 2 +- .../{895a9919.svg => 0ecc56bf.svg} | 72 +- .../non_periodic_boundaries/index.html | 4 +- .../PR1624/tutorials/out/restart_000050.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/restart_000100.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/restart_000150.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/restart_000180.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000000.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000010.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000020.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000030.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000040.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000050.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000060.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000065.h5 | Bin 205696 -> 205696 bytes .../PR1624/tutorials/out/solution_000070.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000080.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000090.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000100.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000110.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000120.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000130.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000140.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000150.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000160.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000170.h5 | Bin 11976 -> 11976 bytes .../PR1624/tutorials/out/solution_000180.h5 | Bin 11976 -> 11976 bytes .../tutorials/p4est_from_gmsh/index.html | 2 +- .../{d6252d2d.svg => f848ac8c.svg} | 62 +- .../tutorials/parabolic_terms/index.html | 4 +- .../{ea897e1b.svg => 1583df04.svg} | 80 +- .../{b21b1a45.svg => 1b24f61e.svg} | 64 +- .../{f5f3ee59.svg => 79ffa393.svg} | 68 +- .../{9b8ddc04.svg => 9a1666e7.svg} | 64 +- .../{077ce278.svg => a25b2fa9.svg} | 64 +- .../{34ec3826.svg => f04cc793.svg} | 68 +- .../scalar_linear_advection_1d/index.html | 14 +- .../{55ae96c2.svg => 784b2b3f.svg} | 230 +- .../tutorials/shock_capturing/index.html | 4 +- .../{cc8d42e1.svg => 177a6750.svg} | 246 +- .../{f4569a16.svg => 6ece1260.svg} | 2102 +-- .../{db994499.svg => 8453627d.svg} | 2114 +-- .../structured_mesh_mapping/index.html | 28 +- .../PR1624/tutorials/time_stepping/index.html | 2 +- .../PR1624/tutorials/upwind_fdsbp/index.html | 2 +- previews/PR1624/visualization/index.html | 2 +- 123 files changed, 23870 insertions(+), 23870 deletions(-) rename previews/PR1624/tutorials/DGMulti_1/{14ff62ef.svg => 32c730a1.svg} (96%) rename previews/PR1624/tutorials/DGMulti_1/{a2206217.svg => 4f2d02a8.svg} (89%) rename previews/PR1624/tutorials/DGMulti_1/{8705badf.svg => 5a98715b.svg} (96%) rename previews/PR1624/tutorials/DGMulti_1/{20dac91b.svg => 89397947.svg} (96%) rename previews/PR1624/tutorials/DGMulti_1/{5397da78.svg => 90b2bf4d.svg} (90%) rename previews/PR1624/tutorials/DGMulti_1/{5dde0c2a.svg => a7c56f44.svg} (90%) rename previews/PR1624/tutorials/DGSEM_FluxDiff/{2377c765.svg => b17d3038.svg} (95%) rename previews/PR1624/tutorials/DGSEM_FluxDiff/{268fccc7.svg => e17adda9.svg} (94%) rename previews/PR1624/tutorials/adaptive_mesh_refinement/{50222a0c.svg => dd5d7cce.svg} (85%) rename previews/PR1624/tutorials/adding_new_parabolic_terms/{2c4d1b0f.svg => 5d504898.svg} (93%) rename previews/PR1624/tutorials/adding_new_scalar_equations/{2a6d7435.svg => 245e7ebd.svg} (84%) rename previews/PR1624/tutorials/adding_new_scalar_equations/{6cdd03d1.svg => 2f11a2e5.svg} (91%) rename previews/PR1624/tutorials/adding_new_scalar_equations/{2d45a4b3.svg => 77cc22ec.svg} (92%) rename previews/PR1624/tutorials/adding_new_scalar_equations/{c22119b2.svg => e48e1a2d.svg} (92%) rename previews/PR1624/tutorials/adding_new_scalar_equations/{f7073dd5.svg => fc58b3fa.svg} (85%) rename previews/PR1624/tutorials/adding_nonconservative_equation/{b6c347e4.svg => b38e5b1f.svg} (84%) rename previews/PR1624/tutorials/behind_the_scenes_simulation_setup/{5167c470.svg => 73dc2d5a.svg} (91%) rename previews/PR1624/tutorials/custom_semidiscretization/{49e341de.svg => 0144130c.svg} (86%) rename previews/PR1624/tutorials/custom_semidiscretization/{5051b8ca.svg => 0c7275a4.svg} (86%) rename previews/PR1624/tutorials/custom_semidiscretization/{80c2f02a.svg => 35162c10.svg} (86%) rename previews/PR1624/tutorials/custom_semidiscretization/{7fdbc3c2.svg => a480584b.svg} (86%) rename previews/PR1624/tutorials/custom_semidiscretization/{6eb03de2.svg => b8bcd239.svg} (85%) rename previews/PR1624/tutorials/differentiable_programming/{3e716af2.svg => 01b9d310.svg} (85%) rename previews/PR1624/tutorials/differentiable_programming/{ca93b49c.svg => 0319eca6.svg} (84%) rename previews/PR1624/tutorials/differentiable_programming/{a1e43ac4.svg => 6c284349.svg} (66%) rename previews/PR1624/tutorials/differentiable_programming/{7263db4c.svg => 714f10e2.svg} (67%) rename previews/PR1624/tutorials/differentiable_programming/{e9aef6cc.svg => 86812c35.svg} (69%) rename previews/PR1624/tutorials/differentiable_programming/{445478a3.svg => a12050e4.svg} (68%) rename previews/PR1624/tutorials/differentiable_programming/{89f46729.svg => ccf5d932.svg} (65%) rename previews/PR1624/tutorials/differentiable_programming/{112514ab.svg => d9122d29.svg} (68%) rename previews/PR1624/tutorials/first_steps/create_first_setup/{1f04e7ce.svg => 5919d287.svg} (93%) rename previews/PR1624/tutorials/first_steps/create_first_setup/{e1130c13.svg => 69147f7b.svg} (86%) rename previews/PR1624/tutorials/first_steps/getting_started/{bdd2f27f.svg => c969fd89.svg} (95%) rename previews/PR1624/tutorials/first_steps/getting_started/{3c6f59b6.svg => fd752d13.svg} (88%) rename previews/PR1624/tutorials/non_periodic_boundaries/{895a9919.svg => 0ecc56bf.svg} (81%) rename previews/PR1624/tutorials/parabolic_terms/{d6252d2d.svg => f848ac8c.svg} (93%) rename previews/PR1624/tutorials/scalar_linear_advection_1d/{ea897e1b.svg => 1583df04.svg} (79%) rename previews/PR1624/tutorials/scalar_linear_advection_1d/{b21b1a45.svg => 1b24f61e.svg} (82%) rename previews/PR1624/tutorials/scalar_linear_advection_1d/{f5f3ee59.svg => 79ffa393.svg} (85%) rename previews/PR1624/tutorials/scalar_linear_advection_1d/{9b8ddc04.svg => 9a1666e7.svg} (83%) rename previews/PR1624/tutorials/scalar_linear_advection_1d/{077ce278.svg => a25b2fa9.svg} (83%) rename previews/PR1624/tutorials/scalar_linear_advection_1d/{34ec3826.svg => f04cc793.svg} (85%) rename previews/PR1624/tutorials/shock_capturing/{55ae96c2.svg => 784b2b3f.svg} (95%) rename previews/PR1624/tutorials/structured_mesh_mapping/{cc8d42e1.svg => 177a6750.svg} (96%) rename previews/PR1624/tutorials/structured_mesh_mapping/{f4569a16.svg => 6ece1260.svg} (92%) rename previews/PR1624/tutorials/structured_mesh_mapping/{db994499.svg => 8453627d.svg} (86%) diff --git a/previews/PR1624/.documenter-siteinfo.json b/previews/PR1624/.documenter-siteinfo.json index d4c6d1ee185..66238cd81ce 100644 --- a/previews/PR1624/.documenter-siteinfo.json +++ b/previews/PR1624/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-03-12T12:13:37","documenter_version":"1.3.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-03-13T11:51:56","documenter_version":"1.3.0"}} \ No newline at end of file diff --git a/previews/PR1624/authors/index.html b/previews/PR1624/authors/index.html index 5671115c1b6..0dc1bc0597c 100644 --- a/previews/PR1624/authors/index.html +++ b/previews/PR1624/authors/index.html @@ -1,2 +1,2 @@ -Authors · Trixi.jl

Authors

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.jl. In addition, there are contributors who have provided substantial additions or modifications. Together, these two groups form "The Trixi.jl Authors" as mentioned under License.

Principal Developers

Contributors

The following people contributed major additions or modifications to Trixi.jl and are listed in alphabetical order:

  • Maximilian D. Bertrand
  • Benjamin Bolm
  • Simon Candelaresi
  • Jesse Chan
  • Lars Christmann
  • Christof Czernik
  • Daniel Doehring
  • 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
  • Michael Schlottke-Lakemper
  • Toskan Theine
  • Andrew Winters
+Authors · Trixi.jl

Authors

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.jl. In addition, there are contributors who have provided substantial additions or modifications. Together, these two groups form "The Trixi.jl Authors" as mentioned under License.

Principal Developers

Contributors

The following people contributed major additions or modifications to Trixi.jl and are listed in alphabetical order:

  • Maximilian D. Bertrand
  • Benjamin Bolm
  • Simon Candelaresi
  • Jesse Chan
  • Lars Christmann
  • Christof Czernik
  • Daniel Doehring
  • 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
  • Michael Schlottke-Lakemper
  • Toskan Theine
  • Andrew Winters
diff --git a/previews/PR1624/callbacks/index.html b/previews/PR1624/callbacks/index.html index 05b39fc3442..48fa0c5be02 100644 --- a/previews/PR1624/callbacks/index.html +++ b/previews/PR1624/callbacks/index.html @@ -12,4 +12,4 @@ julia> pd2 = PlotData1D(time_series, 2) -julia> plot(pd1["p_prime"]); plot!(pd2["p_prime"], xguide="t")

will yield the following plot:

image

Miscellaneous

Equation-specific callbacks

Some callbacks provided by Trixi.jl implement specific features for certain equations:

Usage of step callbacks

Step callbacks are passed to the solve method from the ODE solver via the keyword argument callback. If you want to use a single callback cb, pass it as callback=cb. When using two or more callbacks, you need to turn them into a CallbackSet first by calling callbacks = CallbackSet(cb1, cb2) and passing it as callback=callbacks.

Note

There are some restrictions regarding the order of callbacks in a CallbackSet.

The callbacks are called after each time step but some callbacks actually belong to the next time step. Therefore, the callbacks should be ordered in the following way:

  • Callbacks that belong to the current time step:
    • SummaryCallback controls, among other things, timers and should thus be first
    • SteadyStateCallback may mark a time step as the last one
    • AnalysisCallback may do some checks that mark a time step as the last one
    • AliveCallback should be nearby AnalysisCallback
    • SaveSolutionCallback/SaveRestartCallback should save the current solution before it is degraded by AMR
    • 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 accommodate potential changes to the mesh
    • GlmSpeedCallback must be called after StepsizeCallback because the step size affects the value of c_h
    • LBMCollisionCallback is already part of the calculations of the next time step and should therefore be called after StepsizeCallback

Stage callbacks

PositivityPreservingLimiterZhangShu is a positivity-preserving limiter, used to enforce physical constraints. An example elixir using this feature can be found at examples/tree_2d_dgsem/elixir_euler_positivity.jl.

Implementing new callbacks

Since Trixi.jl is compatible with OrdinaryDiffEq.jl, both packages share the same callback interface. A detailed description of it can be found in the OrdinaryDiffEq.jl documentation. Step callbacks are just called callbacks. Stage callbacks are called stage_limiter!.

An example elixir showing how to implement a new simple stage callback and a new simple step callback can be found at examples/tree_2d_dgsem/elixir_advection_callbacks.jl.

+julia> plot(pd1["p_prime"]); plot!(pd2["p_prime"], xguide="t")

will yield the following plot:

image

Miscellaneous

Equation-specific callbacks

Some callbacks provided by Trixi.jl implement specific features for certain equations:

Usage of step callbacks

Step callbacks are passed to the solve method from the ODE solver via the keyword argument callback. If you want to use a single callback cb, pass it as callback=cb. When using two or more callbacks, you need to turn them into a CallbackSet first by calling callbacks = CallbackSet(cb1, cb2) and passing it as callback=callbacks.

Note

There are some restrictions regarding the order of callbacks in a CallbackSet.

The callbacks are called after each time step but some callbacks actually belong to the next time step. Therefore, the callbacks should be ordered in the following way:

  • Callbacks that belong to the current time step:
    • SummaryCallback controls, among other things, timers and should thus be first
    • SteadyStateCallback may mark a time step as the last one
    • AnalysisCallback may do some checks that mark a time step as the last one
    • AliveCallback should be nearby AnalysisCallback
    • SaveSolutionCallback/SaveRestartCallback should save the current solution before it is degraded by AMR
    • 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 accommodate potential changes to the mesh
    • GlmSpeedCallback must be called after StepsizeCallback because the step size affects the value of c_h
    • LBMCollisionCallback is already part of the calculations of the next time step and should therefore be called after StepsizeCallback

Stage callbacks

PositivityPreservingLimiterZhangShu is a positivity-preserving limiter, used to enforce physical constraints. An example elixir using this feature can be found at examples/tree_2d_dgsem/elixir_euler_positivity.jl.

Implementing new callbacks

Since Trixi.jl is compatible with OrdinaryDiffEq.jl, both packages share the same callback interface. A detailed description of it can be found in the OrdinaryDiffEq.jl documentation. Step callbacks are just called callbacks. Stage callbacks are called stage_limiter!.

An example elixir showing how to implement a new simple stage callback and a new simple step callback can be found at examples/tree_2d_dgsem/elixir_advection_callbacks.jl.

diff --git a/previews/PR1624/code_of_conduct/index.html b/previews/PR1624/code_of_conduct/index.html index 2d6ec74828f..b8b954b7ed6 100644 --- a/previews/PR1624/code_of_conduct/index.html +++ b/previews/PR1624/code_of_conduct/index.html @@ -1,2 +1,2 @@ -Code of Conduct · Trixi.jl

Code of Conduct

Contributor Covenant Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

Our Standards

Examples of behavior that contributes to a positive environment for our community include:

  • Demonstrating empathy and kindness toward other people
  • Being respectful of differing opinions, viewpoints, and experiences
  • Giving and gracefully accepting constructive feedback
  • Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
  • Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

  • The use of sexualized language or imagery, and sexual attention or advances of any kind
  • Trolling, insulting or derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or email address, without their explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting

Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to Michael Schlottke-Lakemper, Hendrik Ranocha, or any other of the principal developers responsible for enforcement listed in Authors. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the community.

Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/codeofconduct.html.

Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

+Code of Conduct · Trixi.jl

Code of Conduct

Contributor Covenant Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

Our Standards

Examples of behavior that contributes to a positive environment for our community include:

  • Demonstrating empathy and kindness toward other people
  • Being respectful of differing opinions, viewpoints, and experiences
  • Giving and gracefully accepting constructive feedback
  • Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
  • Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

  • The use of sexualized language or imagery, and sexual attention or advances of any kind
  • Trolling, insulting or derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or email address, without their explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting

Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to Michael Schlottke-Lakemper, Hendrik Ranocha, or any other of the principal developers responsible for enforcement listed in Authors. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the community.

Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/codeofconduct.html.

Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

diff --git a/previews/PR1624/contributing/index.html b/previews/PR1624/contributing/index.html index b498893366a..8890a709069 100644 --- a/previews/PR1624/contributing/index.html +++ b/previews/PR1624/contributing/index.html @@ -35,4 +35,4 @@ are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. + this project or the open source license(s) involved. diff --git a/previews/PR1624/conventions/index.html b/previews/PR1624/conventions/index.html index bba88819e4e..6ccf7409791 100644 --- a/previews/PR1624/conventions/index.html +++ b/previews/PR1624/conventions/index.html @@ -1,2 +1,2 @@ -Conventions · Trixi.jl

Conventions

Spatial dimensions and directions

We use the following numbering schemes on Cartesian or curved structured meshes.

  • The orientations are numbered as 1 => x, 2 => y, 3 => z. For example, numerical fluxes such as flux_central(u_ll, u_rr, orientation, equations::AbstractEquations) use the orientation in this way.
  • The directions are numbered as 1 => -x, 2 => +x, 3 => -y, 4 => +y, 5 => -z, 6 => +z. For example, the boundary_conditions are ordered in this way when a Tuple of boundary conditions per direction is passed to the constructor of a SemidiscretizationHyperbolic.
  • For structured and unstructured curved meshes the concept of direction is generalized via the variable normal_direction. This variable points in the normal direction at a given, curved surface. For the computation of boundary fluxes the normal_direction is normalized to be a normal_vector used, for example, in FluxRotated.

Cells vs. elements vs. nodes

To uniquely distinguish between different components of the discretization, we use the following naming conventions:

  • The computational domain is discretized by a mesh, which is made up of individual cells. In general, neither the mesh nor the cells should be aware of any solver-specific knowledge, i.e., they should not store anything that goes beyond the geometrical information and the connectivity.
  • The numerical solvers do not directly store their information inside the mesh, but use own data structures. Specifically, for each cell on which a solver wants to operate, the solver creates an element to store solver-specific data.
  • For discretization schemes such as the discontinuous Galerkin or the finite element method, inside each element multiple nodes may be defined, which hold nodal information. The nodes are again a solver-specific component, just like the elements.
  • We often identify elements, nodes, etc. with their (local or global) integer index. Convenience iterators such as eachelement, eachnode use these indices.

Keywords in elixirs

Trixi.jl is distributed with several examples in the form of elixirs, small Julia scripts containing everything to set up and run a simulation. Working interactively from the Julia REPL with these scripts can be quite convenient while for exploratory research and development of Trixi.jl. For example, you can use the convenience function trixi_include to include an elixir with some modified arguments. To enable this, it is helpful to use a consistent naming scheme in elixirs, since trixi_include can only perform simple replacements. Some standard variables names are

  • polydeg for the polynomial degree of a solver
  • surface_flux for the numerical flux at surfaces
  • volume_flux for the numerical flux used in flux differencing volume terms

Moreover, convergence_test requires that the spatial resolution is set via the keywords

Variable names

  • Use descriptive names (using snake_case for variables/functions and CamelCase for types)
  • Use a suffix _ as in name_ for local variables that would otherwise hide existing symbols.
  • Use a prefix _ as in _name to indicate internal methods/data that are "fragile" in the sense that there's no guarantee that they might get changed without notice. These are also not documented with a docstring (but maybe with comments using #).

Array types and wrapping

To allow adaptive mesh refinement efficiently when using time integrators from OrdinaryDiffEq, Trixi.jl allows to represent numerical solutions in two different ways. Some discussion can be found online and in form of comments describing Trixi.wrap_array and Trixi.wrap_array_native in the source code of Trixi.jl. The flexibility introduced by this possible wrapping enables additional performance optimizations. 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.jl). Thus, we use the following conventions to distinguish between arrays visible to the time integrator and wrapped arrays mainly used internally.

  • Arrays visible to the time integrator have a suffix _ode, e.g., du_ode, u_ode.
  • Wrapped arrays do not have a suffix, e.g., du, u.

Methods either accept arrays visible to the time integrator or wrapped arrays based on the following rules.

  • When some solution is passed together with a semidiscretization semi, the solution must be a u_ode that needs to be wrapped via wrap_array(u_ode, semi) (or wrap_array_native(u_ode, semi)) for further processing.
  • When some solution is passed together with the mesh, equations, solver, cache, ..., it is already wrapped via wrap_array (or wrap_array_native).
  • Exceptions of this rule are possible, e.g. for AMR, but must be documented in the code.
  • wrap_array should be used as default option. wrap_array_native should only be used when necessary, e.g., to avoid additional overhead when interfacing with external C libraries such as HDF5, MPI, or visualization.
+Conventions · Trixi.jl

Conventions

Spatial dimensions and directions

We use the following numbering schemes on Cartesian or curved structured meshes.

  • The orientations are numbered as 1 => x, 2 => y, 3 => z. For example, numerical fluxes such as flux_central(u_ll, u_rr, orientation, equations::AbstractEquations) use the orientation in this way.
  • The directions are numbered as 1 => -x, 2 => +x, 3 => -y, 4 => +y, 5 => -z, 6 => +z. For example, the boundary_conditions are ordered in this way when a Tuple of boundary conditions per direction is passed to the constructor of a SemidiscretizationHyperbolic.
  • For structured and unstructured curved meshes the concept of direction is generalized via the variable normal_direction. This variable points in the normal direction at a given, curved surface. For the computation of boundary fluxes the normal_direction is normalized to be a normal_vector used, for example, in FluxRotated.

Cells vs. elements vs. nodes

To uniquely distinguish between different components of the discretization, we use the following naming conventions:

  • The computational domain is discretized by a mesh, which is made up of individual cells. In general, neither the mesh nor the cells should be aware of any solver-specific knowledge, i.e., they should not store anything that goes beyond the geometrical information and the connectivity.
  • The numerical solvers do not directly store their information inside the mesh, but use own data structures. Specifically, for each cell on which a solver wants to operate, the solver creates an element to store solver-specific data.
  • For discretization schemes such as the discontinuous Galerkin or the finite element method, inside each element multiple nodes may be defined, which hold nodal information. The nodes are again a solver-specific component, just like the elements.
  • We often identify elements, nodes, etc. with their (local or global) integer index. Convenience iterators such as eachelement, eachnode use these indices.

Keywords in elixirs

Trixi.jl is distributed with several examples in the form of elixirs, small Julia scripts containing everything to set up and run a simulation. Working interactively from the Julia REPL with these scripts can be quite convenient while for exploratory research and development of Trixi.jl. For example, you can use the convenience function trixi_include to include an elixir with some modified arguments. To enable this, it is helpful to use a consistent naming scheme in elixirs, since trixi_include can only perform simple replacements. Some standard variables names are

  • polydeg for the polynomial degree of a solver
  • surface_flux for the numerical flux at surfaces
  • volume_flux for the numerical flux used in flux differencing volume terms

Moreover, convergence_test requires that the spatial resolution is set via the keywords

Variable names

  • Use descriptive names (using snake_case for variables/functions and CamelCase for types)
  • Use a suffix _ as in name_ for local variables that would otherwise hide existing symbols.
  • Use a prefix _ as in _name to indicate internal methods/data that are "fragile" in the sense that there's no guarantee that they might get changed without notice. These are also not documented with a docstring (but maybe with comments using #).

Array types and wrapping

To allow adaptive mesh refinement efficiently when using time integrators from OrdinaryDiffEq, Trixi.jl allows to represent numerical solutions in two different ways. Some discussion can be found online and in form of comments describing Trixi.wrap_array and Trixi.wrap_array_native in the source code of Trixi.jl. The flexibility introduced by this possible wrapping enables additional performance optimizations. 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.jl). Thus, we use the following conventions to distinguish between arrays visible to the time integrator and wrapped arrays mainly used internally.

  • Arrays visible to the time integrator have a suffix _ode, e.g., du_ode, u_ode.
  • Wrapped arrays do not have a suffix, e.g., du, u.

Methods either accept arrays visible to the time integrator or wrapped arrays based on the following rules.

  • When some solution is passed together with a semidiscretization semi, the solution must be a u_ode that needs to be wrapped via wrap_array(u_ode, semi) (or wrap_array_native(u_ode, semi)) for further processing.
  • When some solution is passed together with the mesh, equations, solver, cache, ..., it is already wrapped via wrap_array (or wrap_array_native).
  • Exceptions of this rule are possible, e.g. for AMR, but must be documented in the code.
  • wrap_array should be used as default option. wrap_array_native should only be used when necessary, e.g., to avoid additional overhead when interfacing with external C libraries such as HDF5, MPI, or visualization.
diff --git a/previews/PR1624/development/index.html b/previews/PR1624/development/index.html index 5c7339fdf3a..79f3b02136c 100644 --- a/previews/PR1624/development/index.html +++ b/previews/PR1624/development/index.html @@ -39,4 +39,4 @@ Trixi.IdealGlmMhdEquations2D Trixi.IdealGlmMhdMulticomponentEquations1D [...]

Text editors

When writing code, the choice of text editor can have a significant impact on productivity and developer satisfaction. While using the default text editor of the operating system has its own benefits (specifically the lack of an explicit installation procure), usually it makes sense to switch to a more programming-friendly tool. In the following, a few of the many options are listed and discussed:

VS Code

Visual Studio Code is a modern open source editor with good support for Julia. While Juno had some better support in the past, the developers of Juno and the Julia VS Code plugin are joining forces and concentrating on VS Code since support of Atom has been suspended. Basically, all comments on Juno below also apply to VS Code.

Juno

If you are new to programming or do not have a preference for a text editor yet, Juno is a good choice for developing Julia code. It is based on Atom, a sophisticated and widely used editor for software developers, and is enhanced with several Julia-specific features. Furthermore and especially helpful for novice programmers, it has a MATLAB-like appearance with easy and interactive access to the current variables, the help system, and a debugger.

Vim or Emacs

Vim and Emacs are both very popular editors that work great with Julia. One of their advantages is that they are text editors without a GUI and as such are available for almost any operating system. They also are preinstalled on virtually all Unix-like systems. However, Vim and Emacs come with their own, steep learning curve if they have never been used before. Therefore, if in doubt, it is probably easier to get started with a classic GUI-based text editor (like Juno). If you decide to use Vim or Emacs, make sure that you install the corresponding Vim plugin julia-vim or Emacs major mode julia-emacs.

Debugging

Julia offers several options for debugging. A classical debugger is available with the Debugger.jl package or in the Julia extension for VS Code. However, it can be quite slow and, at the time of writing (January 2023), currently does not work properly with Trixi.jl. The 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.

Infiltrator

The Infiltrator package provides fast, interactive breakpoints using the @infiltrate command, which drops the user into a local REPL session. From there, it is possible to access local variables, see the call stack, and execute statements.

The package can be installed in the Julia REPL by executing

(@v1.9) pkg> add Infiltrator

To load the package in the Julia REPL execute

julia> using Infiltrator

Breakpoints can be set by adding a line with the @infiltrate macro at the respective position in the code. Use Revise if you want to set and delete breakpoints in your package without having to restart Julia.

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:

To finish a debugging session, either use @continue to continue and eventually stop at the next breakpoint or @exit to skip further breakpoints. After the code has finished, local variables saved with @exfiltrate can be accessed in the REPL using the safehouse variable.

Limitations of using Infiltrator.jl are that local variables cannot be changed, and that it is not possible to step into further calls or access other function scopes.

Releasing a new version of Trixi.jl, Trixi2Vtk

Preview of the documentation

You can build the documentation of Trixi.jl locally by running

julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
-julia --project=docs --color=yes docs/make.jl

from the Trixi.jl main directory. Then, you can look at the html files generated in docs/build. 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.jl website, including malicious code).

Developing Trixi2Vtk

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.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

(@v1.9) pkg> develop path/to/Trixi.jl
+julia --project=docs --color=yes docs/make.jl

from the Trixi.jl main directory. Then, you can look at the html files generated in docs/build. 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.jl website, including malicious code).

Developing Trixi2Vtk

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.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

(@v1.9) pkg> develop path/to/Trixi.jl
diff --git a/previews/PR1624/github-git/index.html b/previews/PR1624/github-git/index.html index 4edf7bb14e9..a3d8474f026 100644 --- a/previews/PR1624/github-git/index.html +++ b/previews/PR1624/github-git/index.html @@ -41,4 +41,4 @@ git rebase # Clean reflog and force garbage collection -git reflog expire --expire=now --all && git gc --prune=now --aggressive

IMPORTANT: You need to do a git rebase instead of a git pull when updating the fixed branch.

+git reflog expire --expire=now --all && git gc --prune=now --aggressive

IMPORTANT: You need to do a git rebase instead of a git pull when updating the fixed branch.

diff --git a/previews/PR1624/index.html b/previews/PR1624/index.html index 7e4aa4aec7f..aca3f2fc78f 100644 --- a/previews/PR1624/index.html +++ b/previews/PR1624/index.html @@ -111,4 +111,4 @@ NumFOCUS --> -

This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) through the following grants:

This project has benefited from funding from the European Research Council through the ERC Starting Grant "An Exascale aware and Un-crashable Space-Time-Adaptive Discontinuous Spectral Element Solver for Non-Linear Conservation Laws" (Extreme), ERC grant agreement no. 714487.

This project has benefited from funding from Vetenskapsrådet (VR, Swedish Research Council), Sweden through the VR Starting Grant "Shallow water flows including sediment transport and morphodynamics", VR grant agreement 2020-03642 VR.

This project has benefited from funding from the United States National Science Foundation (NSF) under awards DMS-1719818 and DMS-1943186.

This project has benefited from funding from the German Federal Ministry of Education and Research (BMBF) through the project grant "Adaptive earth system modeling with significantly reduced computation time for exascale supercomputers (ADAPTEX)" (funding id: 16ME0668K).

This project has benefited from funding by the Daimler und Benz Stiftung (Daimler and Benz Foundation) through grant no. 32-10/22.

Trixi.jl is supported by NumFOCUS as an Affiliated Project.

+

This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) through the following grants:

This project has benefited from funding from the European Research Council through the ERC Starting Grant "An Exascale aware and Un-crashable Space-Time-Adaptive Discontinuous Spectral Element Solver for Non-Linear Conservation Laws" (Extreme), ERC grant agreement no. 714487.

This project has benefited from funding from Vetenskapsrådet (VR, Swedish Research Council), Sweden through the VR Starting Grant "Shallow water flows including sediment transport and morphodynamics", VR grant agreement 2020-03642 VR.

This project has benefited from funding from the United States National Science Foundation (NSF) under awards DMS-1719818 and DMS-1943186.

This project has benefited from funding from the German Federal Ministry of Education and Research (BMBF) through the project grant "Adaptive earth system modeling with significantly reduced computation time for exascale supercomputers (ADAPTEX)" (funding id: 16ME0668K).

This project has benefited from funding by the Daimler und Benz Stiftung (Daimler and Benz Foundation) through grant no. 32-10/22.

Trixi.jl is supported by NumFOCUS as an Affiliated Project.

diff --git a/previews/PR1624/license/index.html b/previews/PR1624/license/index.html index 5988fef79f6..995a4661a21 100644 --- a/previews/PR1624/license/index.html +++ b/previews/PR1624/license/index.html @@ -1,2 +1,2 @@ -License · Trixi.jl

License

MIT License

Copyright (c) 2020-present The Trixi.jl Authors (see Authors)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+License · Trixi.jl

License

MIT License

Copyright (c) 2020-present The Trixi.jl Authors (see Authors)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff --git a/previews/PR1624/meshes/dgmulti_mesh/index.html b/previews/PR1624/meshes/dgmulti_mesh/index.html index c30eb76a3a2..28482c98a9e 100644 --- a/previews/PR1624/meshes/dgmulti_mesh/index.html +++ b/previews/PR1624/meshes/dgmulti_mesh/index.html @@ -5,4 +5,4 @@ surface_flux=flux_central, surface_integral=SurfaceIntegralWeakForm(surface_flux), volume_integral=VolumeIntegralWeakForm(), - RefElemData_kwargs...)

Here, element_type can be Tri(), Quad(), Tet(), or Hex(), and approximation_type can be

Additional options can also be specified through RefElemData_kwargs:

The GaussSBP() approximation type on Quad() and Hex() meshes

When using VolumeIntegralFluxDifferencing on Quad() and Hex() meshes, one can also specify approximation_type = GaussSBP() to use an entropy stable Gauss collocation scheme. Here, GaussSBP() refers to "generalized" summation-by-parts operators (see for example Ranocha 2018 or Fernandez and Zingg 2015).

Unlike traditional SBP operators, generalized SBP operators are constructed from nodes which do not include boundary nodes (i.e., Gauss quadrature nodes as opposed to Gauss-Lobatto quadrature nodes). This makes the computation of interface fluxes slightly more expensive, but also usually results in a more accurate solution. Roughly speaking, an entropy stable Gauss collocation scheme will yield results similar to a modal entropy stable scheme using a Polynomial() approximation type, but will be more efficient at high orders of approximation.

Trixi.jl elixirs on simplicial and tensor product element meshes

Example elixirs with triangular, quadrilateral, and tetrahedral meshes can be found in the examples/dgmulti_2d/ and examples/dgmulti_3d/ folders. Some key elixirs to look at:

For developers

DGMultiMesh wrapper type

DGMulti meshes in Trixi.jl are represented using a DGMultiMesh{NDIMS, ...} type. This mesh type is assumed to have fields md::MeshData, which contains geometric terms derived from the mapping between the reference and physical elements, and boundary_faces, which contains a Dict of boundary segment names (symbols) and list of faces which lie on that boundary segment.

A DGMultiMesh can be constructed in several ways. For example, DGMultiMesh(dg::DGMulti) will return a Cartesian mesh on $[-1, 1]^d$ with element types specified by dg. DGMulti meshes can also be constructed by specifying a list of vertex coordinates vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z and a connectivity matrix EToV where EToV[e,:] gives the vertices which correspond to element e. These quantities are available from most unstructured mesh generators.

Initial support for curved DGMultiMeshes is available for flux differencing solvers using SBP and GaussSBP approximation types on quadrilateral and hexahedral meshes. These can be called by specifying mesh = DGMultiMesh(dg, cells_per_dimension, mapping), where mapping is a function which specifies the warping of the mesh (e.g., mapping(xi, eta) = SVector{2}(xi, eta) is the identity mapping) similar to the mapping argument used by StructuredMesh.

Variable naming conventions

We use the convention that coordinates on the reference element are $r$ in 1D, $r, s$ in 2D, or $r, s, t$ in 3D. Physical coordinates use the standard conventions $x$ (1D), $x, y$ (2D), and $x, y, z$ (3D).

"Ref-to-physical mapping"

Derivatives of reference coordinates with respect to physical coordinates are abbreviated, e.g., $\frac{\partial r}{\partial x} = r_x$. Additionally, $J$ is used to denote the determinant of the Jacobian of the reference-to-physical mapping.

Variable meanings and conventions in StartUpDG.jl

StartUpDG.jl exports structs RefElemData{NDIMS, ElemShape, ...} (which contains data associated with the reference element, such as interpolation points, quadrature rules, face nodes, normals, and differentiation/interpolation/projection matrices) and MeshData{NDIMS} (which contains geometric data associated with a mesh). These are currently used for evaluating DG formulations in a matrix-free fashion. These structs contain fields similar (but not identical) to those in Globals1D, Globals2D, Globals3D in the Matlab codes from "Nodal Discontinuous Galerkin Methods" by Hesthaven and Warburton (2007).

In general, we use the following code conventions:

Quantities in rd::RefElemData:

Quantities in md::MeshData:

For more details, please see the StartUpDG.jl docs.

+ RefElemData_kwargs...)

Here, element_type can be Tri(), Quad(), Tet(), or Hex(), and approximation_type can be

Additional options can also be specified through RefElemData_kwargs:

The GaussSBP() approximation type on Quad() and Hex() meshes

When using VolumeIntegralFluxDifferencing on Quad() and Hex() meshes, one can also specify approximation_type = GaussSBP() to use an entropy stable Gauss collocation scheme. Here, GaussSBP() refers to "generalized" summation-by-parts operators (see for example Ranocha 2018 or Fernandez and Zingg 2015).

Unlike traditional SBP operators, generalized SBP operators are constructed from nodes which do not include boundary nodes (i.e., Gauss quadrature nodes as opposed to Gauss-Lobatto quadrature nodes). This makes the computation of interface fluxes slightly more expensive, but also usually results in a more accurate solution. Roughly speaking, an entropy stable Gauss collocation scheme will yield results similar to a modal entropy stable scheme using a Polynomial() approximation type, but will be more efficient at high orders of approximation.

Trixi.jl elixirs on simplicial and tensor product element meshes

Example elixirs with triangular, quadrilateral, and tetrahedral meshes can be found in the examples/dgmulti_2d/ and examples/dgmulti_3d/ folders. Some key elixirs to look at:

For developers

DGMultiMesh wrapper type

DGMulti meshes in Trixi.jl are represented using a DGMultiMesh{NDIMS, ...} type. This mesh type is assumed to have fields md::MeshData, which contains geometric terms derived from the mapping between the reference and physical elements, and boundary_faces, which contains a Dict of boundary segment names (symbols) and list of faces which lie on that boundary segment.

A DGMultiMesh can be constructed in several ways. For example, DGMultiMesh(dg::DGMulti) will return a Cartesian mesh on $[-1, 1]^d$ with element types specified by dg. DGMulti meshes can also be constructed by specifying a list of vertex coordinates vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z and a connectivity matrix EToV where EToV[e,:] gives the vertices which correspond to element e. These quantities are available from most unstructured mesh generators.

Initial support for curved DGMultiMeshes is available for flux differencing solvers using SBP and GaussSBP approximation types on quadrilateral and hexahedral meshes. These can be called by specifying mesh = DGMultiMesh(dg, cells_per_dimension, mapping), where mapping is a function which specifies the warping of the mesh (e.g., mapping(xi, eta) = SVector{2}(xi, eta) is the identity mapping) similar to the mapping argument used by StructuredMesh.

Variable naming conventions

We use the convention that coordinates on the reference element are $r$ in 1D, $r, s$ in 2D, or $r, s, t$ in 3D. Physical coordinates use the standard conventions $x$ (1D), $x, y$ (2D), and $x, y, z$ (3D).

"Ref-to-physical mapping"

Derivatives of reference coordinates with respect to physical coordinates are abbreviated, e.g., $\frac{\partial r}{\partial x} = r_x$. Additionally, $J$ is used to denote the determinant of the Jacobian of the reference-to-physical mapping.

Variable meanings and conventions in StartUpDG.jl

StartUpDG.jl exports structs RefElemData{NDIMS, ElemShape, ...} (which contains data associated with the reference element, such as interpolation points, quadrature rules, face nodes, normals, and differentiation/interpolation/projection matrices) and MeshData{NDIMS} (which contains geometric data associated with a mesh). These are currently used for evaluating DG formulations in a matrix-free fashion. These structs contain fields similar (but not identical) to those in Globals1D, Globals2D, Globals3D in the Matlab codes from "Nodal Discontinuous Galerkin Methods" by Hesthaven and Warburton (2007).

In general, we use the following code conventions:

Quantities in rd::RefElemData:

Quantities in md::MeshData:

For more details, please see the StartUpDG.jl docs.

diff --git a/previews/PR1624/meshes/p4est_mesh/index.html b/previews/PR1624/meshes/p4est_mesh/index.html index da009312dcf..006586c686b 100644 --- a/previews/PR1624/meshes/p4est_mesh/index.html +++ b/previews/PR1624/meshes/p4est_mesh/index.html @@ -345,4 +345,4 @@ 37, 38, 39, 40, 41, 42, 43, 44, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -94, 95, 96, 97, 98, +94, 95, 96, 97, 98, diff --git a/previews/PR1624/meshes/structured_mesh/index.html b/previews/PR1624/meshes/structured_mesh/index.html index d680cf8c503..0e9bbd74306 100644 --- a/previews/PR1624/meshes/structured_mesh/index.html +++ b/previews/PR1624/meshes/structured_mesh/index.html @@ -1,2 +1,2 @@ -Structured mesh · Trixi.jl

Structured mesh

The StructuredMesh is a structured, curvilinear, conforming mesh type available for one-, two-, and three-dimensional simulations.

Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.

+Structured mesh · Trixi.jl

Structured mesh

The StructuredMesh is a structured, curvilinear, conforming mesh type available for one-, two-, and three-dimensional simulations.

Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.

diff --git a/previews/PR1624/meshes/tree_mesh/index.html b/previews/PR1624/meshes/tree_mesh/index.html index 49f46156707..9ed7ba4faf5 100644 --- a/previews/PR1624/meshes/tree_mesh/index.html +++ b/previews/PR1624/meshes/tree_mesh/index.html @@ -1,2 +1,2 @@ -Tree mesh · Trixi.jl

Tree mesh

The TreeMesh is a Cartesian, $h$-non-conforming mesh type used in many parts of Trixi.jl. Often, the support for this mesh type is developed best since it was the first mesh type in Trixi.jl, and it is available in one, two, and three space dimensions.

It is limited to hypercube domains but supports AMR via the AMRCallback. Due to its Cartesian nature, (numerical) fluxes need to implement methods dispatching on the orientation::Integer as described in the conventions.

+Tree mesh · Trixi.jl

Tree mesh

The TreeMesh is a Cartesian, $h$-non-conforming mesh type used in many parts of Trixi.jl. Often, the support for this mesh type is developed best since it was the first mesh type in Trixi.jl, and it is available in one, two, and three space dimensions.

It is limited to hypercube domains but supports AMR via the AMRCallback. Due to its Cartesian nature, (numerical) fluxes need to implement methods dispatching on the orientation::Integer as described in the conventions.

diff --git a/previews/PR1624/meshes/unstructured_quad_mesh/index.html b/previews/PR1624/meshes/unstructured_quad_mesh/index.html index c76c115c5ec..779f6ebc6e7 100644 --- a/previews/PR1624/meshes/unstructured_quad_mesh/index.html +++ b/previews/PR1624/meshes/unstructured_quad_mesh/index.html @@ -76,4 +76,4 @@ * Upload to YouTube * Obtain responsive code by inserting link on https://embedresponsively.com --> -
+
diff --git a/previews/PR1624/multi-physics_coupling/index.html b/previews/PR1624/multi-physics_coupling/index.html index 1a6e18f98dc..cbd5d344565 100644 --- a/previews/PR1624/multi-physics_coupling/index.html +++ b/previews/PR1624/multi-physics_coupling/index.html @@ -1,2 +1,2 @@ -Coupling · Trixi.jl

Multi-physics coupling

A complex simulation can consist of different spatial domains in which different equations are being solved, different numerical methods being used or the grid structure is different. One example would be a fluid in a tank and an extended hot plate attached to it. We would then like to solve the Navier-Stokes equations in the fluid domain and the heat conduction equations in the plate. The coupling would happen at the interface through the exchange of thermal energy.

Converter coupling

It may happen that the two systems to be coupled do not share any variables, but share some of the physics. In such a situation, the same physics is just represented in a different form and with a different set of variables. This is the case, for instance assuming two domains, if there is a fluid system in one domain and a Vlasov system in the other domain. In that case we would have variables representing distribution functions of the Vlasov system on one side and variables representing the mechanical quantities, like density, of the fluid system. To translate the fields from one description to the other one needs to use converter functions. These functions need to be hand tailored by the user in the elixir file where each pair of coupled systems requires two coupling functions, one for each direction.

In the general case, we have a system $A$ with $m$ variables $u_{A,i}, \: i = 1, \dots, m$ and another system $B$ with $n$ variables $u_{B,j}, \: j = 1, \dots, n$. We then define two coupling functions, one that transforms $u_A$ into $u_B$ and one that goes the other way.

In their minimal form they take the position vector $x$, state vector $u$ and the equations of the two coupled systems and return the transformed variables. By passing the equations we can make use of their parameters, if they are required. Examples can be seen in examples/structured_2d_dgsem/elixir_advection_coupled.jl.

Warning about binary compatibility

Currently the coordinate values on the nodes can differ by machine precision when simulating the mesh and when splitting the mesh in multiple domains. This is an issue coming from the coordinate interpolation on the nodes. As a result, running a simulation in a single system and in two coupled domains may result in a difference of the order of the machine precision. While this is not an issue for most practical problems, it is best to keep this in mind when comparing test runs.

+Coupling · Trixi.jl

Multi-physics coupling

A complex simulation can consist of different spatial domains in which different equations are being solved, different numerical methods being used or the grid structure is different. One example would be a fluid in a tank and an extended hot plate attached to it. We would then like to solve the Navier-Stokes equations in the fluid domain and the heat conduction equations in the plate. The coupling would happen at the interface through the exchange of thermal energy.

Converter coupling

It may happen that the two systems to be coupled do not share any variables, but share some of the physics. In such a situation, the same physics is just represented in a different form and with a different set of variables. This is the case, for instance assuming two domains, if there is a fluid system in one domain and a Vlasov system in the other domain. In that case we would have variables representing distribution functions of the Vlasov system on one side and variables representing the mechanical quantities, like density, of the fluid system. To translate the fields from one description to the other one needs to use converter functions. These functions need to be hand tailored by the user in the elixir file where each pair of coupled systems requires two coupling functions, one for each direction.

In the general case, we have a system $A$ with $m$ variables $u_{A,i}, \: i = 1, \dots, m$ and another system $B$ with $n$ variables $u_{B,j}, \: j = 1, \dots, n$. We then define two coupling functions, one that transforms $u_A$ into $u_B$ and one that goes the other way.

In their minimal form they take the position vector $x$, state vector $u$ and the equations of the two coupled systems and return the transformed variables. By passing the equations we can make use of their parameters, if they are required. Examples can be seen in examples/structured_2d_dgsem/elixir_advection_coupled.jl.

Warning about binary compatibility

Currently the coordinate values on the nodes can differ by machine precision when simulating the mesh and when splitting the mesh in multiple domains. This is an issue coming from the coordinate interpolation on the nodes. As a result, running a simulation in a single system and in two coupled domains may result in a difference of the order of the machine precision. While this is not an issue for most practical problems, it is best to keep this in mind when comparing test runs.

diff --git a/previews/PR1624/objects.inv b/previews/PR1624/objects.inv index b0a737622334b3492ee891dcc4151d04c7577fd9..6bba84aefa1c9da6339ea9e14cf6e168ac57ab73 100644 GIT binary patch delta 14393 zcmV-9IL61Mcky?Sfq!dr+%~f4_xTmr+T&ZvDbtE1CvjB!VP%c2cvo_?mgB9uu2XZU z8A!uuhMXlidL)&O=ufLJc_Q+4-*W@lKw(%=rTzcvvNsi#hj+Jm{lv-^sVjv_Q(Nw z%~}y?MR+TcU6WYbB(*6h=J6`dXR9Qo@K3zBqih$<_B~7NZ@)(ljg3Ugj7(3-nwHCK zQD`WqrAhiP(s?M7p^*&{CrdqVD$a!Ib?F@IUWbDGn14)d*l&oZ0e&gSu^ z+~$0zxjw>dv`4-rm-vWO{oII1oZ`I1HdJe^=1``S2QQ|QfzY^IH36X)?&wts>R1siki`EsifU^yTc@)=>z+!GrF z-QOM%9m>zaN!>Kygj0w!0c*UR<@6e8&6=jA52L#^;Cl)9_)CH>N%c}E7-bIhYMavq zhp>(}8$aQ2HwIilLDV~rjZu*K76brJEQx5W;a+CTe=#`nksE8R8Q}Yl{G1jhMmU5F z=YNks{rHb__#60-zByik#4x+gv-Rv|4a0M94zm&9`JPvzt6#ue~Vz?E&8pWNN%7+G`Exd|Q<8 z;RRhMi=+U7qI3vs0nLFCe?v~#TT*{pOn>-V?Ugy@n^p&JzuN;*g7WPv`&oO?(c5aV zXKzgjX{+s^8ITh%KzGBv`WBRs`9AVMt6uK$%@tk6g#}=7vu4c3144hjM+B$g0N7>& z@s`30*A~xu2eXU&PkS-}Qop*2=eGuZQxEsZiTpWXBZxN3$0C^*vw60KEp2X3cYh0j zA%0DOpx@!9wAhsP7#piUCJTB;SJ}oUhT3D8jOvfc4UmKFRRsU&&8w$-W%>{+J+B zSgoi_Q?g#|F{Y(Gn1JNDg~JW9U4K>^m-z}0mDv`>y0^#w0F8@_dNitO0oJQMCF9$j za5Fb_#Mh$pYxwB^aBx@NHUPla0>Hti@)iNaTadAHV-JZ(d*qn^z`X|DueSEw=+D`1 zQ-4911)XKruya$C>CIloE9?ln29%8x{$K*+ou=kQh(~+mjQ^N?0=X9HaetJ?NQxu- zIIQ9;y7Ha+KmP}j{R!`{pPNae5TO7Eh!KEi|K*WilDJr9Os9?F=x`c=th>blL~#KR z4yMrtUYj^gl^?)M2q5JhPKks-;sPEVObJ4meAuQbN22R;?oVmb!U3HCWvGP{>p(59su*EHmJ zz_fsH7-~A3>kW`~)a_73LEY!sBUS(^1cB6qgCGpVjQ$&)bg2Y)&n4p#6Vyzi1*4yf=;|?Az|1A7MkhdH zviD270){h!gjoP4SC51P*2o0|Jke#=2sd4xz`ms*OGHZ841eFKh6HRt0pW!7wRxq;7s1G9iJr3I1zCNM0LoLhsfRnYYr+_=0q zsd_W9q3S)6!WKJ`kxzK5v@#^YKKYDUDx>%=hJ%T+CVzd1aYIF*I6MG}JYWrJ#R85pi_fy; zGT^%yfq!Mfhc)>2sJ|8eBYh|%3gTpqWm;?u8xqlQg4TmbvmQjk+2QA&w!J~QM^0?@ zOg}x9g2w49mtY+viM^IyM|tjZ5O>OGi6^uGfhD4M@oL*h&-|t>-0IThDM&&Eo*;Nq zfuBfAWc22tr0D|4-SJiYuWcd3ssNd-27z!0LVviLd|*O37i2+kh+u3;QSj3xmv|m| zSf8=70f6w-RiIP{;Uo|pa8?xNN=u*Ad>)QzH@qJ3@jo1S93Q&kY_mLz*y=hm^t=`X z{*9nd!Q7yM3!lfgeBKxVVDvQRV%#Fiws5+XaMww`;b38QD{Fepg}4P_V3lY$kwb}4 z@qbRE?WiK2l3h?IPsz4T;zP|Ks;p=pl|i?pT_oi-oM+%gOA4cByYK@A$*ftTmfZ+; zBdisBSb%j7K# zQ*eTshVC(xLl;tYnH+2G0=H@CWPeHLjHy>PEExASp6q$H29deVA|?T7MliwwkP5&= zNFlmm1nmWLI>T@-5I}*9qjWh#!LoQ!XWlKOS4lb5o<-TE3I3$+&kj+>_g@|PoZ3{F zEmvsMY$vtS^eMU(lcunuZc6HRN8Z>XH@{PX0xoi6g$j5%9n?H*-9(Ss7NkYs-SZ`yjf%%~&Z!hL!;CA(>FEc_IjJnd#koT3w@3^A^^Xp z-AeeAH)2_%VngT2buy34&;hrZs@AJ|t$Pv=rV&ti&7W9shvI%$hvLDM0PWY@iUs#| z?F+wROZcZts__Sa0_ww~rWnx6Wp+Q03yLQIdLpA+MAtwxfScE8f`4qyq%qN&$kr-U zU}nb{RP5A>7{Hm)Vht{`BH_NDXafMzr~z{?3_=~uP8A$d!BK{#zird3QHzTt7d(n8 z&!o}@__9mSq&Y*PAIdtdJtdA-@8<+VH-Lb_ajRjJ;T_Bj23$(EVj{`5s7WJ2@?dW! zZ^gkWIALG{7@8@ENPq7hn9mOOiF(Cp2NTc`-Q+w@;k1BW%A9G&i~+|%4RwV!)QF~c zNuH&3v$M5+5+0H8wBYZQ=@bke(cn!kRg?e@m`CzQ*GWxZGDydz3Jkzc5#j%=lj&s= z#L*MR)|Dh0UZ%M(s13OH<9(Jd3Y2lAd|%_LRWM*8Q*FMx-=<>?~W zL^pLF`7=C{&qj)su29+Xi; z6_XS)qxD1_Ep~)*D~o_Pk{LG(!h`4<`dOOtxQ-2}l>gM!tLDvJ*kYjboD9ZX0 z6qq|IQqn?4tE)rS2=i}ozZ7uYntEX{6y}TKttLXyW|rIg95x(?`sL$>1|5H`GZCE$ zcAk9R-;cOrgkBX(F^Z&OB$lg1(dyuk3_)tFXA5fPt_;e>ILX!<=BQ)G=5O&lyGmm3 zv1tfeM}KWv!eU28!a~FD4Gq#YSW8X6_`Dx6y2fG-3Oy`Ctbi3})M3VbfQ?zUz_VHP zQCb-6%g7f7pf-$~ICL1dABVL++?d!WG-R2eB39IF`c8d~HTz5-&^W`~Y^(p$qo>ic zoF{W@xh;dCrri+PUN~uw(|Gk*B!winAUBD)fPbDbJ`CWma;K-;HH;g@W;d%aLp5Yq zHZs+<;tHkZR<}lI2k|$#)thrVx(dSw-yAh1cG#wMSOJh0;88Axs(vQ+3QlDe{6IbY zgRRa-2^bByt*#~WT)=F~H)y@Bj-=94UBSrwi#>ivO;Zi%t8`UYq%xn8%FU%OgOt2c z<9}=5s}4tr4TeXEa4?fIEtFk>lfmrHh>Oq0?x37recfuC3Q>7&R6xZ{WIEwOlbk|o z$8DJ1D#Mm5)4O|o>i&!U1~J;s13zPOa8x`(Tfc{^nO|}kM8J?a5f~dqAENc5c1mPo zgr15K9bddN8@jSLq{bsU5$H5wiUFvZWq-!xChql4gy}8^3JJ<55W%db+gj!X0S66d zO#af~5P$=+M@a;niDtO)1q21Jmu9r6U>Ow%v?<{=2v8xdS0NCoKhEH0(|%M1EURn* zp={h?#9r#s1shMXN)Zq`#vO*_r9wCS5Z_0M8N|{{Hv>4tgd@z-dPYuvMTwiBjeqQ( zDQIde01UL_xe_oL%{;fatHb80btkGjC!^4P^7-2+OikgWl}Vq%xGCf?OHT>QbgON~jGVPRUK&7FO12rs#A7O7t@7^8t z*{h;2a9x5w34obgaKoA89*bxz+jmiSw{kGl@P`L5RnVofoo*~ECWx{OnKsw348(x7DQJhNd1Tl z2f!jV#L^E~`D)>hChko0P`l&)cSm9A=9iDKB_1M*vGttq(YSa-rnpXu=6}Fi-j(pK zjMZURO)LUtncVd>;bRnLC>oM+I_Ap^L}8o`5XKe>T8{5T%xTX|zhe|~ zFb$7Q35SnUBHqU+G{j@qsmlYXD~!5^uc+u1j;p4c*ZyIT7Os;t1^`)3}V$ z8-Dc*owxbDHE_(kt+Es`lprP*IKshA-lF$RiRUFSB#kO+fBBqSmsX=cKV1ywA74{}ptPu-`o6*7QC1BklS_Mx9IB!U?N<%3pxlXB0- zL$Y?|35E`rL#;L~B_`C#yYxC)!7SEtVQS8EEocJ$%qrTLv&ZNOCg#ff@aQ$shhU${=fg-3ra>`kdMa~_q<`||-38%vy$Ow}X?c+$ zoo_7v)>6=?GYQ%M;i##q&*%N`A|un6FD7TVn#3w*u_pC)V2WXgjCrh~V{9_8q?54n zi%2-saq=5ZnT3tNX6dSWU<^mqgUBAjg3%%ba?=D#fM%t*26OfS_Iq{IJ<{(a6H|d3 zlI0W@W2QGeB8@C3ucOkW90YL?-U248szQJe35Q4+M6QlAh`hZZ7?Q=p z5JCK8TYo;=mhiKc6LVT3Ul7)xode##;?pdxV;HAqi5w1IJ+-Q7`Grial1bMvexrhk zJgG9o9VhHRll7V|5_rCP{Lg4ETWq$g6{ti1+EN>x>*(tMpB)@)AmJ|$P)QeL#5~Tv z){)HRd+bF-ugP^o_DMa{q-IPt(mQxEXW!(Gntx5zNbRV>u99ZgG{%mcL~BMu+;5j? z68L#DJ*`Q^p4bFNbD2N_cHF(;w{n{IZ?sjFZ}x1}>dK?s z^373LX?YNCnTJIW0Yx`AmKsUtk5POZiyYm*rWwm6+R1eMPe#q4as zrNdKigdvSr9xiZA7Iyk{s1%&bXg?Foan>2u{uI#m;STG zIqXbWXGY68eXly}rh4X9zg}hcO%Qd{zHC2n+&ktZ<#w&Rmq*RvRu_2!KQ_Qrryj$& zR$ECmf35@~>nf4XjQ(7IQ!)F```<=ZUNzt0T8%MTeoqDyxTT&BQfxR%GqAvom;o|Xas{$m?2@FkF)AL#@93Qly_!Q>==Kkff0|6tA6eySy`)cgV(`bBJj?TfwOfDu z`TnLfSi305yaTUICj0)V<%$GNJqRnZqp1P1n9hZ_5{=0$BA)OzSI_gw~GZVCe0m)dYZ_<@Z>*oQF$#4=lFfA(bE%e4|xI zz{@{)psa3z1TpTu?kctInH{8pFqA&8sg0OP1%X#|Dt9k>Z01Ao_35vjYRS~rY@Y*T2m!aOK zOVi18EbF#4S}I!X;1Y;1QHTs{8Ia*AgwIGHPsJ877S&Z{DxcJ2^NA)2R_I~T8o~mG zgrmiM)K;Y@c|kOYM1xqVcbr1`NmV=X-eM?HsXNC|O%dJG=;_3EB9f<8hoG>sESbjb zs($C42S+6uDY>6W|U%x2Pe-CzG?W;FbMtggr{q!+;}sZp%4gS0~4G;kD}WZ z&1b;N*&5rQjR_;LBt-%|{|&b6`nCN=;GBh~vFIPoeLh^&ooQjr46A2hVJtuc=5Wej zUtTe&UB5H{ZOh^|4?_P$G&_I%__)Zk0yAspALv{+g2P~$kl+m3kRVRtd_&PY`*)hA zbn$rb{^emhzzQBB@4YsO4dZEbd8Bc#_|KI4lxm<3; zmhy6Yg<`zu`)+!1lI7x3rceOPclwT3;#pn7M5i}zk-r6X*Tne~(4EkC6})qQJUa_( ze3roxEVDBT+hvi{*Dsjr!Y6a@oizg{_Xwr-TCEn@`1*ykH7!^ zobX2cPx%*X^ZW03g9m>|hGv(LZR8sfY$3Uo%qH-FA>mt!A%dNR|FH+MlX_u1$$<}BWC5LQ{dn6VHVQ*;5Y07630+*lwq>4XC@)GkqG0>qkJU<}ipYW)C> z0XUv7RTv}(JUxG9+aL^ntvkSptiP+e}<+z0de@dBO1KLOQZB@$nlwbH}@IA}E) zHL52mdzUHiHUwnzErYO0yLai($BXgz%nCfm>szAt{5xNU&$AZ@jP#{7+uF&i6<*EJ z1lMxtorj~#d2hwqP5?Y(&_7TW+WZmqG1Tc#`Rs@)1G}WMIhbPYtkL$R-T9ka+eYc8J^$GO! zEU)d^Ayl&Cb~Oglx?uxI=PI3HR;6_|!-N*St9__+J5T(;+cX3Hk2*O&`#=A)Y@y)%J%sW8Gx}4qGH_sRD2XS_x?0}BQIn6?c;Ou{yEuxglQ8096Tpe{%6Vm0R@io zUl+>K+pXJQj=ln%7kLKzX8jv$J`?TW-vrbaW?z7oGlikCl@yEodgJe3|1PdCXGS<- z(FZOjzdVf6*)s@hBn{NsETS02SLi+ehYf#T`+2~BPpije^;1ri@bA>D(<6drQr)wI zSJi3&d_L1!U-4Vbxad8rjV!#UCQdf!`UwAr%52}TdKMp9f^JvShnd~jY3oqOC1?+{ z0k2sx6nL*WUHO`sk2%no-j%$!V(e%<_YnI+CNRwI;&er6K3m2#r3M`x&*{;OP5&;U zj!uv2zA7w>U%ZgFaZtlYhS%~b?-%|d7ORyUNxFu8n!mGUAew6oVbz>m?32nPC4Web z*{vQ<(-Oka+y0Vf-7GLeV{}4>(AxylJ9ekdqBnZDM7UKiELy_abwij%Z6^k>hE1NV z59Y$47^WWR_nqnVi5r6?ffB8xG3gEPdoGb3vy2V?+lqO3E{eEUf1k6Hi?*n$4%7#F zjnGguYJy&c1`NUtA0)gFhS4izJ%4HwrO{7i$ubD2=waH!B1aAk?iQyzK+^Op!_o3e1 z9t-Yrvh?=WcUWpS-sVLXQPU5zdh}_FeWK_0*a)3p(t>(4<65s^q;bq?o_`fW-|T{3 z$3UECyacRN?t)#r&hD0{{#|+p!f~>Ay@jon7jiJ6P9cR)LVpTi%sX zbQw)=RknGYMm#|+-Qe4oVTS;#AIz=X6ty)PgsY%gGJ$)|S`BChhJW%7Jg|d9cf(F> zyF(#z4UK4FF??UUs9d7NhR zWxQ*Pp@C*RTVW6O^f8aGuao&(SmU#Qet1%D2pmbAnjADtpL8j3$O_F?WAHhdLd=JUnz981J$ip){> z4xDVSKx5yqD{i_cM>l}+rbmxaMC6Yz8#0o=aDXj$n183R-J*L#%XP*2_%kVSN@f%q z|G3t9o*PtXxs@Ge@bpqwN3x~|D64MkpbOZLP`Ngvpc`LU+|(1P3nsduY68XDuban# zrri*=skb3-1dXZ9UYBPjUddQyvxo4RaHpGu*>ZP4_pi9YMv?9R-<0Ax zvH^?JTMr1UZ)oZQ{i2ovkL}Q?rLMs}?U`G4G9AL$0&AOR6ix1EGbx-tnt+tPZfSfj z%x;U8!oiDBmiAqPgG>d7c8RG5vD_crRoD1QhwkKS^{JW5iI^sPb1vSdN!7elnx z&b7#bFgw-UQFCAZkN}8a-K0I<$FU^qM|`eEY<{bT{fzyy=w;Sg?+;19Em9vx{>L zPk)wg#MUFP+*Ff;NQ?eu>}SW2feuLY58@9Rg9*Bmfgw9>2ptI6Sc6LIbcwwjr?k$2 zO*Z1i<0b0n-6#hh+XKur4%g`GULpSc4S#l$rDdF?G!HytE?yL0Tg&Q=^Quu`vBbQ$t z!V1SKziJsI9iG{4*@SiX=`Kn96NKCcIP-^wuyvvGqlK`I?_3Jp&f`0mtkAW1HD`;; z5#*UeYZ#*{vJcNFb&&BW-HGrDr<<%>osc@Xuv#I<3+NJ;p{}tJt4<9v!jDjO%70uA zmmO<&=Bq%9m6I>T+r_ph=u@+!I@(eA(JmCwAw|zeRX`i=>l)XgHK>By4jfv(Og`~l z|1KNZvuxzSzsp8`$z>xuL|%-c@bn77=&B42kb1k64IWMEJ@ol}I@jl8_Wt})H;aVX zIqd6gLZfaM*?o$)%k;@wF#9&7EPt@;YbwFN=lwUjIPbkerKxH{Xk<9*5%E6r#M%NPKy4-9xjVRac32ztOf? zs1LO|j&ZGRyCPtcF)JHfyOt8~77o+gu<9`0jopX3Se+Zli%!gE$Y8P_k$=HnAl|rO z#seg4D^5_Ng_-Gg?rXPwhFAJHJ3sz#xkDCd;TVrU_HZb$>?wqv@vE6UDQWE=n%uv1?GrffL!**>j%mFx ziS1JkTo%8Rx*7PtQvs!3d7S6*zmo$0=%he>FL+bhpJZI@(m9Fu-z$0hQulbg}9fT`Ysnu&m223fo9om%GuVy99}iuTDDx#E#ED zbhD$#;%z5#RPX5)ZCf28lAo-W*UoBp?XC#vA0aollrzMP6tviann@oF3EEE74&i1F zX#T`+uMKjE-P2VJa(}@MzhFFwpp0-4qYrZ@Dif4I$rcIp2k~VeC`!>oqgG6yFlYqZ zDQx9Z=`~td>9LAJ4~so_z^DhAYe=^REoSjrTjd};W;a!drBVC|wTFN>aGm9A%z!!p znh3<=EGf!BLrl#reZs>ux`i%}sjxpm)=mHP2h#x%Hpjoj^MC9riPKrUn88Bb$N9oZ zygKLVwScctv*r{$QA42Pjb8O-2r1G(LP7oxh@E>Nyw*P2Ru;*+|7 z9ongM@Hi|)wT;n^s>b)KE6s~|MsARJ*;nb@vbiP2=$#Xz_(DzDj?;McSR{qC%nRdCSZ5Z&T_$TF?{s5U zE9w~zE`hlV5P1W{y%!Y>;GE$xTD#1$Xs?jkZf6L!!jEQc2u0W|OOB}E^j@KzC^(jp zJHgoW%gc)oe?L6zz{{#$|WGJ*Kc*Z1Z0TKZin}ObgHHW2jDioO^R7rz#fY8 zT5$HL%A60|AUjV@`|l)9dGZp%I)~Oo8XRug9Aa9~a#s8+FK0O7jt&(^Ux!v+tLbs{qA?H_$=W`B%(`-gSMon446l>RyjuvzoA8#!e+k+*~8 z6qB(n=yeR|XBG>C$&BWCrpnF@u@E&v4lBMiimczs#yhI4?@$4?OJDk`f5vq$e$~&J zdWi(LMYSG>F^6CuVs&LoqaC$J?vj*Q?z3iZ}0r$bVJp zm4;`nHlzs8R(Of-tax0*cjTrmzGW4qaocq(uj)KBh1oqmuaU#E>YB~mHChvpLAg6f zl!5!YheSE%-7Lc+H~P6}TVpf=tY`1iI}izz#p^Ag&x@zAn|YDCSiC3~(j_0o+0~Vo za+58#X?Eu)wgWF=sv~KqvSD{G4S%Y*KlWupz3T4=g~9_lFXA-$J1s%QFF<|8D7GY> z3vc^jptn6#`3g1fc&NiUyT;n~w}nS&ddUC>?DV_2V%ylI@b$Yr!Uw_tc&_(wA^Zf# zIolR*vwXc>v8iNCV0s#EEnBk`RTW^`t$4BC*&_P0 z^^BKn{{n->?ZJJq(c;}wzyjsYJ}F?9XxZITH&DPFYNiVkHJSV3CI%%^|AvuG$2Jmu z-2IHhJ$2A={mgxJ%)Tauw|~>i*MTM6%&^^03B4aZ0BJYZbG3ybg@!e%tGN4qw_5_( zO_AF+37|tY1`&v^3h_A2!adXf+^{?5{tY8Ifm1vN!Lbr2vPE+JI9rsM_&6(zGTRhp zHV+S<(kd!nUW8>xI3U+EdmPY5^9%MOe&cuocPWtfHc1T<$W5sMMSm|Xdr&B2Acd7> zb_VkTQ%G6l>#u>vO%tHn9v+aRTiXNYbO+YtVR#!r}njK)Ij)c8|;JeDt7d< z%~n{P$|aA7TYp@zynmv$Hjor_EVm!FC&SeMcI2{Wug_1i)hfYoU%7x?&V|3f%a+`| zqW%b>C`0S(_t!H9)$$plV2oJXCoq5V*C%4RCc2?qcf2guC%GRiRHyN~NBSx`!yPA2 zP`jyX;Mi!yXGtiuA7PevT;(t7iffI&L;;8X#Ph}|U za@F^&WbU9YytLL$vCxZb^_XUBI2c&fp?D#MwfaG{*%gK!RI2%Et4M&`@!j|V zR{%?Vgb!@9G(Jt(WfpK~y+pG* zcbEGb0%do*!17>;tg{I3s;C?)oHbwWqkrs_tN7|F```X@#Gb=Hwt+^Lndcr;{D07g zhm1v^0DD9z&9M6Ks)hK|9$&o%d*y^>zuL!6;XE2#b& zbo8n>w-PBIJonnGrhhs5sy?Vn$QI4*`!oF;;`gr&lCS=VY|235F11wdZE*))YlSJ%Cn{@6W6aa}=~qYxqoF z-04sjP=CDKf}T6iD3+W^K+vo+yn$xOaGXvO*~MaMc}jXHJRS#0n@-cTcs)u@27vQc zoJ0l0f$oa*IC-9W>aXIy?-BD|3Xc+?OfPZW_L*pTHFHU zFT=om1Uf!M{O=I?@(0Dbc=TsrUD@0+2n=-(n=ti(1^R$tQDZ=YSw@=ixbNDCntuje zZ*%H>p6d7p)!t(g6}(z}srSZMWBX#oJgd0IrOc@6AhJDKsOA%fX8KD)56U;}R~0%W z$FR{xJg%YGrG(*SIg2f({Hn9QqK$#mBMh%nk_(7^TjvxvN`4Z^F)a zOJv1>oX3_Zrk$h#c8OsM&j{qRBY&?KJuoifZZm3xol7SIeb}wGleUQa#_|%oi?T-vW^U9sl13-x4uKk2c!XwOHMvjSd1$5nqBK;t9@>XIT{DtA4URS z!oQPJIchCnw968XeZi=?ia%>5Rq*hKa{1#GaJX*1#Zju4?J|98fX3eKdW*q3e}{Km zlj%8cRn=yFF@8;ipi&m9+NzVSIwCLYTU&GO2VL75 zEGmxS%WlNqTTtxarCt{@hknq}| delta 14326 zcmVp<`v=aCowaZy00Jale?tY#;fGFxJe@=2*lyP3_?Zu-# z@qUCnej;`JZF&>Z;_MEWiggy5mUB>AR4!F#d zha>=@(H@Z0v|MJ3 zLPI${y?k>%d%M~`Oq1(tHyX3e9(hUF6LO!FOL7g5$$tW#)10Prm~Z`imf8GvHjg*u zHs?Fd^$}*HJ@PHN#7Cs+=SD>06z3(rp=6b;lal5d>J+A7L-QnCB=gx-woMmtp1=|~ zhu~?vN4_KPvow;gNcGB?!Sn5^OlJGO$rG>l$oIGe#e7NEFp#?>CjTv7{x>PI)txbZ z+3lbi>VLr=c}0GLEtZqZ*B1)-S8u1!$q6pf*KLTln|s{L*NfuHv)lC+d*lc5Gy9vo zo$4qxi1A{9M=_=MGqFMGzqV|{d#1mk103aV$T52lM<+$v&RUQ;yaamA&(SKrci_*` zs?i-)Fq_BV=>+50*Tw;xLT^T7Gi?-`IFGNg6@P3f*qCe2ms^bh%K^EN&j@?wp4cGh z{`P?AP<{?h>ZSoFoI;!lSmWg^r`JGh)-)}B7~QP_-%G&9UlM#ts+T&!D084!+ng>q zgmt{x_z8!*G2j9UqTX?AjDpO!AOLV;Nkn4}_cB}li@}kP+*oVP0N;1y=d>^}!Xach ze}DYx$A6r|-@t$L&G8Z>hS_zVt!FoD7@m7`n2i9>_v8Yf@lV1R1Yc-y%VbR%OZ3m0 z(F9<=B5xixu<}Vs@D-7-G^mp3mPvfIqO(n&-Q@9l?M2~l5BPo{Q{y$!UTZk#+oFUI zFX%d1Bn1c*r9)r~Xbz0{8*;+llKR_X!hhFlugodmv^seE-5!V%ly6_z&)S2I-d2k} zduvKaTWtr;fSh;%x*P7*x1fZ~_mKx$^>UAIuIMT*EC7p}HDfj&5c=yqA~+2Pz&0C* zw-i>mws_V%m|fg|+LH;8`qfoDzcuKadbmeU)tJTYmry z@oNGE{SG&!#iq2!*jW8BSiRRDVovfE;YEBKS{lUOn9-r%Cza_KN&3 z{4puY#}&QVCJU-Jub$#Yg5QMwF)3l??DNPU!L;%p6A)vrvwR(=a|5LI7`8z5#{`+e zYDHa|lJ#njF)i)E1SHQb9Bz>9vVYpR%vX4*%(f`jy*>U1Xk1*>qft!@uwLyc8Q<=N zo4KJQz80Nd!%qi*gS+y!0RX-h01kdBZxKMe1sOXx_KajiAlD*2j(^e^NpWN! zhgEzwGKjHoLb2DiaA{5{NF#_=HzdZ6w5*MqC>9kQC9Zn;Vb+yYZIrb@&kAY0i?XcDUlFJT)=~aDM1L658E{5NOWD!{V7daIG_`t47G4#9f$}H zL<9%ILSY>v0OmVLQ=A|KB!BdmM_k-R;#k`t*%2^Fh*BeZBo)L-wpv6vT~T@Tnuh!i zm=+KYLrrIMy#cb0nq8Kz9#KTN11bm4Qv%RI*%9z3pT3W#r;*S>B2aZA!G9vI==|4L ze}(N4DJAS{-}f3em_I-J_H_&3XWver9lUz>@*4yEvx6V%TAt*HLVxv=W+hyZoEGq^ zh!#xGZP-w?eX2nr0t(?!%)NA$087uVVa4;5=24n0sQWy7#0o%#Ads4H5QKr4yjigm z7o{}0Szcv1ZmAT_4|hrV=tQ7N8UR%EC$c}$`y&m_)-jwBnC)#2#1=_h#5hx_Xr@A- zF-3rUEc+7Pmyt(O^?#k5gD!vl$PZRT9}>nLqsrXV{S+&RxIraEVck(gT=E13UUCHh z5GmVbcFVHSYN)g$46HFCiKPjs0z!cCVaux}~I5|I)%!+$rbApslExHNjnS1#Ia zjFT3jq81&We_+R)3Bl(zW0T;RwTdqH;$=;A~nc!AR%1ykZ_nLN*J8U zn+FPraYwdu+<&IwD>yodJb8P@QAda|LX6RzPkZnOC>YhKiGVTrxTMiNjc*zKLRwtH z18za}fVT{;$l8~bAPh#wkQk#?nKheSZs0TEz${=)X@Mkw2@H!Q=hk3r6?A?QmcbW1kMd>lrwC;ZI4A%(25ja4bZzO+ ztkbiD6YTcvVBhY@VG;$Cs8^Fu``>d)!)Fz3IT6}&guG&ze!`^|4_HH5v4Eq@;TkvWNFU0Gf;d@YnHC$vhD0=+p!FcqtOt>BcKErcZEsNSkrP`z z(@#&OpmF-jC0GYZVy~swQJ(u8#GNu);t4H4V2S8myxKO>GrwsIx4LwB3X)KPCkUQY z;3v`&8NGQZX}SP%cYGE9Yg-7hDnMqdK_DE05Pz;FADB?i1zAuWA{ZM|6#R6_C7wqf z)@Q7203bYd6)4p~I0-}toE3$+($Xh2pNC`G4X+1${0~PS$A_*s+bqu_wz`fCJ+B3U zey=NWj>lEUcOF8n}2GHaHoWjBJ| z2(qw(4Mr9tS1wXxvVruS|KJvc6 zq6_{=luRtj^>X5~Fqw-3GBAb>XuFy(ihra=o%XQ=C3iAkC<$tEvdWmDq)kL_h&@0g z97=U4FUuIuhDC8JH7iN0*=Z-k5}HYUE8R+i2D)ypq^w>F1Oku(R51w*m~h|-2$=wE z2S>qC6HTtdZhLnhWtC8Wq08~=KwhmS zG#{5at=9f1`YEMR3_BB#5qEZTTh)DpN5sYvEqyjJz zQiyICL3_cR&M=${1W+L3C|%A_uqp1XHj-(fCZ1!)m@_k4+FqvA20b1KD5c}6GAiwXU)H^JV7_eKE~dvh9vy(b|tIt^Y4 zUz83m{{B%&pw1hBfQ?Y6@U5fUa4kCGw$Rq>)2oOZH$XK|ZUYR%ig*}SyKmwkT+4Ui z0{#B&6tyCT50v^)r^Nvp0DnS)$Sgm`&q6`t`f2pj^i55z>4eX#`YW^CuSEp}61Gp?EMQK>IbfV!?e~ z`@*l-68`CuYWxA9fco&LDF*a%ncdIhg5n8)p2+AH(KQea;O2FjAb(pkX-u>xvb72o znAtG~6+5*e25@GySc8kKNVxAO+5kW_YQWqJgHQ*vQw4`qaFk)`Z`(9$)Z!w^1&^Z2 zGpV!zzU};){ghwPiE%-ZSIt7DAGgtd+!u(s@F9lq;rd}8fh54d*tBDY_ndSCAhYbg!e)+heLC0U~Ohjjb zohP66_am+tp;yIHj3TKRiREfhv^qE>Ly#Kl*@Bw6D}!<|PO|leIqKN4`CB~Cu9Db$ zY#M^rQGc73u-K82u+Xr3LxXe;)>6|iKJ7=0uCbVdLJ!LjD`15gb(nDmc=xOvU z=gHh!Zp&b(X*Wc+7f#yaG+sRxNg)X?$W0T)qKTr?< zV5{>{0!9OFt82+T7ciUh4O(xjBdPRMS1>aFVvpZZ(^LccDqYnTsmy1ja&zg+ASG|q z_4xYgW(Y(9L(fQ3uRZ}WH7rk;^LFBJ1D1DU$@$(LR4NG6;Lq~nNGOSB&U$t zaT{j0%CP0i^zI&?y8mLoL5#NZz|WW*92Jky*6-nJ=9e4>5in#<1ja_uhiJX1of4TC zp{HU*#~1I+hOX=lsqu(T1UgNaVgPDpnSU|4iF>^hVY#Og%PLzy zC>wVev6s4Z!NyapQUrvKafcy!sn88S#P?BR2C?+g%>WKD;Rv&|o{`gEQQ{_OBY(SR z3Yr=V00ZrKt^`a*Gtceq>aclg-HGbX$tZN6eEK#DQ&Tu;WzwfGZVEZf(o@34ul|?~ z>CD29LfL?Pe#xM;!-dg3s2EcgYRNX~%__UhRBi*NmpHhKy){#J4B}B15MC5{Y;98jg%fOQ~Q=WKa0>6L+3!*C$q<+MO z17MLFV(AC0e6{dL6L+S0sNHe@yQ8pl^UFur5)To@*m}0 z7U^YQL&xUHzl^$`CKds+OzwJ`@G%NA6b;EZ9rI-dqA*Se2xE%`Eys5v=Co&~-!Td~ zn1;uugu}-vk?@IvKl$5sm4C!zh(8RFDf@hS88yX9Dp$H58X3N&nt@wha~%clnU-oe zpY~rxG8l!qJ0cm3A_i@QuXHe%_`n*&HGneA60Yu$u`_Ru962T0C@0k+Fg5477Bqo=W)*GB*<*B_(AA=4+i2kuItW?z zhk=;94$otDkhIs1oPXuyMKm=GNKzyZ$xX#Ba_B62pSIg5RWr** z>8aJ$OZVA-anR&?t5RIQb2y%)-WBvvgHGFovV*L1YhM!DtZzxoH9=K(kU@gE{*E`@K5q9_e?IiK)O1 z$#Mz{Goc~isDJ7(c!FVJrZG&E?_tJ-sD6a@?ge?Td>9C4@-f-)gjjUJ*e*JAPO&ME zk6=xC94;@(R5_m!ZVaZ1>0Qh{V?!e|1{;0UGLY+FR9 z@roh^f{nGpxFr>;(t`coU%M+0~C>4lUp)juZBu$$Cu}2|Qmt{%16oEjHWL3e=&0ZK;jUb@X+B&kl|?knooWsH6)rVjgE- z>qzGEJ@z7^*W|h(`=p*}QZuF+=^Z?ovu|=o&3~q9q;}L`S4p#L8e>OJqBSES?zc-c z3H-d7p4KE{Pwb1zua!{QJnEIKU<>L{tEA|jxp*oG(V2ax!lJiDEq>Q|4l#cB8fYhH z9&OZ$m4y%lVI8NBgzXCUotU4*zy6*kz+;QYHE2PFG;RyRpruDoTqP;PGEMfsKXO+O z_E=*nGIDhRp_ES5F$8QQN=%S2E?MQm<{m5n~SrEf<7R9Doqrfa~~E~#q56A znP{B_bXt{&sn=-8Y=N$?)8w+ zGrber*i{r7kCzY6g5>SZ6v*@VmU07~O|VSq8ru=k4oJg6bm622{fR&gqFMFCaop?0 zmKh1gqrtXV$n3HncpBI~s-|{IueLWgwF#|>Ga~w;UW<(7AoR4L%aD#*IWm@`P=D1` zjgm#fr&Z-uHRWCeROU>gjhPR8MN1kGMc-^guuu?zf+@)yg&x@O>AOhJo^(|<6#L2J z+6>=U?U;;x=D~;i&0S62v_n>|Xf&bXPW+Wo#imX4uIhwFQ{0S4J6Ib6_98p z2Zeo;#j}W799%Z7uV9nhk!FMgR)6+=VcHacxlAAdJMP}_TRF}9H`=PoH+!~fb>&fR z`Q|9Bv^)s6%)_FGfTEilOO2%S$0)vyMUL)Y(~RX3@@V}67^IT}8dNnLI_xknd;vuV z%{=M?3IQl01=tuP(O^tIP+l>S2P&>;oTmYnDAkJvD9T>UGd9^i<1W# zRsk`yUKt$$e@n8)`T}p(v7J$37wt{fSU-R@tld`N4YbqBuwMez|CCdoYm#8$t2r8c`irLwM zONXc42tyjLJYqm26*L)I4V#_f*y_Tm7G{0H+KAlAe@f{=;U|{uCO@Z(3?w*~y^j@k z8eMtNmS9^^jfa)`=QX>lQvcfen#KOv8k^<*Kfta7{Q+nm=(0$TInjr4V|9egF8ybV zbJ&@%&Wx6G`d)R`P4&#Je!a@>n;`0@ec68ExOdD+%I#WrFOQnTtuFEeer$lLPCbTk zt+tYCe_RPf)>R^%8U4BbregM=_P>p+ylTF~wHjlx{GJRZa7#TMq}XtjW?+FEF%xJz z+^mFNMOKgO^7X}6Uz?#yJS_wM|Hn37;7cGoKhg*I6`bgIt)KeEcvdP$$~#NdxLd6wq|Yq$RR z^ZiX}uy#?9c?VvbO!oaz%M}TldJtA*M^gi2F`WxqB`LRHt!ZU*E2P<39TK+!O+`Bs|f%<%kQyrIS-fg9$0L{Ln=Wk_(rRa zfR}&pKv~@a31ZxR-BoJaGdoBHVJLlGQyVdp3Iea_RPJ!D8qC7|byAy%#7#g8e-=e! zWC#ecoS7~~dQ^iF);I&h3FGIae zm!^~HSk`T8v{ba%!6gu3q7WI@G9bfK2%nKYo{BAEEUK%@R6eQ4<`Yd4tkA=vHG~BW z2}g_jsI5v*@`7j(i3YJ!?>L3>Nvn3^y~R+ZQg@D_nj*TV(bI|TL?lnG4nbjMSu%~= zRsGI84~|MSRz`kdn;D#)J`Ak|F_~{{~xj{n~ybaLz*0SoDwPJ|8aX&a^OQhSjsMFczQzb2w$N zFRvKXu3s8}wqYny?Luu0}4?Y$1m;>WEo1XD&ftH+s& z7rjpkMX0W@aP+)9k8xP=O~&6rpU?y!hiyOljlef_i>@g_cm}fC_4lrovgVOxE#?g49?$25g#W-b9V}!%l<~ zlXLqEoNbhMe<v&M^8}4R3IbPabW&ih%vroy0fk53$QIew z;WUslELqi}f8te13iLm=Kz#QDA*`}^F=NpnCKm=K1N<&%ZY+Ng8l&Yv3=Kk5OaKm@ z3yfiEK&>C3F#yN&rHbg|fTyQy8-&5HbqDy<(`s!Qs>|(~yAxhNUZB78C!kua+TRPa z?3Wk-2dyTfM)f3R?=t1xh5#SYHVB)vdzTK~l^9CS44QMii6nZ@zw>4IJbQt_NMBmB zt)0AD4bdE}NiBbe-g!8>ocC6&?F7Ix2K@t7&Bz~7wLtasG%kuXR7$H8S-f6!c7=Xu zH(h_Xpz-Q-wLV`ihBGZEGWWbV(dsiH_nvwksGDg-_C2V@G`}pfTUsb;dJsqpB>~Vr zuUI7;_^?%do4NiO%x2n05NPq}Zx3i{H`029@}^%f|8##_ysZp?uQAK=1HFnL_rpM7 zSPGlRKPj3_nXd8q{q)`W<#Y0vBcUV-i#5LI?|%OsuK>&`;eUlJpTdTB$W{cHV}zd! z5?_vIhbPYtkL$QqtM74DpdlLr{4bw&->u?Q{Q@dyme=;|5GvVmyBY&&-LL_qbCu38 zLC`vzVM2e4-qk)-y2&Db;BA_L{zsjhpZ%ZzS+-DdyT`MW!)LF*W4%TcaS#6>5%;hz ztKV|#+3Y6YUeSElALGI{-Un573-KKnW&W83RJ=G#uJ{k`>(=i8_&sR&Hf$I*K*xXE z;B&fR&N_w~FY>rp(%ZPpqz_YYeW-h^K#+FJZ=`>LfvMWO?PjFqYBk^WF062jxA*+! z)!xU-VVa0I!rrT)Y@h#-0T}Bbil6OI#Yg>| zLZi<=P2b3Sg+70LPToH!+mA3!;=hCEWXk_6`G26mQU2>f${ZcL{pIK@zTy~9loKUf6{cJ@E@&pzJv(?+tp>p7Gp+R%ztxP3-m}`s z!h34sWP`4c@PA31>B?=&+@*oW z^seN+6=O%^xrf*nG8TV!7pE&q^Vu?{DK+TmcutRIZ2A{>L?a=l5`SzePI zBolvhh}o?k8Pej7?`?lcvu+lcq2VSWL+EXS=^cjBX3-nn^B->23v>KiyKV@xsO`i6 z*09Nw^}$>i6vNa5{pv2AK5=7^Bv7K2G$y?Pe$OScW0rite_QVR=b|2Y_4heDxoC^3 zN*aBj*9Z+oqbBHz?0p`D8$L*Q9}J^c$a;U&CQ759%93ReP|?G*hsoiK?WI0J*n-T@ z;1A7D;m`Qz=q5Jjlm_Cq$u@Kwcbsx+l()rU^BdJ?-BrXH*GugYaJmz`9R%8ile}=J zu7})*dUty)xXa1X+gsmZsoi*+7g+=VKg{ZZlr8p&p5J35bbd(->d}mAy@HX(F{gid zRtSBw3wj*`ah~yNrc${JcI`U5Tb}xN=^Y5i$>Q}EwpL!q!Gt=6P}*h1byz`?e$ukl z-!Coe%+2KZ2TUaynbFsQR{XsmS7)1Wn#{}3m#lCg+mYYB471JDzTRNo2TJ#OGM?Rl z(!r|7V$SMR;XDFdK9lO8efQF`l}vvVIBOfWsn76|@*dH@?6BXnZR)X^+FreZDu4%} zTh(#+@dD$2lXSL@A7;gdVkCQ#UendW!Nf*0z&9Zr&l>Mg8aEki0;W8ss^D0N{#pe> zDsOpLM$u(7y;a%faT@UiwaEEzUxpn5Oyr+iX%=d0GzeEgvt$DInzb6x3=Dte9e7{| zhwg@**mj3VDBs3t@{85B(5Pc?tB?@nehV`RH3@WqyQOsu{cS?cqjNc%4yIMfqaB5a z?L5|bfVLInnCs{SYshm<{SCI(j&)v!OwFM4V$OqJ$?!76 z#BzDn)kjwBtS8kUEt|Es@o)#(tgWJWxbKK9Q1TmHj1{{(hR?`5sMa9)>tC~cvCLNM zK5_D0C|?NTo}u#Qxri6QHD+bT%UP|k)YqR}OB*zF2QWQs*S#j%VBSY(>52B$Ox5qe zjPf|m=F5237DEHgc(%eG?CE13UtcHlx3I=%|NQWz+{lYs|0KNDC_zPbc6D=GXBz|c zO$T&0mk3ih*}s!;CuVt zIKN?WUBT`!V_=n!hb1j>$494#4ciYB+K0Jg*zi?+na>yZ|3yTOV$%PP$@wEl0TK{vjzxTz;n7ff_R)dY%V zOgE1MO}im#Q*T4w2pUtHy)Ms6yj`%&W)I;r;Z8RRv*qr9@b|Xmc4h;^;voOPGEH66 z39Hc4Y?QpWQ6GOsL8y83mMi8_l5(VP4LX)3 z3o5@DqP2FeMHYnFspgKF`|^hbKm_Y1ead(BR#AqP?=mzMytD2FL&vVX$#?^bzFSC-$YgQIFzHuVlc2b%Y&| zvzvuooNIr0vV0@99(m=anjA!0^e|@#k;&vy&_><0Ped;1P5Aa(n_ggX}8pmCPM z?@k!G{OS-^I9B;p%OL6S%y!Erth-NlN#dU%3<2p@0r4dOoTG+Hm#MxDKsB72I~< z(DG&SiSPP%*~p${BM<&vHu6g@8`&Z9Vhn|+R|rN|WoUrZ+of#qXj1Q?&*#&*J|DC9 z=a0HsB+SlXUvCo{b-T#!Q@mZKPu7Cjw;_LJfn8ry3I09rztP2c?-eRdRTDxZ!%>fj zuL_|{q;b-v=rt_-CHCuP*=id0fZC4UI40LWW28B^j$t=h{Pj|Z@-`#!<-v6i&3;y0 zCEERR)@GqT)ap3K4Xy2pfJw%zY;f&{MZ6|AOmoAk!+6beAL?RtZXho@F`prW$$Ec8 z277^cErDD_`~H6S)_$yJpS0j(LAo1u7hbi)J|us zbers+I+C&)EnQtimnMAu%w08q#bC?blN69@{}eV~W(ZzL#0T#z!oApCt9^)Ay?+B8 z8yG~r%gPGv22zt<{JgnO(nTN*bX$LHz5t=8e>t$H5PHV1X7Z$@wSQ=G|I)Qj;Jgow zO7c0T^}-~!PdRW|{7&j-;QvkqlzQcHp2z=A3jCv!0`~YjljX z>U@KT6J3u`t9{?;3uA+Lit}s*5I-(+O3$#=N?6a@{YstW8^_&3KIvw9dij6mJZwyE zp{}<;(5pPg2)5GQ7RTslQ+>h!%N+((ii6R`s$+Dq3_8QIF1sjfBV}FgMw9LmBsRV} z?FbM%KL60ojv|YnEQ6TiJS$R&19S22Ic1vmVH@gRaS!bOZe%$=xAPy!`eB+wtkmwlipMGuWy zF@eIM5p1Whl}n}9Xkn$tDhfR;_S^xZ9%QZ|-4?W%#cOSqgYcN$R3(;1@h8+C0^-1R zmaj1b>I7&a5R0>a@PALf4Z!0~$E@N;HpWPoK}R5#UpF;&0pv3;?H zzm|`SJS$3!$(`kt`2&BD72-i^4E-D;3wOfVH&5z)b_p7H8);_JAMk+Ww<_t_I1|c9 z8Z1k4XhssU8=`Y#n?A9Q5h#PJQa8uYJat{_=FzybE&aFnj^p?UzrnY&yJNfye4eB% zSAQ>#aFIRn&2%H(OJ~}#F;oIKCmTs{bWGi5p_McJXS@nD;F^D0OIV+sl>2$&OAv#u zI~XYeyE9oBDFNHubSfezIHnLc<@>`o`R(B)aN7LagAVqvzS+gQy3ixkcftVQ@|&=L zy=b1YgrOf*KfxxcU3SRY8`G zj{g|erU6S~0W^P1Pwlgg)ZqgwdKVaX^RCEB&?MHOcPbpG@#?Wi3Tc@a#-XszEP}gC z)W_0*1#6naE&&-*n|PEUIgp5S!f&@BipjO$!ddZG4*) zv$B9a6z8?z>`|3DAGSeuo|^XGNu2WJC4_Yjt%)=^+_X8ww4mjz_*Y)eaKs%QDvrJm zw+g@OumpdhxWh$hw`;<8+b7#gg8}U91ly2wo1UZJ8zMb+Rfk+nxugxWYpU~`qY2S829!M>yA6S5L+nybrfK;=504} z%5EZW2g@lYV_VSc7|zcu76y|U&GSr^of~2yYJ?nCd}$O}zmtu3R9WAl0&17O^i}_i z>t6h-pELCm32uvOJq}|I!9K+5?BLL>8riiBq6#Q|Hb60K#5IOuXvU7WSG%uQx$hNk z-Uok?tJEtE&suFr5uUB^65UzxxQ6e@OsDUXd1wl=dwgCahiBC_o4ISW zCLn`ycaSIp_jM16a?HC~hDUDnbI-QMXarc#-lcaS5+;k+TR@)|Ph&UpB6YENQ7)uQ zK8mxeD=+0HTWr(p&QELyUcyvI(oSW=?p}WyRB?ao%Y=H>-wz6f2XbD-Y4Uekf{I^& z`ifC(Njewa_QODLd#LgiYTofshjVs~we4>UkI?jz0S?&dcXP$Iu}k6WcYA~ngaPne z@8LrD3moTcTfEKk^>)Rkk}-klX}Gm)%~DiVfN8hl#d>Fd?cx>_aM)N!jpGbFaXWvC z<7}fSH!*;IqS!GF*U-Q**r*`+LQs_r*qwcS`{also&RfLWqtcT3$s0duICE=bg5?u(lklt}#> zMm8PWNc3^{GYD3NVJ=4w%Wpp`d_c*X3e{)KHJ8c zJCsRKcY_B;wDEv)RZz!i-tC#j=Z4)ehi@3+2wagd2#1vbku8$z$JwI91jboel-Z^* zvvPPClvWw}@**tL!2!9Rq2qu)nt!hs5gW&&w@bmgw`pmRU~O`L6rr>%K%swBfizW? z*%{0WOd(|vtiJ^sDNTTCdw4*OZZ!{_(;ZmN51TAqv#nM_Y=GIz0mrg|x$~031%Bq( zVYUL~{21UjOVptrB?8$8ykkW2G02VaP3O|F%(SpcSgjq*Gwo}gsDbd?DA)(%mFnm( zo2{_OluND-x8k^9c|~SzASr+7N^XB@Pll@j?8s%$UZ0<2t5t$wyK(`$oC|+{mrb~P zW&9CBN`}_S@2@Wms>w4%Q5dmCPhcM8Z%@Q>O>{%K?s(a%Pjb&!s7~W|bM#g2hC4u> zpaxUd2>hI-8_llsY(0Aj=gi}X&|RvpjVwZ&XP`M_ENsKv#d#V7Ck%g|#8KnYp330W z#ilSTnOmm|FRgV`EY!ZqUJ7gVgJ{Y3ta5h?@)qE38tXt)OD+^uc)Fdej^}XPnq^NO z7#2jQI@sEVnz4JC+IDB)9>=${!*gGE^RV(M3_Yk+^VL?70Jj6X@dK^^miP!C*k%WI z<0dMS`pqw6Bz!es>Mnn;S%Qr}$U%}sd%n#0KjLggL;309+diP(9x^j+)AW; z>D>FSn*QbJtNNfSAzL)J@4@tMh~K|9koN=MB;^18by#`PfSJ}V4A6#LyEZ`0RqYK6 z74SFbW(p0mW?id=3shkT6##jSX44cJU0wHI`q%0izX!86%u&!bt>H6y0jEP*K=E=5 zdhR@6(@CKS8!*M!EWEYF2 zfyCL2*pq?@0tj1O@3=I6j?ikHnLX@C%01zECi`Y%SEM7pqw@ObZcauyj3K23L3!=2 zD)&~c3~WQAb@4`6l}nldKgO7x%4+COV0Wjqb`1+{Mh_q7AAs+))qgYudKSy~{=76lXC*xm(6Ej2knWgdnlg780+7Or=MHioT z-$IW79sg~EZ;2SAM;q_H^kFzz6>)y#=HV`5Tnb~z3)ji_ZySbkHy5F_r zlYTiG2W%fk0$;-alb< -Overview · Trixi.jl

Overview of the structure of Trixi.jl

Trixi.jl is designed as a library of components for discretizations of hyperbolic conservation laws. Thus, it is not a monolithic PDE solver that is configured at runtime via parameter files, as it is often found in classical numerical simulation codes. Instead, each simulation is configured by pure Julia code. Many examples of such simulation setups, called elixirs in Trixi.jl, are provided in the examples/ folder.

Trixi.jl uses the method of lines, i.e., the full space-time discretization is separated into two steps; the spatial semidiscretization is performed at first and the resulting ODE system is solved numerically using a suitable time integration method. Thus, the main ingredients of an elixir designed to solve a PDE numerically are the spatial semidiscretization and the time integration scheme.

Semidiscretizations

Semidiscretizations are high-level descriptions of spatial discretizations specialized for certain PDEs. Trixi.jl's main focus is on hyperbolic conservation laws represented in a SemidiscretizationHyperbolic. Such semidiscretizations are usually named semi in Trixi.jl

semidiscretization_overview

The basic building blocks of a semidiscretization are

  • a mesh describing the geometry of the domain
  • a set of equations describing the physical model
  • a solver describing the numerical approach

In addition, a semidiscretization bundles initial and boundary conditions, and possible source terms. These different ingredients of a semidiscretization can be configured individually and combined together. When a semidiscretization is constructed, it will create an internal cache, i.e., a collection of setup-specific data structures, that is usually passed to all lower level functions.

Due to Trixi.jl's modular nature using Julia's multiple dispatch features, new ingredients can be created specifically for a certain combination of other ingredients. For example, a new mesh type can be created and implemented at first only for a specific solver. Thus, there is no need to consider all possible combinations of meshes, equations, and solvers when implementing new features. This allows rapid prototyping of new ideas and is one of the main design goals behind Trixi.jl. Below is a brief overview of the availability of different features on different mesh types.

FeatureTreeMeshStructuredMeshUnstructuredMesh2DP4estMeshDGMultiMeshFurther reading
Spatial dimension1D, 2D, 3D1D, 2D, 3D2D2D, 3D1D, 2D, 3D
CoordinatesCartesiancurvilinearcurvilinearcurvilinearcurvilinear
Connectivityh-nonconformingconformingconformingh-nonconformingconforming
Element typeline, square, cubeline, quadᵃ, hexᵃquadᵃquadᵃ, hexᵃsimplex, quadᵃ, hexᵃ
Adaptive mesh refinementAMRCallback
Solver typeDGSEMDGSEMDGSEMDGSEMDGMulti
Domainhypercubemapped hypercubearbitraryarbitraryarbitrary
Weak formVolumeIntegralWeakForm
Flux differencingVolumeIntegralFluxDifferencing
Shock capturingVolumeIntegralShockCapturingHG
Nonconservative equationse.g., GLM MHD or shallow water equations
Parabolic termse.g., CompressibleNavierStokesDiffusion2D

ᵃ: quad = quadrilateral, hex = hexahedron

Time integration methods

Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, a spatial semidiscretization can be wrapped in an ODE problem using semidiscretize, which returns an ODEProblem. This ODEProblem is a wrapper of Trixi.rhs!(du_ode, u_ode, semi, t), which gets called in ODE solvers. Further information can be found in the section on time integration methods.

Next steps

We explicitly encourage people interested in Trixi.jl to have a look at the examples/ bundled with Trixi.jl to get an impression of what is possible and the general look and feel of Trixi.jl. Before doing that, it is usually good to get an idea of how to visualize numerical results.

If you like learning by doing, looking at the tutorials and trying to mix your own elixirs based thereon is probably a good next step. Otherwise, you can further dig into the documentation by looking at Trixi.jl's basic building blocks.

+Overview · Trixi.jl

Overview of the structure of Trixi.jl

Trixi.jl is designed as a library of components for discretizations of hyperbolic conservation laws. Thus, it is not a monolithic PDE solver that is configured at runtime via parameter files, as it is often found in classical numerical simulation codes. Instead, each simulation is configured by pure Julia code. Many examples of such simulation setups, called elixirs in Trixi.jl, are provided in the examples/ folder.

Trixi.jl uses the method of lines, i.e., the full space-time discretization is separated into two steps; the spatial semidiscretization is performed at first and the resulting ODE system is solved numerically using a suitable time integration method. Thus, the main ingredients of an elixir designed to solve a PDE numerically are the spatial semidiscretization and the time integration scheme.

Semidiscretizations

Semidiscretizations are high-level descriptions of spatial discretizations specialized for certain PDEs. Trixi.jl's main focus is on hyperbolic conservation laws represented in a SemidiscretizationHyperbolic. Such semidiscretizations are usually named semi in Trixi.jl

semidiscretization_overview

The basic building blocks of a semidiscretization are

  • a mesh describing the geometry of the domain
  • a set of equations describing the physical model
  • a solver describing the numerical approach

In addition, a semidiscretization bundles initial and boundary conditions, and possible source terms. These different ingredients of a semidiscretization can be configured individually and combined together. When a semidiscretization is constructed, it will create an internal cache, i.e., a collection of setup-specific data structures, that is usually passed to all lower level functions.

Due to Trixi.jl's modular nature using Julia's multiple dispatch features, new ingredients can be created specifically for a certain combination of other ingredients. For example, a new mesh type can be created and implemented at first only for a specific solver. Thus, there is no need to consider all possible combinations of meshes, equations, and solvers when implementing new features. This allows rapid prototyping of new ideas and is one of the main design goals behind Trixi.jl. Below is a brief overview of the availability of different features on different mesh types.

FeatureTreeMeshStructuredMeshUnstructuredMesh2DP4estMeshDGMultiMeshFurther reading
Spatial dimension1D, 2D, 3D1D, 2D, 3D2D2D, 3D1D, 2D, 3D
CoordinatesCartesiancurvilinearcurvilinearcurvilinearcurvilinear
Connectivityh-nonconformingconformingconformingh-nonconformingconforming
Element typeline, square, cubeline, quadᵃ, hexᵃquadᵃquadᵃ, hexᵃsimplex, quadᵃ, hexᵃ
Adaptive mesh refinementAMRCallback
Solver typeDGSEMDGSEMDGSEMDGSEMDGMulti
Domainhypercubemapped hypercubearbitraryarbitraryarbitrary
Weak formVolumeIntegralWeakForm
Flux differencingVolumeIntegralFluxDifferencing
Shock capturingVolumeIntegralShockCapturingHG
Nonconservative equationse.g., GLM MHD or shallow water equations
Parabolic termse.g., CompressibleNavierStokesDiffusion2D

ᵃ: quad = quadrilateral, hex = hexahedron

Time integration methods

Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, a spatial semidiscretization can be wrapped in an ODE problem using semidiscretize, which returns an ODEProblem. This ODEProblem is a wrapper of Trixi.rhs!(du_ode, u_ode, semi, t), which gets called in ODE solvers. Further information can be found in the section on time integration methods.

Next steps

We explicitly encourage people interested in Trixi.jl to have a look at the examples/ bundled with Trixi.jl to get an impression of what is possible and the general look and feel of Trixi.jl. Before doing that, it is usually good to get an idea of how to visualize numerical results.

If you like learning by doing, looking at the tutorials and trying to mix your own elixirs based thereon is probably a good next step. Otherwise, you can further dig into the documentation by looking at Trixi.jl's basic building blocks.

diff --git a/previews/PR1624/parallelization/index.html b/previews/PR1624/parallelization/index.html index 25be1444d85..04a30141b1e 100644 --- a/previews/PR1624/parallelization/index.html +++ b/previews/PR1624/parallelization/index.html @@ -44,4 +44,4 @@ UUID("f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"), # UUID of HDF5.jl "libhdf5" => "/path/to/your/libhdf5.so", "libhdf5_hl" => "/path/to/your/libhdf5_hl.so", force = true)

Alternatively, with HDF5.jl v0.17.1 or higher you can use

julia> using HDF5
-julia> HDF5.API.set_libraries!("/path/to/your/libhdf5.so", "/path/to/your/libhdf5_hl.so")

For more information see also the documentation of HDF5.jl. In total, you should have a file called LocalPreferences.toml in the project directory that contains a section [MPIPreferences], a section [HDF5] with entries libhdf5 and libhdf5_hl, a section [P4est] with the entry libp4est as well as a section [T8code] with the entries libt8, libp4est and libsc. If you use HDF5.jl v0.16 or older, instead of setting the preferences for HDF5.jl, you need to set the environment variable JULIA_HDF5_PATH to the path, where the HDF5 binaries are located and then call ]build HDF5 from Julia.

If HDF5 is not MPI-enabled, Trixi.jl will fall back on a less efficient I/O mechanism. In that case, all disk I/O is performed only on rank zero and data is distributed to/gathered from the other ranks using regular MPI communication.

+julia> HDF5.API.set_libraries!("/path/to/your/libhdf5.so", "/path/to/your/libhdf5_hl.so")

For more information see also the documentation of HDF5.jl. In total, you should have a file called LocalPreferences.toml in the project directory that contains a section [MPIPreferences], a section [HDF5] with entries libhdf5 and libhdf5_hl, a section [P4est] with the entry libp4est as well as a section [T8code] with the entries libt8, libp4est and libsc. If you use HDF5.jl v0.16 or older, instead of setting the preferences for HDF5.jl, you need to set the environment variable JULIA_HDF5_PATH to the path, where the HDF5 binaries are located and then call ]build HDF5 from Julia.

If HDF5 is not MPI-enabled, Trixi.jl will fall back on a less efficient I/O mechanism. In that case, all disk I/O is performed only on rank zero and data is distributed to/gathered from the other ranks using regular MPI communication.

diff --git a/previews/PR1624/performance/index.html b/previews/PR1624/performance/index.html index b4787cb3e75..8ed3ad65095 100644 --- a/previews/PR1624/performance/index.html +++ b/previews/PR1624/performance/index.html @@ -52,4 +52,4 @@ BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`, id="main") # baseline ) -julia> export_markdown(pkgdir(Trixi, "benchmark", "results.md"), results)

By default, the target is the current state of the repository. Remember that you need to be in a clean state (commit or stash your changes) to run this successfully. You can also run this comparison and an additional one using two threads via

julia> include("benchmark/run_benchmarks.jl")

Then, markdown files including the results are saved in benchmark/. This example result was obtained using a GitHub action for the PR #535. Note that GitHub actions run on in the cloud in a virtual machine. Hence, we do not really have control over it and performance results must be taken with a grain of salt. Nevertheless, significant runtime differences and differences of memory allocations should be robust indicators of performance changes.

Runtime performance vs. latency aka using @nospecialize selectively

Usually, Julia will compile specialized versions of each method, using as much information from the types of function arguments as possible (based on some heuristics). The compiler will generate code that is as efficient as comparable code written in a low-level language such as C or Fortran. However, there are cases where the runtime performance does not really matter but the time needed to compile specializations becomes significant. This is related to latency or the time-to-first-plot problem, well-known in the Julia community. In such a case, it can be useful to remove some burden from the compiler by avoiding specialization on every possible argument types using the macro @nospecialize. A prime example of such a case is pretty printing of structs in the Julia REPL, see the associated PR for further discussions.

As a rule of thumb:

  • Do not use @nospecialize in performance-critical parts, in particular not for methods involved in computing Trixi.rhs!.
  • Consider using @nospecialize for methods like custom implementations of Base.show.

Performance metrics of the AnalysisCallback

The AnalysisCallback computes two performance indicators that you can use to evaluate the serial and parallel performance of Trixi.jl. They represent measured run times that are normalized by the number of rhs! evaluations and the number of degrees of freedom of the problem setup. The normalization ensures that we can compare different measurements for each type of indicator independent of the number of time steps or mesh size. All indicators have in common that they are still in units of time, thus lower is better for each of them.

Here, the term "degrees of freedom" (DOFs) refers to the number of independent state vectors that are used to represent the numerical solution. For example, if you use a DGSEM-type scheme in 2D on a mesh with 8 elements and with 5-by-5 Gauss-Lobatto nodes in each element (i.e., a polynomial degree of 4), the total number of DOFs would be

\[n_\text{DOFs,DGSEM} = \{\text{number of elements}\} \cdot \{\text{number of nodes per element}\} = 8 \cdot (5 \cdot 5) = 200.\]

In contrast, for a finite volume-type scheme on a mesh with 8 elements, the total number of DOFs would be (independent of the number of spatial dimensions)

\[n_\text{DOFs,FV} = \{\text{number of elements}\} = 8,\]

since for standard finite volume methods you store a single state vector in each element. Note that we specifically count the number of state vectors and not the number of state variables for the DOFs. That is, in the previous example $n_\text{DOFs,FV}$ is equal to 8 independent of whether this is a compressible Euler setup with 5 state variables or a linear scalar advection setup with one state variable.

For each indicator, the measurements are always since the last invocation of the AnalysisCallback. That is, if the analysis callback is called multiple times, the indicators are repeatedly computed and can thus also be used to track the performance over the course of a longer simulation, e.g., to analyze setups with varying performance characteristics. Note that the time spent in the AnalysisCallback itself is always excluded, i.e., the performance measurements are not distorted by potentially expensive solution analysis computations. All other parts of a Trixi.jl simulation are included, however, thus make sure that you disable everything you do not want to be measured (such as I/O callbacks, visualization etc.).

Performance indicators and adaptive mesh refinement

Currently it is not possible to compute meaningful performance indicators for a simulation with arbitrary adaptive mesh refinement, since this would require to explicitly keep track of the number of DOF updates due to the mesh size changing repeatedly. The only way to do this at the moment is by setting the analysis interval to the same value as the AMR interval.

Local, rhs!-only indicator

The local, rhs!-only indicator is computed as

\[\text{time/DOF/rhs!} = \frac{t_\text{\texttt{rhs!}}}{n_\text{DOFs,local} \cdot n_\text{calls,\texttt{rhs!}}},\]

where $t_\text{\texttt{rhs!}}$ is the accumulated time spent in rhs!, $n_\text{DOFs,local}$ is the local number of DOFs (i.e., on the current MPI rank; if doing a serial run, you can just think of this as the number of DOFs), and $n_\text{calls,\texttt{rhs!}}$ is the number of times the rhs! function has been evaluated. Note that for this indicator, we measure only the time spent in rhs!, i.e., by definition all computations outside of rhs! - specifically all other callbacks and the time integration method - are not taken into account.

The local, rhs!-only indicator is usually most useful if you do serial measurements and are interested in the performance of the implementation of your core numerical methods (e.g., when doing performance tuning).

Performance index (PID)

The performance index (PID) is computed as

\[\text{PID} = \frac{t_\text{wall} \cdot n_\text{ranks,MPI}}{n_\text{DOFs,global} \cdot n_\text{calls,\texttt{rhs!}}},\]

where $t_\text{wall}$ is the walltime since the last call to the AnalysisCallback, $n_\text{ranks,MPI}$ is the number of MPI ranks used, $n_\text{DOFs,global}$ is the global number of DOFs (i.e., the sum of DOFs over all MPI ranks; if doing a serial run, you can just think of this as the number of DOFs), and $n_\text{calls,\texttt{rhs!}}$ is the number of times the rhs! function has been evaluated since the last call to the AnalysisCallback. The PID measures everything except the time spent in the AnalysisCallback itself - specifically, all other callbacks and the time integration method itself are included.

The PID is usually most useful if you would like to compare the parallel performance of your code to its serial performance. Specifically, it allows you to evaluate the parallelization overhead of your code by giving you a measure of the resources that are necessary to solve a given simulation setup. In a sense, it mimics the "core hours" metric that is often used by supercomputer centers to measure how many resources a particular compute job requires. It can thus be seen as a proxy for "energy used" and, as an extension, "monetary cost".

Initialization overhead in measurements

When using one of the integration schemes from OrdinaryDiffEq.jl, their implementation will initialize some OrdinaryDiffEq.jl-specific information during the first time step. Among other things, one additional call to rhs! is performed. Therefore, make sure that for performance measurements using the PID either the number of timesteps or the workload per rhs! call is large enough to make the initialization overhead negligible. Note that the extra call to rhs! is properly accounted for in both the number of calls and the measured time, so you do not need to worry about it being expensive. If you want a perfect timing result, you need to set the analysis interval such that the AnalysisCallback is invoked at least once during the course of the simulation and discard the first PID value.

Performance issues with multi-threaded reductions

False sharing is a known performance issue for systems with distributed caches. It also occurred for the implementation of a thread parallel bounds checking routine for the subcell IDP limiting in PR #1736. After some testing and discussion, it turned out that initializing a vector of length n * Threads.nthreads() and only using every n-th entry instead of a vector of length Threads.nthreads() fixes the problem. Since there are no processors with caches over 128B, we use n = 128B / size(uEltype). Now, the bounds checking routine of the IDP limiting scales as hoped.

+julia> export_markdown(pkgdir(Trixi, "benchmark", "results.md"), results)

By default, the target is the current state of the repository. Remember that you need to be in a clean state (commit or stash your changes) to run this successfully. You can also run this comparison and an additional one using two threads via

julia> include("benchmark/run_benchmarks.jl")

Then, markdown files including the results are saved in benchmark/. This example result was obtained using a GitHub action for the PR #535. Note that GitHub actions run on in the cloud in a virtual machine. Hence, we do not really have control over it and performance results must be taken with a grain of salt. Nevertheless, significant runtime differences and differences of memory allocations should be robust indicators of performance changes.

Runtime performance vs. latency aka using @nospecialize selectively

Usually, Julia will compile specialized versions of each method, using as much information from the types of function arguments as possible (based on some heuristics). The compiler will generate code that is as efficient as comparable code written in a low-level language such as C or Fortran. However, there are cases where the runtime performance does not really matter but the time needed to compile specializations becomes significant. This is related to latency or the time-to-first-plot problem, well-known in the Julia community. In such a case, it can be useful to remove some burden from the compiler by avoiding specialization on every possible argument types using the macro @nospecialize. A prime example of such a case is pretty printing of structs in the Julia REPL, see the associated PR for further discussions.

As a rule of thumb:

  • Do not use @nospecialize in performance-critical parts, in particular not for methods involved in computing Trixi.rhs!.
  • Consider using @nospecialize for methods like custom implementations of Base.show.

Performance metrics of the AnalysisCallback

The AnalysisCallback computes two performance indicators that you can use to evaluate the serial and parallel performance of Trixi.jl. They represent measured run times that are normalized by the number of rhs! evaluations and the number of degrees of freedom of the problem setup. The normalization ensures that we can compare different measurements for each type of indicator independent of the number of time steps or mesh size. All indicators have in common that they are still in units of time, thus lower is better for each of them.

Here, the term "degrees of freedom" (DOFs) refers to the number of independent state vectors that are used to represent the numerical solution. For example, if you use a DGSEM-type scheme in 2D on a mesh with 8 elements and with 5-by-5 Gauss-Lobatto nodes in each element (i.e., a polynomial degree of 4), the total number of DOFs would be

\[n_\text{DOFs,DGSEM} = \{\text{number of elements}\} \cdot \{\text{number of nodes per element}\} = 8 \cdot (5 \cdot 5) = 200.\]

In contrast, for a finite volume-type scheme on a mesh with 8 elements, the total number of DOFs would be (independent of the number of spatial dimensions)

\[n_\text{DOFs,FV} = \{\text{number of elements}\} = 8,\]

since for standard finite volume methods you store a single state vector in each element. Note that we specifically count the number of state vectors and not the number of state variables for the DOFs. That is, in the previous example $n_\text{DOFs,FV}$ is equal to 8 independent of whether this is a compressible Euler setup with 5 state variables or a linear scalar advection setup with one state variable.

For each indicator, the measurements are always since the last invocation of the AnalysisCallback. That is, if the analysis callback is called multiple times, the indicators are repeatedly computed and can thus also be used to track the performance over the course of a longer simulation, e.g., to analyze setups with varying performance characteristics. Note that the time spent in the AnalysisCallback itself is always excluded, i.e., the performance measurements are not distorted by potentially expensive solution analysis computations. All other parts of a Trixi.jl simulation are included, however, thus make sure that you disable everything you do not want to be measured (such as I/O callbacks, visualization etc.).

Performance indicators and adaptive mesh refinement

Currently it is not possible to compute meaningful performance indicators for a simulation with arbitrary adaptive mesh refinement, since this would require to explicitly keep track of the number of DOF updates due to the mesh size changing repeatedly. The only way to do this at the moment is by setting the analysis interval to the same value as the AMR interval.

Local, rhs!-only indicator

The local, rhs!-only indicator is computed as

\[\text{time/DOF/rhs!} = \frac{t_\text{\texttt{rhs!}}}{n_\text{DOFs,local} \cdot n_\text{calls,\texttt{rhs!}}},\]

where $t_\text{\texttt{rhs!}}$ is the accumulated time spent in rhs!, $n_\text{DOFs,local}$ is the local number of DOFs (i.e., on the current MPI rank; if doing a serial run, you can just think of this as the number of DOFs), and $n_\text{calls,\texttt{rhs!}}$ is the number of times the rhs! function has been evaluated. Note that for this indicator, we measure only the time spent in rhs!, i.e., by definition all computations outside of rhs! - specifically all other callbacks and the time integration method - are not taken into account.

The local, rhs!-only indicator is usually most useful if you do serial measurements and are interested in the performance of the implementation of your core numerical methods (e.g., when doing performance tuning).

Performance index (PID)

The performance index (PID) is computed as

\[\text{PID} = \frac{t_\text{wall} \cdot n_\text{ranks,MPI}}{n_\text{DOFs,global} \cdot n_\text{calls,\texttt{rhs!}}},\]

where $t_\text{wall}$ is the walltime since the last call to the AnalysisCallback, $n_\text{ranks,MPI}$ is the number of MPI ranks used, $n_\text{DOFs,global}$ is the global number of DOFs (i.e., the sum of DOFs over all MPI ranks; if doing a serial run, you can just think of this as the number of DOFs), and $n_\text{calls,\texttt{rhs!}}$ is the number of times the rhs! function has been evaluated since the last call to the AnalysisCallback. The PID measures everything except the time spent in the AnalysisCallback itself - specifically, all other callbacks and the time integration method itself are included.

The PID is usually most useful if you would like to compare the parallel performance of your code to its serial performance. Specifically, it allows you to evaluate the parallelization overhead of your code by giving you a measure of the resources that are necessary to solve a given simulation setup. In a sense, it mimics the "core hours" metric that is often used by supercomputer centers to measure how many resources a particular compute job requires. It can thus be seen as a proxy for "energy used" and, as an extension, "monetary cost".

Initialization overhead in measurements

When using one of the integration schemes from OrdinaryDiffEq.jl, their implementation will initialize some OrdinaryDiffEq.jl-specific information during the first time step. Among other things, one additional call to rhs! is performed. Therefore, make sure that for performance measurements using the PID either the number of timesteps or the workload per rhs! call is large enough to make the initialization overhead negligible. Note that the extra call to rhs! is properly accounted for in both the number of calls and the measured time, so you do not need to worry about it being expensive. If you want a perfect timing result, you need to set the analysis interval such that the AnalysisCallback is invoked at least once during the course of the simulation and discard the first PID value.

Performance issues with multi-threaded reductions

False sharing is a known performance issue for systems with distributed caches. It also occurred for the implementation of a thread parallel bounds checking routine for the subcell IDP limiting in PR #1736. After some testing and discussion, it turned out that initializing a vector of length n * Threads.nthreads() and only using every n-th entry instead of a vector of length Threads.nthreads() fixes the problem. Since there are no processors with caches over 128B, we use n = 128B / size(uEltype). Now, the bounds checking routine of the IDP limiting scales as hoped.

diff --git a/previews/PR1624/reference-trixi/index.html b/previews/PR1624/reference-trixi/index.html index a4dee1e6abb..a265bc4ba87 100644 --- a/previews/PR1624/reference-trixi/index.html +++ b/previews/PR1624/reference-trixi/index.html @@ -1,9 +1,9 @@ -Trixi.jl · Trixi.jl

Trixi.jl API

Trixi.TrixiModule
Trixi

Trixi.jl is a numerical simulation framework for hyperbolic conservation laws. 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.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures.

To get started, run your first simulation with Trixi.jl using

trixi_include(default_example())

See also: trixi-framework/Trixi.jl

source
Trixi.AMRCallbackType
AMRCallback(semi, controller [,adaptor=AdaptorAMR(semi)];
+Trixi.jl · Trixi.jl

Trixi.jl API

Trixi.TrixiModule
Trixi

Trixi.jl is a numerical simulation framework for hyperbolic conservation laws. 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.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures.

To get started, run your first simulation with Trixi.jl using

trixi_include(default_example())

See also: trixi-framework/Trixi.jl

source
Trixi.AMRCallbackType
AMRCallback(semi, controller [,adaptor=AdaptorAMR(semi)];
             interval,
             adapt_initial_condition=true,
             adapt_initial_condition_only_refine=true,
-            dynamic_load_balancing=true)

Performs adaptive mesh refinement (AMR) every interval time steps for a given semidiscretization semi using the chosen controller.

source
Trixi.AbstractEquationsType
AbstractEquations{NDIMS, NVARS}

An abstract supertype of specific equations such as the compressible Euler equations. The type parameters encode the number of spatial dimensions (NDIMS) and the number of primary variables (NVARS) of the physics model.

source
Trixi.AbstractMeshType
AbstractMesh{NDIMS}

An abstract supertype of specific mesh types such as TreeMesh or StructuredMesh. The type parameters encode the number of spatial dimensions (NDIMS).

source
Trixi.AcousticPerturbationEquations2DType
AcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global)

Acoustic perturbation equations (APE) in two space dimensions. The equations are given by

\[\begin{aligned} + dynamic_load_balancing=true)

Performs adaptive mesh refinement (AMR) every interval time steps for a given semidiscretization semi using the chosen controller.

source
Trixi.AbstractEquationsType
AbstractEquations{NDIMS, NVARS}

An abstract supertype of specific equations such as the compressible Euler equations. The type parameters encode the number of spatial dimensions (NDIMS) and the number of primary variables (NVARS) of the physics model.

source
Trixi.AbstractMeshType
AbstractMesh{NDIMS}

An abstract supertype of specific mesh types such as TreeMesh or StructuredMesh. The type parameters encode the number of spatial dimensions (NDIMS).

source
Trixi.AcousticPerturbationEquations2DType
AcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global)

Acoustic perturbation equations (APE) in two space dimensions. The equations are given by

\[\begin{aligned} \frac{\partial\mathbf{v'}}{\partial t} + \nabla (\bar{\mathbf{v}}\cdot\mathbf{v'}) + \nabla\left( \frac{\bar{c}^2 \tilde{p}'}{\bar{\rho}} \right) &= 0 \\ \frac{\partial \tilde{p}'}{\partial t} + @@ -11,13 +11,13 @@ \end{aligned}\]

The bar $\bar{(\cdot)}$ indicates time-averaged quantities. The unknowns of the APE are the perturbed velocities $\mathbf{v'} = (v_1', v_2')^T$ and the scaled perturbed pressure $\tilde{p}' = \frac{p'}{\bar{c}^2}$, where $p'$ denotes the perturbed pressure and the perturbed variables are defined by $\phi' = \phi - \bar{\phi}$.

In addition to the unknowns, Trixi.jl currently stores the mean values in the state vector, i.e. the state vector used internally is given by

\[\mathbf{u} = \begin{pmatrix} v_1' \\ v_2' \\ \tilde{p}' \\ \bar{v}_1 \\ \bar{v}_2 \\ \bar{c} \\ \bar{\rho} - \end{pmatrix}.\]

This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the mean values must be zero.
  • The mean values have to be considered when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes these variables too.
  • Trixi.jl's visualization tools will visualize the mean values by default.

The constructor accepts a 2-tuple v_mean_global and scalars c_mean_global and rho_mean_global which can be used to make the definition of initial conditions for problems with constant mean flow more flexible. These values are ignored if the mean values are defined internally in an initial condition.

The equations are based on the APE-4 system introduced in the following paper:

source
Trixi.AdiabaticType
struct Adiabatic

Used to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_normal_flux_function should be a function with signature boundary_value_normal_flux_function(x, t, equations) and return a scalar value for the normal heat flux at point x and time t.

source
Trixi.AliveCallbackType
AliveCallback(analysis_interval=0, alive_interval=analysis_interval÷10)

Inexpensive callback showing that a simulation is still running by printing some information such as the current time to the screen every alive_interval time steps. If analysis_interval ≂̸ 0, the output is omitted every analysis_interval time steps.

source
Trixi.AnalysisCallbackType
AnalysisCallback(semi; interval=0,
+  \end{pmatrix}.\]

This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the mean values must be zero.
  • The mean values have to be considered when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes these variables too.
  • Trixi.jl's visualization tools will visualize the mean values by default.

The constructor accepts a 2-tuple v_mean_global and scalars c_mean_global and rho_mean_global which can be used to make the definition of initial conditions for problems with constant mean flow more flexible. These values are ignored if the mean values are defined internally in an initial condition.

The equations are based on the APE-4 system introduced in the following paper:

source
Trixi.AdiabaticType
struct Adiabatic

Used to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_normal_flux_function should be a function with signature boundary_value_normal_flux_function(x, t, equations) and return a scalar value for the normal heat flux at point x and time t.

source
Trixi.AliveCallbackType
AliveCallback(analysis_interval=0, alive_interval=analysis_interval÷10)

Inexpensive callback showing that a simulation is still running by printing some information such as the current time to the screen every alive_interval time steps. If analysis_interval ≂̸ 0, the output is omitted every analysis_interval time steps.

source
Trixi.AnalysisCallbackType
AnalysisCallback(semi; interval=0,
                        save_analysis=false,
                        output_directory="out",
                        analysis_filename="analysis.dat",
                        extra_analysis_errors=Symbol[],
-                       extra_analysis_integrals=())

Analyze a numerical solution every interval time steps and print the results to the screen. If save_analysis, the results are also saved in joinpath(output_directory, analysis_filename).

Additional errors can be computed, e.g. by passing extra_analysis_errors = (:l2_error_primitive, :linf_error_primitive) or extra_analysis_errors = (:conservation_error,).

If you want to omit the computation (to safe compute-time) of the default_analysis_errors, specify analysis_errors = Symbol[]. Note: default_analysis_errors are :l2_error and :linf_error for all equations. If you want to compute extra_analysis_errors such as :conservation_error solely, i.e., without :l2_error, :linf_error you need to specify analysis_errors = [:conservation_error] instead of extra_analysis_errors = [:conservation_error].

Further scalar functions func in extra_analysis_integrals are applied to the numerical solution and integrated over the computational domain. Some examples for this are entropy, energy_kinetic, energy_internal, and energy_total. You can also write your own function with the same signature as the examples listed above and pass it via extra_analysis_integrals. See the developer comments about Trixi.analyze, Trixi.pretty_form_utf, and Trixi.pretty_form_ascii for further information on how to create custom analysis quantities.

In addition, the analysis callback records and outputs a number of quantities that are useful for evaluating the computational performance, such as the total runtime, the performance index (time/DOF/rhs!), the time spent in garbage collection (GC), or the current memory usage (alloc'd memory).

source
Trixi.AnalysisCallbackCoupledType
AnalysisCallbackCoupled(semi, callbacks...)

Combine multiple analysis callbacks for coupled simulations with a SemidiscretizationCoupled. For each coupled system, an indididual AnalysisCallback must be created and passed to the AnalysisCallbackCoupled in order, i.e., in the same sequence as the indidvidual semidiscretizations are stored in the SemidiscretizationCoupled.

Experimental code

This is an experimental feature and can change any time.

source
Trixi.AveragingCallbackType
AveragingCallback(semi::SemidiscretizationHyperbolic, tspan; output_directory="out",
-                  filename="averaging.h5")
Experimental code

This callback is experimental and may change in any future release.

A callback that averages the flow field described by semi which must be a semidiscretization of the compressible Euler equations in two dimensions. The callback records the mean velocity, mean speed of sound, mean density, and mean vorticity for each node over the time interval given by tspan and stores the results in an HDF5 file filename in the directory output_directory. Note that this callback does not support adaptive mesh refinement (AMRCallback).

source
Trixi.BoundaryConditionCoupledType
BoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter)

Boundary condition to glue two meshes together. Solution values at the boundary of another mesh will be used as boundary values. This requires the use of SemidiscretizationCoupled. The other mesh is specified by other_semi_index, which is the index of the mesh in the tuple of semidiscretizations.

Note that the elements and nodes of the two meshes at the coupled boundary must coincide. This is currently only implemented for StructuredMesh.

Arguments

  • other_semi_index: the index in SemidiscretizationCoupled of the semidiscretization from which the values are copied
  • indices::Tuple: node/cell indices at the boundary of the mesh in the other semidiscretization. See examples below.
  • uEltype::Type: element type of solution
  • coupling_converter::CouplingConverter: function to call for converting the solution state of one system to the other system

Examples

# Connect the left boundary of mesh 2 to our boundary such that our positive
+                       extra_analysis_integrals=())

Analyze a numerical solution every interval time steps and print the results to the screen. If save_analysis, the results are also saved in joinpath(output_directory, analysis_filename).

Additional errors can be computed, e.g. by passing extra_analysis_errors = (:l2_error_primitive, :linf_error_primitive) or extra_analysis_errors = (:conservation_error,).

If you want to omit the computation (to safe compute-time) of the default_analysis_errors, specify analysis_errors = Symbol[]. Note: default_analysis_errors are :l2_error and :linf_error for all equations. If you want to compute extra_analysis_errors such as :conservation_error solely, i.e., without :l2_error, :linf_error you need to specify analysis_errors = [:conservation_error] instead of extra_analysis_errors = [:conservation_error].

Further scalar functions func in extra_analysis_integrals are applied to the numerical solution and integrated over the computational domain. Some examples for this are entropy, energy_kinetic, energy_internal, and energy_total. You can also write your own function with the same signature as the examples listed above and pass it via extra_analysis_integrals. See the developer comments about Trixi.analyze, Trixi.pretty_form_utf, and Trixi.pretty_form_ascii for further information on how to create custom analysis quantities.

In addition, the analysis callback records and outputs a number of quantities that are useful for evaluating the computational performance, such as the total runtime, the performance index (time/DOF/rhs!), the time spent in garbage collection (GC), or the current memory usage (alloc'd memory).

source
Trixi.AnalysisCallbackCoupledType
AnalysisCallbackCoupled(semi, callbacks...)

Combine multiple analysis callbacks for coupled simulations with a SemidiscretizationCoupled. For each coupled system, an indididual AnalysisCallback must be created and passed to the AnalysisCallbackCoupled in order, i.e., in the same sequence as the indidvidual semidiscretizations are stored in the SemidiscretizationCoupled.

Experimental code

This is an experimental feature and can change any time.

source
Trixi.AveragingCallbackType
AveragingCallback(semi::SemidiscretizationHyperbolic, tspan; output_directory="out",
+                  filename="averaging.h5")
Experimental code

This callback is experimental and may change in any future release.

A callback that averages the flow field described by semi which must be a semidiscretization of the compressible Euler equations in two dimensions. The callback records the mean velocity, mean speed of sound, mean density, and mean vorticity for each node over the time interval given by tspan and stores the results in an HDF5 file filename in the directory output_directory. Note that this callback does not support adaptive mesh refinement (AMRCallback).

source
Trixi.BoundaryConditionCoupledType
BoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter)

Boundary condition to glue two meshes together. Solution values at the boundary of another mesh will be used as boundary values. This requires the use of SemidiscretizationCoupled. The other mesh is specified by other_semi_index, which is the index of the mesh in the tuple of semidiscretizations.

Note that the elements and nodes of the two meshes at the coupled boundary must coincide. This is currently only implemented for StructuredMesh.

Arguments

  • other_semi_index: the index in SemidiscretizationCoupled of the semidiscretization from which the values are copied
  • indices::Tuple: node/cell indices at the boundary of the mesh in the other semidiscretization. See examples below.
  • uEltype::Type: element type of solution
  • coupling_converter::CouplingConverter: function to call for converting the solution state of one system to the other system

Examples

# Connect the left boundary of mesh 2 to our boundary such that our positive
 # boundary direction will match the positive y direction of the other boundary
 BoundaryConditionCoupled(2, (:begin, :i), Float64, fun)
 
@@ -25,7 +25,7 @@
 BoundaryConditionCoupled(2, (:begin, :i_backwards), Float64, fun)
 
 # Using this as y_neg boundary will connect `our_cells[i, 1, j]` to `other_cells[j, end-i, end]`
-BoundaryConditionCoupled(2, (:j, :i_backwards, :end), Float64, fun)
Experimental code

This is an experimental feature and can change any time.

source
Trixi.BoundaryConditionDirichletType
BoundaryConditionDirichlet(boundary_value_function)

Create a Dirichlet boundary condition that uses the function boundary_value_function to specify the values at the boundary. This can be used to create a boundary condition that specifies exact boundary values by passing the exact solution of the equation. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as

boundary_value_function(x, t, equations)

where x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.

Examples

julia> BoundaryConditionDirichlet(initial_condition_convergence_test)
source
Trixi.BoundaryConditionNavierStokesWallType
struct BoundaryConditionNavierStokesWall

Creates a wall-type boundary conditions for the compressible Navier-Stokes equations. The fields boundary_condition_velocity and boundary_condition_heat_flux are intended to be boundary condition types such as the NoSlip velocity boundary condition and the Adiabatic or Isothermal heat boundary condition.

source
Trixi.BoundaryConditionNeumannType
BoundaryConditionNeumann(boundary_normal_flux_function)

Similar to BoundaryConditionDirichlet, but creates a Neumann boundary condition for parabolic equations that uses the function boundary_normal_flux_function to specify the values of the normal flux at the boundary. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as

boundary_normal_flux_function(x, t, equations)

where x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.

source
Trixi.BoundsCheckCallbackType
BoundsCheckCallback(; output_directory="out", save_errors=false, interval=1)

Subcell limiting techniques with SubcellLimiterIDP are constructed to adhere certain local or global bounds. To make sure that these bounds are actually met, this callback calculates the maximum deviation from the bounds. The maximum deviation per applied bound is printed to the screen at the end of the simulation. For more insights, when setting save_errors=true the occurring errors are exported every interval time steps during the simulation. Then, the maximum deviations since the last export are saved in "output_directory/deviations.txt". The BoundsCheckCallback has to be applied as a stage callback for the SSPRK time integration scheme.

Note

For SubcellLimiterIDP, the solution is corrected in the a posteriori correction stage SubcellLimiterIDPCorrection. So, to check the final solution, this bounds check callback must be called after the correction stage.

source
Trixi.CarpenterKennedy2N54Type
CarpenterKennedy2N54()

The following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of

Carpenter, Kennedy (1994) Fourth order 2N storage RK schemes, Solution 3

using the same interface as OrdinaryDiffEq.jl.

source
Trixi.CompressibleEulerEquations1DType
CompressibleEulerEquations1D(gamma)

The compressible Euler equations

\[\frac{\partial}{\partial t} +BoundaryConditionCoupled(2, (:j, :i_backwards, :end), Float64, fun)

Experimental code

This is an experimental feature and can change any time.

source
Trixi.BoundaryConditionDirichletType
BoundaryConditionDirichlet(boundary_value_function)

Create a Dirichlet boundary condition that uses the function boundary_value_function to specify the values at the boundary. This can be used to create a boundary condition that specifies exact boundary values by passing the exact solution of the equation. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as

boundary_value_function(x, t, equations)

where x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.

Examples

julia> BoundaryConditionDirichlet(initial_condition_convergence_test)
source
Trixi.BoundaryConditionNavierStokesWallType
struct BoundaryConditionNavierStokesWall

Creates a wall-type boundary conditions for the compressible Navier-Stokes equations. The fields boundary_condition_velocity and boundary_condition_heat_flux are intended to be boundary condition types such as the NoSlip velocity boundary condition and the Adiabatic or Isothermal heat boundary condition.

source
Trixi.BoundaryConditionNeumannType
BoundaryConditionNeumann(boundary_normal_flux_function)

Similar to BoundaryConditionDirichlet, but creates a Neumann boundary condition for parabolic equations that uses the function boundary_normal_flux_function to specify the values of the normal flux at the boundary. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as

boundary_normal_flux_function(x, t, equations)

where x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.

source
Trixi.BoundsCheckCallbackType
BoundsCheckCallback(; output_directory="out", save_errors=false, interval=1)

Subcell limiting techniques with SubcellLimiterIDP are constructed to adhere certain local or global bounds. To make sure that these bounds are actually met, this callback calculates the maximum deviation from the bounds. The maximum deviation per applied bound is printed to the screen at the end of the simulation. For more insights, when setting save_errors=true the occurring errors are exported every interval time steps during the simulation. Then, the maximum deviations since the last export are saved in "output_directory/deviations.txt". The BoundsCheckCallback has to be applied as a stage callback for the SSPRK time integration scheme.

Note

For SubcellLimiterIDP, the solution is corrected in the a posteriori correction stage SubcellLimiterIDPCorrection. So, to check the final solution, this bounds check callback must be called after the correction stage.

source
Trixi.CarpenterKennedy2N54Type
CarpenterKennedy2N54()

The following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of

Carpenter, Kennedy (1994) Fourth order 2N storage RK schemes, Solution 3

using the same interface as OrdinaryDiffEq.jl.

source
Trixi.CompressibleEulerEquations1DType
CompressibleEulerEquations1D(gamma)

The compressible Euler equations

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho e \end{pmatrix} @@ -37,7 +37,7 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 -\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in one space dimension. Here, $\rho$ is the density, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v_1^2 \right)\]

the pressure.

source
Trixi.CompressibleEulerEquations2DType
CompressibleEulerEquations2D(gamma)

The compressible Euler equations

\[\frac{\partial}{\partial t} +\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in one space dimension. Here, $\rho$ is the density, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v_1^2 \right)\]

the pressure.

source
Trixi.CompressibleEulerEquations2DType
CompressibleEulerEquations2D(gamma)

The compressible Euler equations

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho v_2 \\ \rho e \end{pmatrix} @@ -54,7 +54,7 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 -\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in two space dimensions. Here, $\rho$ is the density, $v_1$, $v_2$ the velocities, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2) \right)\]

the pressure.

source
Trixi.CompressibleEulerEquations3DType
CompressibleEulerEquations3D(gamma)

The compressible Euler equations

\[\frac{\partial}{\partial t} +\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in two space dimensions. Here, $\rho$ is the density, $v_1$, $v_2$ the velocities, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2) \right)\]

the pressure.

source
Trixi.CompressibleEulerEquations3DType
CompressibleEulerEquations3D(gamma)

The compressible Euler equations

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho v_2 \\ \rho v_3 \\ \rho e \end{pmatrix} @@ -76,7 +76,7 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 -\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in three space dimensions. Here, $\rho$ is the density, $v_1$, $v_2$, $v_3$ the velocities, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2+v_3^2) \right)\]

the pressure.

source
Trixi.CompressibleEulerEquationsQuasi1DType
CompressibleEulerEquationsQuasi1D(gamma)

The quasi-1d compressible Euler equations (see Chan et al. DOI: 10.48550/arXiv.2307.12089 for details)

\[\frac{\partial}{\partial t} +\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in three space dimensions. Here, $\rho$ is the density, $v_1$, $v_2$, $v_3$ the velocities, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2+v_3^2) \right)\]

the pressure.

source
Trixi.CompressibleEulerEquationsQuasi1DType
CompressibleEulerEquationsQuasi1D(gamma)

The quasi-1d compressible Euler equations (see Chan et al. DOI: 10.48550/arXiv.2307.12089 for details)

\[\frac{\partial}{\partial t} \begin{pmatrix} a \rho \\ a \rho v_1 \\ a e \end{pmatrix} @@ -93,7 +93,7 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 -\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in one space dimension. Here, $\rho$ is the density, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, $a$ the (possibly) variable nozzle width, and

\[p = (\gamma - 1) \left( e - \frac{1}{2} \rho v_1^2 \right)\]

the pressure.

The nozzle width function $a(x)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the compressible Euler equations one can set the nozzle width variable $a$ to one.

In addition to the unknowns, Trixi.jl currently stores the nozzle width values at the approximation points despite being fixed in time. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the nozzle width must be zero.
  • The nozzle width values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the nozzle width by default.
source
Trixi.CompressibleEulerMulticomponentEquations1DType
CompressibleEulerMulticomponentEquations1D(; gammas, gas_constants)

Multicomponent version of the compressible Euler equations

\[\frac{\partial}{\partial t} +\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in one space dimension. Here, $\rho$ is the density, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, $a$ the (possibly) variable nozzle width, and

\[p = (\gamma - 1) \left( e - \frac{1}{2} \rho v_1^2 \right)\]

the pressure.

The nozzle width function $a(x)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the compressible Euler equations one can set the nozzle width variable $a$ to one.

In addition to the unknowns, Trixi.jl currently stores the nozzle width values at the approximation points despite being fixed in time. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the nozzle width must be zero.
  • The nozzle width values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the nozzle width by default.
source
Trixi.CompressibleEulerMulticomponentEquations1DType
CompressibleEulerMulticomponentEquations1D(; gammas, gas_constants)

Multicomponent version of the compressible Euler equations

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho v_1 \\ \rho e \\ \rho_1 \\ \rho_2 \\ \vdots \\ \rho_{n} \end{pmatrix} @@ -106,7 +106,7 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ \vdots \\ 0 -\end{pmatrix}\]

for calorically perfect gas in one space dimension. Here, $\rho_i$ is the density of component $i$, $\rho=\sum_{i=1}^n\rho_i$ the sum of the individual $\rho_i$, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v_1^2 \right)\]

the pressure,

\[\gamma=\frac{\sum_{i=1}^n\rho_i C_{v,i}\gamma_i}{\sum_{i=1}^n\rho_i C_{v,i}}\]

total heat capacity ratio, $\gamma_i$ heat capacity ratio of component $i$,

\[C_{v,i}=\frac{R}{\gamma_i-1}\]

specific heat capacity at constant volume of component $i$.

In case of more than one component, the specific heat ratios gammas and the gas constants gas_constants should be passed as tuples, e.g., gammas=(1.4, 1.667).

The remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.

source
Trixi.CompressibleEulerMulticomponentEquations2DType
CompressibleEulerMulticomponentEquations2D(; gammas, gas_constants)

Multicomponent version of the compressible Euler equations

\[\frac{\partial}{\partial t} +\end{pmatrix}\]

for calorically perfect gas in one space dimension. Here, $\rho_i$ is the density of component $i$, $\rho=\sum_{i=1}^n\rho_i$ the sum of the individual $\rho_i$, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v_1^2 \right)\]

the pressure,

\[\gamma=\frac{\sum_{i=1}^n\rho_i C_{v,i}\gamma_i}{\sum_{i=1}^n\rho_i C_{v,i}}\]

total heat capacity ratio, $\gamma_i$ heat capacity ratio of component $i$,

\[C_{v,i}=\frac{R}{\gamma_i-1}\]

specific heat capacity at constant volume of component $i$.

In case of more than one component, the specific heat ratios gammas and the gas constants gas_constants should be passed as tuples, e.g., gammas=(1.4, 1.667).

The remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.

source
Trixi.CompressibleEulerMulticomponentEquations2DType
CompressibleEulerMulticomponentEquations2D(; gammas, gas_constants)

Multicomponent version of the compressible Euler equations

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho v_1 \\ \rho v_2 \\ \rho e \\ \rho_1 \\ \rho_2 \\ \vdots \\ \rho_{n} \end{pmatrix} @@ -123,7 +123,7 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ \vdots \\ 0 -\end{pmatrix}\]

for calorically perfect gas in two space dimensions. Here, $\rho_i$ is the density of component $i$, $\rho=\sum_{i=1}^n\rho_i$ the sum of the individual $\rho_i$, $v_1$, $v_2$ the velocities, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2 + v_2^2) \right)\]

the pressure,

\[\gamma=\frac{\sum_{i=1}^n\rho_i C_{v,i}\gamma_i}{\sum_{i=1}^n\rho_i C_{v,i}}\]

total heat capacity ratio, $\gamma_i$ heat capacity ratio of component $i$,

\[C_{v,i}=\frac{R}{\gamma_i-1}\]

specific heat capacity at constant volume of component $i$.

In case of more than one component, the specific heat ratios gammas and the gas constants gas_constants in [kJ/(kg*K)] should be passed as tuples, e.g., gammas=(1.4, 1.667).

The remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.

source
Trixi.CompressibleNavierStokesDiffusion1DType
CompressibleNavierStokesDiffusion1D(equations; mu, Pr,
+\end{pmatrix}\]

for calorically perfect gas in two space dimensions. Here, $\rho_i$ is the density of component $i$, $\rho=\sum_{i=1}^n\rho_i$ the sum of the individual $\rho_i$, $v_1$, $v_2$ the velocities, $e$ the specific total energy rather than specific internal energy, and

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2 + v_2^2) \right)\]

the pressure,

\[\gamma=\frac{\sum_{i=1}^n\rho_i C_{v,i}\gamma_i}{\sum_{i=1}^n\rho_i C_{v,i}}\]

total heat capacity ratio, $\gamma_i$ heat capacity ratio of component $i$,

\[C_{v,i}=\frac{R}{\gamma_i-1}\]

specific heat capacity at constant volume of component $i$.

In case of more than one component, the specific heat ratios gammas and the gas constants gas_constants in [kJ/(kg*K)] should be passed as tuples, e.g., gammas=(1.4, 1.667).

The remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.

source
Trixi.CompressibleNavierStokesDiffusion1DType
CompressibleNavierStokesDiffusion1D(equations; mu, Pr,
                                     gradient_variables=GradientVariablesPrimitive())

Contains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations1D.

  • equations: instance of the CompressibleEulerEquations1D
  • mu: dynamic viscosity,
  • Pr: Prandtl number,
  • gradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().

Fluid properties such as the dynamic viscosity $\mu$ can be provided in any consistent unit system, e.g., [$\mu$] = kg m⁻¹ s⁻¹.

The particular form of the compressible Navier-Stokes implemented is

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v \\ \rho e @@ -137,7 +137,7 @@ \frac{\partial}{\partial x} \begin{pmatrix} 0 \\ \tau \\ \tau v - q -\end{pmatrix}\]

where the system is closed with the ideal gas assumption giving

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v^2 \right)\]

as the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations1D. The terms on the right hand side of the system above are built from the viscous stress

\[\tau = \mu \frac{\partial}{\partial x} v\]

where the heat flux is

\[q = -\kappa \frac{\partial}{\partial x} \left(T\right),\quad T = \frac{p}{R\rho}\]

where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is

\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]

From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R cancels and the heat flux becomes

\[q = -\kappa \frac{\partial}{\partial x} \left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}} \frac{\partial}{\partial x} \left(\frac{p}{\rho}\right)\]

which is the form implemented below in the flux function.

In one spatial dimensions we require gradients for two quantities, e.g., primitive quantities

\[\frac{\partial}{\partial x} v,\, \frac{\partial}{\partial x} T\]

or the entropy variables

\[\frac{\partial}{\partial x} w_2,\, \frac{\partial}{\partial x} w_3\]

where

\[w_2 = \frac{\rho v1}{p},\, w_3 = -\frac{\rho}{p}\]

source
Trixi.CompressibleNavierStokesDiffusion2DType
CompressibleNavierStokesDiffusion2D(equations; mu, Pr,
+\end{pmatrix}\]

where the system is closed with the ideal gas assumption giving

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v^2 \right)\]

as the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations1D. The terms on the right hand side of the system above are built from the viscous stress

\[\tau = \mu \frac{\partial}{\partial x} v\]

where the heat flux is

\[q = -\kappa \frac{\partial}{\partial x} \left(T\right),\quad T = \frac{p}{R\rho}\]

where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is

\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]

From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R cancels and the heat flux becomes

\[q = -\kappa \frac{\partial}{\partial x} \left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}} \frac{\partial}{\partial x} \left(\frac{p}{\rho}\right)\]

which is the form implemented below in the flux function.

In one spatial dimensions we require gradients for two quantities, e.g., primitive quantities

\[\frac{\partial}{\partial x} v,\, \frac{\partial}{\partial x} T\]

or the entropy variables

\[\frac{\partial}{\partial x} w_2,\, \frac{\partial}{\partial x} w_3\]

where

\[w_2 = \frac{\rho v1}{p},\, w_3 = -\frac{\rho}{p}\]

source
Trixi.CompressibleNavierStokesDiffusion2DType
CompressibleNavierStokesDiffusion2D(equations; mu, Pr,
                                     gradient_variables=GradientVariablesPrimitive())

Contains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations2D.

  • equations: instance of the CompressibleEulerEquations2D
  • mu: dynamic viscosity,
  • Pr: Prandtl number,
  • gradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().

Fluid properties such as the dynamic viscosity $\mu$ can be provided in any consistent unit system, e.g., [$\mu$] = kg m⁻¹ s⁻¹.

The particular form of the compressible Navier-Stokes implemented is

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho \mathbf{v} \\ \rho e @@ -151,7 +151,7 @@ \nabla \cdot \begin{pmatrix} 0 \\ \underline{\tau} \\ \underline{\tau}\mathbf{v} - \mathbf{q} -\end{pmatrix}\]

where the system is closed with the ideal gas assumption giving

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2) \right)\]

as the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor

\[\underline{\tau} = \mu \left(\nabla\mathbf{v} + \left(\nabla\mathbf{v}\right)^T\right) - \frac{2}{3} \mu \left(\nabla\cdot\mathbf{v}\right)\underline{I}\]

where $\underline{I}$ is the $2\times 2$ identity matrix and the heat flux is

\[\mathbf{q} = -\kappa\nabla\left(T\right),\quad T = \frac{p}{R\rho}\]

where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is

\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]

From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R cancels and the heat flux becomes

\[\mathbf{q} = -\kappa\nabla\left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}}\nabla\left(\frac{p}{\rho}\right)\]

which is the form implemented below in the flux function.

In two spatial dimensions we require gradients for three quantities, e.g., primitive quantities

\[\nabla v_1,\, \nabla v_2,\, \nabla T\]

or the entropy variables

\[\nabla w_2,\, \nabla w_3,\, \nabla w_4\]

where

\[w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = -\frac{\rho}{p}\]

source
Trixi.CompressibleNavierStokesDiffusion3DType
CompressibleNavierStokesDiffusion3D(equations; mu, Pr,
+\end{pmatrix}\]

where the system is closed with the ideal gas assumption giving

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2) \right)\]

as the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor

\[\underline{\tau} = \mu \left(\nabla\mathbf{v} + \left(\nabla\mathbf{v}\right)^T\right) - \frac{2}{3} \mu \left(\nabla\cdot\mathbf{v}\right)\underline{I}\]

where $\underline{I}$ is the $2\times 2$ identity matrix and the heat flux is

\[\mathbf{q} = -\kappa\nabla\left(T\right),\quad T = \frac{p}{R\rho}\]

where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is

\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]

From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R cancels and the heat flux becomes

\[\mathbf{q} = -\kappa\nabla\left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}}\nabla\left(\frac{p}{\rho}\right)\]

which is the form implemented below in the flux function.

In two spatial dimensions we require gradients for three quantities, e.g., primitive quantities

\[\nabla v_1,\, \nabla v_2,\, \nabla T\]

or the entropy variables

\[\nabla w_2,\, \nabla w_3,\, \nabla w_4\]

where

\[w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = -\frac{\rho}{p}\]

source
Trixi.CompressibleNavierStokesDiffusion3DType
CompressibleNavierStokesDiffusion3D(equations; mu, Pr,
                                     gradient_variables=GradientVariablesPrimitive())

Contains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations3D.

  • equations: instance of the CompressibleEulerEquations3D
  • mu: dynamic viscosity,
  • Pr: Prandtl number,
  • gradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().

Fluid properties such as the dynamic viscosity $\mu$ can be provided in any consistent unit system, e.g., [$\mu$] = kg m⁻¹ s⁻¹.

The particular form of the compressible Navier-Stokes implemented is

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho \mathbf{v} \\ \rho e @@ -165,41 +165,41 @@ \nabla \cdot \begin{pmatrix} 0 \\ \underline{\tau} \\ \underline{\tau}\mathbf{v} - \mathbf{q} -\end{pmatrix}\]

where the system is closed with the ideal gas assumption giving

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2+v_3^2) \right)\]

as the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor

\[\underline{\tau} = \mu \left(\nabla\mathbf{v} + \left(\nabla\mathbf{v}\right)^T\right) - \frac{2}{3} \mu \left(\nabla\cdot\mathbf{v}\right)\underline{I}\]

where $\underline{I}$ is the $3\times 3$ identity matrix and the heat flux is

\[\mathbf{q} = -\kappa\nabla\left(T\right),\quad T = \frac{p}{R\rho}\]

where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is

\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]

From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R cancels and the heat flux becomes

\[\mathbf{q} = -\kappa\nabla\left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}}\nabla\left(\frac{p}{\rho}\right)\]

which is the form implemented below in the flux function.

In two spatial dimensions we require gradients for three quantities, e.g., primitive quantities

\[\nabla v_1,\, \nabla v_2,\, \nabla v_3,\, \nabla T\]

or the entropy variables

\[\nabla w_2,\, \nabla w_3,\, \nabla w_4\, \nabla w_5\]

where

\[w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = \frac{\rho v_3}{p},\, w_5 = -\frac{\rho}{p}\]

source
Trixi.ControllerThreeLevelType
ControllerThreeLevel(semi, indicator; base_level=1,
+\end{pmatrix}\]

where the system is closed with the ideal gas assumption giving

\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2+v_3^2) \right)\]

as the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor

\[\underline{\tau} = \mu \left(\nabla\mathbf{v} + \left(\nabla\mathbf{v}\right)^T\right) - \frac{2}{3} \mu \left(\nabla\cdot\mathbf{v}\right)\underline{I}\]

where $\underline{I}$ is the $3\times 3$ identity matrix and the heat flux is

\[\mathbf{q} = -\kappa\nabla\left(T\right),\quad T = \frac{p}{R\rho}\]

where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is

\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]

From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R cancels and the heat flux becomes

\[\mathbf{q} = -\kappa\nabla\left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}}\nabla\left(\frac{p}{\rho}\right)\]

which is the form implemented below in the flux function.

In two spatial dimensions we require gradients for three quantities, e.g., primitive quantities

\[\nabla v_1,\, \nabla v_2,\, \nabla v_3,\, \nabla T\]

or the entropy variables

\[\nabla w_2,\, \nabla w_3,\, \nabla w_4\, \nabla w_5\]

where

\[w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = \frac{\rho v_3}{p},\, w_5 = -\frac{\rho}{p}\]

source
Trixi.ControllerThreeLevelType
ControllerThreeLevel(semi, indicator; base_level=1,
                                       med_level=base_level, med_threshold=0.0,
-                                      max_level=base_level, max_threshold=1.0)

An AMR controller based on three levels (in descending order of precedence):

  • set the target level to max_level if indicator > max_threshold
  • set the target level to med_level if indicator > med_threshold; if med_level < 0, set the target level to the current level
  • set the target level to base_level otherwise
source
Trixi.ControllerThreeLevelCombinedType
ControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;
+                                      max_level=base_level, max_threshold=1.0)

An AMR controller based on three levels (in descending order of precedence):

  • set the target level to max_level if indicator > max_threshold
  • set the target level to med_level if indicator > med_threshold; if med_level < 0, set the target level to the current level
  • set the target level to base_level otherwise
source
Trixi.ControllerThreeLevelCombinedType
ControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;
                              base_level=1,
                              med_level=base_level, med_threshold=0.0,
                              max_level=base_level, max_threshold=1.0,
-                             max_threshold_secondary=1.0)

An AMR controller based on three levels (in descending order of precedence):

  • set the target level to max_level if indicator_primary > max_threshold
  • set the target level to med_level if indicator_primary > med_threshold; if med_level < 0, set the target level to the current level
  • set the target level to base_level otherwise

If indicator_secondary >= max_threshold_secondary, set the target level to max_level.

source
Trixi.DGMultiMethod
DGMulti(approximation_type::AbstractDerivativeOperator;
+                             max_threshold_secondary=1.0)

An AMR controller based on three levels (in descending order of precedence):

  • set the target level to max_level if indicator_primary > max_threshold
  • set the target level to med_level if indicator_primary > med_threshold; if med_level < 0, set the target level to the current level
  • set the target level to base_level otherwise

If indicator_secondary >= max_threshold_secondary, set the target level to max_level.

source
Trixi.DGMultiMethod
DGMulti(approximation_type::AbstractDerivativeOperator;
         element_type::AbstractElemShape,
         surface_flux=flux_central,
         surface_integral=SurfaceIntegralWeakForm(surface_flux),
         volume_integral=VolumeIntegralWeakForm(),
-        kwargs...)

Create a summation by parts (SBP) discretization on the given element_type using a tensor product structure based on the 1D SBP derivative operator passed as approximation_type.

For more info, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.

source
Trixi.DGMultiMethod
DGMulti(; polydeg::Integer,
+        kwargs...)

Create a summation by parts (SBP) discretization on the given element_type using a tensor product structure based on the 1D SBP derivative operator passed as approximation_type.

For more info, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.

source
Trixi.DGMultiMethod
DGMulti(; polydeg::Integer,
           element_type::AbstractElemShape,
           approximation_type=Polynomial(),
           surface_flux=flux_central,
           surface_integral=SurfaceIntegralWeakForm(surface_flux),
           volume_integral=VolumeIntegralWeakForm(),
-          RefElemData_kwargs...)

Create a discontinuous Galerkin method which uses

  • approximations of polynomial degree polydeg
  • element type element_type (Tri(), Quad(), Tet(), and Hex() currently supported)

Optional:

  • approximation_type (default is Polynomial(); SBP() also supported for Tri(), Quad(), and Hex() element types).
  • RefElemData_kwargs are additional keyword arguments for RefElemData, such as quad_rule_vol. For more info, see the StartUpDG.jl docs.
source
Trixi.DGMultiMeshType
DGMultiMesh{NDIMS, ...}

DGMultiMesh describes a mesh type which wraps StartUpDG.MeshData and boundary_faces in a dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured).

source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti{2, Tri}, triangulateIO, boundary_dict::Dict{Symbol, Int})
  • dg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).
  • triangulateIO is a TriangulateIO mesh representation
  • boundary_dict is a Dict{Symbol, Int} which associates each integer TriangulateIO boundary tag with a Symbol.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti)

Constructs a single-element DGMultiMesh for a single periodic element given a DGMulti with approximation_type set to a periodic (finite difference) SBP operator from SummationByPartsOperators.jl.

source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti{NDIMS}, vertex_coordinates, EToV;
+          RefElemData_kwargs...)

Create a discontinuous Galerkin method which uses

  • approximations of polynomial degree polydeg
  • element type element_type (Tri(), Quad(), Tet(), and Hex() currently supported)

Optional:

  • approximation_type (default is Polynomial(); SBP() also supported for Tri(), Quad(), and Hex() element types).
  • RefElemData_kwargs are additional keyword arguments for RefElemData, such as quad_rule_vol. For more info, see the StartUpDG.jl docs.
source
Trixi.DGMultiMeshType
DGMultiMesh{NDIMS, ...}

DGMultiMesh describes a mesh type which wraps StartUpDG.MeshData and boundary_faces in a dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured).

source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti{2, Tri}, triangulateIO, boundary_dict::Dict{Symbol, Int})
  • dg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).
  • triangulateIO is a TriangulateIO mesh representation
  • boundary_dict is a Dict{Symbol, Int} which associates each integer TriangulateIO boundary tag with a Symbol.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti)

Constructs a single-element DGMultiMesh for a single periodic element given a DGMulti with approximation_type set to a periodic (finite difference) SBP operator from SummationByPartsOperators.jl.

source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti{NDIMS}, vertex_coordinates, EToV;
             is_on_boundary=nothing,
-            periodicity=ntuple(_->false, NDIMS)) where {NDIMS}
  • dg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).
  • vertex_coordinates is a tuple of vectors containing x,y,... components of the vertex coordinates
  • EToV is a 2D array containing element-to-vertex connectivities for each element
  • is_on_boundary specifies boundary using a Dict{Symbol, <:Function}
  • periodicity is a tuple of booleans specifying if the domain is periodic true/false in the (x,y,z) direction.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension, mapping;
+            periodicity=ntuple(_->false, NDIMS)) where {NDIMS}
  • dg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).
  • vertex_coordinates is a tuple of vectors containing x,y,... components of the vertex coordinates
  • EToV is a 2D array containing element-to-vertex connectivities for each element
  • is_on_boundary specifies boundary using a Dict{Symbol, <:Function}
  • periodicity is a tuple of booleans specifying if the domain is periodic true/false in the (x,y,z) direction.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension, mapping;
             is_on_boundary=nothing,
-            periodicity=ntuple(_ -> false, NDIMS), kwargs...) where {NDIMS}

Constructs a Curved() DGMultiMesh with element type dg.basis.element_type.

  • mapping is a function which maps from a reference [-1, 1]^NDIMS domain to a mapped domain, e.g., xy = mapping(x, y) in 2D.
  • is_on_boundary specifies boundary using a Dict{Symbol, <:Function}
  • periodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti, cells_per_dimension;
+            periodicity=ntuple(_ -> false, NDIMS), kwargs...) where {NDIMS}

Constructs a Curved() DGMultiMesh with element type dg.basis.element_type.

  • mapping is a function which maps from a reference [-1, 1]^NDIMS domain to a mapped domain, e.g., xy = mapping(x, y) in 2D.
  • is_on_boundary specifies boundary using a Dict{Symbol, <:Function}
  • periodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti, cells_per_dimension;
             coordinates_min=(-1.0, -1.0), coordinates_max=(1.0, 1.0),
             is_on_boundary=nothing,
-            periodicity=ntuple(_ -> false, NDIMS))

Constructs a Cartesian DGMultiMesh with element type dg.basis.element_type. The domain is the tensor product of the intervals [coordinates_min[i], coordinates_max[i]].

  • is_on_boundary specifies boundary using a Dict{Symbol, <:Function}
  • periodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti, filename::String)
  • dg::DGMulti contains information associated with the reference element (e.g., quadrature, basis evaluation, differentiation, etc).
  • filename is a path specifying a .mesh file generated by HOHQMesh.
source
Trixi.DGSEMType
DGSEM(; RealT=Float64, polydeg::Integer,
+            periodicity=ntuple(_ -> false, NDIMS))

Constructs a Cartesian DGMultiMesh with element type dg.basis.element_type. The domain is the tensor product of the intervals [coordinates_min[i], coordinates_max[i]].

  • is_on_boundary specifies boundary using a Dict{Symbol, <:Function}
  • periodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.
source
Trixi.DGMultiMeshMethod
DGMultiMesh(dg::DGMulti, filename::String)
  • dg::DGMulti contains information associated with the reference element (e.g., quadrature, basis evaluation, differentiation, etc).
  • filename is a path specifying a .mesh file generated by HOHQMesh.
source
Trixi.DGSEMType
DGSEM(; RealT=Float64, polydeg::Integer,
         surface_flux=flux_central,
         surface_integral=SurfaceIntegralWeakForm(surface_flux),
         volume_integral=VolumeIntegralWeakForm(),
-        mortar=MortarL2(basis))

Create a discontinuous Galerkin spectral element method (DGSEM) using a LobattoLegendreBasis with polynomials of degree polydeg.

source
Trixi.DissipationLocalLaxFriedrichsType
DissipationLocalLaxFriedrichs(max_abs_speed=max_abs_speed_naive)

Create a local Lax-Friedrichs dissipation operator where the maximum absolute wave speed is estimated as max_abs_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to max_abs_speed_naive.

source
Trixi.EulerAcousticsCouplingCallbackType
EulerAcousticsCouplingCallback
Experimental code

This callback is experimental and may change in any future release.

A callback that couples the acoustic perturbation equations and compressible Euler equations. Must be used in conjunction with SemidiscretizationEulerAcoustics. This callback manages the flow solver - which is always one time step ahead of the acoustics solver - and calculates the acoustic source term after each time step. The linearized Lamb vector is used as the source term, i.e.

\[\mathbf{s} = -(\mathbf{\omega'} \times \bar{\mathbf{v}} - + \bar{\mathbf{\omega}} \times \mathbf{v'}),\]

where $\mathbf{v}$ denotes the velocity, $\mathbf{\omega}$ denotes the vorticity, the bar $\bar{(\cdot)}$ indicates time-averaged quantities (see AveragingCallback) and prime $(\cdot)'$ denotes perturbed quantities defined by $\phi' = \phi - \bar{\phi}$. Note that the perturbed quantities here are based entirely on the pure flow solution and should not be confused with the state variables of the acoustic perturbation equations.

In addition, this callback manages the time step size for both solvers and initializes the mean values of the acoustic perturbation equations using results obtained with the AveragingCallback.

source
Trixi.EulerAcousticsCouplingCallbackMethod
EulerAcousticsCouplingCallback(ode_euler, averaging_file::AbstractString, alg,
-                               cfl_acoustics::Real, cfl_euler::Real; kwargs...)
Experimental code

This callback is experimental and may change in any future release.

Creates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_file (see AveragingCallback).

source
Trixi.DissipationLocalLaxFriedrichsType
DissipationLocalLaxFriedrichs(max_abs_speed=max_abs_speed_naive)

Create a local Lax-Friedrichs dissipation operator where the maximum absolute wave speed is estimated as max_abs_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to max_abs_speed_naive.

source
Trixi.EulerAcousticsCouplingCallbackType
EulerAcousticsCouplingCallback
Experimental code

This callback is experimental and may change in any future release.

A callback that couples the acoustic perturbation equations and compressible Euler equations. Must be used in conjunction with SemidiscretizationEulerAcoustics. This callback manages the flow solver - which is always one time step ahead of the acoustics solver - and calculates the acoustic source term after each time step. The linearized Lamb vector is used as the source term, i.e.

\[\mathbf{s} = -(\mathbf{\omega'} \times \bar{\mathbf{v}} + + \bar{\mathbf{\omega}} \times \mathbf{v'}),\]

where $\mathbf{v}$ denotes the velocity, $\mathbf{\omega}$ denotes the vorticity, the bar $\bar{(\cdot)}$ indicates time-averaged quantities (see AveragingCallback) and prime $(\cdot)'$ denotes perturbed quantities defined by $\phi' = \phi - \bar{\phi}$. Note that the perturbed quantities here are based entirely on the pure flow solution and should not be confused with the state variables of the acoustic perturbation equations.

In addition, this callback manages the time step size for both solvers and initializes the mean values of the acoustic perturbation equations using results obtained with the AveragingCallback.

source
Trixi.EulerAcousticsCouplingCallbackMethod
EulerAcousticsCouplingCallback(ode_euler, averaging_file::AbstractString, alg,
+                               cfl_acoustics::Real, cfl_euler::Real; kwargs...)
Experimental code

This callback is experimental and may change in any future release.

Creates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_file (see AveragingCallback).

source
Trixi.EulerAcousticsCouplingCallbackMethod
EulerAcousticsCouplingCallback(ode_euler,
                                averaging_callback::DiscreteCallback{<:Any, <:AveragingCallback},
-                               alg, cfl_acoustics::Real, cfl_euler::Real; kwargs...)
Experimental code

This callback is experimental and may change in any future release.

Creates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_callback (see AveragingCallback).

source
Trixi.FDSBPType
FDSBP(D_SBP; surface_integral, volume_integral)

Specialization of DG methods that uses general summation by parts (SBP) operators from SummationByPartsOperators.jl. In particular, this includes classical finite difference (FD) SBP methods. These methods have the same structure as classical DG methods - local operations on elements with connectivity through interfaces without imposing any continuity constraints.

D_SBP is an SBP derivative operator from SummationByPartsOperators.jl. The other arguments have the same meaning as in DG or DGSEM.

Experimental implementation (upwind SBP)

This is an experimental feature and may change in future releases.

source
Trixi.FluxHLLType
FluxHLL(min_max_speed=min_max_speed_davis)

Create an HLL (Harten, Lax, van Leer) numerical flux where the minimum and maximum wave speeds are estimated as λ_min, λ_max = min_max_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to min_max_speed_davis. Original paper:

  • Amiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002
source
Trixi.FluxHydrostaticReconstructionType
FluxHydrostaticReconstruction(numerical_flux, hydrostatic_reconstruction)
Experimental code

This numerical flux is experimental and may change in any future release.

Allow for some kind of hydrostatic reconstruction of the solution state prior to the surface flux computation. This is a particular strategy to ensure that the method remains well-balanced for the shallow water equations, see ShallowWaterEquations1D or ShallowWaterEquations2D.

For example, the hydrostatic reconstruction from Audusse et al. is implemented in one and two spatial dimensions, see hydrostatic_reconstruction_audusse_etal or the original paper

  • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090

Other hydrostatic reconstruction techniques are available, particularly to handle wet / dry fronts. A good overview of the development and application of hydrostatic reconstruction can be found in

  • Guoxian Chen and Sebastian Noelle A unified surface-gradient and hydrostatic reconstruction scheme for the shallow water equations (2021) RWTH Aachen preprint
  • Andreas Buttinger-Kreuzhuber, Zsolt Horváth, Sebastian Noelle, Günter Blöschl and Jürgen Waser (2019) A fast second-order shallow water scheme on two-dimensional structured grids over abrupt topography DOI: 10.1016/j.advwatres.2019.03.010
source
Trixi.FluxLMARSType
FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,
-             equations::CompressibleEulerEquations2D)

Low Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.

References:

  • Xi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1
source
Trixi.FluxLMARSMethod
FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,
-             equations::CompressibleEulerEquations3D)

Low Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.

References:

  • Xi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1
source
Trixi.FluxPlusDissipationType
FluxPlusDissipation(numerical_flux, dissipation)

Combine a numerical_flux with a dissipation operator to create a new numerical flux.

source
Trixi.FluxRotatedType
FluxRotated(numerical_flux)

Compute a numerical_flux flux in direction of a normal vector by rotating the solution, computing the numerical flux in x-direction, and rotating the calculated flux back.

Requires a rotationally invariant equation with equation-specific functions rotate_to_x and rotate_from_x.

source
Trixi.FluxUpwindType
FluxUpwind(splitting)

A numerical flux f(u_left, u_right) = f⁺(u_left) + f⁻(u_right) based on flux vector splitting.

The SurfaceIntegralUpwind with a given splitting is equivalent to the SurfaceIntegralStrongForm with FluxUpwind(splitting) as numerical flux (up to floating point differences). Note, that SurfaceIntegralUpwind is only available on TreeMesh.

Experimental implementation (upwind SBP)

This is an experimental feature and may change in future releases.

source
Trixi.GlmSpeedCallbackType
GlmSpeedCallback(; glm_scale=0.5, cfl)

Update the divergence cleaning wave speed c_h according to the time step computed in StepsizeCallback for the ideal GLM-MHD equations. The cfl number should be set to the same value as for the time step size calculation. The glm_scale ensures that the GLM wave speed is lower than the fastest physical waves in the MHD solution and should thus be set to a value within the interval [0,1]. Note that glm_scale = 0 deactivates the divergence cleaning.

source
Trixi.GradientVariablesPrimitiveType

GradientVariablesPrimitive and GradientVariablesEntropy are gradient variable type parameters for CompressibleNavierStokesDiffusion1D. By default, the gradient variables are set to be GradientVariablesPrimitive. Specifying GradientVariablesEntropy instead uses the entropy variable formulation from

  • Hughes, Mallet, Franca (1986) A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the compressible Euler and Navier-Stokes equations and the second law of thermodynamics. https://doi.org/10.1016/0045-7825(86)90127-1

Under GradientVariablesEntropy, the Navier-Stokes discretization is provably entropy stable.

source
Trixi.HypDiffN3Erk3Sstar52Type
HypDiffN3Erk3Sstar52()

Five stage, second-order accurate explicit Runge-Kutta scheme with stability region optimized for the hyperbolic diffusion equation with LLF flux and polynomials of degree polydeg=3.

source
Trixi.HyperbolicDiffusionEquations1DType
HyperbolicDiffusionEquations1D

The linear hyperbolic diffusion equations in one space dimension. A description of this system can be found in Sec. 2.5 of the book

Further analysis can be found in the paper

source
Trixi.IdealGlmMhdEquations1DType
IdealGlmMhdEquations1D(gamma)

The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in one space dimension.

Note

There is no divergence cleaning variable psi because the divergence-free constraint is satisfied trivially in one spatial dimension.

source
Trixi.IdealGlmMhdEquations2DType
IdealGlmMhdEquations2D(gamma)

The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in two space dimensions.

source
Trixi.IdealGlmMhdEquations3DType
IdealGlmMhdEquations3D(gamma)

The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in three space dimensions.

source
Trixi.IndicatorHennemannGassnerType
IndicatorHennemannGassner(equations::AbstractEquations, basis;
+                               alg, cfl_acoustics::Real, cfl_euler::Real; kwargs...)
Experimental code

This callback is experimental and may change in any future release.

Creates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_callback (see AveragingCallback).

source
Trixi.FDSBPType
FDSBP(D_SBP; surface_integral, volume_integral)

Specialization of DG methods that uses general summation by parts (SBP) operators from SummationByPartsOperators.jl. In particular, this includes classical finite difference (FD) SBP methods. These methods have the same structure as classical DG methods - local operations on elements with connectivity through interfaces without imposing any continuity constraints.

D_SBP is an SBP derivative operator from SummationByPartsOperators.jl. The other arguments have the same meaning as in DG or DGSEM.

Experimental implementation (upwind SBP)

This is an experimental feature and may change in future releases.

source
Trixi.FluxHLLType
FluxHLL(min_max_speed=min_max_speed_davis)

Create an HLL (Harten, Lax, van Leer) numerical flux where the minimum and maximum wave speeds are estimated as λ_min, λ_max = min_max_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to min_max_speed_davis. Original paper:

  • Amiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002
source
Trixi.FluxHydrostaticReconstructionType
FluxHydrostaticReconstruction(numerical_flux, hydrostatic_reconstruction)
Experimental code

This numerical flux is experimental and may change in any future release.

Allow for some kind of hydrostatic reconstruction of the solution state prior to the surface flux computation. This is a particular strategy to ensure that the method remains well-balanced for the shallow water equations, see ShallowWaterEquations1D or ShallowWaterEquations2D.

For example, the hydrostatic reconstruction from Audusse et al. is implemented in one and two spatial dimensions, see hydrostatic_reconstruction_audusse_etal or the original paper

  • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090

Other hydrostatic reconstruction techniques are available, particularly to handle wet / dry fronts. A good overview of the development and application of hydrostatic reconstruction can be found in

  • Guoxian Chen and Sebastian Noelle A unified surface-gradient and hydrostatic reconstruction scheme for the shallow water equations (2021) RWTH Aachen preprint
  • Andreas Buttinger-Kreuzhuber, Zsolt Horváth, Sebastian Noelle, Günter Blöschl and Jürgen Waser (2019) A fast second-order shallow water scheme on two-dimensional structured grids over abrupt topography DOI: 10.1016/j.advwatres.2019.03.010
source
Trixi.FluxLMARSType
FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,
+             equations::CompressibleEulerEquations2D)

Low Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.

References:

  • Xi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1
source
Trixi.FluxLMARSMethod
FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,
+             equations::CompressibleEulerEquations3D)

Low Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.

References:

  • Xi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1
source
Trixi.FluxPlusDissipationType
FluxPlusDissipation(numerical_flux, dissipation)

Combine a numerical_flux with a dissipation operator to create a new numerical flux.

source
Trixi.FluxRotatedType
FluxRotated(numerical_flux)

Compute a numerical_flux flux in direction of a normal vector by rotating the solution, computing the numerical flux in x-direction, and rotating the calculated flux back.

Requires a rotationally invariant equation with equation-specific functions rotate_to_x and rotate_from_x.

source
Trixi.FluxUpwindType
FluxUpwind(splitting)

A numerical flux f(u_left, u_right) = f⁺(u_left) + f⁻(u_right) based on flux vector splitting.

The SurfaceIntegralUpwind with a given splitting is equivalent to the SurfaceIntegralStrongForm with FluxUpwind(splitting) as numerical flux (up to floating point differences). Note, that SurfaceIntegralUpwind is only available on TreeMesh.

Experimental implementation (upwind SBP)

This is an experimental feature and may change in future releases.

source
Trixi.GlmSpeedCallbackType
GlmSpeedCallback(; glm_scale=0.5, cfl)

Update the divergence cleaning wave speed c_h according to the time step computed in StepsizeCallback for the ideal GLM-MHD equations. The cfl number should be set to the same value as for the time step size calculation. The glm_scale ensures that the GLM wave speed is lower than the fastest physical waves in the MHD solution and should thus be set to a value within the interval [0,1]. Note that glm_scale = 0 deactivates the divergence cleaning.

source
Trixi.GradientVariablesPrimitiveType

GradientVariablesPrimitive and GradientVariablesEntropy are gradient variable type parameters for CompressibleNavierStokesDiffusion1D. By default, the gradient variables are set to be GradientVariablesPrimitive. Specifying GradientVariablesEntropy instead uses the entropy variable formulation from

  • Hughes, Mallet, Franca (1986) A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the compressible Euler and Navier-Stokes equations and the second law of thermodynamics. https://doi.org/10.1016/0045-7825(86)90127-1

Under GradientVariablesEntropy, the Navier-Stokes discretization is provably entropy stable.

source
Trixi.HypDiffN3Erk3Sstar52Type
HypDiffN3Erk3Sstar52()

Five stage, second-order accurate explicit Runge-Kutta scheme with stability region optimized for the hyperbolic diffusion equation with LLF flux and polynomials of degree polydeg=3.

source
Trixi.HyperbolicDiffusionEquations1DType
HyperbolicDiffusionEquations1D

The linear hyperbolic diffusion equations in one space dimension. A description of this system can be found in Sec. 2.5 of the book

Further analysis can be found in the paper

source
Trixi.IdealGlmMhdEquations1DType
IdealGlmMhdEquations1D(gamma)

The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in one space dimension.

Note

There is no divergence cleaning variable psi because the divergence-free constraint is satisfied trivially in one spatial dimension.

source
Trixi.IdealGlmMhdEquations2DType
IdealGlmMhdEquations2D(gamma)

The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in two space dimensions.

source
Trixi.IdealGlmMhdEquations3DType
IdealGlmMhdEquations3D(gamma)

The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in three space dimensions.

source
Trixi.IndicatorHennemannGassnerType
IndicatorHennemannGassner(equations::AbstractEquations, basis;
                           alpha_max=0.5,
                           alpha_min=0.001,
                           alpha_smooth=true,
@@ -208,20 +208,20 @@
                           alpha_max=0.5,
                           alpha_min=0.001,
                           alpha_smooth=true,
-                          variable)

Indicator used for shock-capturing (when passing the equations and the basis) or adaptive mesh refinement (AMR, when passing the semi).

See also VolumeIntegralShockCapturingHG.

References

  • Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
source
Trixi.IndicatorLöhnerType
IndicatorLöhner (equivalent to IndicatorLoehner)
+                          variable)

Indicator used for shock-capturing (when passing the equations and the basis) or adaptive mesh refinement (AMR, when passing the semi).

See also VolumeIntegralShockCapturingHG.

References

  • Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
source
Trixi.IndicatorLöhnerType
IndicatorLöhner (equivalent to IndicatorLoehner)
 
 IndicatorLöhner(equations::AbstractEquations, basis;
                 f_wave=0.2, variable)
 IndicatorLöhner(semi::AbstractSemidiscretization;
-                f_wave=0.2, variable)

AMR indicator adapted from a FEM indicator by Löhner (1987), also used in the FLASH code as standard AMR indicator. The indicator estimates a weighted second derivative of a specified variable locally.

When constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.

References

source
Trixi.IndicatorMaxType
IndicatorMax(equations::AbstractEquations, basis; variable)
-IndicatorMax(semi::AbstractSemidiscretization; variable)

A simple indicator returning the maximum of variable in an element. When constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.

source
Trixi.IsothermalType
struct Isothermal

Used to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and return a scalar value for the temperature at point x and time t.

source
Trixi.LaplaceDiffusion1DType
LaplaceDiffusion1D(diffusivity, equations)

LaplaceDiffusion1D represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations.

source
Trixi.LaplaceDiffusion2DType
LaplaceDiffusion2D(diffusivity, equations)

LaplaceDiffusion2D represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations.

source
Trixi.LaplaceDiffusion3DType
LaplaceDiffusion3D(diffusivity, equations)

LaplaceDiffusion3D represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations.

source
Trixi.LatticeBoltzmannEquations2DType
LatticeBoltzmannEquations2D(; Ma, Re, collision_op=collision_bgk,
+                f_wave=0.2, variable)

AMR indicator adapted from a FEM indicator by Löhner (1987), also used in the FLASH code as standard AMR indicator. The indicator estimates a weighted second derivative of a specified variable locally.

When constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.

References

source
Trixi.IndicatorMaxType
IndicatorMax(equations::AbstractEquations, basis; variable)
+IndicatorMax(semi::AbstractSemidiscretization; variable)

A simple indicator returning the maximum of variable in an element. When constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.

source
Trixi.IsothermalType
struct Isothermal

Used to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and return a scalar value for the temperature at point x and time t.

source
Trixi.LaplaceDiffusion1DType
LaplaceDiffusion1D(diffusivity, equations)

LaplaceDiffusion1D represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations.

source
Trixi.LaplaceDiffusion2DType
LaplaceDiffusion2D(diffusivity, equations)

LaplaceDiffusion2D represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations.

source
Trixi.LaplaceDiffusion3DType
LaplaceDiffusion3D(diffusivity, equations)

LaplaceDiffusion3D represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations.

source
Trixi.LatticeBoltzmannEquations2DType
LatticeBoltzmannEquations2D(; Ma, Re, collision_op=collision_bgk,
                            c=1, L=1, rho0=1, u0=nothing, nu=nothing)

The Lattice-Boltzmann equations

\[\partial_t u_\alpha + v_{\alpha,1} \partial_1 u_\alpha + v_{\alpha,2} \partial_2 u_\alpha = 0\]

in two space dimensions for the D2Q9 scheme.

The characteristic Mach number and Reynolds numbers are specified as Ma and Re. By the default, the collision operator collision_op is set to the BGK model. c, L, and rho0 specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0 directly (Ma needs to be set to nothing in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu directly (in this case, Re needs to be set to nothing).

The nine discrete velocity directions of the D2Q9 scheme are sorted as follows [4]:

  6     2     5       y
     ┌───┼───┐         │
     │       │         │
   3 ┼   9   ┼ 1        ──── x
     │       │        ╱
     └───┼───┘       ╱
-  7     4     8    z

Note that usually the velocities are numbered from 0 to 8, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 9, where 1 through 8 correspond to the velocity directions in [4] and 9 is the zero velocity.

The corresponding opposite directions are:

  • 1 ←→ 3
  • 2 ←→ 4
  • 3 ←→ 1
  • 4 ←→ 2
  • 5 ←→ 7
  • 6 ←→ 8
  • 7 ←→ 5
  • 8 ←→ 6
  • 9 ←→ 9

The main sources for the base implementation were

  1. Misun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024
  2. Karsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.
  3. Dieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0
  4. Dieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3
source
Trixi.LatticeBoltzmannEquations3DType
LatticeBoltzmannEquations3D(; Ma, Re, collision_op=collision_bgk,
+  7     4     8    z

Note that usually the velocities are numbered from 0 to 8, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 9, where 1 through 8 correspond to the velocity directions in [4] and 9 is the zero velocity.

The corresponding opposite directions are:

  • 1 ←→ 3
  • 2 ←→ 4
  • 3 ←→ 1
  • 4 ←→ 2
  • 5 ←→ 7
  • 6 ←→ 8
  • 7 ←→ 5
  • 8 ←→ 6
  • 9 ←→ 9

The main sources for the base implementation were

  1. Misun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024
  2. Karsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.
  3. Dieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0
  4. Dieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3
source
Trixi.LatticeBoltzmannEquations3DType
LatticeBoltzmannEquations3D(; Ma, Re, collision_op=collision_bgk,
                            c=1, L=1, rho0=1, u0=nothing, nu=nothing)

The Lattice-Boltzmann equations

\[\partial_t u_\alpha + v_{\alpha,1} \partial_1 u_\alpha + v_{\alpha,2} \partial_2 u_\alpha + v_{\alpha,3} \partial_3 u_\alpha = 0\]

in three space dimensions for the D3Q27 scheme.

The characteristic Mach number and Reynolds numbers are specified as Ma and Re. By the default, the collision operator collision_op is set to the BGK model. c, L, and rho0 specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0 directly (Ma needs to be set to nothing in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu directly (in this case, Re needs to be set to nothing).

The twenty-seven discrete velocity directions of the D3Q27 scheme are sorted as follows [4]:

  • plane at z = -1:
      24    17     21       y
          ┌───┼───┐          │
          │       │          │
    @@ -240,7 +240,7 @@
       16 ┼   5   ┼ 9         ──── x
          │       │         ╱
          └───┼───┘        ╱
    -  22    18     23    z

Note that usually the velocities are numbered from 0 to 26, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 27, where 1 through 26 correspond to the velocity directions in [4] and 27 is the zero velocity.

The corresponding opposite directions are:

  • 1 ←→ 2
  • 2 ←→ 1
  • 3 ←→ 4
  • 4 ←→ 3
  • 5 ←→ 6
  • 6 ←→ 5
  • 7 ←→ 8
  • 8 ←→ 7
  • 9 ←→ 10
  • 10 ←→ 9
  • 11 ←→ 12
  • 12 ←→ 11
  • 13 ←→ 14
  • 14 ←→ 13
  • 15 ←→ 16
  • 16 ←→ 15
  • 17 ←→ 18
  • 18 ←→ 17
  • 19 ←→ 20
  • 20 ←→ 19
  • 21 ←→ 22
  • 22 ←→ 21
  • 23 ←→ 24
  • 24 ←→ 23
  • 25 ←→ 26
  • 26 ←→ 25
  • 27 ←→ 27

The main sources for the base implementation were

  1. Misun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024
  2. Karsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.
  3. Dieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0
  4. Dieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3
source
Trixi.LinearScalarAdvectionEquation2DType
LinearScalarAdvectionEquation2D

The linear scalar advection equation

\[\partial_t u + a_1 \partial_1 u + a_2 \partial_2 u = 0\]

in two space dimensions with constant velocity a.

source
Trixi.LinearScalarAdvectionEquation3DType
LinearScalarAdvectionEquation3D

The linear scalar advection equation

\[\partial_t u + a_1 \partial_1 u + a_2 \partial_2 u + a_3 \partial_3 u = 0\]

in three space dimensions with constant velocity a.

source
Trixi.LinearizedEulerEquations2DType
LinearizedEulerEquations2D(v_mean_global, c_mean_global, rho_mean_global)

Linearized euler equations in two space dimensions. The equations are given by

\[\partial_t + 22 18 23 z

Note that usually the velocities are numbered from 0 to 26, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 27, where 1 through 26 correspond to the velocity directions in [4] and 27 is the zero velocity.

The corresponding opposite directions are:

  • 1 ←→ 2
  • 2 ←→ 1
  • 3 ←→ 4
  • 4 ←→ 3
  • 5 ←→ 6
  • 6 ←→ 5
  • 7 ←→ 8
  • 8 ←→ 7
  • 9 ←→ 10
  • 10 ←→ 9
  • 11 ←→ 12
  • 12 ←→ 11
  • 13 ←→ 14
  • 14 ←→ 13
  • 15 ←→ 16
  • 16 ←→ 15
  • 17 ←→ 18
  • 18 ←→ 17
  • 19 ←→ 20
  • 20 ←→ 19
  • 21 ←→ 22
  • 22 ←→ 21
  • 23 ←→ 24
  • 24 ←→ 23
  • 25 ←→ 26
  • 26 ←→ 25
  • 27 ←→ 27

The main sources for the base implementation were

  1. Misun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024
  2. Karsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.
  3. Dieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0
  4. Dieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3
source
Trixi.LinearScalarAdvectionEquation2DType
LinearScalarAdvectionEquation2D

The linear scalar advection equation

\[\partial_t u + a_1 \partial_1 u + a_2 \partial_2 u = 0\]

in two space dimensions with constant velocity a.

source
Trixi.LinearScalarAdvectionEquation3DType
LinearScalarAdvectionEquation3D

The linear scalar advection equation

\[\partial_t u + a_1 \partial_1 u + a_2 \partial_2 u + a_3 \partial_3 u = 0\]

in three space dimensions with constant velocity a.

source
Trixi.LinearizedEulerEquations2DType
LinearizedEulerEquations2D(v_mean_global, c_mean_global, rho_mean_global)

Linearized euler equations in two space dimensions. The equations are given by

\[\partial_t \begin{pmatrix} \rho' \\ v_1' \\ v_2' \\ p' \end{pmatrix} @@ -257,20 +257,20 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 -\end{pmatrix}\]

The bar $\bar{(\cdot)}$ indicates uniform mean flow variables and c is the speed of sound. The unknowns are the acoustic velocities $v' = (v_1', v_2')$, the pressure $p'$ and the density $\rho'$.

source
Trixi.LobattoLegendreBasisType
LobattoLegendreBasis([RealT=Float64,] polydeg::Integer)

Create a nodal Lobatto-Legendre basis for polynomials of degree polydeg.

For the special case polydeg=0 the DG method reduces to a finite volume method. Therefore, this function sets the center point of the cell as single node. This exceptional case is currently only supported for TreeMesh!

source
Trixi.NoSlipType
struct NoSlip

Use to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and should return a SVector{NDIMS} whose entries are the velocity vector at a point x and time t.

source
Trixi.NonConservativeLocalType
NonConservativeLocal()

Struct used for multiple dispatch on non-conservative flux functions in the format of "local * symmetric". When the argument nonconservative_type is of type NonConservativeLocal, the function returns the local part of the non-conservative term.

source
Trixi.NonConservativeSymmetricType
NonConservativeSymmetric()

Struct used for multiple dispatch on non-conservative flux functions in the format of "local * symmetric". When the argument nonconservative_type is of type NonConservativeSymmetric, the function returns the symmetric part of the non-conservative term.

source
Trixi.P4estMeshType
P4estMesh{NDIMS} <: AbstractMesh{NDIMS}

An unstructured curved mesh based on trees that uses the C library p4est to manage trees and mesh refinement.

source
Trixi.P4estMeshMethod
P4estMesh(trees_per_dimension; polydeg,
+\end{pmatrix}\]

The bar $\bar{(\cdot)}$ indicates uniform mean flow variables and c is the speed of sound. The unknowns are the acoustic velocities $v' = (v_1', v_2')$, the pressure $p'$ and the density $\rho'$.

source
Trixi.LobattoLegendreBasisType
LobattoLegendreBasis([RealT=Float64,] polydeg::Integer)

Create a nodal Lobatto-Legendre basis for polynomials of degree polydeg.

For the special case polydeg=0 the DG method reduces to a finite volume method. Therefore, this function sets the center point of the cell as single node. This exceptional case is currently only supported for TreeMesh!

source
Trixi.NoSlipType
struct NoSlip

Use to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and should return a SVector{NDIMS} whose entries are the velocity vector at a point x and time t.

source
Trixi.NonConservativeLocalType
NonConservativeLocal()

Struct used for multiple dispatch on non-conservative flux functions in the format of "local * symmetric". When the argument nonconservative_type is of type NonConservativeLocal, the function returns the local part of the non-conservative term.

source
Trixi.NonConservativeSymmetricType
NonConservativeSymmetric()

Struct used for multiple dispatch on non-conservative flux functions in the format of "local * symmetric". When the argument nonconservative_type is of type NonConservativeSymmetric, the function returns the symmetric part of the non-conservative term.

source
Trixi.P4estMeshType
P4estMesh{NDIMS} <: AbstractMesh{NDIMS}

An unstructured curved mesh based on trees that uses the C library p4est to manage trees and mesh refinement.

source
Trixi.P4estMeshMethod
P4estMesh(trees_per_dimension; polydeg,
           mapping=nothing, faces=nothing, coordinates_min=nothing, coordinates_max=nothing,
           RealT=Float64, initial_refinement_level=0, periodicity=true, unsaved_changes=true,
-          p4est_partition_allow_for_coarsening=true)

Create a structured curved P4estMesh of the specified size.

There are three ways to map the mesh to the physical domain.

  1. Define a mapping that maps the hypercube [-1, 1]^n.
  2. Specify a Tuple faces of functions that parametrize each face.
  3. Create a rectangular mesh by specifying coordinates_min and coordinates_max.

Non-periodic boundaries will be called :x_neg, :x_pos, :y_neg, :y_pos, :z_neg, :z_pos.

Arguments

  • trees_per_dimension::NTupleE{NDIMS, Int}: the number of trees in each dimension.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • faces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • p4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.
source
Trixi.P4estMeshMethod
P4estMesh{NDIMS}(meshfile::String;
+          p4est_partition_allow_for_coarsening=true)

Create a structured curved P4estMesh of the specified size.

There are three ways to map the mesh to the physical domain.

  1. Define a mapping that maps the hypercube [-1, 1]^n.
  2. Specify a Tuple faces of functions that parametrize each face.
  3. Create a rectangular mesh by specifying coordinates_min and coordinates_max.

Non-periodic boundaries will be called :x_neg, :x_pos, :y_neg, :y_pos, :z_neg, :z_pos.

Arguments

  • trees_per_dimension::NTupleE{NDIMS, Int}: the number of trees in each dimension.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • faces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • p4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.
source
Trixi.P4estMeshMethod
P4estMesh{NDIMS}(meshfile::String;
                  mapping=nothing, polydeg=1, RealT=Float64,
                  initial_refinement_level=0, unsaved_changes=true,
                  p4est_partition_allow_for_coarsening=true,
-                 boundary_symbols = nothing)

Main mesh constructor for the P4estMesh that imports an unstructured, conforming mesh from an Abaqus mesh file (.inp). Each element of the conforming mesh parsed from the meshfile is created as a p4est tree datatype.

To create a curved unstructured mesh P4estMesh two strategies are available:

  • p4est_mesh_from_hohqmesh_abaqus: High-order, curved boundary information created by HOHQMesh.jl is available in the meshfile. The mesh polynomial degree polydeg of the boundaries is provided from the meshfile. The computation of the mapped tree coordinates is done with transfinite interpolation with linear blending similar to UnstructuredMesh2D. Boundary name information is also parsed from the meshfile such that different boundary conditions can be set at each named boundary on a given tree.
  • p4est_mesh_from_standard_abaqus: By default, with mapping=nothing and polydeg=1, this creates a straight-sided from the information parsed from the meshfile. If a mapping function is specified then it computes the mapped tree coordinates via polynomial interpolants with degree polydeg. The mesh created by this function will only have one boundary :all if boundary_symbols is not specified. If boundary_symbols is specified the mesh file will be parsed for nodesets defining the boundary nodes from which boundary edges (2D) and faces (3D) will be assigned.

Note that the mapping and polydeg keyword arguments are only used by the p4est_mesh_from_standard_abaqus function. The p4est_mesh_from_hohqmesh_abaqus function obtains the mesh polydeg directly from the meshfile and constructs the transfinite mapping internally.

The particular strategy is selected according to the header present in the meshfile where the constructor checks whether or not the meshfile was created with HOHQMesh.jl. If the Abaqus file header is not present in the meshfile then the P4estMesh is created with the function p4est_mesh_from_standard_abaqus.

The default keyword argument initial_refinement_level=0 corresponds to a forest where the number of trees is the same as the number of elements in the original meshfile. Increasing the initial_refinement_level allows one to uniformly refine the base mesh given in the meshfile to create a forest with more trees before the simulation begins. For example, if a two-dimensional base mesh contains 25 elements then setting initial_refinement_level=1 creates an initial forest of 2^2 * 25 = 100 trees.

Arguments

  • meshfile::String: an uncurved Abaqus mesh file that can be imported by p4est.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • p4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.
  • boundary_symbols::Vector{Symbol}: A vector of symbols that correspond to the boundary names in the meshfile. If nothing is passed then all boundaries are named :all.
source
Trixi.ParametersEulerGravityType
ParametersEulerGravity(; background_density=0.0,
+                 boundary_symbols = nothing)

Main mesh constructor for the P4estMesh that imports an unstructured, conforming mesh from an Abaqus mesh file (.inp). Each element of the conforming mesh parsed from the meshfile is created as a p4est tree datatype.

To create a curved unstructured mesh P4estMesh two strategies are available:

  • p4est_mesh_from_hohqmesh_abaqus: High-order, curved boundary information created by HOHQMesh.jl is available in the meshfile. The mesh polynomial degree polydeg of the boundaries is provided from the meshfile. The computation of the mapped tree coordinates is done with transfinite interpolation with linear blending similar to UnstructuredMesh2D. Boundary name information is also parsed from the meshfile such that different boundary conditions can be set at each named boundary on a given tree.
  • p4est_mesh_from_standard_abaqus: By default, with mapping=nothing and polydeg=1, this creates a straight-sided from the information parsed from the meshfile. If a mapping function is specified then it computes the mapped tree coordinates via polynomial interpolants with degree polydeg. The mesh created by this function will only have one boundary :all if boundary_symbols is not specified. If boundary_symbols is specified the mesh file will be parsed for nodesets defining the boundary nodes from which boundary edges (2D) and faces (3D) will be assigned.

Note that the mapping and polydeg keyword arguments are only used by the p4est_mesh_from_standard_abaqus function. The p4est_mesh_from_hohqmesh_abaqus function obtains the mesh polydeg directly from the meshfile and constructs the transfinite mapping internally.

The particular strategy is selected according to the header present in the meshfile where the constructor checks whether or not the meshfile was created with HOHQMesh.jl. If the Abaqus file header is not present in the meshfile then the P4estMesh is created with the function p4est_mesh_from_standard_abaqus.

The default keyword argument initial_refinement_level=0 corresponds to a forest where the number of trees is the same as the number of elements in the original meshfile. Increasing the initial_refinement_level allows one to uniformly refine the base mesh given in the meshfile to create a forest with more trees before the simulation begins. For example, if a two-dimensional base mesh contains 25 elements then setting initial_refinement_level=1 creates an initial forest of 2^2 * 25 = 100 trees.

Arguments

  • meshfile::String: an uncurved Abaqus mesh file that can be imported by p4est.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • p4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.
  • boundary_symbols::Vector{Symbol}: A vector of symbols that correspond to the boundary names in the meshfile. If nothing is passed then all boundaries are named :all.
source
Trixi.PerformanceCounterType
PerformanceCounter()

A PerformanceCounter can be used to track the runtime performance of some calls. Add a new runtime measurement via put!(counter, runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.

source
Trixi.PerformanceCounterListType
PerformanceCounterList{N}()

A PerformanceCounterList{N} can be used to track the runtime performance of calls to multiple functions, adding them up. Add a new runtime measurement via put!(counter.counters[i], runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.

source
Trixi.PlotData1DType
PlotData1D

Holds all relevant data for creating 1D plots of multiple solution variables and to visualize the mesh.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PlotData1DMethod
PlotData1D(u, semi [or mesh, equations, solver, cache];
-           solution_variables=nothing, nvisnodes=nothing)

Create a new PlotData1D object that can be used for visualizing 1D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.

nvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.

When visualizing data from a two-dimensional simulation, a 1D slice is extracted for plotting. slice specifies the axis along which the slice is extracted and may be :x, or :y. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0). Both of these values are ignored when visualizing 1D data. This applies analogously to three-dimensional simulations, where slice may be :xy, :xz, or :yz.

Another way to visualize 2D/3D data is by creating a plot along a given curve. This is done with the keyword argument curve. It can be set to a list of 2D/3D points which define the curve. When using curve any other input from slice or point will be ignored.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PlotData1DMethod
PlotData1D(sol; kwargs...)

Create a PlotData1D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PlotData2DCartesianType
PlotData2D

Holds all relevant data for creating 2D plots of multiple solution variables and to visualize the mesh.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PerformanceCounterType
PerformanceCounter()

A PerformanceCounter can be used to track the runtime performance of some calls. Add a new runtime measurement via put!(counter, runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.

source
Trixi.PerformanceCounterListType
PerformanceCounterList{N}()

A PerformanceCounterList{N} can be used to track the runtime performance of calls to multiple functions, adding them up. Add a new runtime measurement via put!(counter.counters[i], runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.

source
Trixi.PlotData1DType
PlotData1D

Holds all relevant data for creating 1D plots of multiple solution variables and to visualize the mesh.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PlotData1DMethod
PlotData1D(u, semi [or mesh, equations, solver, cache];
+           solution_variables=nothing, nvisnodes=nothing)

Create a new PlotData1D object that can be used for visualizing 1D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.

nvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.

When visualizing data from a two-dimensional simulation, a 1D slice is extracted for plotting. slice specifies the axis along which the slice is extracted and may be :x, or :y. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0). Both of these values are ignored when visualizing 1D data. This applies analogously to three-dimensional simulations, where slice may be :xy, :xz, or :yz.

Another way to visualize 2D/3D data is by creating a plot along a given curve. This is done with the keyword argument curve. It can be set to a list of 2D/3D points which define the curve. When using curve any other input from slice or point will be ignored.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PlotData1DMethod
PlotData1D(sol; kwargs...)

Create a PlotData1D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PlotData2DCartesianType
PlotData2D

Holds all relevant data for creating 2D plots of multiple solution variables and to visualize the mesh.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.PolytropicEulerEquations2DType
PolytropicEulerEquations2D(gamma, kappa)

The polytropic Euler equations

\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho v_2 \end{pmatrix} @@ -287,65 +287,65 @@ = \begin{pmatrix} 0 \\ 0 \\ 0 -\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in two space dimensions. Here, $\rho$ is the density and $v_1$ andv_2 the velocities and

\[p = \kappa\rho^\gamma\]

the pressure, which we replaced using this relation.

source
Trixi.PositivityPreservingLimiterZhangShuType
PositivityPreservingLimiterZhangShu(; threshold, variables)

The fully-discrete positivity-preserving limiter of

  • Zhang, Shu (2011) Maximum-principle-satisfying and positivity-preserving high-order schemes for conservation laws: survey and new developments doi: 10.1098/rspa.2011.0153

The limiter is applied to all scalar variables in their given order using the associated thresholds to determine the minimal acceptable values. The order of the variables is important and might have a strong influence on the robustness.

source
Trixi.SaveRestartCallbackType
SaveRestartCallback(; interval=0,
+\end{pmatrix}\]

for an ideal gas with ratio of specific heats gamma in two space dimensions. Here, $\rho$ is the density and $v_1$ andv_2 the velocities and

\[p = \kappa\rho^\gamma\]

the pressure, which we replaced using this relation.

source
Trixi.PositivityPreservingLimiterZhangShuType
PositivityPreservingLimiterZhangShu(; threshold, variables)

The fully-discrete positivity-preserving limiter of

  • Zhang, Shu (2011) Maximum-principle-satisfying and positivity-preserving high-order schemes for conservation laws: survey and new developments doi: 10.1098/rspa.2011.0153

The limiter is applied to all scalar variables in their given order using the associated thresholds to determine the minimal acceptable values. The order of the variables is important and might have a strong influence on the robustness.

source
Trixi.SaveRestartCallbackType
SaveRestartCallback(; interval=0,
                       save_final_restart=true,
-                      output_directory="out")

Save the current numerical solution in a restart file every interval time steps.

source
Trixi.SaveSolutionCallbackType
SaveSolutionCallback(; interval::Integer=0,
+                      output_directory="out")

Save the current numerical solution in a restart file every interval time steps.

source
Trixi.SaveSolutionCallbackType
SaveSolutionCallback(; interval::Integer=0,
                        dt=nothing,
                        save_initial_solution=true,
                        save_final_solution=true,
                        output_directory="out",
-                       solution_variables=cons2prim)

Save the current numerical solution in regular intervals. Either pass interval to save every interval time steps or pass dt to save in intervals of dt in terms of integration time by adding additional (shortened) time steps where necessary (note that this may change the solution). solution_variables can be any callable that converts the conservative variables at a single point to a set of solution variables. The first parameter passed to solution_variables will be the set of conservative variables and the second parameter is the equation struct.

source
Trixi.SemidiscretizationCoupledType
SemidiscretizationCoupled

A struct used to bundle multiple semidiscretizations. semidiscretize will return an ODEProblem that synchronizes time steps between the semidiscretizations. Each call of rhs! will call rhs! for each semidiscretization individually. The semidiscretizations can be coupled by gluing meshes together using BoundaryConditionCoupled.

Experimental code

This is an experimental feature and can change any time.

source
Trixi.SemidiscretizationEulerAcousticsType
SemidiscretizationEulerAcoustics(semi_acoustics::SemiAcoustics, semi_euler::SemiEuler;
-                                 source_region=x->true, weights=x->1.0)
Experimental code

This semidiscretization is experimental and may change in any future release.

Construct a semidiscretization of the acoustic perturbation equations that is coupled with the compressible Euler equations via source terms for the perturbed velocity. Both semidiscretizations have to use the same mesh and solvers with a shared basis. The coupling region is described by a function source_region that maps the coordinates of a single node to true or false depending on whether the point lies within the coupling region or not. A weighting function weights that maps coordinates to weights is applied to the acoustic source terms. Note that this semidiscretization should be used in conjunction with EulerAcousticsCouplingCallback and only works in two dimensions.

source
Trixi.SemidiscretizationEulerGravityType
SemidiscretizationEulerGravity

A struct containing everything needed to describe a spatial semidiscretization of a the compressible Euler equations with self-gravity, reformulating the Poisson equation for the gravitational potential as steady-state problem of the hyperblic diffusion equations.

  • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) "A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics" arXiv: 2008.10593
source
Trixi.SemidiscretizationHyperbolicMethod
SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
+                       solution_variables=cons2prim)

Save the current numerical solution in regular intervals. Either pass interval to save every interval time steps or pass dt to save in intervals of dt in terms of integration time by adding additional (shortened) time steps where necessary (note that this may change the solution). solution_variables can be any callable that converts the conservative variables at a single point to a set of solution variables. The first parameter passed to solution_variables will be the set of conservative variables and the second parameter is the equation struct.

source
Trixi.SemidiscretizationCoupledType
SemidiscretizationCoupled

A struct used to bundle multiple semidiscretizations. semidiscretize will return an ODEProblem that synchronizes time steps between the semidiscretizations. Each call of rhs! will call rhs! for each semidiscretization individually. The semidiscretizations can be coupled by gluing meshes together using BoundaryConditionCoupled.

Experimental code

This is an experimental feature and can change any time.

source
Trixi.SemidiscretizationEulerAcousticsType
SemidiscretizationEulerAcoustics(semi_acoustics::SemiAcoustics, semi_euler::SemiEuler;
+                                 source_region=x->true, weights=x->1.0)
Experimental code

This semidiscretization is experimental and may change in any future release.

Construct a semidiscretization of the acoustic perturbation equations that is coupled with the compressible Euler equations via source terms for the perturbed velocity. Both semidiscretizations have to use the same mesh and solvers with a shared basis. The coupling region is described by a function source_region that maps the coordinates of a single node to true or false depending on whether the point lies within the coupling region or not. A weighting function weights that maps coordinates to weights is applied to the acoustic source terms. Note that this semidiscretization should be used in conjunction with EulerAcousticsCouplingCallback and only works in two dimensions.

source
Trixi.SemidiscretizationEulerGravityType
SemidiscretizationEulerGravity

A struct containing everything needed to describe a spatial semidiscretization of a the compressible Euler equations with self-gravity, reformulating the Poisson equation for the gravitational potential as steady-state problem of the hyperblic diffusion equations.

  • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) "A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics" arXiv: 2008.10593
source
Trixi.SemidiscretizationHyperbolicMethod
SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
                              source_terms=nothing,
                              boundary_conditions=boundary_condition_periodic,
                              RealT=real(solver),
                              uEltype=RealT,
-                             initial_cache=NamedTuple())

Construct a semidiscretization of a hyperbolic PDE.

source
Trixi.SemidiscretizationHyperbolicParabolicMethod
SemidiscretizationHyperbolicParabolic(mesh, both_equations, initial_condition, solver;
                                       solver_parabolic=default_parabolic_solver(),
                                       source_terms=nothing,
                                       both_boundary_conditions=(boundary_condition_periodic, boundary_condition_periodic),
                                       RealT=real(solver),
                                       uEltype=RealT,
-                                      both_initial_caches=(NamedTuple(), NamedTuple()))

Construct a semidiscretization of a hyperbolic-parabolic PDE.

source
Trixi.ShallowWaterEquations1DType
ShallowWaterEquations1D(; gravity, H0 = 0)

Shallow water equations (SWE) in one space dimension. The equations are given by

\[\begin{aligned} + both_initial_caches=(NamedTuple(), NamedTuple()))

Construct a semidiscretization of a hyperbolic-parabolic PDE.

source
Trixi.ShallowWaterEquations1DType
ShallowWaterEquations1D(; gravity, H0 = 0)

Shallow water equations (SWE) in one space dimension. The equations are given by

\[\begin{aligned} \frac{\partial h}{\partial t} + \frac{\partial}{\partial x}(h v) &= 0 \\ \frac{\partial}{\partial t}(h v) + \frac{\partial}{\partial x}\left(h v^2 + \frac{g}{2}h^2\right) + g h \frac{\partial b}{\partial x} &= 0 -\end{aligned}\]

The unknown quantities of the SWE are the water height $h$ and the velocity $v$. The gravitational constant is denoted by g and the (possibly) variable bottom topography function $b(x)$. Conservative variable water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.

The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.

The bottom topography function $b(x)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.

In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the bottom topography must be zero.
  • The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the bottom topography by default.

References for the SWE are many but a good introduction is available in Chapter 13 of the book:

source
Trixi.ShallowWaterEquations2DType
ShallowWaterEquations2D(; gravity, H0 = 0)

Shallow water equations (SWE) in two space dimensions. The equations are given by

\[\begin{aligned} +\end{aligned}\]

The unknown quantities of the SWE are the water height $h$ and the velocity $v$. The gravitational constant is denoted by g and the (possibly) variable bottom topography function $b(x)$. Conservative variable water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.

The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.

The bottom topography function $b(x)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.

In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the bottom topography must be zero.
  • The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the bottom topography by default.

References for the SWE are many but a good introduction is available in Chapter 13 of the book:

source
Trixi.ShallowWaterEquations2DType
ShallowWaterEquations2D(; gravity, H0 = 0)

Shallow water equations (SWE) in two space dimensions. The equations are given by

\[\begin{aligned} \frac{\partial h}{\partial t} + \frac{\partial}{\partial x}(h v_1) + \frac{\partial}{\partial y}(h v_2) &= 0 \\ \frac{\partial}{\partial t}(h v_1) + \frac{\partial}{\partial x}\left(h v_1^2 + \frac{g}{2}h^2\right) + \frac{\partial}{\partial y}(h v_1 v_2) + g h \frac{\partial b}{\partial x} &= 0 \\ \frac{\partial}{\partial t}(h v_2) + \frac{\partial}{\partial x}(h v_1 v_2) + \frac{\partial}{\partial y}\left(h v_2^2 + \frac{g}{2}h^2\right) + g h \frac{\partial b}{\partial y} &= 0. -\end{aligned}\]

The unknown quantities of the SWE are the water height $h$ and the velocities $\mathbf{v} = (v_1, v_2)^T$. The gravitational constant is denoted by g and the (possibly) variable bottom topography function $b(x,y)$. Conservative variable water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.

The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.

The bottom topography function $b(x,y)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.

In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the bottom topography must be zero.
  • The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the bottom topography by default.

References for the SWE are many but a good introduction is available in Chapter 13 of the book:

source
Trixi.ShallowWaterEquationsQuasi1DType
ShallowWaterEquationsQuasi1D(; gravity, H0 = 0, threshold_limiter = nothing threshold_wet = nothing)

The quasi-1D shallow water equations (SWE). The equations are given by

\[\begin{aligned} +\end{aligned}\]

The unknown quantities of the SWE are the water height $h$ and the velocities $\mathbf{v} = (v_1, v_2)^T$. The gravitational constant is denoted by g and the (possibly) variable bottom topography function $b(x,y)$. Conservative variable water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.

The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.

The bottom topography function $b(x,y)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.

In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the bottom topography must be zero.
  • The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the bottom topography by default.

References for the SWE are many but a good introduction is available in Chapter 13 of the book:

source
Trixi.ShallowWaterEquationsQuasi1DType
ShallowWaterEquationsQuasi1D(; gravity, H0 = 0, threshold_limiter = nothing threshold_wet = nothing)

The quasi-1D shallow water equations (SWE). The equations are given by

\[\begin{aligned} \frac{\partial}{\partial t}(a h) + \frac{\partial}{\partial x}(a h v) &= 0 \\ \frac{\partial}{\partial t}(a h v) + \frac{\partial}{\partial x}(a h v^2) + g a h \frac{\partial}{\partial x}(h + b) &= 0 -\end{aligned}\]

The unknown quantities of the Quasi-1D SWE are the water height $h$ and the scaled velocity $v$. The gravitational constant is denoted by g, the (possibly) variable bottom topography function $b(x)$, and (possibly) variable channel width $a(x)$. The water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.

The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.

The bottom topography function $b(x)$ and channel width $a(x)$ are set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero and $a$ to one.

In addition to the unknowns, Trixi.jl currently stores the bottom topography and channel width values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the bottom topography and channel width must be zero.
  • The bottom topography and channel width values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the bottom topography and channel width by default.
source
Trixi.SimpleSSPRK33Type
SimpleSSPRK33(; stage_callbacks=())

The third-order SSP Runge-Kutta method of Shu and Osher.

References

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.StepsizeCallbackType
StepsizeCallback(; cfl=1.0)

Set the time step size according to a CFL condition with CFL number cfl if the time integration method isn't adaptive itself.

source
Trixi.StructuredMeshType
StructuredMesh{NDIMS} <: AbstractMesh{NDIMS}

A structured curved mesh.

Different numbers of cells per dimension are possible and arbitrary functions can be used as domain faces.

source
Trixi.StructuredMeshMethod
StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; periodicity=true)

Create a StructuredMesh that represents a uncurved structured mesh with a rectangular domain.

Arguments

  • cells_per_dimension::NTuple{NDIMS, Int}: the number of cells in each dimension.
  • coordinates_min::NTuple{NDIMS, RealT}: coordinate of the corner in the negative direction of each dimension.
  • coordinates_max::NTuple{NDIMS, RealT}: coordinate of the corner in the positive direction of each dimension.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
source
Trixi.StructuredMeshMethod
StructuredMesh(cells_per_dimension, mapping; RealT=Float64, unsaved_changes=true, mapping_as_string=mapping2string(mapping, length(cells_per_dimension)))

Create a StructuredMesh of the given size and shape that uses RealT as coordinate type.

Arguments

  • cells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.
  • mapping: a function of NDIMS variables to describe the mapping, which transforms the reference mesh to the physical domain. If no mapping_as_string is defined, this function must be defined with the name mapping to allow for restarts. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.
  • RealT::Type: the type that should be used for coordinates.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • mapping_as_string::String: the code that defines the mapping. If CodeTracking can't find the function definition, it can be passed directly here. The code string must define the mapping function with the name mapping. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.
source
Trixi.StructuredMeshMethod
StructuredMesh(cells_per_dimension, faces; RealT=Float64, unsaved_changes=true, faces_as_string=faces2string(faces))

Create a StructuredMesh of the given size and shape that uses RealT as coordinate type.

Arguments

  • cells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.
  • faces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D).
  • RealT::Type: the type that should be used for coordinates.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
source
Trixi.SubcellLimiterIDPType
SubcellLimiterIDP(equations::AbstractEquations, basis;
+\end{aligned}\]

The unknown quantities of the Quasi-1D SWE are the water height $h$ and the scaled velocity $v$. The gravitational constant is denoted by g, the (possibly) variable bottom topography function $b(x)$, and (possibly) variable channel width $a(x)$. The water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.

The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.

The bottom topography function $b(x)$ and channel width $a(x)$ are set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero and $a$ to one.

In addition to the unknowns, Trixi.jl currently stores the bottom topography and channel width values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:

  • The flux values corresponding to the bottom topography and channel width must be zero.
  • The bottom topography and channel width values must be included when defining initial conditions, boundary conditions or source terms.
  • AnalysisCallback analyzes this variable.
  • Trixi.jl's visualization tools will visualize the bottom topography and channel width by default.
source
Trixi.SimpleSSPRK33Type
SimpleSSPRK33(; stage_callbacks=())

The third-order SSP Runge-Kutta method of Shu and Osher.

References

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.StepsizeCallbackType
StepsizeCallback(; cfl=1.0)

Set the time step size according to a CFL condition with CFL number cfl if the time integration method isn't adaptive itself.

source
Trixi.StructuredMeshType
StructuredMesh{NDIMS} <: AbstractMesh{NDIMS}

A structured curved mesh.

Different numbers of cells per dimension are possible and arbitrary functions can be used as domain faces.

source
Trixi.StructuredMeshMethod
StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; periodicity=true)

Create a StructuredMesh that represents a uncurved structured mesh with a rectangular domain.

Arguments

  • cells_per_dimension::NTuple{NDIMS, Int}: the number of cells in each dimension.
  • coordinates_min::NTuple{NDIMS, RealT}: coordinate of the corner in the negative direction of each dimension.
  • coordinates_max::NTuple{NDIMS, RealT}: coordinate of the corner in the positive direction of each dimension.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
source
Trixi.StructuredMeshMethod
StructuredMesh(cells_per_dimension, mapping; RealT=Float64, unsaved_changes=true, mapping_as_string=mapping2string(mapping, length(cells_per_dimension)))

Create a StructuredMesh of the given size and shape that uses RealT as coordinate type.

Arguments

  • cells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.
  • mapping: a function of NDIMS variables to describe the mapping, which transforms the reference mesh to the physical domain. If no mapping_as_string is defined, this function must be defined with the name mapping to allow for restarts. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.
  • RealT::Type: the type that should be used for coordinates.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • mapping_as_string::String: the code that defines the mapping. If CodeTracking can't find the function definition, it can be passed directly here. The code string must define the mapping function with the name mapping. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.
source
Trixi.StructuredMeshMethod
StructuredMesh(cells_per_dimension, faces; RealT=Float64, unsaved_changes=true, faces_as_string=faces2string(faces))

Create a StructuredMesh of the given size and shape that uses RealT as coordinate type.

Arguments

  • cells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.
  • faces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D).
  • RealT::Type: the type that should be used for coordinates.
  • periodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.
source
Trixi.StructuredMeshViewMethod
StructuredMeshView(parent; index_min, index_max)

Create a StructuredMeshView on a StructuredMesh parent.

Arguments

  • parent: the parent StructuredMesh.
  • index_min: starting indices of the parent mesh.
  • index_max: ending indices of the parent mesh.
source
Trixi.SubcellLimiterIDPType
SubcellLimiterIDP(equations::AbstractEquations, basis;
                   local_minmax_variables_cons = String[],
                   positivity_variables_cons = String[],
                   positivity_variables_nonlinear = [],
                   positivity_correction_factor = 0.1,
                   max_iterations_newton = 10,
                   newton_tolerances = (1.0e-12, 1.0e-14),
-                  gamma_constant_newton = 2 * ndims(equations))

Subcell invariant domain preserving (IDP) limiting used with VolumeIntegralSubcellLimiting including:

  • Local maximum/minimum Zalesak-type limiting for conservative variables (local_minmax_variables_cons)
  • Positivity limiting for conservative variables (positivity_variables_cons) and nonlinear variables

(positivity_variables_nonlinear)

Conservative variables to be limited are passed as a vector of strings, e.g. local_minmax_variables_cons = ["rho"] and positivity_variables_cons = ["rho"]. For nonlinear variables the specific functions are passed in a vector, e.g. positivity_variables_nonlinear = [pressure].

The bounds are calculated using the low-order FV solution. The positivity limiter uses positivity_correction_factor such that u^new >= positivity_correction_factor * u^FV. The limiting of nonlinear variables uses a Newton-bisection method with a maximum of max_iterations_newton iterations, relative and absolute tolerances of newton_tolerances and a provisional update constant gamma_constant_newton (gamma_constant_newton>=2*d, where d = #dimensions). See equation (20) of Pazner (2020) and equation (30) of Rueda-Ramírez et al. (2022).

Note

This limiter and the correction callback SubcellLimiterIDPCorrection only work together. Without the callback, no correction takes place, leading to a standard low-order FV scheme.

References

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.SubcellLimiterIDPCorrectionType
SubcellLimiterIDPCorrection()

Perform antidiffusive correction stage for the a posteriori IDP limiter SubcellLimiterIDP called with VolumeIntegralSubcellLimiting.

Note

This callback and the actual limiter SubcellLimiterIDP only work together. This is not a replacement but a necessary addition.

References

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.SurfaceIntegralWeakFormType
SurfaceIntegralWeakForm(surface_flux=flux_central)

The classical weak form surface integral type for DG methods as explained in standard textbooks.

See also VolumeIntegralWeakForm.

References

source
Trixi.T8codeMeshType
T8codeMesh{NDIMS} <: AbstractMesh{NDIMS}

An unstructured curved mesh based on trees that uses the C library 't8code' to manage trees and mesh refinement.

source
Trixi.T8codeMeshMethod
T8codeMesh(trees_per_dimension; polydeg, mapping=identity,
-           RealT=Float64, initial_refinement_level=0, periodicity=true)

Create a structured potentially curved 'T8codeMesh' of the specified size.

Non-periodic boundaries will be called ':xneg', ':xpos', ':yneg', ':ypos', ':zneg', ':zpos'.

Arguments

  • 'treesperdimension::NTupleE{NDIMS, Int}': the number of trees in each dimension.
  • 'polydeg::Integer': polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • faces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • 'RealT::Type': the type that should be used for coordinates.
  • 'initialrefinementlevel::Integer': refine the mesh uniformly to this level before the simulation starts.
  • 'periodicity': either a 'Bool' deciding if all of the boundaries are periodic or an 'NTuple{NDIMS, Bool}' deciding for each dimension if the boundaries in this dimension are periodic.
source
Trixi.T8codeMeshMethod
T8codeMesh(conn::Ptr{p4est_connectivity}; kwargs...)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.

Arguments

  • conn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.T8codeMeshMethod
T8codeMesh(conn::Ptr{p8est_connectivity}; kwargs...)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.

Arguments

  • conn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.T8codeMeshMethod
T8codeMesh(cmesh::Ptr{t8_cmesh},
+                  gamma_constant_newton = 2 * ndims(equations))

Subcell invariant domain preserving (IDP) limiting used with VolumeIntegralSubcellLimiting including:

  • Local maximum/minimum Zalesak-type limiting for conservative variables (local_minmax_variables_cons)
  • Positivity limiting for conservative variables (positivity_variables_cons) and nonlinear variables

(positivity_variables_nonlinear)

Conservative variables to be limited are passed as a vector of strings, e.g. local_minmax_variables_cons = ["rho"] and positivity_variables_cons = ["rho"]. For nonlinear variables the specific functions are passed in a vector, e.g. positivity_variables_nonlinear = [pressure].

The bounds are calculated using the low-order FV solution. The positivity limiter uses positivity_correction_factor such that u^new >= positivity_correction_factor * u^FV. The limiting of nonlinear variables uses a Newton-bisection method with a maximum of max_iterations_newton iterations, relative and absolute tolerances of newton_tolerances and a provisional update constant gamma_constant_newton (gamma_constant_newton>=2*d, where d = #dimensions). See equation (20) of Pazner (2020) and equation (30) of Rueda-Ramírez et al. (2022).

Note

This limiter and the correction callback SubcellLimiterIDPCorrection only work together. Without the callback, no correction takes place, leading to a standard low-order FV scheme.

References

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.SubcellLimiterIDPCorrectionType
SubcellLimiterIDPCorrection()

Perform antidiffusive correction stage for the a posteriori IDP limiter SubcellLimiterIDP called with VolumeIntegralSubcellLimiting.

Note

This callback and the actual limiter SubcellLimiterIDP only work together. This is not a replacement but a necessary addition.

References

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.SurfaceIntegralWeakFormType
SurfaceIntegralWeakForm(surface_flux=flux_central)

The classical weak form surface integral type for DG methods as explained in standard textbooks.

See also VolumeIntegralWeakForm.

References

source
Trixi.T8codeMeshType
T8codeMesh{NDIMS} <: AbstractMesh{NDIMS}

An unstructured curved mesh based on trees that uses the C library 't8code' to manage trees and mesh refinement.

source
Trixi.T8codeMeshMethod
T8codeMesh(trees_per_dimension; polydeg, mapping=identity,
+           RealT=Float64, initial_refinement_level=0, periodicity=true)

Create a structured potentially curved 'T8codeMesh' of the specified size.

Non-periodic boundaries will be called ':xneg', ':xpos', ':yneg', ':ypos', ':zneg', ':zpos'.

Arguments

  • 'treesperdimension::NTupleE{NDIMS, Int}': the number of trees in each dimension.
  • 'polydeg::Integer': polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • faces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • coordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.
  • 'RealT::Type': the type that should be used for coordinates.
  • 'initialrefinementlevel::Integer': refine the mesh uniformly to this level before the simulation starts.
  • 'periodicity': either a 'Bool' deciding if all of the boundaries are periodic or an 'NTuple{NDIMS, Bool}' deciding for each dimension if the boundaries in this dimension are periodic.
source
Trixi.T8codeMeshMethod
T8codeMesh(conn::Ptr{p4est_connectivity}; kwargs...)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.

Arguments

  • conn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.T8codeMeshMethod
T8codeMesh(conn::Ptr{p8est_connectivity}; kwargs...)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.

Arguments

  • conn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.T8codeMeshMethod
T8codeMesh(cmesh::Ptr{t8_cmesh},
            mapping=nothing, polydeg=1, RealT=Float64,
-           initial_refinement_level=0)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a t8_cmesh data structure.

Arguments

  • cmesh::Ptr{t8_cmesh}: Pointer to a cmesh object.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.T8codeMeshMethod
T8codeMesh(meshfile::String, ndims; kwargs...)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a Gmsh mesh file (.msh).

Arguments

  • meshfile::String: path to a Gmsh mesh file.
  • ndims: Mesh file dimension: 2 or 3.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.TimeSeriesCallbackType
TimeSeriesCallback(semi, point_coordinates;
+           initial_refinement_level=0)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a t8_cmesh data structure.

Arguments

  • cmesh::Ptr{t8_cmesh}: Pointer to a cmesh object.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.T8codeMeshMethod
T8codeMesh(meshfile::String, ndims; kwargs...)

Main mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a Gmsh mesh file (.msh).

Arguments

  • meshfile::String: path to a Gmsh mesh file.
  • ndims: Mesh file dimension: 2 or 3.
  • mapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
source
Trixi.TimeSeriesCallbackType
TimeSeriesCallback(semi, point_coordinates;
                    interval=1, solution_variables=cons2cons,
                    output_directory="out", filename="time_series.h5",
-                   RealT=real(solver), uEltype=eltype(cache.elements))

Create a callback that records point-wise data at points given in point_coordinates every interval time steps. The point coordinates are to be specified either as a vector of coordinate tuples or as a two-dimensional array where the first dimension is the point number and the second dimension is the coordinate dimension. By default, the conservative variables are recorded, but this can be controlled by passing a different conversion function to solution_variables.

After the last time step, the results are stored in an HDF5 file filename in directory output_directory.

The real data type RealT and data type for solution variables uEltype default to the respective types used in the solver and the cache.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.TrafficFlowLWREquations1DType
TrafficFlowLWREquations1D

The classic Lighthill-Witham Richards (LWR) model for 1D traffic flow. The car density is denoted by $u \in [0, 1]$ and the maximum possible speed (e.g. due to speed limits) is $v_{\text{max}}$.

\[\partial_t u + v_{\text{max}} \partial_1 [u (1 - u)] = 0\]

For more details see e.g. Section 11.1 of

  • Randall LeVeque (2002)

Finite Volume Methods for Hyperbolic Problems [DOI: 10.1017/CBO9780511791253]https://doi.org/10.1017/CBO9780511791253

source
Trixi.TreeMeshType
TreeMesh{NDIMS} <: AbstractMesh{NDIMS}

A Cartesian mesh based on trees of hypercubes to support adaptive mesh refinement.

source
Trixi.UnstructuredMesh2DType
UnstructuredMesh2D <: AbstractMesh{2}

An unstructured (possibly curved) quadrilateral mesh.

UnstructuredMesh2D(filename; RealT=Float64, periodicity=false)

All mesh information, neighbour coupling, and boundary curve information is read in from a mesh file filename.

source
Trixi.UnstructuredSortedBoundaryTypesType
UnstructuredSortedBoundaryTypes

General container to sort the boundary conditions by type for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type to expedite computation during the call to calc_boundary_flux!. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing.

source
Trixi.ViscousFormulationLocalDGType
ViscousFormulationLocalDG(penalty_parameter)

The local DG (LDG) flux from "The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems" by Cockburn and Shu (1998).

Note that, since this implementation does not involve the parabolic "upwinding" vector, the LDG solver is equivalent to ViscousFormulationBassiRebay1 with an LDG-type penalization.

source
Trixi.VisualizationCallbackMethod
VisualizationCallback(; interval=0,
+                   RealT=real(solver), uEltype=eltype(cache.elements))

Create a callback that records point-wise data at points given in point_coordinates every interval time steps. The point coordinates are to be specified either as a vector of coordinate tuples or as a two-dimensional array where the first dimension is the point number and the second dimension is the coordinate dimension. By default, the conservative variables are recorded, but this can be controlled by passing a different conversion function to solution_variables.

After the last time step, the results are stored in an HDF5 file filename in directory output_directory.

The real data type RealT and data type for solution variables uEltype default to the respective types used in the solver and the cache.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.TrafficFlowLWREquations1DType
TrafficFlowLWREquations1D

The classic Lighthill-Witham Richards (LWR) model for 1D traffic flow. The car density is denoted by $u \in [0, 1]$ and the maximum possible speed (e.g. due to speed limits) is $v_{\text{max}}$.

\[\partial_t u + v_{\text{max}} \partial_1 [u (1 - u)] = 0\]

For more details see e.g. Section 11.1 of

  • Randall LeVeque (2002)

Finite Volume Methods for Hyperbolic Problems [DOI: 10.1017/CBO9780511791253]https://doi.org/10.1017/CBO9780511791253

source
Trixi.TreeMeshType
TreeMesh{NDIMS} <: AbstractMesh{NDIMS}

A Cartesian mesh based on trees of hypercubes to support adaptive mesh refinement.

source
Trixi.UnstructuredMesh2DType
UnstructuredMesh2D <: AbstractMesh{2}

An unstructured (possibly curved) quadrilateral mesh.

UnstructuredMesh2D(filename; RealT=Float64, periodicity=false)

All mesh information, neighbour coupling, and boundary curve information is read in from a mesh file filename.

source
Trixi.UnstructuredSortedBoundaryTypesType
UnstructuredSortedBoundaryTypes

General container to sort the boundary conditions by type for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type to expedite computation during the call to calc_boundary_flux!. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing.

source
Trixi.ViscousFormulationLocalDGType
ViscousFormulationLocalDG(penalty_parameter)

The local DG (LDG) flux from "The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems" by Cockburn and Shu (1998).

Note that, since this implementation does not involve the parabolic "upwinding" vector, the LDG solver is equivalent to ViscousFormulationBassiRebay1 with an LDG-type penalization.

source
Trixi.VisualizationCallbackMethod
VisualizationCallback(; interval=0,
                         solution_variables=cons2prim,
                         variable_names=[],
                         show_mesh=false,
                         plot_data_creator=PlotData2D,
                         plot_creator=show_plot,
-                        plot_arguments...)

Create a callback that visualizes results during a simulation, also known as in-situ visualization.

Experimental implementation

This is an experimental feature and may change in any future releases.

The interval specifies the number of time step iterations after which a new plot is generated. The available variables to plot are configured with the solution_variables parameter, which acts the same way as for the SaveSolutionCallback. The variables to be actually plotted can be selected by providing a single string or a list of strings to variable_names, and if show_mesh is true, an additional plot with the mesh will be generated.

To customize the generated figure, plot_data_creator allows to use different plot data types. With plot_creator you can further specify an own function to visualize results, which must support the same interface as the default implementation show_plot. All remaining keyword arguments are collected and passed as additional arguments to the plotting command.

source
Trixi.VolumeIntegralFluxDifferencingType
VolumeIntegralFluxDifferencing(volume_flux)

Volume integral type for DG methods based on SBP operators and flux differencing using a symmetric two-point volume_flux. This volume_flux needs to satisfy the interface of numerical fluxes in Trixi.jl.

References

source
Trixi.VolumeIntegralPureLGLFiniteVolumeType
VolumeIntegralPureLGLFiniteVolume(volume_flux_fv)

A volume integral that only uses the subcell finite volume schemes of the VolumeIntegralShockCapturingHG.

This gives a formally O(1)-accurate finite volume scheme on an LGL-type subcell mesh (LGL = Legendre-Gauss-Lobatto).

Experimental implementation

This is an experimental feature and may change in future releases.

References

  • Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
source
Trixi.VolumeIntegralShockCapturingHGType
VolumeIntegralShockCapturingHG(indicator; volume_flux_dg=flux_central,
-                                          volume_flux_fv=flux_lax_friedrichs)

Shock-capturing volume integral type for DG methods using a convex blending of the finite volume method with numerical flux volume_flux_fv and the VolumeIntegralFluxDifferencing with volume flux volume_flux_dg. The amount of blending is determined by the indicator, e.g., IndicatorHennemannGassner.

References

  • Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
source
Trixi.VolumeIntegralSubcellLimitingType
VolumeIntegralSubcellLimiting(limiter;
-                              volume_flux_dg, volume_flux_fv)

A subcell limiting volume integral type for DG methods based on subcell blending approaches with a low-order FV method. Used with limiter SubcellLimiterIDP.

Note

Subcell limiting methods are not fully functional on non-conforming meshes. This is mainly because the implementation assumes that low- and high-order schemes have the same surface terms, which is not guaranteed for non-conforming meshes. The low-order scheme with a high-order mortar is not invariant domain preserving.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.VolumeIntegralUpwindType
VolumeIntegralUpwind(splitting)

Specialized volume integral for finite difference summation-by-parts (FDSBP) solvers. Can be used together with the upwind SBP operators of Mattsson (2017) implemented in SummationByPartsOperators.jl. The splitting controls the discretization.

See also splitting_steger_warming, splitting_lax_friedrichs, splitting_vanleer_haenel.

References

Experimental implementation (upwind SBP)

This is an experimental feature and may change in future releases.

source
Trixi.VolumeIntegralWeakFormType
VolumeIntegralWeakForm()

The classical weak form volume integral type for DG methods as explained in standard textbooks.

References

VolumeIntegralWeakForm() is only implemented for conserved terms as non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, see VolumeIntegralFluxDifferencing. This treatment is required to achieve, e.g., entropy-stability or well-balancedness.

source
Base.getindexMethod
Base.getindex(pd::AbstractPlotData, variable_name)

Extract a single variable variable_name from pd for plotting with Plots.plot.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Base.resize!Method
resize!(c::AbstractContainer, new_length) -> AbstractContainer

Resize c to contain new_length elements. If new_length is smaller than the current container length, the first new_length elements will be retained. If new_length is larger, the new elements are invalidated.

source
PolynomialBases.compute_coefficientsMethod
compute_coefficients(func, t, semi::AbstractSemidiscretization)

Compute the discrete coefficients of the continuous function func at time t associated with the semidiscretization semi. For example, the discrete coefficients of func for a discontinuous Galerkin spectral element method (DGSEM) are the values of func at the Lobatto-Legendre nodes. Similarly, a classical finite difference method will use the values of func at the nodes of the grid assoociated with the semidiscretization semi.

For semidiscretizations semi associated with an initial condition, func can be omitted to use the given initial condition at time t.

source
PolynomialBases.integrateMethod
integrate(f, u, basis::LobattoLegendreBasis)

Map the function f to the coefficients u and integrate with respect to the quadrature rule given by basis.

source
PolynomialBases.integrateMethod
integrate([func=(u_node,equations)->u_node,] u_ode, semi::AbstractSemidiscretization; normalize=true)

Call func(u_node, equations) for each vector of nodal variables u_node in u_ode and integrate the result using a quadrature associated with the semidiscretization semi.

If normalize is true, the result is divided by the total volume of the computational domain.

source
SciMLBase.add_tstop!Method
add_tstop!(integrator::SimpleIntegratorSSP, t)

Add a time stop during the time integration process. This function is called after the periodic SaveSolutionCallback to specify the next stop to save the solution.

source
SummationByPartsOperators.semidiscretizeMethod
semidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan)

Wrap the semidiscretization semi as a split ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The parabolic right-hand side is the first function of the split ODE problem and will be used by default by the implicit part of IMEX methods from the SciML ecosystem.

source
SummationByPartsOperators.semidiscretizeMethod
semidiscretize(semi::AbstractSemidiscretization, tspan, restart_file::AbstractString)

Wrap the semidiscretization semi as an ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The initial condition etc. is taken from the restart_file.

source
Trixi.DGMultiBasisMethod
DGMultiBasis(element_type, polydeg; approximation_type = Polynomial(), kwargs...)

Constructs a basis for DGMulti solvers. Returns a "StartUpDG.RefElemData" object. The kwargs arguments are additional keyword arguments for RefElemData, such as quad_rule_vol. These are the same as the RefElemData_kwargs used in DGMulti. For more info, see the StartUpDG.jl docs.

source
Trixi.P4estMeshCubedSphereMethod
P4estMeshCubedSphere(trees_per_face_dimension, layers, inner_radius, thickness;
+                        plot_arguments...)

Create a callback that visualizes results during a simulation, also known as in-situ visualization.

Experimental implementation

This is an experimental feature and may change in any future releases.

The interval specifies the number of time step iterations after which a new plot is generated. The available variables to plot are configured with the solution_variables parameter, which acts the same way as for the SaveSolutionCallback. The variables to be actually plotted can be selected by providing a single string or a list of strings to variable_names, and if show_mesh is true, an additional plot with the mesh will be generated.

To customize the generated figure, plot_data_creator allows to use different plot data types. With plot_creator you can further specify an own function to visualize results, which must support the same interface as the default implementation show_plot. All remaining keyword arguments are collected and passed as additional arguments to the plotting command.

source
Trixi.VolumeIntegralFluxDifferencingType
VolumeIntegralFluxDifferencing(volume_flux)

Volume integral type for DG methods based on SBP operators and flux differencing using a symmetric two-point volume_flux. This volume_flux needs to satisfy the interface of numerical fluxes in Trixi.jl.

References

source
Trixi.VolumeIntegralPureLGLFiniteVolumeType
VolumeIntegralPureLGLFiniteVolume(volume_flux_fv)

A volume integral that only uses the subcell finite volume schemes of the VolumeIntegralShockCapturingHG.

This gives a formally O(1)-accurate finite volume scheme on an LGL-type subcell mesh (LGL = Legendre-Gauss-Lobatto).

Experimental implementation

This is an experimental feature and may change in future releases.

References

  • Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
source
Trixi.VolumeIntegralShockCapturingHGType
VolumeIntegralShockCapturingHG(indicator; volume_flux_dg=flux_central,
+                                          volume_flux_fv=flux_lax_friedrichs)

Shock-capturing volume integral type for DG methods using a convex blending of the finite volume method with numerical flux volume_flux_fv and the VolumeIntegralFluxDifferencing with volume flux volume_flux_dg. The amount of blending is determined by the indicator, e.g., IndicatorHennemannGassner.

References

  • Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
source
Trixi.VolumeIntegralSubcellLimitingType
VolumeIntegralSubcellLimiting(limiter;
+                              volume_flux_dg, volume_flux_fv)

A subcell limiting volume integral type for DG methods based on subcell blending approaches with a low-order FV method. Used with limiter SubcellLimiterIDP.

Note

Subcell limiting methods are not fully functional on non-conforming meshes. This is mainly because the implementation assumes that low- and high-order schemes have the same surface terms, which is not guaranteed for non-conforming meshes. The low-order scheme with a high-order mortar is not invariant domain preserving.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.VolumeIntegralUpwindType
VolumeIntegralUpwind(splitting)

Specialized volume integral for finite difference summation-by-parts (FDSBP) solvers. Can be used together with the upwind SBP operators of Mattsson (2017) implemented in SummationByPartsOperators.jl. The splitting controls the discretization.

See also splitting_steger_warming, splitting_lax_friedrichs, splitting_vanleer_haenel.

References

Experimental implementation (upwind SBP)

This is an experimental feature and may change in future releases.

source
Trixi.VolumeIntegralWeakFormType
VolumeIntegralWeakForm()

The classical weak form volume integral type for DG methods as explained in standard textbooks.

References

VolumeIntegralWeakForm() is only implemented for conserved terms as non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, see VolumeIntegralFluxDifferencing. This treatment is required to achieve, e.g., entropy-stability or well-balancedness.

source
Base.getindexMethod
Base.getindex(pd::AbstractPlotData, variable_name)

Extract a single variable variable_name from pd for plotting with Plots.plot.

Experimental implementation

This is an experimental feature and may change in future releases.

source
Base.resize!Method
resize!(c::AbstractContainer, new_length) -> AbstractContainer

Resize c to contain new_length elements. If new_length is smaller than the current container length, the first new_length elements will be retained. If new_length is larger, the new elements are invalidated.

source
PolynomialBases.compute_coefficientsMethod
compute_coefficients(func, t, semi::AbstractSemidiscretization)

Compute the discrete coefficients of the continuous function func at time t associated with the semidiscretization semi. For example, the discrete coefficients of func for a discontinuous Galerkin spectral element method (DGSEM) are the values of func at the Lobatto-Legendre nodes. Similarly, a classical finite difference method will use the values of func at the nodes of the grid assoociated with the semidiscretization semi.

For semidiscretizations semi associated with an initial condition, func can be omitted to use the given initial condition at time t.

source
PolynomialBases.integrateMethod
integrate(f, u, basis::LobattoLegendreBasis)

Map the function f to the coefficients u and integrate with respect to the quadrature rule given by basis.

source
PolynomialBases.integrateMethod
integrate([func=(u_node,equations)->u_node,] u_ode, semi::AbstractSemidiscretization; normalize=true)

Call func(u_node, equations) for each vector of nodal variables u_node in u_ode and integrate the result using a quadrature associated with the semidiscretization semi.

If normalize is true, the result is divided by the total volume of the computational domain.

source
SciMLBase.add_tstop!Method
add_tstop!(integrator::SimpleIntegratorSSP, t)

Add a time stop during the time integration process. This function is called after the periodic SaveSolutionCallback to specify the next stop to save the solution.

source
SummationByPartsOperators.semidiscretizeMethod
semidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan)

Wrap the semidiscretization semi as a split ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The parabolic right-hand side is the first function of the split ODE problem and will be used by default by the implicit part of IMEX methods from the SciML ecosystem.

source
SummationByPartsOperators.semidiscretizeMethod
semidiscretize(semi::AbstractSemidiscretization, tspan, restart_file::AbstractString)

Wrap the semidiscretization semi as an ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The initial condition etc. is taken from the restart_file.

source
Trixi.DGMultiBasisMethod
DGMultiBasis(element_type, polydeg; approximation_type = Polynomial(), kwargs...)

Constructs a basis for DGMulti solvers. Returns a "StartUpDG.RefElemData" object. The kwargs arguments are additional keyword arguments for RefElemData, such as quad_rule_vol. These are the same as the RefElemData_kwargs used in DGMulti. For more info, see the StartUpDG.jl docs.

source
Trixi.P4estMeshCubedSphereMethod
P4estMeshCubedSphere(trees_per_face_dimension, layers, inner_radius, thickness;
                      polydeg, RealT=Float64,
                      initial_refinement_level=0, unsaved_changes=true,
-                     p4est_partition_allow_for_coarsening=true)

Build a "Cubed Sphere" mesh as P4estMesh with 6 * trees_per_face_dimension^2 * layers trees.

The mesh will have two boundaries, :inside and :outside.

Arguments

  • trees_per_face_dimension::Integer: the number of trees in the first two local dimensions of each face.
  • layers::Integer: the number of trees in the third local dimension of each face, i.e., the number of layers of the sphere.
  • inner_radius::Integer: the inner radius of the sphere.
  • thickness::Integer: the thickness of the sphere. The outer radius will be inner_radius + thickness.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • p4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.
source
Trixi.PlotData2DMethod
PlotData2D(u, semi [or mesh, equations, solver, cache];
+                     p4est_partition_allow_for_coarsening=true)

Build a "Cubed Sphere" mesh as P4estMesh with 6 * trees_per_face_dimension^2 * layers trees.

The mesh will have two boundaries, :inside and :outside.

Arguments

  • trees_per_face_dimension::Integer: the number of trees in the first two local dimensions of each face.
  • layers::Integer: the number of trees in the third local dimension of each face, i.e., the number of layers of the sphere.
  • inner_radius::Integer: the inner radius of the sphere.
  • thickness::Integer: the thickness of the sphere. The outer radius will be inner_radius + thickness.
  • polydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
  • RealT::Type: the type that should be used for coordinates.
  • initial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.
  • unsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.
  • p4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.
source
Trixi.PlotData2DMethod
PlotData2D(u, semi [or mesh, equations, solver, cache];
            solution_variables=nothing,
            grid_lines=true, max_supported_level=11, nvisnodes=nothing,
            slice=:xy, point=(0.0, 0.0, 0.0))

Create a new PlotData2D object that can be used for visualizing 2D/3D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.

If grid_lines is true, also extract grid vertices for visualizing the mesh. The output resolution is indirectly set via max_supported_level: all data is interpolated to 2^max_supported_level uniformly distributed points in each spatial direction, also setting the maximum allowed refinement level in the solution. nvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.

When visualizing data from a three-dimensional simulation, a 2D slice is extracted for plotting. slice specifies the plane that is being sliced and may be :xy, :xz, or :yz. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0, 0.0). Both of these values are ignored when visualizing 2D data.

Experimental implementation

This is an experimental feature and may change in future releases.

Examples

julia> using Trixi, Plots
@@ -360,7 +360,7 @@
 
 julia> plot(pd["scalar"]) # To plot only a single variable
 
-julia> plot!(getmesh(pd)) # To add grid lines to the plot
source
Trixi.PlotData2DMethod
PlotData2D(sol; kwargs...)

Create a PlotData2D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.ScalarPlotData2DMethod
ScalarPlotData2D(u, semi::AbstractSemidiscretization; kwargs...)

Returns an PlotData2DTriangulated object which is used to visualize a single scalar field. u should be an array whose entries correspond to values of the scalar field at nodal points.

source
Trixi.SummaryCallbackFunction
SummaryCallback()

Create and return a callback that prints a human-readable summary of the simulation setup at the beginning of a simulation and then resets the timer. When the returned callback is executed directly, the current timer values are shown.

source
Trixi.adapt!Method
Trixi.adapt!(mesh::T8codeMesh, adapt_callback; kwargs...)

Adapt a T8codeMesh according to a user-defined adapt_callback.

Arguments

  • mesh::T8codeMesh: Initialized mesh object.

  • adapt_callback: A user-defined callback which tells the adaption routines if an element should be refined, coarsened or stay unchanged.

    The expected callback signature is as follows:

    `adapt_callback(forest, ltreeid, eclass_scheme, lelemntid, elements, is_family, user_data)`
    +julia> plot!(getmesh(pd)) # To add grid lines to the plot
source
Trixi.PlotData2DMethod
PlotData2D(sol; kwargs...)

Create a PlotData2D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).

Experimental implementation

This is an experimental feature and may change in future releases.

source
Trixi.ScalarPlotData2DMethod
ScalarPlotData2D(u, semi::AbstractSemidiscretization; kwargs...)

Returns an PlotData2DTriangulated object which is used to visualize a single scalar field. u should be an array whose entries correspond to values of the scalar field at nodal points.

source
Trixi.SummaryCallbackFunction
SummaryCallback()

Create and return a callback that prints a human-readable summary of the simulation setup at the beginning of a simulation and then resets the timer. When the returned callback is executed directly, the current timer values are shown.

source
Trixi.adapt!Method
Trixi.adapt!(mesh::T8codeMesh, adapt_callback; kwargs...)

Adapt a T8codeMesh according to a user-defined adapt_callback.

Arguments

  • mesh::T8codeMesh: Initialized mesh object.

  • adapt_callback: A user-defined callback which tells the adaption routines if an element should be refined, coarsened or stay unchanged.

    The expected callback signature is as follows:

    `adapt_callback(forest, ltreeid, eclass_scheme, lelemntid, elements, is_family, user_data)`
       # Arguments
       - `forest`: Pointer to the analyzed forest.
       - `ltreeid`: Local index of the current tree where the analyzed elements are part of.
    @@ -373,189 +373,189 @@
       # Returns
         -1 : Coarsen family of elements.
          0 : Stay unchanged.
    -     1 : Refine element.
  • kwargs:

    • recursive = true: Adapt the forest recursively. If true the caller must ensure that the callback returns 0 for every analyzed element at some point to stop the recursion.
    • balance = true: Make sure the adapted forest is 2^(NDIMS-1):1 balanced.
    • partition = true: Partition the forest to redistribute elements evenly among MPI ranks.
    • ghost = true: Create a ghost layer for MPI data exchange.
    • user_data = C_NULL: Pointer to some arbitrary user-defined data.
source
Trixi.adapt_to_mesh_level!Method
adapt_to_mesh_level!(u_ode, semi, level)
-adapt_to_mesh_level!(sol::Trixi.TrixiODESolution, level)

Like adapt_to_mesh_level, but modifies the solution and parts of the semidiscretization (mesh and caches) in place.

source
Trixi.adapt_to_mesh_levelMethod
adapt_to_mesh_level(u_ode, semi, level)
-adapt_to_mesh_level(sol::Trixi.TrixiODESolution, level)

Use the regular adaptive mesh refinement routines to adaptively refine/coarsen the solution u_ode with semidiscretization semi towards a uniformly refined grid with refinement level level. The solution and semidiscretization are copied such that the original objects remain unaltered.

A convenience method accepts an ODE solution object, from which solution and semidiscretization are extracted as needed.

See also: adapt_to_mesh_level!

source
Trixi.balance!Method
Trixi.balance!(mesh::T8codeMesh)

Balance a T8codeMesh to ensure 2^(NDIMS-1):1 face neighbors.

source
Trixi.boundary_condition_linear_xMethod
boundary_condition_linear_x(u_inner, orientation, direction, x, t,
+     1 : Refine element.
  • kwargs:

    • recursive = true: Adapt the forest recursively. If true the caller must ensure that the callback returns 0 for every analyzed element at some point to stop the recursion.
    • balance = true: Make sure the adapted forest is 2^(NDIMS-1):1 balanced.
    • partition = true: Partition the forest to redistribute elements evenly among MPI ranks.
    • ghost = true: Create a ghost layer for MPI data exchange.
    • user_data = C_NULL: Pointer to some arbitrary user-defined data.
  • source
    Trixi.adapt_to_mesh_level!Method
    adapt_to_mesh_level!(u_ode, semi, level)
    +adapt_to_mesh_level!(sol::Trixi.TrixiODESolution, level)

    Like adapt_to_mesh_level, but modifies the solution and parts of the semidiscretization (mesh and caches) in place.

    source
    Trixi.adapt_to_mesh_levelMethod
    adapt_to_mesh_level(u_ode, semi, level)
    +adapt_to_mesh_level(sol::Trixi.TrixiODESolution, level)

    Use the regular adaptive mesh refinement routines to adaptively refine/coarsen the solution u_ode with semidiscretization semi towards a uniformly refined grid with refinement level level. The solution and semidiscretization are copied such that the original objects remain unaltered.

    A convenience method accepts an ODE solution object, from which solution and semidiscretization are extracted as needed.

    See also: adapt_to_mesh_level!

    source
    Trixi.balance!Method
    Trixi.balance!(mesh::T8codeMesh)

    Balance a T8codeMesh to ensure 2^(NDIMS-1):1 face neighbors.

    source
    Trixi.boundary_condition_noslip_wallMethod
    boundary_condition_noslip_wall(u_inner, orientation, direction, x, t,
                                    surface_flux_function,
    -                               equations::LatticeBoltzmannEquations2D)

    No-slip wall boundary condition using the bounce-back approach.

    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    -                             equations::AcousticPerturbationEquations2D)

    Use an orthogonal projection of the perturbed velocities to zero out the normal velocity while retaining the possibility of a tangential velocity in the boundary state. Further details are available in the paper:

    • Marcus Bauer, Jürgen Dierke and Roland Ewert (2011) Application of a discontinuous Galerkin method to discretize acoustic perturbation equations DOI: 10.2514/1.J050333
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    -                             equations::CompressibleEulerEquations2D)

    Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:

    • J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF

    Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761

    Should be used together with UnstructuredMesh2D.

    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    -                             equations::CompressibleEulerEquations3D)

    Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:

    • J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF

    Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    -                             equations::ShallowWaterEquations2D)

    Create a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value. For details see Section 9.2.5 of the book:

    • Eleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, orientation, direction, x, t,
    -                             surface_flux_function, equations::CompressibleEulerEquations1D)

    Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:

    • J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF

      Should be used together with TreeMesh.

    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, orientation_or_normal, x, t, surface_flux_function,
    -                              equations::ShallowWaterEquations1D)

    Create a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value.

    For details see Section 9.2.5 of the book:

    • Eleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662
    source
    Trixi.boundary_condition_wallMethod
    boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
    -                        equations::AcousticPerturbationEquations2D)

    Boundary conditions for a solid wall.

    source
    Trixi.boundary_condition_wallMethod
    boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
    -                            equations::LinearizedEulerEquations2D)

    Boundary conditions for a solid wall.

    source
    Trixi.calc_error_normsMethod
    calc_error_norms([func=(u_node,equations)->u_node,] u_ode, t, analyzer, semi::AbstractSemidiscretization, cache_analysis)

    Calculate discrete L2 and L∞ error norms of func applied to each nodal variable u_node in u_ode. If no exact solution is available, "errors" are calculated using some reference state and can be useful for regression tests.

    source
    Trixi.calc_fast_wavespeed_roeMethod
    calc_fast_wavespeed_roe(u_ll, u_rr, direction, equations::IdealGlmMhdEquations1D)

    Compute the fast magnetoacoustic wave speed using Roe averages as given by

    • Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
    source
    Trixi.calc_fast_wavespeed_roeMethod
    calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations2D)

    Compute the fast magnetoacoustic wave speed using Roe averages as given by

    • Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
    source
    Trixi.calc_fast_wavespeed_roeMethod
    calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)

    Compute the fast magnetoacoustic wave speed using Roe averages as given by

    • Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
    source
    Trixi.calc_wavespeed_roeMethod
    calc_wavespeed_roe(u_ll, u_rr, direction::Integer,
    -                   equations::ShallowWaterEquations1D)

    Calculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} See for instance equation (62) in

    • Paul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044

    Or equation (9.17) in this lecture notes.

    source
    Trixi.calc_wavespeed_roeMethod
    calc_wavespeed_roe(u_ll, u_rr, direction::Integer,
    -                   equations::ShallowWaterEquations2D)

    Calculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} depending on direction. See for instance equation (62) in

    • Paul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044

    Or this slides, slides 8 and 9.

    source
    Trixi.collision_bgkMethod
    collision_bgk(u, dt, equations::LatticeBoltzmannEquations2D)

    Collision operator for the Bhatnagar, Gross, and Krook (BGK) model.

    source
    Trixi.collision_bgkMethod
    collision_bgk(u, dt, equations::LatticeBoltzmannEquations3D)

    Collision operator for the Bhatnagar, Gross, and Krook (BGK) model.

    source
    Trixi.cons2consMethod
    cons2cons(u, equations)

    Return the conserved variables u. While this function is as trivial as identity, it is also as useful.

    source
    Trixi.cons2entropyFunction
    cons2entropy(u, equations)

    Convert the conserved variables u to the entropy variables for a given set of equations with chosen standard entropy.

    u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by entropy2cons.

    source
    Trixi.cons2primFunction
    cons2prim(u, equations)

    Convert the conserved variables u to the primitive variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by prim2cons.

    source
    Trixi.convergence_testMethod
    convergence_test([mod::Module=Main,] elixir::AbstractString, iterations; kwargs...)

    Run iterations Trixi.jl simulations using the setup given in elixir and compute the experimental order of convergence (EOC) in the $L^2$ and $L^\infty$ norm. In each iteration, the resolution of the respective mesh will be doubled. Additional keyword arguments kwargs... and the optional module mod are passed directly to trixi_include.

    This function assumes that the spatial resolution is set via the keywords initial_refinement_level (an integer) or cells_per_dimension (a tuple of integers, one per spatial dimension).

    source
    Trixi.default_example_unstructuredMethod
    default_example_unstructured()

    Return the path to an example elixir that can be used to quickly see Trixi.jl in action on an UnstructuredMesh2D. This simulation is run on the example curved, unstructured mesh given in the Trixi.jl documentation regarding unstructured meshes.

    source
    Trixi.densityMethod
    density(p::Real, equations::LatticeBoltzmannEquations2D)
    -density(u, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic density from the pressure p or the particle distribution functions u.

    source
    Trixi.densityMethod
    density(p::Real, equations::LatticeBoltzmannEquations3D)
    -density(u, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic density from the pressure p or the particle distribution functions u.

    source
    Trixi.downloadMethod
    Trixi.download(src_url, file_path)

    Download a file from given src_url to given file_path if file_path is not already a file. This function just returns file_path. This is a small wrapper of Downloads.download(src_url, file_path) that avoids race conditions when multiple MPI ranks are used.

    source
    Trixi.each_dof_globalMethod
    each_dof_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the degrees of freedom (DOF) in dg. In particular, not the DOFs themselves are returned.

    source
    Trixi.each_face_nodeMethod
    each_face_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the face nodes in dg. In particular, not the face_nodes themselves are returned.

    source
    Trixi.each_face_node_globalMethod
    each_face_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the face nodes in mesh. In particular, not the face nodes themselves are returned.

    source
    Trixi.each_quad_nodeMethod
    each_quad_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the quadrature nodes in dg. In particular, not the quadrature nodes themselves are returned.

    source
    Trixi.each_quad_node_globalMethod
    each_quad_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the global quadrature nodes in mesh. In particular, not the quadrature nodes themselves are returned.

    source
    Trixi.eachboundaryMethod
    eachboundary(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the boundaries in cache. In particular, not the boundaries themselves are returned.

    source
    Trixi.eachcomponentMethod
    eachcomponent(equations::AbstractCompressibleEulerMulticomponentEquations)

    Return an iterator over the indices that specify the location in relevant data structures for the components in AbstractCompressibleEulerMulticomponentEquations. In particular, not the components themselves are returned.

    source
    Trixi.eachcomponentMethod
    eachcomponent(equations::AbstractIdealGlmMhdMulticomponentEquations)

    Return an iterator over the indices that specify the location in relevant data structures for the components in AbstractIdealGlmMhdMulticomponentEquations. In particular, not the components themselves are returned.

    source
    Trixi.eachdimMethod
    eachdim(mesh)

    Return an iterator over the indices that specify the location in relevant data structures for the dimensions in AbstractTree. In particular, not the dimensions themselves are returned.

    source
    Trixi.eachdirectionMethod
    eachdirection(tree::AbstractTree)

    Return an iterator over the indices that specify the location in relevant data structures for the directions in AbstractTree. In particular, not the directions themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in cache. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in mesh. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::ElementContainer1D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::ElementContainer2D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::ElementContainer3D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::UnstructuredElementContainer2D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachinterfaceMethod
    eachinterface(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the interfaces in cache. In particular, not the interfaces themselves are returned.

    source
    Trixi.eachmortarMethod
    eachmortar(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the mortars in cache. In particular, not the mortars themselves are returned.

    source
    Trixi.eachmpiinterfaceMethod
    eachmpiinterface(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the MPI interfaces in cache. In particular, not the interfaces themselves are returned.

    source
    Trixi.eachmpimortarMethod
    eachmpimortar(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the MPI mortars in cache. In particular, not the mortars themselves are returned.

    source
    Trixi.eachnodeMethod
    eachnode(dg::DG)

    Return an iterator over the indices that specify the location in relevant data structures for the nodes in dg. In particular, not the nodes themselves are returned.

    source
    Trixi.eachnodeMethod
    eachnode(basis::LobattoLegendreBasis)

    Return an iterator over the indices that specify the location in relevant data structures for the nodes in basis. In particular, not the nodes themselves are returned.

    source
    Trixi.eachnodeMethod
    eachnode(analyzer::LobattoLegendreAnalyzer)

    Return an iterator over the indices that specify the location in relevant data structures for the nodes in analyzer. In particular, not the nodes themselves are returned.

    source
    Trixi.eachvariableMethod
    eachvariable(equations::AbstractEquations)

    Return an iterator over the indices that specify the location in relevant data structures for the variables in equations. In particular, not the variables themselves are returned.

    source
    Trixi.energy_internalFunction
    energy_internal(u, equations)

    Return the internal energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.energy_kineticFunction
    energy_kinetic(u, equations)

    Return the kinetic energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.energy_totalFunction
    energy_total(u, equations)

    Return the total energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.entropyFunction
    entropy(u, equations)

    Return the chosen entropy of the conserved variables u for a given set of equations.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.entropy2consFunction
    entropy2cons(w, equations)

    Convert the entropy variables w based on a standard entropy to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2entropy.

    source
    Trixi.equilibrium_distributionMethod
    equilibrium_distribution(alpha, rho, v1, v2, v3, equations::LatticeBoltzmannEquations3D)

    Calculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2, v3.

    source
    Trixi.equilibrium_distributionMethod
    equilibrium_distribution(alpha, rho, v1, v2, equations::LatticeBoltzmannEquations2D)

    Calculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2.

    source
    Trixi.examples_dirMethod
    examples_dir()

    Return the directory where the example files provided with Trixi.jl are located. If Trixi.jl is installed as a regular package (with ]add Trixi), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir:

    Examples

    readdir(examples_dir())
    source
    Trixi.fluxFunction
    flux(u, orientation_or_normal, equations)

    Given the conservative variables u, calculate the (physical) flux in Cartesian direction orientation::Integer or in arbitrary direction normal::AbstractVector for the corresponding set of governing equations. orientation is 1, 2, and 3 for the x-, y-, and z-directions, respectively.

    source
    Trixi.fluxMethod
    flux(u, normal_direction::AbstractVector, equations::AbstractEquations{1})

    Enables calling flux with a non-integer argument normal_direction for one-dimensional equations. Returns the value of flux(u, 1, equations) scaled by normal_direction[1].

    source
    Trixi.flux_centralMethod
    flux_central(u_ll, u_rr, orientation_or_normal_direction, equations::AbstractEquations)

    The classical central numerical flux f((u_ll) + f(u_rr)) / 2. When this flux is used as volume flux, the discretization is equivalent to the classical weak form DG method (except floating point errors).

    source
    Trixi.flux_chan_etalMethod

    @inline function fluxchanetal(ull, urr, orientation::Integer, equations::CompressibleEulerEquationsQuasi1D)

    Conservative (symmetric) part of the entropy conservative flux for quasi 1D compressible Euler equations split form. This flux is a generalization of flux_ranocha for CompressibleEulerEquations1D. Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_chan_etalMethod
    flux_chan_etal(u_ll, u_rr, orientation,
    -               equations::ShallowWaterEquationsQuasi1D)

    Total energy conservative (mathematical entropy for quasi 1D shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., FluxPlusDissipation(flux_chan_etal, DissipationLocalLaxFriedrichs()).

    Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    Entropy conserving two-point flux by

    • Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)

    Entropy conserving two-point flux by

    • Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)

    Entropy conserving two-point flux by

    • Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations1D)

    Entropy conserving two-point flux by

    • Ayoub Gouasmi, Karthik Duraisamy (2020) "Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations" arXiv:1904.00972v3 [math.NA] 4 Feb 2020
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations2D)

    Adaption of the entropy conserving two-point flux by

    • Ayoub Gouasmi, Karthik Duraisamy (2020) "Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations" arXiv:1904.00972v3 [math.NA] 4 Feb 2020
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)

    Entropy conserving two-point flux by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations2D)

    Entropy conserving two-point flux by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations3D)

    Entropy conserving two-point flux by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)

    Entropy conserving two-point flux adapted by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdMulticomponentEquations2D)

    Entropy conserving two-point flux adapted by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_fjordholm_etalMethod
    flux_fjordholm_etal(u_ll, u_rr, orientation,
    -                    equations::ShallowWaterEquations1D)

    Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.

    Details are available in Eq. (4.1) in the paper:

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
    source
    Trixi.flux_fjordholm_etalMethod
    flux_fjordholm_etal(u_ll, u_rr, orientation_or_normal_direction,
    -                    equations::ShallowWaterEquations2D)

    Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.

    Details are available in Eq. (4.1) in the paper:

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
    source
    Trixi.flux_godunovMethod
    flux_godunov(u_ll, u_rr, orientation_or_normal_direction,
    -             equations::LinearizedEulerEquations2D)

    An upwind flux for the linearized Euler equations based on diagonalization of the physical flux matrix. Given the physical flux $Au$, $A=T \Lambda T^{-1}$ with $\Lambda$ being a diagonal matrix that holds the eigenvalues of $A$, decompose $\Lambda = \Lambda^+ + \Lambda^-$ where $\Lambda^+$ and $\Lambda^-$ are diagonal matrices holding the positive and negative eigenvalues of $A$, respectively. Then for left and right states $u_L, u_R$, the numerical flux calculated by this function is given by $A^+ u_L + A^- u_R$ where $A^{\pm} = T \Lambda^{\pm} T^{-1}$.

    The diagonalization of the flux matrix can be found in

    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    -                        equations::IdealGlmMhdEquations1D)

    Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    -                        equations::IdealGlmMhdEquations2D)

    Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    -                        equations::IdealGlmMhdEquations3D)

    Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    -                        equations::IdealGlmMhdMulticomponentEquations1D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    -                        equations::IdealGlmMhdMulticomponentEquations2D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_kennedy_gruberMethod
    flux_kennedy_gruber(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    Kinetic energy preserving two-point flux by

    • Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
    source
    Trixi.flux_kennedy_gruberMethod
    flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,
    -                    equations::CompressibleEulerEquations2D)

    Kinetic energy preserving two-point flux by

    • Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
    source
    Trixi.flux_kennedy_gruberMethod
    flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,
    -                    equations::CompressibleEulerEquations3D)

    Kinetic energy preserving two-point flux by

    • Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
    source
    Trixi.flux_nonconservative_audusse_etalMethod
    flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,
    -                                  equations::ShallowWaterEquations1D)

    Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.

    This hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations1D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.

    Further details on the hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    +                             equations::AcousticPerturbationEquations2D)

    Use an orthogonal projection of the perturbed velocities to zero out the normal velocity while retaining the possibility of a tangential velocity in the boundary state. Further details are available in the paper:

    • Marcus Bauer, Jürgen Dierke and Roland Ewert (2011) Application of a discontinuous Galerkin method to discretize acoustic perturbation equations DOI: 10.2514/1.J050333
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    +                             equations::CompressibleEulerEquations2D)

    Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:

    • J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF

    Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761

    Should be used together with UnstructuredMesh2D.

    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    +                             equations::CompressibleEulerEquations3D)

    Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:

    • J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF

    Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
    +                             equations::ShallowWaterEquations2D)

    Create a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value. For details see Section 9.2.5 of the book:

    • Eleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662
    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, orientation, direction, x, t,
    +                             surface_flux_function, equations::CompressibleEulerEquations1D)

    Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:

    • J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF

      Should be used together with TreeMesh.

    source
    Trixi.boundary_condition_slip_wallMethod
    boundary_condition_slip_wall(u_inner, orientation_or_normal, x, t, surface_flux_function,
    +                              equations::ShallowWaterEquations1D)

    Create a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value.

    For details see Section 9.2.5 of the book:

    • Eleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662
    source
    Trixi.boundary_condition_wallMethod
    boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
    +                        equations::AcousticPerturbationEquations2D)

    Boundary conditions for a solid wall.

    source
    Trixi.boundary_condition_wallMethod
    boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
    +                            equations::LinearizedEulerEquations2D)

    Boundary conditions for a solid wall.

    source
    Trixi.calc_error_normsMethod
    calc_error_norms([func=(u_node,equations)->u_node,] u_ode, t, analyzer, semi::AbstractSemidiscretization, cache_analysis)

    Calculate discrete L2 and L∞ error norms of func applied to each nodal variable u_node in u_ode. If no exact solution is available, "errors" are calculated using some reference state and can be useful for regression tests.

    source
    Trixi.calc_fast_wavespeed_roeMethod
    calc_fast_wavespeed_roe(u_ll, u_rr, direction, equations::IdealGlmMhdEquations1D)

    Compute the fast magnetoacoustic wave speed using Roe averages as given by

    • Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
    source
    Trixi.calc_fast_wavespeed_roeMethod
    calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations2D)

    Compute the fast magnetoacoustic wave speed using Roe averages as given by

    • Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
    source
    Trixi.calc_fast_wavespeed_roeMethod
    calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)

    Compute the fast magnetoacoustic wave speed using Roe averages as given by

    • Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
    source
    Trixi.calc_wavespeed_roeMethod
    calc_wavespeed_roe(u_ll, u_rr, direction::Integer,
    +                   equations::ShallowWaterEquations1D)

    Calculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} See for instance equation (62) in

    • Paul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044

    Or equation (9.17) in this lecture notes.

    source
    Trixi.calc_wavespeed_roeMethod
    calc_wavespeed_roe(u_ll, u_rr, direction::Integer,
    +                   equations::ShallowWaterEquations2D)

    Calculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} depending on direction. See for instance equation (62) in

    • Paul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044

    Or this slides, slides 8 and 9.

    source
    Trixi.collision_bgkMethod
    collision_bgk(u, dt, equations::LatticeBoltzmannEquations2D)

    Collision operator for the Bhatnagar, Gross, and Krook (BGK) model.

    source
    Trixi.collision_bgkMethod
    collision_bgk(u, dt, equations::LatticeBoltzmannEquations3D)

    Collision operator for the Bhatnagar, Gross, and Krook (BGK) model.

    source
    Trixi.cons2consMethod
    cons2cons(u, equations)

    Return the conserved variables u. While this function is as trivial as identity, it is also as useful.

    source
    Trixi.cons2entropyFunction
    cons2entropy(u, equations)

    Convert the conserved variables u to the entropy variables for a given set of equations with chosen standard entropy.

    u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by entropy2cons.

    source
    Trixi.cons2primFunction
    cons2prim(u, equations)

    Convert the conserved variables u to the primitive variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by prim2cons.

    source
    Trixi.convergence_testMethod
    convergence_test([mod::Module=Main,] elixir::AbstractString, iterations; kwargs...)

    Run iterations Trixi.jl simulations using the setup given in elixir and compute the experimental order of convergence (EOC) in the $L^2$ and $L^\infty$ norm. In each iteration, the resolution of the respective mesh will be doubled. Additional keyword arguments kwargs... and the optional module mod are passed directly to trixi_include.

    This function assumes that the spatial resolution is set via the keywords initial_refinement_level (an integer) or cells_per_dimension (a tuple of integers, one per spatial dimension).

    source
    Trixi.default_example_unstructuredMethod
    default_example_unstructured()

    Return the path to an example elixir that can be used to quickly see Trixi.jl in action on an UnstructuredMesh2D. This simulation is run on the example curved, unstructured mesh given in the Trixi.jl documentation regarding unstructured meshes.

    source
    Trixi.densityMethod
    density(p::Real, equations::LatticeBoltzmannEquations2D)
    +density(u, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic density from the pressure p or the particle distribution functions u.

    source
    Trixi.densityMethod
    density(p::Real, equations::LatticeBoltzmannEquations3D)
    +density(u, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic density from the pressure p or the particle distribution functions u.

    source
    Trixi.downloadMethod
    Trixi.download(src_url, file_path)

    Download a file from given src_url to given file_path if file_path is not already a file. This function just returns file_path. This is a small wrapper of Downloads.download(src_url, file_path) that avoids race conditions when multiple MPI ranks are used.

    source
    Trixi.each_dof_globalMethod
    each_dof_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the degrees of freedom (DOF) in dg. In particular, not the DOFs themselves are returned.

    source
    Trixi.each_face_nodeMethod
    each_face_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the face nodes in dg. In particular, not the face_nodes themselves are returned.

    source
    Trixi.each_face_node_globalMethod
    each_face_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the face nodes in mesh. In particular, not the face nodes themselves are returned.

    source
    Trixi.each_quad_nodeMethod
    each_quad_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the quadrature nodes in dg. In particular, not the quadrature nodes themselves are returned.

    source
    Trixi.each_quad_node_globalMethod
    each_quad_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the global quadrature nodes in mesh. In particular, not the quadrature nodes themselves are returned.

    source
    Trixi.eachboundaryMethod
    eachboundary(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the boundaries in cache. In particular, not the boundaries themselves are returned.

    source
    Trixi.eachcomponentMethod
    eachcomponent(equations::AbstractCompressibleEulerMulticomponentEquations)

    Return an iterator over the indices that specify the location in relevant data structures for the components in AbstractCompressibleEulerMulticomponentEquations. In particular, not the components themselves are returned.

    source
    Trixi.eachcomponentMethod
    eachcomponent(equations::AbstractIdealGlmMhdMulticomponentEquations)

    Return an iterator over the indices that specify the location in relevant data structures for the components in AbstractIdealGlmMhdMulticomponentEquations. In particular, not the components themselves are returned.

    source
    Trixi.eachdimMethod
    eachdim(mesh)

    Return an iterator over the indices that specify the location in relevant data structures for the dimensions in AbstractTree. In particular, not the dimensions themselves are returned.

    source
    Trixi.eachdirectionMethod
    eachdirection(tree::AbstractTree)

    Return an iterator over the indices that specify the location in relevant data structures for the directions in AbstractTree. In particular, not the directions themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in cache. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(mesh::DGMultiMesh, dg::DGMulti, other_args...)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in mesh. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::ElementContainer1D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::ElementContainer2D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::ElementContainer3D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachelementMethod
    eachelement(elements::UnstructuredElementContainer2D)

    Return an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.

    source
    Trixi.eachinterfaceMethod
    eachinterface(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the interfaces in cache. In particular, not the interfaces themselves are returned.

    source
    Trixi.eachmortarMethod
    eachmortar(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the mortars in cache. In particular, not the mortars themselves are returned.

    source
    Trixi.eachmpiinterfaceMethod
    eachmpiinterface(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the MPI interfaces in cache. In particular, not the interfaces themselves are returned.

    source
    Trixi.eachmpimortarMethod
    eachmpimortar(dg::DG, cache)

    Return an iterator over the indices that specify the location in relevant data structures for the MPI mortars in cache. In particular, not the mortars themselves are returned.

    source
    Trixi.eachnodeMethod
    eachnode(dg::DG)

    Return an iterator over the indices that specify the location in relevant data structures for the nodes in dg. In particular, not the nodes themselves are returned.

    source
    Trixi.eachnodeMethod
    eachnode(basis::LobattoLegendreBasis)

    Return an iterator over the indices that specify the location in relevant data structures for the nodes in basis. In particular, not the nodes themselves are returned.

    source
    Trixi.eachnodeMethod
    eachnode(analyzer::LobattoLegendreAnalyzer)

    Return an iterator over the indices that specify the location in relevant data structures for the nodes in analyzer. In particular, not the nodes themselves are returned.

    source
    Trixi.eachvariableMethod
    eachvariable(equations::AbstractEquations)

    Return an iterator over the indices that specify the location in relevant data structures for the variables in equations. In particular, not the variables themselves are returned.

    source
    Trixi.energy_internalFunction
    energy_internal(u, equations)

    Return the internal energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.energy_kineticFunction
    energy_kinetic(u, equations)

    Return the kinetic energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.energy_totalFunction
    energy_total(u, equations)

    Return the total energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.entropyFunction
    entropy(u, equations)

    Return the chosen entropy of the conserved variables u for a given set of equations.

    u is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).

    source
    Trixi.entropy2consFunction
    entropy2cons(w, equations)

    Convert the entropy variables w based on a standard entropy to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2entropy.

    source
    Trixi.equilibrium_distributionMethod
    equilibrium_distribution(alpha, rho, v1, v2, v3, equations::LatticeBoltzmannEquations3D)

    Calculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2, v3.

    source
    Trixi.equilibrium_distributionMethod
    equilibrium_distribution(alpha, rho, v1, v2, equations::LatticeBoltzmannEquations2D)

    Calculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2.

    source
    Trixi.examples_dirMethod
    examples_dir()

    Return the directory where the example files provided with Trixi.jl are located. If Trixi.jl is installed as a regular package (with ]add Trixi), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir:

    Examples

    readdir(examples_dir())
    source
    Trixi.fluxFunction
    flux(u, orientation_or_normal, equations)

    Given the conservative variables u, calculate the (physical) flux in Cartesian direction orientation::Integer or in arbitrary direction normal::AbstractVector for the corresponding set of governing equations. orientation is 1, 2, and 3 for the x-, y-, and z-directions, respectively.

    source
    Trixi.fluxMethod
    flux(u, normal_direction::AbstractVector, equations::AbstractEquations{1})

    Enables calling flux with a non-integer argument normal_direction for one-dimensional equations. Returns the value of flux(u, 1, equations) scaled by normal_direction[1].

    source
    Trixi.flux_centralMethod
    flux_central(u_ll, u_rr, orientation_or_normal_direction, equations::AbstractEquations)

    The classical central numerical flux f((u_ll) + f(u_rr)) / 2. When this flux is used as volume flux, the discretization is equivalent to the classical weak form DG method (except floating point errors).

    source
    Trixi.flux_chan_etalMethod

    @inline function fluxchanetal(ull, urr, orientation::Integer, equations::CompressibleEulerEquationsQuasi1D)

    Conservative (symmetric) part of the entropy conservative flux for quasi 1D compressible Euler equations split form. This flux is a generalization of flux_ranocha for CompressibleEulerEquations1D. Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_chan_etalMethod
    flux_chan_etal(u_ll, u_rr, orientation,
    +               equations::ShallowWaterEquationsQuasi1D)

    Total energy conservative (mathematical entropy for quasi 1D shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., FluxPlusDissipation(flux_chan_etal, DissipationLocalLaxFriedrichs()).

    Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    Entropy conserving two-point flux by

    • Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)

    Entropy conserving two-point flux by

    • Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)

    Entropy conserving two-point flux by

    • Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations1D)

    Entropy conserving two-point flux by

    • Ayoub Gouasmi, Karthik Duraisamy (2020) "Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations" arXiv:1904.00972v3 [math.NA] 4 Feb 2020
    source
    Trixi.flux_chandrashekarMethod
    flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations2D)

    Adaption of the entropy conserving two-point flux by

    • Ayoub Gouasmi, Karthik Duraisamy (2020) "Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations" arXiv:1904.00972v3 [math.NA] 4 Feb 2020
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)

    Entropy conserving two-point flux by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations2D)

    Entropy conserving two-point flux by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations3D)

    Entropy conserving two-point flux by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)

    Entropy conserving two-point flux adapted by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_derigs_etalMethod
    flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdMulticomponentEquations2D)

    Entropy conserving two-point flux adapted by

    • Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002
    source
    Trixi.flux_fjordholm_etalMethod
    flux_fjordholm_etal(u_ll, u_rr, orientation,
    +                    equations::ShallowWaterEquations1D)

    Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.

    Details are available in Eq. (4.1) in the paper:

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
    source
    Trixi.flux_fjordholm_etalMethod
    flux_fjordholm_etal(u_ll, u_rr, orientation_or_normal_direction,
    +                    equations::ShallowWaterEquations2D)

    Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.

    Details are available in Eq. (4.1) in the paper:

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
    source
    Trixi.flux_godunovMethod
    flux_godunov(u_ll, u_rr, orientation_or_normal_direction,
    +             equations::LinearizedEulerEquations2D)

    An upwind flux for the linearized Euler equations based on diagonalization of the physical flux matrix. Given the physical flux $Au$, $A=T \Lambda T^{-1}$ with $\Lambda$ being a diagonal matrix that holds the eigenvalues of $A$, decompose $\Lambda = \Lambda^+ + \Lambda^-$ where $\Lambda^+$ and $\Lambda^-$ are diagonal matrices holding the positive and negative eigenvalues of $A$, respectively. Then for left and right states $u_L, u_R$, the numerical flux calculated by this function is given by $A^+ u_L + A^- u_R$ where $A^{\pm} = T \Lambda^{\pm} T^{-1}$.

    The diagonalization of the flux matrix can be found in

    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    +                        equations::IdealGlmMhdEquations1D)

    Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    +                        equations::IdealGlmMhdEquations2D)

    Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    +                        equations::IdealGlmMhdEquations3D)

    Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    +                        equations::IdealGlmMhdMulticomponentEquations1D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_hindenlang_gassnerMethod
    flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
    +                        equations::IdealGlmMhdMulticomponentEquations2D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.

    References

    • Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_kennedy_gruberMethod
    flux_kennedy_gruber(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    Kinetic energy preserving two-point flux by

    • Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
    source
    Trixi.flux_kennedy_gruberMethod
    flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,
    +                    equations::CompressibleEulerEquations2D)

    Kinetic energy preserving two-point flux by

    • Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
    source
    Trixi.flux_kennedy_gruberMethod
    flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,
    +                    equations::CompressibleEulerEquations3D)

    Kinetic energy preserving two-point flux by

    • Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
    source
    Trixi.flux_nonconservative_audusse_etalMethod
    flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,
    +                                  equations::ShallowWaterEquations1D)

    Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.

    This hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations1D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.

    Further details on the hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.flux_nonconservative_audusse_etalMethod
    flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,
                                       equations::ShallowWaterEquations2D)
     flux_nonconservative_audusse_etal(u_ll, u_rr,
                                       normal_direction_ll     ::AbstractVector,
                                       normal_direction_average::AbstractVector,
    -                                  equations::ShallowWaterEquations2D)

    Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.

    This hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations2D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.

    Further details for the hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.flux_nonconservative_chan_etalMethod
    flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,
    +                                  equations::ShallowWaterEquations2D)

    Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.

    This hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations2D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.

    Further details for the hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.flux_nonconservative_chan_etalMethod
    flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,
                                    equations::CompressibleEulerEquationsQuasi1D)
     flux_nonconservative_chan_etal(u_ll, u_rr, normal_direction, 
                                    equations::CompressibleEulerEquationsQuasi1D)
     flux_nonconservative_chan_etal(u_ll, u_rr, normal_ll, normal_rr,
    -                               equations::CompressibleEulerEquationsQuasi1D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the pressure CompressibleEulerEquationsQuasi1D and the nozzle width.

    Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_nonconservative_chan_etalMethod
    flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,
    +                               equations::CompressibleEulerEquationsQuasi1D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the pressure CompressibleEulerEquationsQuasi1D and the nozzle width.

    Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_nonconservative_chan_etalMethod
    flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,
                                    equations::ShallowWaterEquationsQuasi1D)
     flux_nonconservative_chan_etal(u_ll, u_rr, normal_direction::AbstractVector,
                                    equations::ShallowWaterEquationsQuasi1D)    
     flux_nonconservative_chan_etal(u_ll, u_rr, 
                                    normal_ll::AbstractVector, normal_rr::AbstractVector,
    -                               equations::ShallowWaterEquationsQuasi1D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquationsQuasi1D and the channel width.

    Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_nonconservative_ersing_etalMethod
    flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
    -                                 equations::ShallowWaterEquations1D)
    Experimental code

    This numerical flux is experimental and may change in any future release.

    Non-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.

    This is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.

    For further details see:

    • Patrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699
    source
    Trixi.flux_nonconservative_ersing_etalMethod
    flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
    +                               equations::ShallowWaterEquationsQuasi1D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquationsQuasi1D and the channel width.

    Further details are available in the paper:

    • Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
    source
    Trixi.flux_nonconservative_ersing_etalMethod
    flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
    +                                 equations::ShallowWaterEquations1D)
    Experimental code

    This numerical flux is experimental and may change in any future release.

    Non-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.

    This is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.

    For further details see:

    • Patrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699
    source
    Trixi.flux_nonconservative_ersing_etalMethod
    flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
                                      equations::ShallowWaterEquations2D)
     flux_nonconservative_ersing_etal(u_ll, u_rr,
                                      normal_direction_ll::AbstractVector,
                                      normal_direction_average::AbstractVector,
    -                                 equations::ShallowWaterEquations2D)
    Experimental code

    This numerical flux is experimental and may change in any future release.

    Non-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    This is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.

    For further details see:

    • Patrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699
    source
    Trixi.flux_nonconservative_fjordholm_etalMethod
    flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
    -                                    equations::ShallowWaterEquations1D)

    Non-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations1D.

    This contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.

    Further details for the original finite volume formulation are available in

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042

    and for curvilinear 2D case in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_nonconservative_fjordholm_etalMethod
    flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
    +                                 equations::ShallowWaterEquations2D)
    Experimental code

    This numerical flux is experimental and may change in any future release.

    Non-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    This is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.

    For further details see:

    • Patrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699
    source
    Trixi.flux_nonconservative_fjordholm_etalMethod
    flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
    +                                    equations::ShallowWaterEquations1D)

    Non-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations1D.

    This contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.

    Further details for the original finite volume formulation are available in

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042

    and for curvilinear 2D case in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_nonconservative_fjordholm_etalMethod
    flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
                                         equations::ShallowWaterEquations2D)
     flux_nonconservative_fjordholm_etal(u_ll, u_rr,
                                         normal_direction_ll     ::AbstractVector,
                                         normal_direction_average::AbstractVector,
    -                                    equations::ShallowWaterEquations2D)

    Non-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    This contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.

    Further details for the original finite volume formulation are available in

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042

    and for curvilinear 2D case in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_nonconservative_powellMethod
    flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
    +                                    equations::ShallowWaterEquations2D)

    Non-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    This contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.

    Further details for the original finite volume formulation are available in

    • Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042

    and for curvilinear 2D case in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_nonconservative_powellMethod
    flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
                                 equations::IdealGlmMhdEquations2D)
     flux_nonconservative_powell(u_ll, u_rr,
                                 normal_direction_ll     ::AbstractVector,
                                 normal_direction_average::AbstractVector,
    -                            equations::IdealGlmMhdEquations2D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    References

    • Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
    source
    Trixi.flux_nonconservative_powellMethod
    flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
    +                            equations::IdealGlmMhdEquations2D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    References

    • Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
    source
    Trixi.flux_nonconservative_powellMethod
    flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
                                 equations::IdealGlmMhdEquations3D)
     flux_nonconservative_powell(u_ll, u_rr,
                                 normal_direction_ll     ::AbstractVector,
                                 normal_direction_average::AbstractVector,
    -                            equations::IdealGlmMhdEquations3D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations3D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    References

    • Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
    source
    Trixi.flux_nonconservative_powellMethod
    flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
    -                            equations::IdealGlmMhdMulticomponentEquations2D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdMulticomponentEquations2D.

    References

    • Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
    source
    Trixi.flux_nonconservative_powell_local_symmetricMethod
    flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,
    +                            equations::IdealGlmMhdEquations3D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations3D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    References

    • Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
    source
    Trixi.flux_nonconservative_powellMethod
    flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
    +                            equations::IdealGlmMhdMulticomponentEquations2D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdMulticomponentEquations2D.

    References

    • Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
    source
    Trixi.flux_nonconservative_powell_local_symmetricMethod
    flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,
                                                 equations::IdealGlmMhdEquations2D,
                                                 nonconservative_type::NonConservativeSymmetric,
    -                                            nonconservative_term::Integer)

    Symmetric part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered "fluxes" for subcell limiting. See, e.g.,

    • Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.

    This function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.

    source
    Trixi.flux_nonconservative_powell_local_symmetricMethod
    flux_nonconservative_powell_local_symmetric(u_ll, u_rr,
    +                                            nonconservative_term::Integer)

    Symmetric part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered "fluxes" for subcell limiting. See, e.g.,

    • Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.

    This function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.

    source
    Trixi.flux_nonconservative_powell_local_symmetricMethod
    flux_nonconservative_powell_local_symmetric(u_ll, u_rr,
                                                 orientation::Integer,
    -                                            equations::IdealGlmMhdEquations2D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.

    This implementation uses a non-conservative term that can be written as the product of local and symmetric parts. It is equivalent to the non-conservative flux of Bohm et al. (flux_nonconservative_powell) for conforming meshes but it yields different results on non-conforming meshes(!).

    The two other flux functions with the same name return either the local or symmetric portion of the non-conservative flux based on the type of the nonconservativetype argument, employing multiple dispatch. They are used to compute the subcell fluxes in dg2dsubcelllimiters.jl.

    References

    • Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.
    source
    Trixi.flux_nonconservative_powell_local_symmetricMethod
    flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,
    +                                            equations::IdealGlmMhdEquations2D)

    Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.

    This implementation uses a non-conservative term that can be written as the product of local and symmetric parts. It is equivalent to the non-conservative flux of Bohm et al. (flux_nonconservative_powell) for conforming meshes but it yields different results on non-conforming meshes(!).

    The two other flux functions with the same name return either the local or symmetric portion of the non-conservative flux based on the type of the nonconservativetype argument, employing multiple dispatch. They are used to compute the subcell fluxes in dg2dsubcelllimiters.jl.

    References

    • Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.
    source
    Trixi.flux_nonconservative_powell_local_symmetricMethod
    flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,
                                                 equations::IdealGlmMhdEquations2D,
                                                 nonconservative_type::NonConservativeLocal,
    -                                            nonconservative_term::Integer)

    Local part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered "fluxes" for subcell limiting. See, e.g.,

    • Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.

    This function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.

    source
    Trixi.flux_nonconservative_wintermeyer_etalMethod
    flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
    -                                      equations::ShallowWaterEquations1D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.

    Further details are available in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_nonconservative_wintermeyer_etalMethod
    flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
    +                                            nonconservative_term::Integer)

    Local part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered "fluxes" for subcell limiting. See, e.g.,

    • Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.

    This function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.

    source
    Trixi.flux_nonconservative_wintermeyer_etalMethod
    flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
    +                                      equations::ShallowWaterEquations1D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.

    Further details are available in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_nonconservative_wintermeyer_etalMethod
    flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
                                           equations::ShallowWaterEquations2D)
     flux_nonconservative_wintermeyer_etal(u_ll, u_rr,
                                           normal_direction_ll     ::AbstractVector,
                                           normal_direction_average::AbstractVector,
    -                                      equations::ShallowWaterEquations2D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    Further details are available in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations1D)

    Entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    -             equations::CompressibleEulerEquations2D)

    Entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    -             equations::CompressibleEulerEquations3D)

    Entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    -             equations::CompressibleEulerMulticomponentEquations1D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    -             equations::CompressibleEulerMulticomponentEquations2D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_shima_etalMethod
    flux_shima_etal(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    This flux is is a modification of the original kinetic energy preserving two-point flux by

    • Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058

    The modification is in the energy flux to guarantee pressure equilibrium and was developed by

    • Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
    source
    Trixi.flux_shima_etalMethod
    flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,
    -                equations::CompressibleEulerEquations2D)

    This flux is is a modification of the original kinetic energy preserving two-point flux by

    • Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058

    The modification is in the energy flux to guarantee pressure equilibrium and was developed by

    • Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
    source
    Trixi.flux_shima_etalMethod
    flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,
    -                equations::CompressibleEulerEquations3D)

    This flux is is a modification of the original kinetic energy preserving two-point flux by

    • Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058

    The modification is in the energy flux to guarantee pressure equilibrium and was developed by

    • Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
    source
    Trixi.flux_wintermeyer_etalMethod
    flux_wintermeyer_etal(u_ll, u_rr, orientation,
    -                      equations::ShallowWaterEquations1D)

    Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.

    Further details are available in Theorem 1 of the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_wintermeyer_etalMethod
    flux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,
    -                      equations::ShallowWaterEquations2D)

    Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.

    Further details are available in Theorem 1 of the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_winters_etalMethod
    flux_winters_etal(u_ll, u_rr, orientation_or_normal_direction,
    -                  equations::PolytropicEulerEquations2D)

    Entropy conserving two-point flux for isothermal or polytropic gases. Requires a special weighted Stolarsky mean for the evaluation of the density denoted here as stolarsky_mean. Note, for isothermal gases where gamma = 1 this stolarsky_mean becomes the ln_mean.

    For details see Section 3.2 of the following reference

    • Andrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w
    source
    Trixi.get_boundary_outer_stateMethod
    get_boundary_outer_state(boundary_condition::BoundaryConditionDirichlet,
    -                         cache, t, equations, dg, indices...)

    For subcell limiting, the calculation of local bounds for non-periodic domains require the boundary outer state. This function returns the boundary value at time t and for node with spatial indices indices.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    source
    Trixi.get_nameMethod
    get_name(x)

    Returns a name of x ready for pretty printing. By default, return string(y) if x isa Val{y} and return string(x) otherwise.

    Examples

    julia> Trixi.get_name("test")
    +                                      equations::ShallowWaterEquations2D)

    Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.

    On curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.

    Further details are available in the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations1D)

    Entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    +             equations::CompressibleEulerEquations2D)

    Entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    +             equations::CompressibleEulerEquations3D)

    Entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    +             equations::CompressibleEulerMulticomponentEquations1D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_ranochaMethod
    flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
    +             equations::CompressibleEulerMulticomponentEquations2D)

    Adaption of the entropy conserving and kinetic energy preserving two-point flux by

    • Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig

    See also

    • Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
    source
    Trixi.flux_shima_etalMethod
    flux_shima_etal(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    This flux is is a modification of the original kinetic energy preserving two-point flux by

    • Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058

    The modification is in the energy flux to guarantee pressure equilibrium and was developed by

    • Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
    source
    Trixi.flux_shima_etalMethod
    flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,
    +                equations::CompressibleEulerEquations2D)

    This flux is is a modification of the original kinetic energy preserving two-point flux by

    • Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058

    The modification is in the energy flux to guarantee pressure equilibrium and was developed by

    • Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
    source
    Trixi.flux_shima_etalMethod
    flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,
    +                equations::CompressibleEulerEquations3D)

    This flux is is a modification of the original kinetic energy preserving two-point flux by

    • Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058

    The modification is in the energy flux to guarantee pressure equilibrium and was developed by

    • Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
    source
    Trixi.flux_wintermeyer_etalMethod
    flux_wintermeyer_etal(u_ll, u_rr, orientation,
    +                      equations::ShallowWaterEquations1D)

    Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.

    Further details are available in Theorem 1 of the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_wintermeyer_etalMethod
    flux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,
    +                      equations::ShallowWaterEquations2D)

    Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.

    Further details are available in Theorem 1 of the paper:

    • Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
    source
    Trixi.flux_winters_etalMethod
    flux_winters_etal(u_ll, u_rr, orientation_or_normal_direction,
    +                  equations::PolytropicEulerEquations2D)

    Entropy conserving two-point flux for isothermal or polytropic gases. Requires a special weighted Stolarsky mean for the evaluation of the density denoted here as stolarsky_mean. Note, for isothermal gases where gamma = 1 this stolarsky_mean becomes the ln_mean.

    For details see Section 3.2 of the following reference

    • Andrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w
    source
    Trixi.get_boundary_outer_stateMethod
    get_boundary_outer_state(boundary_condition::BoundaryConditionDirichlet,
    +                         cache, t, equations, dg, indices...)

    For subcell limiting, the calculation of local bounds for non-periodic domains require the boundary outer state. This function returns the boundary value at time t and for node with spatial indices indices.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    source
    Trixi.get_nameMethod
    get_name(x)

    Returns a name of x ready for pretty printing. By default, return string(y) if x isa Val{y} and return string(x) otherwise.

    Examples

    julia> Trixi.get_name("test")
     "test"
     
     julia> Trixi.get_name(Val(:test))
    -"test"
    source
    Trixi.get_nameMethod
    get_name(equations::AbstractEquations)

    Returns the canonical, human-readable name for the given system of equations.

    Examples

    julia> Trixi.get_name(CompressibleEulerEquations1D(1.4))
    -"CompressibleEulerEquations1D"
    source
    Trixi.getmeshMethod
    getmesh(pd::AbstractPlotData)

    Extract grid lines from pd for plotting with Plots.plot.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    source
    Trixi.global_mean_varsMethod
    global_mean_vars(equations::AcousticPerturbationEquations2D)

    Returns the global mean variables stored in equations. This makes it easier to define flexible initial conditions for problems with constant mean flow.

    source
    Trixi.have_nonconservative_termsMethod
    have_nonconservative_terms(equations)

    Trait function determining whether equations represent a conservation law with or without nonconservative terms. Classical conservation laws such as the CompressibleEulerEquations2D do not have nonconservative terms. The ShallowWaterEquations2D with non-constant bottom topography are an example of equations with nonconservative terms. The return value will be True() or False() to allow dispatching on the return type.

    source
    Trixi.hydrostatic_reconstruction_audusse_etalMethod
    hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation::Integer,
    -                                        equations::ShallowWaterEquations1D)

    A particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations1D. The reconstructed solution states u_ll_star and u_rr_star variables are then used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.

    Further details on this hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.hydrostatic_reconstruction_audusse_etalMethod
    hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation_or_normal_direction,
    -                                        equations::ShallowWaterEquations2D)

    A particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations2D. The reconstructed solution states u_ll_star and u_rr_star variables are used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.

    Further details for the hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.init_mpiMethod
    init_mpi()

    Initialize MPI by calling MPI.Initialized(). The function will check if MPI is already initialized and if yes, do nothing, thus it is safe to call it multiple times.

    source
    Trixi.init_p4estMethod
    init_p4est()

    Initialize p4est by calling p4est_init and setting the log level to SC_LP_ERROR. This function will check if p4est is already initialized and if yes, do nothing, thus it is safe to call it multiple times.

    source
    Trixi.init_t8codeMethod
    init_t8code()

    Initialize t8code by calling sc_init, p4est_init, and t8_init while setting the log level to SC_LP_ERROR. This function will check if t8code is already initialized and if yes, do nothing, thus it is safe to call it multiple times.

    source
    Trixi.initial_condition_constantMethod
    initial_condition_constant(x, t, equations::AcousticPerturbationEquations2D)

    A constant initial condition where the state variables are zero and the mean flow is constant. Uses the global mean values from equations.

    source
    Trixi.initial_condition_density_waveMethod
    initial_condition_density_wave(x, t, equations::CompressibleEulerEquations1D)

    A sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper

    • Gregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026

    with the following parameters

    • domain [-1, 1]
    • mesh = 4x4
    • polydeg = 5
    source
    Trixi.initial_condition_density_waveMethod
    initial_condition_density_wave(x, t, equations::CompressibleEulerEquations2D)

    A sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper

    • Gregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026

    with the following parameters

    • domain [-1, 1]
    • mesh = 4x4
    • polydeg = 5
    source
    Trixi.initial_condition_eoc_test_coupled_euler_gravityMethod
    initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations1D)

    One dimensional variant of the setup used for convergence tests of the Euler equations with self-gravity from

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
    Note

    There is no additional source term necessary for the manufactured solution in one spatial dimension. Thus, source_terms_eoc_test_coupled_euler_gravity is not present there.

    source
    Trixi.initial_condition_eoc_test_coupled_euler_gravityMethod
    initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations2D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.

    source
    Trixi.initial_condition_eoc_test_coupled_euler_gravityMethod
    initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations3D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.

    source
    Trixi.initial_condition_gaussMethod
    initial_condition_gauss(x, t, equations::AcousticPerturbationEquations2D)

    A Gaussian pulse in a constant mean flow. Uses the global mean values from equations.

    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations1D)

    A weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations2D)

    A weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations3D)

    A weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations1D)

    A for multicomponent adapted weak blast wave adapted to multicomponent and taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations2D)

    A for multicomponent adapted weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations1D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations3D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations1D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations2D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquations2D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations1D)

    A weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.

    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations2D)

    A weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.

    source
    Trixi.integrate_via_indicesMethod
    integrate_via_indices(func, u_ode, semi::AbstractSemidiscretization, args...; normalize=true)

    Call func(u, i..., element, equations, solver, args...) for all nodal indices i..., element and integrate the result using a quadrature associated with the semidiscretization semi.

    If normalize is true, the result is divided by the total volume of the computational domain.

    source
    Trixi.inv_ln_meanMethod
    inv_ln_mean(x, y)

    Compute the inverse 1 / ln_mean(x, y) of the logarithmic mean ln_mean.

    This function may be used to increase performance where the inverse of the logarithmic mean is needed, by replacing a (slow) division by a (fast) multiplication.

    source
    Trixi.get_nameMethod
    get_name(equations::AbstractEquations)

    Returns the canonical, human-readable name for the given system of equations.

    Examples

    julia> Trixi.get_name(CompressibleEulerEquations1D(1.4))
    +"CompressibleEulerEquations1D"
    source
    Trixi.getmeshMethod
    getmesh(pd::AbstractPlotData)

    Extract grid lines from pd for plotting with Plots.plot.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    source
    Trixi.global_mean_varsMethod
    global_mean_vars(equations::AcousticPerturbationEquations2D)

    Returns the global mean variables stored in equations. This makes it easier to define flexible initial conditions for problems with constant mean flow.

    source
    Trixi.have_nonconservative_termsMethod
    have_nonconservative_terms(equations)

    Trait function determining whether equations represent a conservation law with or without nonconservative terms. Classical conservation laws such as the CompressibleEulerEquations2D do not have nonconservative terms. The ShallowWaterEquations2D with non-constant bottom topography are an example of equations with nonconservative terms. The return value will be True() or False() to allow dispatching on the return type.

    source
    Trixi.hydrostatic_reconstruction_audusse_etalMethod
    hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation::Integer,
    +                                        equations::ShallowWaterEquations1D)

    A particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations1D. The reconstructed solution states u_ll_star and u_rr_star variables are then used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.

    Further details on this hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.hydrostatic_reconstruction_audusse_etalMethod
    hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation_or_normal_direction,
    +                                        equations::ShallowWaterEquations2D)

    A particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations2D. The reconstructed solution states u_ll_star and u_rr_star variables are used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.

    Further details for the hydrostatic reconstruction and its motivation can be found in

    • Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
    source
    Trixi.init_mpiMethod
    init_mpi()

    Initialize MPI by calling MPI.Initialized(). The function will check if MPI is already initialized and if yes, do nothing, thus it is safe to call it multiple times.

    source
    Trixi.init_p4estMethod
    init_p4est()

    Initialize p4est by calling p4est_init and setting the log level to SC_LP_ERROR. This function will check if p4est is already initialized and if yes, do nothing, thus it is safe to call it multiple times.

    source
    Trixi.init_t8codeMethod
    init_t8code()

    Initialize t8code by calling sc_init, p4est_init, and t8_init while setting the log level to SC_LP_ERROR. This function will check if t8code is already initialized and if yes, do nothing, thus it is safe to call it multiple times.

    source
    Trixi.initial_condition_constantMethod
    initial_condition_constant(x, t, equations::AcousticPerturbationEquations2D)

    A constant initial condition where the state variables are zero and the mean flow is constant. Uses the global mean values from equations.

    source
    Trixi.initial_condition_density_waveMethod
    initial_condition_density_wave(x, t, equations::CompressibleEulerEquations1D)

    A sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper

    • Gregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026

    with the following parameters

    • domain [-1, 1]
    • mesh = 4x4
    • polydeg = 5
    source
    Trixi.initial_condition_density_waveMethod
    initial_condition_density_wave(x, t, equations::CompressibleEulerEquations2D)

    A sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper

    • Gregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026

    with the following parameters

    • domain [-1, 1]
    • mesh = 4x4
    • polydeg = 5
    source
    Trixi.initial_condition_eoc_test_coupled_euler_gravityMethod
    initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations1D)

    One dimensional variant of the setup used for convergence tests of the Euler equations with self-gravity from

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
    Note

    There is no additional source term necessary for the manufactured solution in one spatial dimension. Thus, source_terms_eoc_test_coupled_euler_gravity is not present there.

    source
    Trixi.initial_condition_eoc_test_coupled_euler_gravityMethod
    initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations2D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.

    source
    Trixi.initial_condition_eoc_test_coupled_euler_gravityMethod
    initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations3D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.

    source
    Trixi.initial_condition_gaussMethod
    initial_condition_gauss(x, t, equations::AcousticPerturbationEquations2D)

    A Gaussian pulse in a constant mean flow. Uses the global mean values from equations.

    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations1D)

    A weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations2D)

    A weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations3D)

    A weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations1D)

    A for multicomponent adapted weak blast wave adapted to multicomponent and taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations2D)

    A for multicomponent adapted weak blast wave taken from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations1D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations3D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations1D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations2D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquations2D)

    A weak blast wave adapted from

    • Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations1D)

    A weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.

    source
    Trixi.initial_condition_weak_blast_waveMethod
    initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations2D)

    A weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.

    source
    Trixi.integrate_via_indicesMethod
    integrate_via_indices(func, u_ode, semi::AbstractSemidiscretization, args...; normalize=true)

    Call func(u, i..., element, equations, solver, args...) for all nodal indices i..., element and integrate the result using a quadrature associated with the semidiscretization semi.

    If normalize is true, the result is divided by the total volume of the computational domain.

    source
    Trixi.inv_ln_meanMethod
    inv_ln_mean(x, y)

    Compute the inverse 1 / ln_mean(x, y) of the logarithmic mean ln_mean.

    This function may be used to increase performance where the inverse of the logarithmic mean is needed, by replacing a (slow) division by a (fast) multiplication.

    source
    Trixi.jacobian_ad_forwardMethod
    jacobian_ad_forward(semi::AbstractSemidiscretization;
                         t0=zero(real(semi)),
    -                    u0_ode=compute_coefficients(t0, semi))

    Uses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.

    source
    Trixi.jacobian_fdMethod
    jacobian_fd(semi::AbstractSemidiscretization;
    +                    u0_ode=compute_coefficients(t0, semi))

    Uses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.

    source
    Trixi.jacobian_fdMethod
    jacobian_fd(semi::AbstractSemidiscretization;
                 t0=zero(real(semi)),
    -            u0_ode=compute_coefficients(t0, semi))

    Uses the right-hand side operator of the semidiscretization semi and simple second order finite difference to compute the Jacobian J of the semidiscretization semi at state u0_ode.

    source
    Trixi.linear_structureMethod
    linear_structure(semi::AbstractSemidiscretization;
    -                 t0=zero(real(semi)))

    Wraps the right-hand side operator of the semidiscretization semi at time t0 as an affine-linear operator given by a linear operator A and a vector b.

    source
    Trixi.ln_meanMethod
    ln_mean(x, y)

    Compute the logarithmic mean

    ln_mean(x, y) = (y - x) / (log(y) - log(x)) = (y - x) / log(y / x)

    Problem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Ismail and Roe (2009). Set ξ = y / x. Then, we have

    (y - x) / log(y / x) = (x + y) / log(ξ) * (ξ - 1) / (ξ + 1)

    Set f = (ξ - 1) / (ξ + 1) = (y - x) / (x + y). Then, we use the expansion

    log(ξ) = 2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7) + O(ξ^9)

    Inserting the first few terms of this expansion yields

    (y - x) / log(ξ) ≈ (x + y) * f / (2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7))
    +            u0_ode=compute_coefficients(t0, semi))

    Uses the right-hand side operator of the semidiscretization semi and simple second order finite difference to compute the Jacobian J of the semidiscretization semi at state u0_ode.

    source
    Trixi.linear_structureMethod
    linear_structure(semi::AbstractSemidiscretization;
    +                 t0=zero(real(semi)))

    Wraps the right-hand side operator of the semidiscretization semi at time t0 as an affine-linear operator given by a linear operator A and a vector b.

    source
    Trixi.ln_meanMethod
    ln_mean(x, y)

    Compute the logarithmic mean

    ln_mean(x, y) = (y - x) / (log(y) - log(x)) = (y - x) / log(y / x)

    Problem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Ismail and Roe (2009). Set ξ = y / x. Then, we have

    (y - x) / log(y / x) = (x + y) / log(ξ) * (ξ - 1) / (ξ + 1)

    Set f = (ξ - 1) / (ξ + 1) = (y - x) / (x + y). Then, we use the expansion

    log(ξ) = 2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7) + O(ξ^9)

    Inserting the first few terms of this expansion yields

    (y - x) / log(ξ) ≈ (x + y) * f / (2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7))
                      = (x + y) / (2 + 2/3 * f^2 + 2/5 * f^4 + 2/7 * f^6)

    Since divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use

    f^2 = (y - x)^2 / (x + y)^2
         = (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)

    Given ε = 1.0e-4, we use the following algorithm.

    if f^2 < ε
       # use the expansion above
     else
       # use the direct formula (y - x) / log(y / x)
    -end

    References

    source
    Trixi.load_adaptive_time_integrator!Method
    load_adaptive_time_integrator!(integrator, restart_file::AbstractString)

    Load the context information for time integrators with error-based step size control saved in a restart_file.

    source
    Trixi.load_dtMethod
    load_dt(restart_file::AbstractString)

    Load the time step size (dt in OrdinaryDiffEq.jl) saved in a restart_file.

    source
    Trixi.load_meshMethod
    load_mesh(restart_file::AbstractString; n_cells_max)

    Load the mesh from the restart_file.

    source
    Trixi.load_timeMethod
    load_time(restart_file::AbstractString)

    Load the time saved in a restart_file.

    source
    Trixi.load_timestep!Method
    load_timestep!(integrator, restart_file::AbstractString)

    Load the time step number saved in a restart_file and assign it to both the time step number and and the number of accepted steps (iter and stats.naccept in OrdinaryDiffEq.jl, respectively) in integrator.

    source
    Trixi.load_timestepMethod
    load_timestep(restart_file::AbstractString)

    Load the time step number (iter in OrdinaryDiffEq.jl) saved in a restart_file.

    source
    Trixi.maxMethod
    max(x, y, ...)

    Return the maximum of the arguments. See also the maximum function to take the maximum element from a collection.

    This version in Trixi.jl is semantically equivalent to Base.max but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).

    Examples

    julia> max(2, 5, 1)
    -5
    source
    Trixi.max_abs_speed_naiveFunction
    max_abs_speed_naive(u_ll, u_rr, orientation::Integer,   equations)
    -max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)

    Simple and fast estimate of the maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, based only on the local wave speeds associated to u_ll and u_rr.

    For non-integer arguments normal_direction in one dimension, max_abs_speed_naive returns abs(normal_direction[1]) * max_abs_speed_naive(u_ll, u_rr, 1, equations).

    source
    Trixi.minMethod
    min(x, y, ...)

    Return the minimum of the arguments. See also the minimum function to take the minimum element from a collection.

    This version in Trixi.jl is semantically equivalent to Base.min but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).

    Examples

    julia> min(2, 5, 1)
    -1
    source
    Trixi.min_max_speed_davisFunction
    min_max_speed_davis(u_ll, u_rr, orientation::Integer, equations)
    -min_max_speed_davis(u_ll, u_rr, normal_direction::AbstractVector, equations)

    Simple and fast estimates of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr.

    See eq. (10.38) from

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761

    See also FluxHLL, min_max_speed_naive, min_max_speed_einfeldt.

    source
    Trixi.min_max_speed_einfeldtFunction
    min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations)
    -min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations)

    More advanced mininmal and maximal wave speed computation based on

    originally developed for the compressible Euler equations. A compact representation can be found in this lecture notes, eq. (9.28).

    See also FluxHLL, min_max_speed_naive, min_max_speed_davis.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    Original publication:

    Compactly summarized:

    • Siddhartha Mishra, Ulrik Skre Fjordholm and Rémi Abgrall Numerical methods for conservation laws and related equations. Link
    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_naiveFunction
    min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations)
    -min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)

    Simple and fast estimate(!) of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr. Slightly more diffusive than min_max_speed_davis.

    • Amiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002

    See eq. (10.37) from

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761

    See also FluxHLL, min_max_speed_davis, min_max_speed_einfeldt.

    source
    Trixi.modify_dt_for_tstops!Method
    modify_dt_for_tstops!(integrator::SimpleIntegratorSSP)

    Modify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54

    source
    Trixi.multiply_dimensionwiseMethod
    multiply_dimensionwise(matrix::AbstractMatrix, data_in::AbstractArray{<:Any, NDIMS+1})

    Multiply the array data_in by matrix in each coordinate direction, where data_in is assumed to have the first coordinate for the number of variables and the remaining coordinates are multiplied by matrix.

    source
    Trixi.n_nonconservative_termsFunction
    n_nonconservative_terms(equations)

    Number of nonconservative terms in the form local * symmetric for a particular equation. This function needs to be specialized only if equations with nonconservative terms are combined with certain solvers (e.g., subcell limiting).

    source
    Trixi.ndofsMethod
    ndofs(semi::AbstractSemidiscretization)

    Return the number of degrees of freedom associated with each scalar variable.

    source
    Trixi.negative_partMethod
    negative_part(x)

    Return x if x is negative, else zero. In other words, return (x - abs(x)) / 2 for real numbers x.

    source
    Trixi.ode_default_optionsMethod
    ode_default_options()

    Return the default options for OrdinaryDiffEq's solve. Pass ode_default_options()... to solve to only return the solution at the final time and enable MPI aware error-based step size control, whenever MPI is used. For example, use solve(ode, alg; ode_default_options()...).

    source
    Trixi.ode_normMethod
    ode_norm(u, t)

    Implementation of the weighted L2 norm of Hairer and Wanner used for error-based step size control in OrdinaryDiffEq.jl. This function is aware of MPI and uses global MPI communication when running in parallel.

    You must pass this function as a keyword argument internalnorm=ode_norm to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.

    See the "Advanced Adaptive Stepsize Control" section of the documentation.

    source
    Trixi.ode_unstable_checkMethod
    ode_unstable_check(dt, u, semi, t)

    Implementation of the basic check for instability used in OrdinaryDiffEq.jl. Instead of checking something like any(isnan, u), this function just checks isnan(dt). This helps when using MPI parallelization, since no additional global communication is required and all ranks will return the same result.

    You should pass this function as a keyword argument unstable_check=ode_unstable_check to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.

    See the "Miscellaneous" section of the documentation.

    source
    Trixi.partition!Method
    Trixi.partition!(mesh::T8codeMesh)

    Partition a T8codeMesh in order to redistribute elements evenly among MPI ranks.

    Arguments

    • mesh::T8codeMesh: Initialized mesh object.
    source
    Trixi.partition!Method
    partition!(mesh::ParallelTreeMesh, allow_coarsening=true)

    Partition mesh using a static domain decomposition algorithm based on leaf cell count and tree structure. If allow_coarsening is true, the algorithm will keep leaf cells together on one rank when needed for local coarsening (i.e. when all children of a cell are leaves).

    source
    Trixi.positive_partMethod
    positive_part(x)

    Return x if x is positive, else zero. In other words, return (x + abs(x)) / 2 for real numbers x.

    source
    Trixi.pressureMethod
    pressure(rho::Real, equations::LatticeBoltzmannEquations2D)
    -pressure(u, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic pressure from the density rho or the particle distribution functions u.

    source
    Trixi.pressureMethod
    pressure(rho::Real, equations::LatticeBoltzmannEquations3D)
    -pressure(u, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic pressure from the density rho or the particle distribution functions u.

    source
    Trixi.prim2consFunction
    prim2cons(u, equations)

    Convert the primitive variables u to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2prim.

    source
    Trixi.rotate_from_xFunction
    rotate_from_x(u, normal, equations)

    Apply the rotation that maps the x-axis onto normal to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.

    See also: rotate_to_x

    source
    Trixi.rotate_to_xFunction
    rotate_to_x(u, normal, equations)

    Apply the rotation that maps normal onto the x-axis to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.

    See also: rotate_from_x

    source
    Trixi.load_adaptive_time_integrator!Method
    load_adaptive_time_integrator!(integrator, restart_file::AbstractString)

    Load the context information for time integrators with error-based step size control saved in a restart_file.

    source
    Trixi.load_dtMethod
    load_dt(restart_file::AbstractString)

    Load the time step size (dt in OrdinaryDiffEq.jl) saved in a restart_file.

    source
    Trixi.load_meshMethod
    load_mesh(restart_file::AbstractString; n_cells_max)

    Load the mesh from the restart_file.

    source
    Trixi.load_timeMethod
    load_time(restart_file::AbstractString)

    Load the time saved in a restart_file.

    source
    Trixi.load_timestep!Method
    load_timestep!(integrator, restart_file::AbstractString)

    Load the time step number saved in a restart_file and assign it to both the time step number and and the number of accepted steps (iter and stats.naccept in OrdinaryDiffEq.jl, respectively) in integrator.

    source
    Trixi.load_timestepMethod
    load_timestep(restart_file::AbstractString)

    Load the time step number (iter in OrdinaryDiffEq.jl) saved in a restart_file.

    source
    Trixi.maxMethod
    max(x, y, ...)

    Return the maximum of the arguments. See also the maximum function to take the maximum element from a collection.

    This version in Trixi.jl is semantically equivalent to Base.max but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).

    Examples

    julia> max(2, 5, 1)
    +5
    source
    Trixi.max_abs_speed_naiveFunction
    max_abs_speed_naive(u_ll, u_rr, orientation::Integer,   equations)
    +max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)

    Simple and fast estimate of the maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, based only on the local wave speeds associated to u_ll and u_rr.

    For non-integer arguments normal_direction in one dimension, max_abs_speed_naive returns abs(normal_direction[1]) * max_abs_speed_naive(u_ll, u_rr, 1, equations).

    source
    Trixi.minMethod
    min(x, y, ...)

    Return the minimum of the arguments. See also the minimum function to take the minimum element from a collection.

    This version in Trixi.jl is semantically equivalent to Base.min but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).

    Examples

    julia> min(2, 5, 1)
    +1
    source
    Trixi.min_max_speed_davisFunction
    min_max_speed_davis(u_ll, u_rr, orientation::Integer, equations)
    +min_max_speed_davis(u_ll, u_rr, normal_direction::AbstractVector, equations)

    Simple and fast estimates of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr.

    See eq. (10.38) from

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761

    See also FluxHLL, min_max_speed_naive, min_max_speed_einfeldt.

    source
    Trixi.min_max_speed_einfeldtFunction
    min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations)
    +min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations)

    More advanced mininmal and maximal wave speed computation based on

    originally developed for the compressible Euler equations. A compact representation can be found in this lecture notes, eq. (9.28).

    See also FluxHLL, min_max_speed_naive, min_max_speed_davis.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    Original publication:

    Compactly summarized:

    • Siddhartha Mishra, Ulrik Skre Fjordholm and Rémi Abgrall Numerical methods for conservation laws and related equations. Link
    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_einfeldtMethod
    min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)

    Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.

    source
    Trixi.min_max_speed_naiveFunction
    min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations)
    +min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)

    Simple and fast estimate(!) of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr. Slightly more diffusive than min_max_speed_davis.

    • Amiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002

    See eq. (10.37) from

    • Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761

    See also FluxHLL, min_max_speed_davis, min_max_speed_einfeldt.

    source
    Trixi.modify_dt_for_tstops!Method
    modify_dt_for_tstops!(integrator::SimpleIntegratorSSP)

    Modify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54

    source
    Trixi.multiply_dimensionwiseMethod
    multiply_dimensionwise(matrix::AbstractMatrix, data_in::AbstractArray{<:Any, NDIMS+1})

    Multiply the array data_in by matrix in each coordinate direction, where data_in is assumed to have the first coordinate for the number of variables and the remaining coordinates are multiplied by matrix.

    source
    Trixi.n_nonconservative_termsFunction
    n_nonconservative_terms(equations)

    Number of nonconservative terms in the form local * symmetric for a particular equation. This function needs to be specialized only if equations with nonconservative terms are combined with certain solvers (e.g., subcell limiting).

    source
    Trixi.ndofsMethod
    ndofs(semi::AbstractSemidiscretization)

    Return the number of degrees of freedom associated with each scalar variable.

    source
    Trixi.negative_partMethod
    negative_part(x)

    Return x if x is negative, else zero. In other words, return (x - abs(x)) / 2 for real numbers x.

    source
    Trixi.ode_default_optionsMethod
    ode_default_options()

    Return the default options for OrdinaryDiffEq's solve. Pass ode_default_options()... to solve to only return the solution at the final time and enable MPI aware error-based step size control, whenever MPI is used. For example, use solve(ode, alg; ode_default_options()...).

    source
    Trixi.ode_normMethod
    ode_norm(u, t)

    Implementation of the weighted L2 norm of Hairer and Wanner used for error-based step size control in OrdinaryDiffEq.jl. This function is aware of MPI and uses global MPI communication when running in parallel.

    You must pass this function as a keyword argument internalnorm=ode_norm to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.

    See the "Advanced Adaptive Stepsize Control" section of the documentation.

    source
    Trixi.ode_unstable_checkMethod
    ode_unstable_check(dt, u, semi, t)

    Implementation of the basic check for instability used in OrdinaryDiffEq.jl. Instead of checking something like any(isnan, u), this function just checks isnan(dt). This helps when using MPI parallelization, since no additional global communication is required and all ranks will return the same result.

    You should pass this function as a keyword argument unstable_check=ode_unstable_check to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.

    See the "Miscellaneous" section of the documentation.

    source
    Trixi.partition!Method
    Trixi.partition!(mesh::T8codeMesh)

    Partition a T8codeMesh in order to redistribute elements evenly among MPI ranks.

    Arguments

    • mesh::T8codeMesh: Initialized mesh object.
    source
    Trixi.partition!Method
    partition!(mesh::ParallelTreeMesh, allow_coarsening=true)

    Partition mesh using a static domain decomposition algorithm based on leaf cell count and tree structure. If allow_coarsening is true, the algorithm will keep leaf cells together on one rank when needed for local coarsening (i.e. when all children of a cell are leaves).

    source
    Trixi.positive_partMethod
    positive_part(x)

    Return x if x is positive, else zero. In other words, return (x + abs(x)) / 2 for real numbers x.

    source
    Trixi.pressureMethod
    pressure(rho::Real, equations::LatticeBoltzmannEquations2D)
    +pressure(u, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic pressure from the density rho or the particle distribution functions u.

    source
    Trixi.pressureMethod
    pressure(rho::Real, equations::LatticeBoltzmannEquations3D)
    +pressure(u, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic pressure from the density rho or the particle distribution functions u.

    source
    Trixi.prim2consFunction
    prim2cons(u, equations)

    Convert the primitive variables u to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2prim.

    source
    Trixi.rotate_from_xFunction
    rotate_from_x(u, normal, equations)

    Apply the rotation that maps the x-axis onto normal to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.

    See also: rotate_to_x

    source
    Trixi.rotate_to_xFunction
    rotate_to_x(u, normal, equations)

    Apply the rotation that maps normal onto the x-axis to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.

    See also: rotate_from_x

    source
    Trixi.save_plotMethod
    save_plot(plot_data, variable_names;
               show_mesh=true, plot_arguments=Dict{Symbol,Any}(),
    -          time=nothing, timestep=nothing)

    Visualize the plot data object provided in plot_data and save result as a PNG file in the out directory, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.

    The timestep is used in the filename. time is currently unused by this function.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    See also: VisualizationCallback, show_plot

    source
    Trixi.set_log_typeMethod
    Trixi.set_log_type(type; force = true)

    Set the type of the (natural) log function to be used in Trixi.jl. The default is "sqrt_Trixi_NaN" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to "sqrt_Base" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.

    source
    Trixi.set_sqrt_typeMethod
    Trixi.set_sqrt_type(type; force = true)

    Set the type of the square root function to be used in Trixi.jl. The default is "sqrt_Trixi_NaN" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to "sqrt_Base" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.

    source
    Trixi.show_plotMethod
    show_plot(plot_data, variable_names;
    +          time=nothing, timestep=nothing)

    Visualize the plot data object provided in plot_data and save result as a PNG file in the out directory, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.

    The timestep is used in the filename. time is currently unused by this function.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    See also: VisualizationCallback, show_plot

    source
    Trixi.set_log_typeMethod
    Trixi.set_log_type(type; force = true)

    Set the type of the (natural) log function to be used in Trixi.jl. The default is "sqrt_Trixi_NaN" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to "sqrt_Base" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.

    source
    Trixi.set_sqrt_typeMethod
    Trixi.set_sqrt_type(type; force = true)

    Set the type of the square root function to be used in Trixi.jl. The default is "sqrt_Trixi_NaN" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to "sqrt_Base" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.

    source
    Trixi.show_plotMethod
    show_plot(plot_data, variable_names;
               show_mesh=true, plot_arguments=Dict{Symbol,Any}(),
    -          time=nothing, timestep=nothing)

    Visualize the plot data object provided in plot_data and display result, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.

    This function is the default plot_creator argument for the VisualizationCallback. time and timestep are currently unused by this function.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    See also: VisualizationCallback, save_plot

    source
    Trixi.solveFunction
    solve(ode, alg; dt, callbacks, kwargs...)

    The following structures and methods provide the infrastructure for SSP Runge-Kutta methods of type SimpleAlgorithmSSP.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    source
    Trixi.source_terms_convergence_testMethod
    source_terms_convergence_test(u, x, t, equations::ShallowWaterEquations2D)

    Source terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).

    This manufactured solution source term is specifically designed for the bottom topography function b(x,y) = 2 + 0.5 * sin(sqrt(2)*pi*x) + 0.5 * sin(sqrt(2)*pi*y) as defined in initial_condition_convergence_test.

    source
    Trixi.source_terms_convergence_testMethod
    source_terms_convergence_test(u, x, t, equations::ShallowWaterEquationsQuasi1D)

    Source terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).

    This manufactured solution source term is specifically designed for the bottom topography function b(x) = 0.2 - 0.05 * sin(sqrt(2) * pi *x[1]) and channel width 'a(x)= 1 + 0.1 * cos(sqrt(2) * pi * x[1])' as defined in initial_condition_convergence_test.

    source
    Trixi.source_terms_eoc_test_coupled_euler_gravityMethod
    source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations2D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with initial_condition_eoc_test_coupled_euler_gravity.

    source
    Trixi.source_terms_eoc_test_coupled_euler_gravityMethod
    source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations3D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with initial_condition_eoc_test_coupled_euler_gravity.

    source
    Trixi.source_terms_eoc_test_eulerMethod
    source_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations3D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with initial_condition_eoc_test_coupled_euler_gravity.

    Note

    This method is to be used for testing pure Euler simulations with analytic self-gravity. If you intend to do coupled Euler-gravity simulations, you need to use source_terms_eoc_test_coupled_euler_gravity instead.

    source
    Trixi.source_terms_harmonicMethod
    source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations1D)

    Source term that only includes the forcing from the hyperbolic diffusion system.

    source
    Trixi.source_terms_harmonicMethod
    source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations2D)

    Source term that only includes the forcing from the hyperbolic diffusion system.

    source
    Trixi.source_terms_harmonicMethod
    source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations3D)

    Source term that only includes the forcing from the hyperbolic diffusion system.

    source
    Trixi.splitting_coirier_vanleerMethod
    splitting_coirier_vanleer(u, orientation::Integer,
    +          time=nothing, timestep=nothing)

    Visualize the plot data object provided in plot_data and display result, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.

    This function is the default plot_creator argument for the VisualizationCallback. time and timestep are currently unused by this function.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    See also: VisualizationCallback, save_plot

    source
    Trixi.solveFunction
    solve(ode, alg; dt, callbacks, kwargs...)

    The following structures and methods provide the infrastructure for SSP Runge-Kutta methods of type SimpleAlgorithmSSP.

    Experimental implementation

    This is an experimental feature and may change in future releases.

    source
    Trixi.source_terms_convergence_testMethod
    source_terms_convergence_test(u, x, t, equations::ShallowWaterEquations2D)

    Source terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).

    This manufactured solution source term is specifically designed for the bottom topography function b(x,y) = 2 + 0.5 * sin(sqrt(2)*pi*x) + 0.5 * sin(sqrt(2)*pi*y) as defined in initial_condition_convergence_test.

    source
    Trixi.source_terms_convergence_testMethod
    source_terms_convergence_test(u, x, t, equations::ShallowWaterEquationsQuasi1D)

    Source terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).

    This manufactured solution source term is specifically designed for the bottom topography function b(x) = 0.2 - 0.05 * sin(sqrt(2) * pi *x[1]) and channel width 'a(x)= 1 + 0.1 * cos(sqrt(2) * pi * x[1])' as defined in initial_condition_convergence_test.

    source
    Trixi.source_terms_eoc_test_coupled_euler_gravityMethod
    source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations2D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with initial_condition_eoc_test_coupled_euler_gravity.

    source
    Trixi.source_terms_eoc_test_coupled_euler_gravityMethod
    source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations3D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with initial_condition_eoc_test_coupled_euler_gravity.

    source
    Trixi.source_terms_eoc_test_eulerMethod
    source_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations3D)

    Setup used for convergence tests of the Euler equations with self-gravity used in

    • Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593

    in combination with initial_condition_eoc_test_coupled_euler_gravity.

    Note

    This method is to be used for testing pure Euler simulations with analytic self-gravity. If you intend to do coupled Euler-gravity simulations, you need to use source_terms_eoc_test_coupled_euler_gravity instead.

    source
    Trixi.source_terms_harmonicMethod
    source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations1D)

    Source term that only includes the forcing from the hyperbolic diffusion system.

    source
    Trixi.source_terms_harmonicMethod
    source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations2D)

    Source term that only includes the forcing from the hyperbolic diffusion system.

    source
    Trixi.source_terms_harmonicMethod
    source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations3D)

    Source term that only includes the forcing from the hyperbolic diffusion system.

    source
    Trixi.splitting_coirier_vanleerMethod
    splitting_coirier_vanleer(u, orientation::Integer,
                               equations::CompressibleEulerEquations1D)
     splitting_coirier_vanleer(u, which::Union{Val{:minus}, Val{:plus}}
                               orientation::Integer,
    -                          equations::CompressibleEulerEquations1D)

    Splitting of the compressible Euler flux from Coirier and van Leer. The splitting has correction terms in the pressure splitting as well as the mass and energy flux components. The motivation for these corrections are to handle flows at the low Mach number limit.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • William Coirier and Bram van Leer (1991) Numerical flux formulas for the Euler and Navier-Stokes equations. II - Progress in flux-vector splitting DOI: 10.2514/6.1991-1566
    source
    Trixi.splitting_drikakis_tsangarisMethod
    splitting_drikakis_tsangaris(u, orientation_or_normal_direction,
    +                          equations::CompressibleEulerEquations1D)

    Splitting of the compressible Euler flux from Coirier and van Leer. The splitting has correction terms in the pressure splitting as well as the mass and energy flux components. The motivation for these corrections are to handle flows at the low Mach number limit.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • William Coirier and Bram van Leer (1991) Numerical flux formulas for the Euler and Navier-Stokes equations. II - Progress in flux-vector splitting DOI: 10.2514/6.1991-1566
    source
    Trixi.splitting_drikakis_tsangarisMethod
    splitting_drikakis_tsangaris(u, orientation_or_normal_direction,
                                  equations::CompressibleEulerEquations2D)
     splitting_drikakis_tsangaris(u, which::Union{Val{:minus}, Val{:plus}}
                                  orientation_or_normal_direction,
    -                             equations::CompressibleEulerEquations2D)

    Improved variant of the Steger-Warming flux vector splitting splitting_steger_warming for generalized coordinates. This splitting also reformulates the energy flux as in Hänel et al. to obtain conservation of the total temperature for inviscid flows.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • D. Drikakis and S. Tsangaris (1993) On the solution of the compressible Navier-Stokes equations using improved flux vector splitting methods DOI: 10.1016/0307-904X(93)90054-K
    • D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
    source
    Trixi.splitting_lax_friedrichsMethod
    splitting_lax_friedrichs(u, orientation_or_normal_direction,
    +                             equations::CompressibleEulerEquations2D)

    Improved variant of the Steger-Warming flux vector splitting splitting_steger_warming for generalized coordinates. This splitting also reformulates the energy flux as in Hänel et al. to obtain conservation of the total temperature for inviscid flows.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • D. Drikakis and S. Tsangaris (1993) On the solution of the compressible Navier-Stokes equations using improved flux vector splitting methods DOI: 10.1016/0307-904X(93)90054-K
    • D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
    source
    Trixi.splitting_lax_friedrichsMethod
    splitting_lax_friedrichs(u, orientation_or_normal_direction,
                              equations::CompressibleEulerEquations2D)
     splitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation_or_normal_direction,
    -                         equations::CompressibleEulerEquations2D)

    Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) similar to a flux splitting one would apply, e.g., to Burgers' equation.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    source
    Trixi.splitting_lax_friedrichsMethod
    splitting_lax_friedrichs(u, orientation::Integer,
    +                         equations::CompressibleEulerEquations2D)

    Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) similar to a flux splitting one would apply, e.g., to Burgers' equation.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    source
    Trixi.splitting_lax_friedrichsMethod
    splitting_lax_friedrichs(u, orientation::Integer,
                              equations::InviscidBurgersEquation1D)
     splitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation::Integer,
    -                         equations::InviscidBurgersEquation1D)

    Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ = abs(u).

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    source
    Trixi.splitting_lax_friedrichsMethod
    splitting_lax_friedrichs(u, orientation::Integer,
    +                         equations::InviscidBurgersEquation1D)

    Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ = abs(u).

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    source
    Trixi.splitting_lax_friedrichsMethod
    splitting_lax_friedrichs(u, orientation::Integer,
                              equations::LinearScalarAdvectionEquation1D)
     splitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation::Integer,
    -                         equations::LinearScalarAdvectionEquation1D)

    Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ is the absolute value of the advection velocity.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    source
    Trixi.splitting_steger_warmingMethod
    splitting_steger_warming(u, orientation::Integer,
    +                         equations::LinearScalarAdvectionEquation1D)

    Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ is the absolute value of the advection velocity.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    source
    Trixi.splitting_steger_warmingMethod
    splitting_steger_warming(u, orientation::Integer,
                              equations::CompressibleEulerEquations1D)
     splitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation::Integer,
    -                         equations::CompressibleEulerEquations1D)

    Splitting of the compressible Euler flux of Steger and Warming.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
    source
    Trixi.splitting_steger_warmingMethod
    splitting_steger_warming(u, orientation::Integer,
    +                         equations::CompressibleEulerEquations1D)

    Splitting of the compressible Euler flux of Steger and Warming.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
    source
    Trixi.splitting_steger_warmingMethod
    splitting_steger_warming(u, orientation::Integer,
                              equations::CompressibleEulerEquations2D)
     splitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation::Integer,
    -                         equations::CompressibleEulerEquations2D)

    Splitting of the compressible Euler flux of Steger and Warming. For curvilinear coordinates use the improved Steger-Warming-type splitting splitting_drikakis_tsangaris.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
    source
    Trixi.splitting_steger_warmingMethod
    splitting_steger_warming(u, orientation::Integer,
    +                         equations::CompressibleEulerEquations2D)

    Splitting of the compressible Euler flux of Steger and Warming. For curvilinear coordinates use the improved Steger-Warming-type splitting splitting_drikakis_tsangaris.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
    source
    Trixi.splitting_steger_warmingMethod
    splitting_steger_warming(u, orientation::Integer,
                              equations::CompressibleEulerEquations3D)
     splitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation::Integer,
    -                         equations::CompressibleEulerEquations3D)

    Splitting of the compressible Euler flux of Steger and Warming.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
    source
    Trixi.splitting_vanleer_haenelMethod
    splitting_vanleer_haenel(u, orientation_or_normal_direction,
    +                         equations::CompressibleEulerEquations3D)

    Splitting of the compressible Euler flux of Steger and Warming.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
    source
    Trixi.splitting_vanleer_haenelMethod
    splitting_vanleer_haenel(u, orientation_or_normal_direction,
                              equations::CompressibleEulerEquations2D)
     splitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation_or_normal_direction,
    -                         equations::CompressibleEulerEquations2D)

    Splitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice. For details on the curvilinear variant of this flux vector splitting see Anderson et al.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Bram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5
    • D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
    • Meng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum
    • W. Kyle Anderson, James L. Thomas, and Bram van Leer (1986) Comparison of Finite Volume Flux Vector Splittings for the Euler Equations DOI: 10.2514/3.9465
    source
    Trixi.splitting_vanleer_haenelMethod
    splitting_vanleer_haenel(u, orientation::Integer,
    +                         equations::CompressibleEulerEquations2D)

    Splitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice. For details on the curvilinear variant of this flux vector splitting see Anderson et al.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    • Bram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5
    • D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
    • Meng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum
    • W. Kyle Anderson, James L. Thomas, and Bram van Leer (1986) Comparison of Finite Volume Flux Vector Splittings for the Euler Equations DOI: 10.2514/3.9465
    source
    Trixi.splitting_vanleer_haenelMethod
    splitting_vanleer_haenel(u, orientation::Integer,
                              equations::CompressibleEulerEquations1D)
     splitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}
                              orientation::Integer,
    -                         equations::CompressibleEulerEquations1D)

    Splitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    source
    Trixi.stolarsky_meanMethod
    stolarsky_mean(x, y, gamma)

    Compute an instance of a weighted Stolarsky mean of the form

    stolarsky_mean(x, y, gamma) = (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))

    where gamma > 1.

    Problem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Winters et al. (2020). Set f = (y - x) / (y + x) and g = gamma (for compact notation). Then, we use the expansions

    ((1+f)^g - (1-f)^g) / g = 2*f + (g-1)(g-2)/3 * f^3 + (g-1)(g-2)(g-3)(g-4)/60 * f^5 + O(f^7)

    and

    ((1+f)^(g-1) - (1-f)^(g-1)) / (g-1) = 2*f + (g-2)(g-3)/3 * f^3 + (g-2)(g-3)(g-4)(g-5)/60 * f^5 + O(f^7)

    Inserting the first few terms of these expansions and performing polynomial long division we find that

    stolarsky_mean(x, y, gamma) ≈ (y + x) / 2 * (1 + (g-2)/3 * f^2 - (g+1)(g-2)(g-3)/45 * f^4 + (g+1)(g-2)(g-3)(2g(g-2)-9)/945 * f^6)

    Since divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use

    f^2 = (y - x)^2 / (x + y)^2
    +                         equations::CompressibleEulerEquations1D)

    Splitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice.

    Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().

    Experimental implementation (upwind SBP)

    This is an experimental feature and may change in future releases.

    References

    source
    Trixi.stolarsky_meanMethod
    stolarsky_mean(x, y, gamma)

    Compute an instance of a weighted Stolarsky mean of the form

    stolarsky_mean(x, y, gamma) = (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))

    where gamma > 1.

    Problem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Winters et al. (2020). Set f = (y - x) / (y + x) and g = gamma (for compact notation). Then, we use the expansions

    ((1+f)^g - (1-f)^g) / g = 2*f + (g-1)(g-2)/3 * f^3 + (g-1)(g-2)(g-3)(g-4)/60 * f^5 + O(f^7)

    and

    ((1+f)^(g-1) - (1-f)^(g-1)) / (g-1) = 2*f + (g-2)(g-3)/3 * f^3 + (g-2)(g-3)(g-4)(g-5)/60 * f^5 + O(f^7)

    Inserting the first few terms of these expansions and performing polynomial long division we find that

    stolarsky_mean(x, y, gamma) ≈ (y + x) / 2 * (1 + (g-2)/3 * f^2 - (g+1)(g-2)(g-3)/45 * f^4 + (g+1)(g-2)(g-3)(2g(g-2)-9)/945 * f^6)

    Since divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use

    f^2 = (y - x)^2 / (x + y)^2
         = (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)

    Given ε = 1.0e-4, we use the following algorithm.

    if f^2 < ε
       # use the expansion above
     else
       # use the direct formula (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))
    -end

    References

    source
    Trixi.totalgammaMethod
    totalgamma(u, equations::CompressibleEulerMulticomponentEquations1D)

    Function that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.

    source
    Trixi.totalgammaMethod
    totalgamma(u, equations::CompressibleEulerMulticomponentEquations2D)

    Function that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.

    source
    Trixi.varnamesFunction
    varnames(conversion_function, equations)

    Return the list of variable names when applying conversion_function to the conserved variables associated to equations. This function is mainly used internally to determine output to screen and for IO, e.g., for the AnalysisCallback and the SaveSolutionCallback. Common choices of the conversion_function are cons2cons and cons2prim.

    source
    Trixi.velocityMethod
    velocity(u, orientation, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y) from the particle distribution functions u.

    source
    Trixi.velocityMethod
    velocity(u, orientation, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y, 3 -> z) from the particle distribution functions u.

    source
    Trixi.velocityMethod
    velocity(u, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic velocity vector from the particle distribution functions u.

    source
    Trixi.velocityMethod
    velocity(u, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic velocity vector from the particle distribution functions u.

    source
    Trixi.@autoinfiltrateMacro
    @autoinfiltrate
    -@autoinfiltrate condition::Bool

    Invoke the @infiltrate macro of the package Infiltrator.jl to create a breakpoint for ad-hoc interactive debugging in the REPL. If the optional argument condition is given, the breakpoint is only enabled if condition evaluates to true.

    As opposed to using Infiltrator.@infiltrate directly, this macro does not require Infiltrator.jl to be added as a dependency to Trixi.jl. As a bonus, the macro will also attempt to load the Infiltrator module if it has not yet been loaded manually.

    Note: For this macro to work, the Infiltrator.jl package needs to be installed in your current Julia environment stack.

    See also: Infiltrator.jl

    Internal use only

    Please note that this macro is intended for internal use only. It is not part of the public API of Trixi.jl, and it thus can altered (or be removed) at any time without it being considered a breaking change.

    source
    Trixi.@threadedMacro
    @threaded for ... end

    Semantically the same as Threads.@threads when iterating over a AbstractUnitRange but without guarantee that the underlying implementation uses Threads.@threads or works for more general for loops. In particular, there may be an additional check whether only one thread is used to reduce the overhead of serial execution or the underlying threading capabilities might be provided by other packages such as Polyester.jl.

    Warn

    This macro does not necessarily work for general for loops. For example, it does not necessarily support general iterables such as eachline(filename).

    Some discussion can be found at https://discourse.julialang.org/t/overhead-of-threads-threads/53964 and https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435.

    source
    +end

    References

    source
    Trixi.totalgammaMethod
    totalgamma(u, equations::CompressibleEulerMulticomponentEquations1D)

    Function that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.

    source
    Trixi.totalgammaMethod
    totalgamma(u, equations::CompressibleEulerMulticomponentEquations2D)

    Function that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.

    source
    Trixi.varnamesFunction
    varnames(conversion_function, equations)

    Return the list of variable names when applying conversion_function to the conserved variables associated to equations. This function is mainly used internally to determine output to screen and for IO, e.g., for the AnalysisCallback and the SaveSolutionCallback. Common choices of the conversion_function are cons2cons and cons2prim.

    source
    Trixi.velocityMethod
    velocity(u, orientation, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y) from the particle distribution functions u.

    source
    Trixi.velocityMethod
    velocity(u, orientation, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y, 3 -> z) from the particle distribution functions u.

    source
    Trixi.velocityMethod
    velocity(u, equations::LatticeBoltzmannEquations2D)

    Calculate the macroscopic velocity vector from the particle distribution functions u.

    source
    Trixi.velocityMethod
    velocity(u, equations::LatticeBoltzmannEquations3D)

    Calculate the macroscopic velocity vector from the particle distribution functions u.

    source
    Trixi.@autoinfiltrateMacro
    @autoinfiltrate
    +@autoinfiltrate condition::Bool

    Invoke the @infiltrate macro of the package Infiltrator.jl to create a breakpoint for ad-hoc interactive debugging in the REPL. If the optional argument condition is given, the breakpoint is only enabled if condition evaluates to true.

    As opposed to using Infiltrator.@infiltrate directly, this macro does not require Infiltrator.jl to be added as a dependency to Trixi.jl. As a bonus, the macro will also attempt to load the Infiltrator module if it has not yet been loaded manually.

    Note: For this macro to work, the Infiltrator.jl package needs to be installed in your current Julia environment stack.

    See also: Infiltrator.jl

    Internal use only

    Please note that this macro is intended for internal use only. It is not part of the public API of Trixi.jl, and it thus can altered (or be removed) at any time without it being considered a breaking change.

    source
    Trixi.@threadedMacro
    @threaded for ... end

    Semantically the same as Threads.@threads when iterating over a AbstractUnitRange but without guarantee that the underlying implementation uses Threads.@threads or works for more general for loops. In particular, there may be an additional check whether only one thread is used to reduce the overhead of serial execution or the underlying threading capabilities might be provided by other packages such as Polyester.jl.

    Warn

    This macro does not necessarily work for general for loops. For example, it does not necessarily support general iterables such as eachline(filename).

    Some discussion can be found at https://discourse.julialang.org/t/overhead-of-threads-threads/53964 and https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435.

    source
    diff --git a/previews/PR1624/reference-trixi2vtk/index.html b/previews/PR1624/reference-trixi2vtk/index.html index 4aa64629d19..a0b842b0545 100644 --- a/previews/PR1624/reference-trixi2vtk/index.html +++ b/previews/PR1624/reference-trixi2vtk/index.html @@ -3,4 +3,4 @@ format=:vtu, verbose=false, hide_progress=false, pvd=nothing, output_directory=".", nvisnodes=nothing, save_celldata=true, reinterpolate=true, data_is_uniform=false)

    Convert Trixi-generated output files to VTK files (VTU or VTI).

    Arguments

    • filename: One or more Trixi solution/restart/mesh files to convert to a VTK file. Filenames support file globbing, e.g., "solution*" to match all files starting with solution.
    • format: Output format for solution/restart files. Can be 'vtu' or 'vti'.
    • verbose: Set to true to enable verbose output.
    • hide_progress: Hide progress bar (will be hidden automatically if verbose is true).
    • pvd: Use this filename to store PVD file (instead of auto-detecting name). Note that only the name will be used (directory and file extension are ignored).
    • output_directory: Output directory where generated files are stored.
    • nvisnodes: Number of visualization nodes per element. (default: number of DG nodes for StructuredMesh or UnstructuredMesh2D, twice the number of DG nodes for TreeMesh). A value of 0 (zero) uses the number of nodes in the DG elements.
    • save_celldata: Boolean value to determine if cell-based data should be saved. (default: true)
    • reinterpolate: Boolean value to determine if data should be reinterpolated onto uniform points. When false the raw data at the compute nodes is copied into the appropriate format. (default: true)
    • data_is_uniform: Boolean to indicate if the data to be converted is from a finite difference method on a uniform grid of points. (default: false)

    Examples

    julia> trixi2vtk("out/solution_000*.h5")
    -[...]
    source +[...]source diff --git a/previews/PR1624/reference-trixibase/index.html b/previews/PR1624/reference-trixibase/index.html index 5a3272c6f67..aaeeaaf9417 100644 --- a/previews/PR1624/reference-trixibase/index.html +++ b/previews/PR1624/reference-trixibase/index.html @@ -7,4 +7,4 @@ sol.t[end] end [ Info: You just called `trixi_include`. Julia may now compile the code, please be patient. -0.1source +0.1source diff --git a/previews/PR1624/restart/index.html b/previews/PR1624/restart/index.html index e18aca3ad03..1a9f2238280 100644 --- a/previews/PR1624/restart/index.html +++ b/previews/PR1624/restart/index.html @@ -3,4 +3,4 @@ save_final_restart=true)

    Make this part of your CallbackSet.

    An example is examples/examples/structured_2d_dgsem/elixir_advection_extended.jl.

    Perform the simulation restart

    Since all of the information about the simulation can be obtained from the last snapshot, the restart can be done with relatively few lines in an extra elixir file. However, some might prefer to keep everything in one elixir and conditionals like if restart with a boolean variable restart that is user defined.

    First we need to define from which file we want to restart, e.g.

    restart_file = "restart_000021.h5"
     restart_filename = joinpath("out", restart_file)

    Then we load the mesh file:

    mesh = load_mesh(restart_filename)

    This is then needed for the semidiscretization:

    semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

    We then define a new time span for the simulation that takes as starting time the one form the snapshot:

    tspan = (load_time(restart_filename), 2.0)

    We now also take the last dt, so that our solver does not need to first find one to fulfill the CFL condition:

    dt = load_dt(restart_filename)

    The ODE that we will pass to the solver is now:

    ode = semidiscretize(semi, tspan, restart_filename)

    You should now define a SaveSolutionCallback similar to the original simulation, but with save_initial_solution=false, otherwise our initial snapshot will be overwritten. If you are using one file for the original simulation and the restart you can reuse your SaveSolutionCallback, but need to set

    save_solution.condition.save_initial_solution = false

    Before we compute the solution using OrdinaryDiffEq.jl we need to set the integrator and its time step number, e.g.:

    integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),
                       dt=dt, save_everystep=false, callback=callbacks);
    -load_timestep!(integrator, restart_filename)

    Now we can compute the solution:

    sol = solve!(integrator)

    An example is in examples/structured_2d_dgsem/elixir_advection_restart.jl.

    +load_timestep!(integrator, restart_filename)

    Now we can compute the solution:

    sol = solve!(integrator)

    An example is in examples/structured_2d_dgsem/elixir_advection_restart.jl.

    diff --git a/previews/PR1624/search_index.js b/previews/PR1624/search_index.js index dd729eb978b..45bd7e55c5c 100644 --- a/previews/PR1624/search_index.js +++ b/previews/PR1624/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"EditURL = \"../../literate/src/files/adaptive_mesh_refinement.jl\"","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#adaptive_mesh_refinement","page":"14 Adaptive mesh refinement","title":"14: Adaptive mesh refinement","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Adaptive mesh refinement (AMR) is a method of adapting the resolution of the numerical method to the solution features such as turbulent regions or shocks. In those critical regions 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.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Implementation-in-Trixi.jl","page":"14 Adaptive mesh refinement","title":"Implementation in Trixi.jl","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"In Trixi.jl, AMR is possible for the mesh types TreeMesh and P4estMesh. Both meshes are organized in a tree structure 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.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The implementation of AMR is divided into different steps. The basic refinement setting contains an indicator and a controller. These are added to the simulation by using an AMR callback.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Indicators","page":"14 Adaptive mesh refinement","title":"Indicators","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"An indicator estimates the current accuracy of the numerical approximation. It indicates which regions of the domain need finer or coarser resolutions. In Trixi.jl, you can use for instance IndicatorLöhner and IndicatorHennemannGassner.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"IndicatorLöhner (also callable with IndicatorLoehner) is an interpretation and adaptation of a FEM indicator by Löhner (1987) and estimates a weighted second derivative of a specified variable locally.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorLöhner(semi, variable=variable)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"All indicators have the parameter variable which is used to specify the variable for the indicator calculation. You can use for instance density, pressure or density_pressure for the compressible Euler equations. Moreover, you have the option to use simply the first conservation variable with first for any equations. This might be a good choice for a starting example.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"IndicatorHennemannGassner, also used as a shock-capturing indicator, was developed by Hennemann et al. (2021) and is explained in detail in the tutorial about shock-capturing. It can be constructed as follows.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorHennemannGassner(semi,\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable=variable)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"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.jl.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorMax(semi, variable=variable)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Controllers","page":"14 Adaptive mesh refinement","title":"Controllers","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The spatial discretization into elements is tree-based for both AMR supporting mesh types TreeMesh and P4estMesh. Thus, the higher the level in the tree the higher the level of refinement. For instance, a mesh element of level 3 has double resolution in each direction compared to another element with level 2.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"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 in Trixi.jl.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_controller = ControllerThreeLevel(semi, amr_indicator;\n base_level=4,\n med_level=5, med_threshold=0.1,\n max_level=6, max_threshold=0.6)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"You can also set med_level=0 to use the current level as target, see the docstring of ControllerThreeLevel.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"An extension is ControllerThreeLevelCombined, which uses two different indicators. The primary indicator works the same as the single indicator for ControllerThreeLevel. The second indicator with its own maximum threshold adds the property, that the target level is set to max_level additionally if this indicator's value is greater than max_threshold_secondary. This is for instance used to assure that a shock has always the maximum refinement level.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_controller = ControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;\n base_level=2,\n med_level=6, med_threshold=0.0003,\n max_level=8, max_threshold=0.003,\n max_threshold_secondary=0.3)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"This controller is for instance used in elixir_euler_astro_jet_amr.jl.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Callback","page":"14 Adaptive mesh refinement","title":"Callback","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The AMR indicator and controller are added to the simulation through the callback AMRCallback. It contains a semidiscretization semi, the controller amr_controller and the parameters interval, adapt_initial_condition, and adapt_initial_condition_only_refine.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Adaptive mesh refinement will be performed every interval time steps. adapt_initial_condition indicates whether the initial condition already should be adapted before the first time step. And with adapt_initial_condition_only_refine=true the mesh is only refined at the beginning but not coarsened.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_callback = AMRCallback(semi, amr_controller,\n interval=5,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Exemplary-simulation","page":"14 Adaptive mesh refinement","title":"Exemplary simulation","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Here, we want to implement a simple AMR simulation of the 2D linear advection equation for a Gaussian pulse.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"using OrdinaryDiffEq\nusing Trixi\n\nadvection_velocity = (0.2, -0.7)\nequations = LinearScalarAdvectionEquation2D(advection_velocity)\n\ninitial_condition = initial_condition_gauss\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\ncoordinates_min = (-5.0, -5.0)\ncoordinates_max = ( 5.0, 5.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n n_cells_max=30_000)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n\n\ntspan = (0.0, 10.0)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"For the best understanding about indicators and controllers, we use the simple AMR indicator IndicatorMax. As described before, it returns the maximal value of the specified variable (here the only conserved variable). Therefore, regions with a high maximum are refined. This is not really useful numerical application, but a nice demonstration example.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorMax(semi, variable=first)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"These values are transferred to a refinement level with the ControllerThreeLevel, such that every element with maximal value greater than 0.1 is refined once and elements with maximum above 0.6 are refined twice.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_controller = ControllerThreeLevel(semi, amr_indicator,\n base_level=4,\n med_level=5, med_threshold=0.1,\n max_level=6, max_threshold=0.6)\n\namr_callback = AMRCallback(semi, amr_controller,\n interval=5,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true)\n\nstepsize_callback = StepsizeCallback(cfl=0.9)\n\ncallbacks = CallbackSet(amr_callback, stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Running the simulation.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"We plot the solution and add the refined mesh at the end of the simulation.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#More-examples","page":"14 Adaptive mesh refinement","title":"More examples","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Trixi.jl provides many elixirs using AMR. We want to give some examples for different mesh types:","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"elixir_euler_blast_wave_amr.jl for TreeMesh and P4estMesh\nelixir_euler_kelvin_helmholtz_instability_amr.jl for TreeMesh\nelixir_euler_double_mach_amr.jl for P4estMesh","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Animations of more interesting and complicated AMR simulations can be found below and on Trixi.jl's youtube channel \"Trixi Framework\".","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"First, we give a purely hyperbolic simulation of a Sedov blast wave with self-gravity. This simulation uses the mesh type TreeMesh as we did and the AMR indicator IndicatorHennemannGassner.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":" \n
    ","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Source: Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The next example is a numerical simulation of an ideal MHD rotor on an unstructured AMR mesh. The used mesh type is a P4estMesh.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":" \n
    ","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Source: Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"For more information, please have a look at the respective links.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Package-versions","page":"14 Adaptive mesh refinement","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"EditURL = \"../../literate/src/files/structured_mesh_mapping.jl\"","category":"page"},{"location":"tutorials/structured_mesh_mapping/#structured_mesh_mapping","page":"15 Structured mesh with curvilinear mapping","title":"15: Structured mesh with curvilinear mapping","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Here, we want to introduce another mesh type of Trixi.jl. More precisely, this tutorial is about the curved mesh type StructuredMesh supporting curved meshes.","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Creating-a-curved-mesh","page":"15 Structured mesh with curvilinear mapping","title":"Creating a curved mesh","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"There are two basic options to define a curved StructuredMesh 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.","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Mesh-defined-by-domain-boundary-curves","page":"15 Structured mesh with curvilinear mapping","title":"Mesh defined by domain boundary curves","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Both examples are based on a semdiscretization of the 2D compressible Euler equations.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"using OrdinaryDiffEq\nusing Trixi\n\nequations = CompressibleEulerEquations2D(1.4)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We start with a pressure perturbation at (xs, 0.0) as initial condition.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"function initial_condition_pressure_perturbation(x, t, equations::CompressibleEulerEquations2D)\n xs = 1.5 # location of the initial disturbance on the x axis\n w = 1/8 # half width\n p = exp(-log(2) * ((x[1]-xs)^2 + x[2]^2)/w^2) + 1.0\n v1 = 0.0\n v2 = 0.0\n rho = 1.0\n\n return prim2cons(SVector(rho, v1, v2, p), equations)\nend\ninitial_condition = initial_condition_pressure_perturbation","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Initialize every boundary as a boundary_condition_slip_wall.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"boundary_conditions = boundary_condition_slip_wall","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"The approximation setup is an entropy-stable split-form DG method with polydeg=4. We are using the two fluxes flux_ranocha and flux_lax_friedrichs.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs,\n volume_integral=VolumeIntegralFluxDifferencing(flux_ranocha))","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We want to define a circular cylinder as physical domain. It contains an inner semicircle with radius r0 and an outer semicircle of radius r1.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"(Image: )","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"The domain boundary curves with curve parameter in -11 are sorted as shown in the sketch. They always are orientated from negative to positive coordinate, such that the corners have to fit like this f_1(+1) = f_4(-1), f_3(+1) = f_2(-1), etc.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"In our case we can define the domain boundary curves as follows:","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"r0 = 0.5 # inner radius\nr1 = 5.0 # outer radius\nf1(xi) = SVector( r0 + 0.5 * (r1 - r0) * (xi + 1), 0.0) # right line\nf2(xi) = SVector(-r0 - 0.5 * (r1 - r0) * (xi + 1), 0.0) # left line\nf3(eta) = SVector(r0 * cos(0.5 * pi * (eta + 1)), r0 * sin(0.5 * pi * (eta + 1))) # inner circle\nf4(eta) = SVector(r1 * cos(0.5 * pi * (eta + 1)), r1 * sin(0.5 * pi * (eta + 1))) # outer circle","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We create a curved mesh with 16 x 16 elements. The defined domain boundary curves are passed as a tuple.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"cells_per_dimension = (16, 16)\nmesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4), periodicity=false)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Then, we define the simulation with endtime T=3 with semi, ode and callbacks.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_conditions)\n\ntspan = (0.0, 3.0)\node = semidiscretize(semi, tspan)\n\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi, interval=analysis_interval)\n\nalive_callback = AliveCallback(analysis_interval=analysis_interval)\n\nstepsize_callback = StepsizeCallback(cfl=0.9)\n\ncallbacks = CallbackSet(analysis_callback,\n alive_callback,\n stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Running the simulation","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\n\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"pd = PlotData2D(sol)\nplot(pd[\"p\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Mesh-directly-defined-by-the-transformation-mapping","page":"15 Structured mesh with curvilinear mapping","title":"Mesh directly defined by the transformation mapping","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"As mentioned before, you can also define the domain for a StructuredMesh by directly setting up a transformation mapping. Here, we want to present a nice mapping, which is often used to test free-stream preservation. Exact free-stream preservation is a crucial property of any numerical method on curvilinear grids. The mapping is a reduced 2D version of the mapping described in Rueda-Ramírez et al. (2021), p.18.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"using OrdinaryDiffEq\nusing Trixi\n\nequations = CompressibleEulerEquations2D(1.4)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"As mentioned, this mapping is used for testing free-stream preservation. So, we use a constant initial condition.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"initial_condition = initial_condition_constant\n\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We define the transformation mapping with variables in -1 1 as described in Rueda-Ramírez et al. (2021), p.18 (reduced to 2D):","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"function mapping(xi_, eta_)\n # Transform input variables between -1 and 1 onto [0,3]\n xi = 1.5 * xi_ + 1.5\n eta = 1.5 * eta_ + 1.5\n\n y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *\n cos(0.5 * pi * (2 * eta - 3)/3))\n\n x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *\n cos(2 * pi * (2 * y - 3)/3))\n\n return SVector(x, y)\nend","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Instead of a tuple of boundary functions, the mesh now has the mapping as its parameter.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"cells_per_dimension = (16, 16)\nmesh = StructuredMesh(cells_per_dimension, mapping)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan)\n\nanalysis_callback = AnalysisCallback(semi, interval=250)\n\nstepsize_callback = StepsizeCallback(cfl=0.8)\n\ncallbacks = CallbackSet(analysis_callback,\n stepsize_callback)\n\nsol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Now, we want to verify the free-stream preservation property and plot the mesh. For the verification, we calculate the absolute difference of the first conservation variable density u[1] and 1.0. To plot this error and the mesh, we are using the visualization feature ScalarPlotData2D, explained in visualization.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"error_density = let u = Trixi.wrap_array(sol.u[end], semi)\n abs.(u[1, :, :, :] .- 1.0) # density, x, y, elements\nend\npd = ScalarPlotData2D(error_density, semi)\n\nusing Plots\nplot(pd, title=\"Error in density\")\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We observe that the errors in the variable density are at the level of machine accuracy. Moreover, the plot shows the mesh structure resulting from our transformation mapping.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Of course, you can also use other mappings as for instance shifts by (x y)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"mapping(xi, eta) = SVector(xi + x, eta + y)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"or rotations with a rotation matrix T","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"mapping(xi, eta) = T * SVector(xi, eta).","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"For more curved mesh mappings, please have a look at some elixirs for StructuredMesh. For another curved mesh type, there is a tutorial about Trixi.jl's unstructured mesh type [UnstructuredMesh2D] and its use of the High-Order Hex-Quad Mesh (HOHQMesh) generator, created and developed by David Kopriva.","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Package-versions","page":"15 Structured mesh with curvilinear mapping","title":"Package versions","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"This page was generated using Literate.jl.","category":"page"},{"location":"github-git/#GitHub-and-Git","page":"GitHub & Git","title":"GitHub & Git","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"This page contains information on how to use GitHub and Git when developing Trixi.jl.","category":"page"},{"location":"github-git/#Development-workflow","page":"GitHub & Git","title":"Development workflow","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"For adding modifications to Trixi.jl, we generally follow these steps:","category":"page"},{"location":"github-git/#Create-an-issue-(optional)","page":"GitHub & Git","title":"Create an issue (optional)","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"In many cases it makes sense to start by creating an issue on GitHub. For example, if the implementation approach for a new feature is not yet clear or if there should be a discussion about the desired outcome, it is good practice to first get a consensus on what is the expected result of this modification. A GitHub issue is the place to lead this discussion, as it preserves it in the project and - together with the actual code changes - allows in the future to revisit the reasons for a particular choice of implementation or feature.","category":"page"},{"location":"github-git/#Create-a-branch-and-*immediately*-create-a-pull-request","page":"GitHub & Git","title":"Create a branch and immediately create a pull request","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"All feature development, bug fixes etc. should be developed in a branch and not directly on main. If you do not have write access to the main repository on GitHub, first create a fork of the Trixi.jl repository and clone the fork to your machine. Then, create a branch locally by executing git checkout -b yourbranch, push it to the repository, and create a pull request (PR).","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"If you have already cloned Trixi.jl from the main repo to your local machine, you can also work in that clone. You just need to add your fork as additional remote repository and push your new branch there.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"git remote add myfork git@github.com:YOUR_NAME/Trixi.jl.git\n# get latest main from the main repo\ngit checkout main\ngit pull\n# create a new branch for a cool new feature, bug fix, ...\ngit checkout -b YOUR_BRANCH_NAME\n# do some work and push it to your fork\ngit push -u myfork\n# go to https://github.com/trixi-framework/Trixi.jl/pull\n# and create a PR from your new branch","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"info: Why using pull requests?\nImmediately creating a PR for your branch has the benefit that all code discussions can now be held directly next to the corresponding code. Also, the PR allows to easily compare your branch to the upstream branch (usually main) to see what you have changed. Moreover, tests will run automatically.","category":"page"},{"location":"github-git/#Make-changes","page":"GitHub & Git","title":"Make changes","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"With a branch and PR in place, you can now write your code and commit it to your branch. If you request feedback from someone else, make sure to push your branch to the repository such that the others can easily review your changes or dive in and change something themselves.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"warning: Avoid committing unwanted files\nWhen you use git add . or similar catch-all versions, make sure you do not 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). However, this strategy only works if you have not yet pushed your changes. If you did push your changes, please talk to one of the core developers on how to proceed.","category":"page"},{"location":"github-git/#Keep-your-branch-in-sync-with-main","page":"GitHub & Git","title":"Keep your branch in sync with main","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"For larger features with longer-living branches, it may make sense to synchronize your branch with the current main, e.g., if there was a bug fix in main that is relevant for you. In this case, perform the following steps to merge the current main to your branch:","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Commit all your local changes to your branch and push it. This allows you to delete your clone in case you make a mistake and need to abort the merge.\nExecute git fetch to get the latest changes from the repository.\nMake sure you are in the correct branch by checking the output of git status or by running git checkout yourbranch.\nMerge main using git merge main. If there were no conflicts, hooray!, you are done. Otherwise you need to resolve your merge conflicts and commit the changes afterwards. A good guide for resolving merge conflicts can be found here.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"In general, always use git merge and not git rebase to get the latest changes from main. It is less error-prone and does not create problems on branches that are worked on collaboratively.","category":"page"},{"location":"github-git/#Prepare-for-review","page":"GitHub & Git","title":"Prepare for review","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"If you feel like your branch is ready to be merged to main, prepare it for review. That is, you should","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"merge the current main to your branch\nrun tests if available, but at least ensure that you did not accidentally change the results for one of the existing example elixirs\nproperly comment your code\ndelete old/unused code, especially commented lines (unless they contain helpful code, in which case you should add a comment on why you keep this around)\nremove debug statements\nadd a elixir_xxx.jl that uses your feature (only relevant for new features)\nmake sure your code formatting adheres to the Style guide\ndescribe changes in NEWS.md if appropriate","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"After you are confident that your branch is cleaned up properly, commit all changes and push them to the repository.","category":"page"},{"location":"github-git/#Get-reviewed","page":"GitHub & Git","title":"Get reviewed","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Ask one of the core developers to review your code. Sometimes this will be done directly, either face-to-face or via a video call. Other times a review will be conducted asynchronously, with the reviewer leaving comments and annotations. In some cases it will be necessary to do multiple rounds of reviews, especially if there are larger changes to be added. Just commit and push your changes to your branch, and the corresponding pull request will be updated automatically.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Please note that a review has nothing to do with the lack of experience of the 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 that the code is developed in a consistent fashion. Furthermore, do not take criticism of your code personally - we just try to keep Trixi.jl as accessible and easy to use for everyone.","category":"page"},{"location":"github-git/#Merge-branch","page":"GitHub & Git","title":"Merge branch","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Once your branch is reviewed and declared ready for merging by the reviewer, make sure that all the latest changes have been pushed. Then, one of the developers will merge your PR. If you are one of the developers, you can also go to the pull request page on GitHub and and click on Merge pull request. Voilà, you are done! Your branch will have been merged to main and the source branch will have been deleted in the GitHub repository (if you are not working in your own fork).","category":"page"},{"location":"github-git/#Update-your-working-copy","page":"GitHub & Git","title":"Update your working copy","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Once you have merged your branch by accepting the PR on GitHub, you should clean up your local working copy of the repository by performing the following steps:","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Update your clone by running git fetch.\nCheck out main using git checkout main.\nDelete merged branch locally with git branch -d yourbranch.\nRemove local references to deleted remote branch by executing git remote prune origin.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"You can now proceed with your next changes by starting again at the top.","category":"page"},{"location":"github-git/#Using-Git","page":"GitHub & Git","title":"Using Git","text":"","category":"section"},{"location":"github-git/#Resources-for-learning-Git","page":"GitHub & Git","title":"Resources for learning Git","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Here are a few resources for learning do use Git that at least one of us found helpful in the past (roughly ordered from novice to advanced to expert):","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Git Handbook by GitHub\nLearn Git Branching","category":"page"},{"location":"github-git/#Tips-and-tricks","page":"GitHub & Git","title":"Tips and tricks","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"This is an unordered collection of different tips and tricks that can be helpful while working with Git. As usual, your mileage might vary.","category":"page"},{"location":"github-git/#Undo-last-commit","page":"GitHub & Git","title":"Undo last commit","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"If you made a mistake in your last commit, e.g., by committing an unwanted file, you can undo the latest commit by running","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"git reset HEAD~","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"This only works if you have not yet pushed your branch to the GitHub repository. In this case, please talk to one of the core developers on how to proceed. Especially when you accidentally committed a large file (image, or video), please let us know as fast as possible, since the effort to fix the repository grows considerably over time.","category":"page"},{"location":"github-git/#Remove-large-file-from-repository","page":"GitHub & Git","title":"Remove large file from repository","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"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.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"danger: Large files\nYou should never try to fix this yourself, as it potentially disrupts/destroys the work of others!","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Based on the instructions found here and here, the following steps need to be taken (as documented for GitLab in issue #33):","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Tell everyone to commit and push their changes to the repository.\nFix the branch in which the file was committed by removing it and committing the removal. This is especially important on main.\nPerform the following steps to clean up the Git repository:\ncd /tmp\n\n# Download bfg-1.13.0.jar from https://rtyley.github.io/bfg-repo-cleaner/\n\n# Get fresh clone of repo (so you can throw it away in case there is a problem)\ngit clone --mirror git@github.com:trixi-framework/Trixi.jl.git\n\n# Clean up repo of all files larger than 10M\njava -jar bfg-1.13.0.jar --strip-blobs-bigger-than 10M Trixi.jl.git\n\n# Enter repo\ncd Trixi.jl.git\n\n# Clean up reflog and force aggressive garbage collection\ngit reflog expire --expire=now --all && git gc --prune=now --aggressive\n\n# Push changes\ngit push\n\n# Delete clone\nrm -rf Trixi.jl.git\nTell everyone to clean up their local working copies by performing the following steps (also do this yourself):\n# Enter repo\ncd Trixi.jl\n\n# Get current changes\ngit fetch\n\n# Check out the fixed branch\ngit checkout branchname\n\n# IMPORTANT: Do a rebase instead of a pull!\ngit rebase\n\n# Clean reflog and force garbage collection\ngit reflog expire --expire=now --all && git gc --prune=now --aggressive\nIMPORTANT: You need to do a git rebase instead of a git pull when updating the fixed branch.","category":"page"},{"location":"testing/#Testing","page":"Testing","title":"Testing","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"During the development of Trixi.jl, we rely on continuous testing to ensure that modifications or new features do not break existing functionality or add other errors. In the main Trixi.jl repository (and the repositories for the visualization tool Trixi2Vtk), this is facilitated by GitHub Actions, which allows to run tests automatically upon certain events. When, how, and what is tested by GitHub Actions is controlled by the workflow file .github/workflows/ci.yml. In Trixi.jl and its related repositories, tests are triggered by","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"each git push to main and\neach git push to any pull request.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"Besides checking functionality, we also analyse the Test coverage to ensure that we do not miss important parts during testing.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"note: Test and coverage requirements\nBefore merging a pull request (PR) to main, we require thatthe code passes all functional tests\ncode coverage does not decrease.","category":"page"},{"location":"testing/#Testing-setup","page":"Testing","title":"Testing setup","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"The entry point for all testing is the file test/runtests.jl, which is run by the automated tests and which can be triggered manually by executing","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"julia> using Pkg; Pkg.test(\"Trixi\")","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"in the REPL. Since there already exist many tests, we have split them up into multiple files in the test directory to allow for faster testing of individual parts of the code. Thus in addition to performing all tests, you can also just include one of the files named test_xxx.jl to run only a specific subset, e.g.,","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"julia> # Run all 2D tests on the P4estMesh\n include(joinpath(\"test\", \"test_p4est_2d.jl\"))\n\njulia> # Run all 1D tests for the Euler equations on the TreeMesh\n include(joinpath(\"test\", \"test_tree_1d_euler.jl\"))","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"For the automated tests with GitHub Actions, we run multiple jobs in parallel to reduce the waiting time until all tests are finished. You can see the different components that are run as jobs by looking at the TRIXI_TEST variable in test/runtests.jl.","category":"page"},{"location":"testing/#Adding-new-tests","page":"Testing","title":"Adding new tests","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"We use Julia's built-in unit testing capabilities to configure tests. In general, newly added code must be covered by at least one test, and all new elixirs added to the examples/ directory must be used at least once during testing. New tests should be added to the corresponding test/test_xxx.jl file, e.g., a test involving the 3D linear advection equation on the TreeMesh would go into test/test_tree_3d_advection.jl. Please study one of the existing tests and stay consistent to the current style when creating new tests.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"Since we want to test as much as possible, we have a lot of tests and frequently create new ones. Naturally, this increases the time to wait for all tests to pass with each novel feature added to Trixi.jl. Therefore, new tests should be as short as reasonably possible, i.e., without being too insensitive to pick up changes or errors in the code.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"When you add new tests, please check whether all CI jobs still take approximately the same time. If the job where you added new tests takes much longer than everything else, please consider moving some tests from one job to another (or report this incident and ask the main developers for help).","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"note: Test duration\nAs a general rule, tests should last no more than 10 seconds when run with a single thread and after compilation (i.e., excluding the first run).","category":"page"},{"location":"testing/#Test-coverage","page":"Testing","title":"Test coverage","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"In addition to ensuring that the code produces the expected results, the automated tests also record the code coverage. The resulting coverage reports, i.e., which lines of code were executed by at least one test and are thus considered \"covered\" by testing, are automatically uploaded to Coveralls for easy analysis. Typically, you see a number of Coveralls results at the bottom of each pull request: One for each parallel job (see Testing setup), which can usually be ignored since they only cover parts of the code by definition, and a cumulative coverage result named coverage/coveralls. The \"Details\" link takes you to a detailed report on which lines of code are covered by tests, which ones are missed, and especially which new lines the pull requests adds to Trixi.jl's code base that are not yet covered by testing.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"note: Coverage requirements\nIn general, we require pull requests to not decrease the overall test coverage percentage in main, with a hard lower bound of 97%.","category":"page"},{"location":"authors/#Authors","page":"Authors","title":"Authors","text":"","category":"section"},{"location":"authors/","page":"Authors","title":"Authors","text":"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.jl. In addition, there are contributors who have provided substantial additions or modifications. Together, these two groups form \"The Trixi.jl Authors\" as mentioned under License.","category":"page"},{"location":"authors/#Principal-Developers","page":"Authors","title":"Principal Developers","text":"","category":"section"},{"location":"authors/","page":"Authors","title":"Authors","text":"Michael Schlottke-Lakemper, RWTH Aachen University/High-Performance Computing Center Stuttgart (HLRS), Germany\nGregor Gassner, University of Cologne, Germany\nHendrik Ranocha, Johannes Gutenberg University Mainz, Germany\nAndrew Winters, Linköping University, Sweden\nJesse Chan, Rice University, US","category":"page"},{"location":"authors/#Contributors","page":"Authors","title":"Contributors","text":"","category":"section"},{"location":"authors/","page":"Authors","title":"Authors","text":"The following people contributed major additions or modifications to Trixi.jl and are listed in alphabetical order:","category":"page"},{"location":"authors/","page":"Authors","title":"Authors","text":"Maximilian D. Bertrand\nBenjamin Bolm\nSimon Candelaresi\nJesse Chan\nLars Christmann\nChristof Czernik\nDaniel Doehring\nPatrick Ersing\nErik Faulhaber\nGregor Gassner\nLucas Gemein\nSven Goldberg\nJoshua Lampert\nJulia Odenthal\nSigrun Ortleb\nHendrik Ranocha\nAndrés M. Rueda-Ramírez\nFelipe Santillan\nMichael Schlottke-Lakemper\nToskan Theine\nAndrew Winters","category":"page"},{"location":"license/#License","page":"License","title":"License","text":"","category":"section"},{"location":"license/","page":"License","title":"License","text":"MIT LicenseCopyright (c) 2020-present The Trixi.jl Authors (see Authors)Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","category":"page"},{"location":"restart/#restart","page":"Restart simulation","title":"Restart simulation","text":"","category":"section"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"You can continue running an already finished simulation by first preparing the simulation for the restart and then performing the restart. Here we suppose that in the first run your simulation stops at time 1.0 and then you want it to run further to time 2.0.","category":"page"},{"location":"restart/#restart_preparation","page":"Restart simulation","title":"Prepare the simulation for a restart","text":"","category":"section"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"In you original elixir you need to specify to write out restart files. Those will later be read for the restart of your simulation. This is done almost the same way as writing the snapshots using the SaveSolutionCallback callback. For the restart files it is called SaveRestartCallback:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"save_restart = SaveRestartCallback(interval=100,\n save_final_restart=true)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Make this part of your CallbackSet.","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"An example is examples/examples/structured_2d_dgsem/elixir_advection_extended.jl.","category":"page"},{"location":"restart/#restart_perform","page":"Restart simulation","title":"Perform the simulation restart","text":"","category":"section"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Since all of the information about the simulation can be obtained from the last snapshot, the restart can be done with relatively few lines in an extra elixir file. However, some might prefer to keep everything in one elixir and conditionals like if restart with a boolean variable restart that is user defined.","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"First we need to define from which file we want to restart, e.g.","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"restart_file = \"restart_000021.h5\"\nrestart_filename = joinpath(\"out\", restart_file)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Then we load the mesh file:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"mesh = load_mesh(restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"This is then needed for the semidiscretization:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"We then define a new time span for the simulation that takes as starting time the one form the snapshot:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"tspan = (load_time(restart_filename), 2.0)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"We now also take the last dt, so that our solver does not need to first find one to fulfill the CFL condition:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"dt = load_dt(restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"The ODE that we will pass to the solver is now:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"ode = semidiscretize(semi, tspan, restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"You should now define a SaveSolutionCallback similar to the original simulation, but with save_initial_solution=false, otherwise our initial snapshot will be overwritten. If you are using one file for the original simulation and the restart you can reuse your SaveSolutionCallback, but need to set","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"save_solution.condition.save_initial_solution = false","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Before we compute the solution using OrdinaryDiffEq.jl we need to set the integrator and its time step number, e.g.:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=dt, save_everystep=false, callback=callbacks);\nload_timestep!(integrator, restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Now we can compute the solution:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"sol = solve!(integrator)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"An example is in examples/structured_2d_dgsem/elixir_advection_restart.jl.","category":"page"},{"location":"meshes/structured_mesh/#Structured-mesh","page":"Structured mesh","title":"Structured mesh","text":"","category":"section"},{"location":"meshes/structured_mesh/","page":"Structured mesh","title":"Structured mesh","text":"The StructuredMesh is a structured, curvilinear, conforming mesh type available for one-, two-, and three-dimensional simulations.","category":"page"},{"location":"meshes/structured_mesh/","page":"Structured mesh","title":"Structured mesh","text":"Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.","category":"page"},{"location":"development/#Development","page":"Development","title":"Development","text":"","category":"section"},{"location":"development/#interactive-use-of-julia","page":"Development","title":"Interactive use of Julia","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"When a Julia program is executed, Julia first loads and parses all code. Then, the just-in-time compiler has to compile all functions at their first use, which 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.jl should generally always be used interactively from the REPL without closing Julia during development, as it allows much faster turnaround times.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"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 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","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> add Revise","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"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.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Another recommended package for working from the REPL is OhMyREPL.jl. It can be installed by running","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> add OhMyREPL","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"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.","category":"page"},{"location":"development/#Running-Trixi.jl-interactively-in-the-global-environment","page":"Development","title":"Running Trixi.jl interactively in the global environment","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"If you've installed Trixi.jl and Revise in your default environment, begin by executing:","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"This will start the Julia REPL. Then, run","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> using Revise; using Trixi","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"You can run a simulation by executing","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> trixi_include(default_example())","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Together, all of these commands can take some time, roughly half a minute on a 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.jl runs do not need to be recompiled and thus execute much faster after the first run.","category":"page"},{"location":"development/#Manually-starting-Trixi.jl-in-the-local-environment","page":"Development","title":"Manually starting Trixi.jl in the local environment","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"If you followed the installation instructions 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.jl this way, you need to start the REPL with","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia --project=path/to/Trixi.jl/run","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"and execute","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> using Revise; using Trixi","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"to load Revise and Trixi.jl. You can then proceed with the usual commands and run Trixi.jl as in the example above. 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 manually such that you can modify their implementations.","category":"page"},{"location":"development/#Pitfalls-when-using-Revise","page":"Development","title":"Pitfalls when using Revise","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"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.jl developers and probably incomplete. Further information on limitations and possible issues with Revise can be found in the official documentation.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"tip: If in doubt, restart the REPL\nOftentimes, it is possible to recover from issues with Revise by fixing the offending code. Sometimes, however, this is not possible or you might have troubles finding out what exactly caused the problems. Therefore, in these cases, or if in doubt, restart the REPL to get a fresh start.","category":"page"},{"location":"development/#Syntax-errors-are-easy-to-miss","page":"Development","title":"Syntax errors are easy to miss","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Revise does not stop on syntax errors, e.g., when you accidentally write a[i) instead of a[i]. In this case, Revise reports an error but continues 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.jl starts writing output to the screen and you might not even have noticed that an error occurred at all.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Therefore, when you are deep in a coding/debugging session and wonder why your code modifications do not seem to have any effect, scroll up in your terminal to check if you missed earlier syntax errors, or - if in doubt - restart your REPL.","category":"page"},{"location":"development/#Files-are-not-tracked-after-changing-branches","page":"Development","title":"Files are not tracked after changing branches","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Sometimes, Revise stops tracking files when changing the Git branch. That is, 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 changing branches.","category":"page"},{"location":"development/#Changes-to-type-definitions-are-not-allowed","page":"Development","title":"Changes to type definitions are not allowed","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Revise cannot handle changes to type definitions, e.g., when modifying the fields in a struct. In this case, Revise reports an error and refuses to run your code unless you undo the modifications. Once you undo the changes, Revise will usually continue to work as expected again. However, if you want to keep your type modifications, you need to restart the REPL.","category":"page"},{"location":"development/#Using-the-Julia-REPL-effectively","page":"Development","title":"Using the Julia REPL effectively","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"The Julia manual is an excellent resource to learn Julia. Here, we list some helpful commands than can increase your productivity in the Julia REPL.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Use the REPL help mode entered by typing ?.\njulia> using Trixi\n\nhelp?> trixi_include\nsearch: trixi_include\n\n trixi_include([mod::Module=Main,] elixir::AbstractString; kwargs...)\n\n include the file elixir and evaluate its content in the global scope of module mod. You can override specific\n assignments in elixir by supplying keyword arguments. It's basic purpose is to make it easier to modify some\n parameters while running Trixi.jl from the REPL. Additionally, this is used in tests to reduce the computational\n burden for CI while still providing examples with sensible default values for users.\n\n Examples\n ≡≡≡≡≡≡≡≡≡≡\n\n julia> trixi_include(@__MODULE__, default_example(), tspan=(0.0, 0.1))\n [...]\n\n julia> sol.t[end]\n 0.1\nYou can copy and paste REPL history including julia> prompts into the REPL.\nUse tab completion in the REPL, both for names of functions/types/variables and for function arguments.\njulia> flux_ranocha( # and TAB\nflux_ranocha(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations1D) in Trixi at ~/.julia/dev/Trixi/src/equations/compressible_euler_1d.jl:390\nflux_ranocha(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) in Trixi at ~/.julia/dev/Trixi/src/equations/compressible_euler_2d.jl:839\n[...]\nUse methodswith to discover methods associated to a given type etc.\njulia> methodswith(CompressibleEulerEquations2D)\n[1] initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations2D) in Trixi at ~/.julia/dev/Trixi/src/equations/compressible_euler_2d.jl:51\n[...]\nUse @which (or @edit) for method calls.\njulia> @which trixi_include(default_example())\ntrixi_include(elixir::AbstractString; kwargs...) in Trixi at ~/.julia/dev/Trixi/src/auxiliary/special_elixirs.jl:36\nUse apropos to search through the documentation and docstrings.\njulia> apropos(\"MHD\")\nTrixi.IdealGlmMhdEquations3D\nTrixi.IdealGlmMhdMulticomponentEquations2D\nTrixi.calc_fast_wavespeed_roe\nTrixi.IdealGlmMhdEquations1D\nTrixi.initial_condition_constant\nTrixi.flux_nonconservative_powell\nTrixi.GlmSpeedCallback\nTrixi.flux_derigs_etal\nTrixi.flux_hindenlang_gassner\nTrixi.initial_condition_convergence_test\nTrixi.min_max_speed_naive\nTrixi.IdealGlmMhdEquations2D\nTrixi.IdealGlmMhdMulticomponentEquations1D\n[...]","category":"page"},{"location":"development/#Text-editors","page":"Development","title":"Text editors","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"When writing code, the choice of text editor can have a significant impact on productivity and developer satisfaction. While using the default text editor of the operating system has its own benefits (specifically the lack of an explicit installation procure), usually it makes sense to switch to a more programming-friendly tool. In the following, a few of the many options are listed and discussed:","category":"page"},{"location":"development/#VS-Code","page":"Development","title":"VS Code","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Visual Studio Code is a modern open source editor with good support for Julia. While Juno had some better support in the past, the developers of Juno and the Julia VS Code plugin are joining forces and concentrating on VS Code since support of Atom has been suspended. Basically, all comments on Juno below also apply to VS Code.","category":"page"},{"location":"development/#Juno","page":"Development","title":"Juno","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"If you are new to programming or do not have a preference for a text editor yet, Juno is a good choice for developing Julia code. It is based on Atom, a sophisticated and widely used editor for software developers, and is enhanced with several Julia-specific features. Furthermore and especially helpful for novice programmers, it has a MATLAB-like appearance with easy and interactive access to the current variables, the help system, and a debugger.","category":"page"},{"location":"development/#Vim-or-Emacs","page":"Development","title":"Vim or Emacs","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Vim and Emacs are both very popular editors that work great with Julia. One of their advantages is that they are text editors without a GUI and as such are available for almost any operating system. They also are preinstalled on virtually all Unix-like systems. However, Vim and Emacs come with their own, steep learning curve if they have never been used before. Therefore, if in doubt, it is probably easier to get started with a classic GUI-based text editor (like Juno). If you decide to use Vim or Emacs, make sure that you install the corresponding Vim plugin julia-vim or Emacs major mode julia-emacs.","category":"page"},{"location":"development/#Debugging","page":"Development","title":"Debugging","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Julia offers several options for debugging. A classical debugger is available with the Debugger.jl package or in the Julia extension for VS Code. However, it can be quite slow and, at the time of writing (January 2023), currently does not work properly with Trixi.jl. The 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.","category":"page"},{"location":"development/#Infiltrator","page":"Development","title":"Infiltrator","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"The Infiltrator package provides fast, interactive breakpoints using the @infiltrate command, which drops the user into a local REPL session. From there, it is possible to access local variables, see the call stack, and execute statements.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"The package can be installed in the Julia REPL by executing","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> add Infiltrator","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"To load the package in the Julia REPL execute","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> using Infiltrator","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Breakpoints can be set by adding a line with the @infiltrate macro at the respective position in the code. Use Revise if you want to set and delete breakpoints in your package without having to restart Julia.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"note: Use `@autoinfiltrate` when debugging Trixi.jl\nWhen 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.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Triggering the breakpoint starts a REPL session where it is possible to interact with the current local scope. Possible commands are:","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"@locals: Print the local variables.\n@exfiltrate: Save the local variables to a global storage, which can be accessed with the safehouse variable outside the Infiltrator session.\n@trace: Print the current stack trace.\nExecute other arbitrary statements\n?: Print a help list with all options","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"To finish a debugging session, either use @continue to continue and eventually stop at the next breakpoint or @exit to skip further breakpoints. After the code has finished, local variables saved with @exfiltrate can be accessed in the REPL using the safehouse variable.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Limitations of using Infiltrator.jl are that local variables cannot be changed, and that it is not possible to step into further calls or access other function scopes.","category":"page"},{"location":"development/#Releasing-a-new-version-of-Trixi.jl,-Trixi2Vtk","page":"Development","title":"Releasing a new version of Trixi.jl, Trixi2Vtk","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Check whether everything is okay, tests pass etc.\nSet the new version number in Project.toml according to the Julian version of semver. Commit and push.\nComment @JuliaRegistrator register on the commit setting the version number.\nJuliaRegistrator will create a PR with the new version in the General registry. Wait for it to be merged.\nIncrement 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.\nWhen 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.jl should be updated.\nThese 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.jl was released afterwards.","category":"page"},{"location":"development/#Preview-of-the-documentation","page":"Development","title":"Preview of the documentation","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"You can build the documentation of Trixi.jl locally by running","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'\njulia --project=docs --color=yes docs/make.jl","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"from the Trixi.jl main directory. Then, you can look at the html files generated in docs/build. 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.jl website, including malicious code).","category":"page"},{"location":"development/#trixi2vtk-dev","page":"Development","title":"Developing Trixi2Vtk","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"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.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","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> develop path/to/Trixi.jl","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"EditURL = \"../../../literate/src/files/first_steps/create_first_setup.jl\"","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#create_first_setup","page":"1.2 Create first setup","title":"1.2: First steps in Trixi.jl: Create first setup","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"In this part of the introductory guide, we will create a first Trixi.jl setup as an extension of elixir_advection_basic.jl. Since Trixi.jl has a common basic structure for the setups, you can create your own by extending and modifying the following example.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Let's consider the linear advection equation for a state u = u(x y t) on the two-dimensional spatial domain -1 1 times -1 1 with a source term","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"fracpartialpartial tu + fracpartialpartial x (02 u) - fracpartialpartial y (07 u) = - 2 e^-t\nsinbigl(2 pi (x - t) bigr) sinbigl(2 pi (y - t) bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"with the initial condition","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"u(x y 0) = sinbigl(pi x bigr) sinbigl(pi y bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"and periodic boundary conditions.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The first step is to create and open a file with the .jl extension. You can do this with your favorite text editor (if you do not have one, we recommend VS Code). In this file you will create your setup.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To be able to use functionalities of Trixi.jl, you always need to load Trixi.jl itself and the OrdinaryDiffEq.jl package.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"using Trixi\nusing OrdinaryDiffEq","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The next thing to do is to choose an equation that is suitable for your problem. To see all the currently implemented equations, take a look at src/equations. If you are interested in adding a new physics model that has not yet been implemented in Trixi.jl, take a look at the tutorials Adding a new scalar conservation law or Adding a non-conservative equation.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The linear scalar advection equation in two spatial dimensions","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"fracpartialpartial tu + fracpartialpartial x (a_1 u) + fracpartialpartial y (a_2 u) = 0","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"is already implemented in Trixi.jl as LinearScalarAdvectionEquation2D, for which we need to define a two-dimensional parameter advection_velocity describing the parameters a_1 and a_2. Appropriate for our problem is (0.2, -0.7).","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"advection_velocity = (0.2, -0.7)\nequations = LinearScalarAdvectionEquation2D(advection_velocity)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To solve our problem numerically using Trixi.jl, we have to discretize the spatial domain, for which we set up a mesh. One of the most used meshes in Trixi.jl is the TreeMesh. The spatial domain used is -1 1 times -1 1. We set an initial number of elements in the mesh using initial_refinement_level, which describes the initial number of hierarchical refinements. In this simple case, the total number of elements is 2^initial_refinement_level throughout the simulation. The variable n_cells_max is used to limit the number of elements in the mesh, which cannot be exceeded when using adaptive mesh refinement.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"All minimum and all maximum coordinates must be combined into Tuples.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"coordinates_min = (-1.0, -1.0)\ncoordinates_max = ( 1.0, 1.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level = 4,\n n_cells_max = 30_000)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To approximate the solution of the defined model, we create a DGSEM solver. The solution in each of the recently defined mesh elements will be approximated by a polynomial of degree polydeg. For more information about discontinuous Galerkin methods, check out the Introduction to DG methods tutorial.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"solver = DGSEM(polydeg=3)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now we need to define an initial condition for our problem. All the already implemented initial conditions for LinearScalarAdvectionEquation2D can be found in src/equations/linear_scalar_advection_2d.jl. If you want to use, for example, a Gaussian pulse, it can be used as follows:","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"initial_conditions = initial_condition_gauss","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"But to show you how an arbitrary initial condition can be implemented in a way suitable for Trixi.jl, we define our own initial conditions.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"u(x y 0) = sinbigl(pi x bigr) sinbigl(pi y bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The initial conditions function must take spatial coordinates, time and equation as arguments and returns an initial condition as a statically sized vector SVector. Following the same structure, you can define your own initial conditions. The time variable t can be unused in the initial condition, but might also be used to describe an analytical solution if known. If you use the initial condition as analytical solution, you can analyze your numerical solution by computing the error, see also the section about analyzing the solution.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"function initial_condition_sinpi(x, t, equations::LinearScalarAdvectionEquation2D)\n scalar = sinpi(x[1]) * sinpi(x[2])\n return SVector(scalar)\nend\ninitial_condition = initial_condition_sinpi","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The next step is to define a function of the source term corresponding to our problem.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"f(u x y t) = - 2 e^-t sinbigl(2 pi (x - t) bigr) sinbigl(2 pi (y - t) bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"This function must take the state variable, the spatial coordinates, the time and the equation itself as arguments and returns the source term as a static vector SVector.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"function source_term_exp_sinpi(u, x, t, equations::LinearScalarAdvectionEquation2D)\n scalar = - 2 * exp(-t) * sinpi(2*(x[1] - t)) * sinpi(2*(x[2] - t))\n return SVector(scalar)\nend","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now we collect all the information that is necessary to define a spatial discretization, which leaves us with an ODE problem in time with a span from 0.0 to 1.0. This approach is commonly referred to as the method of lines.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;\n source_terms = source_term_exp_sinpi)\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"At this point, our problem is defined. We will use the solve function defined in OrdinaryDiffEq.jl to get the solution. OrdinaryDiffEq.jl gives us the ability to customize the solver using callbacks without actually modifying it. Trixi.jl already has some implemented Callbacks. The most widely used callbacks in Trixi.jl are step control callbacks that are activated at the end of each time step to perform some actions, e.g. to print statistics. We will show you how to use some of the common callbacks.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To print a summary of the simulation setup at the beginning and to reset timers we use the SummaryCallback. When the returned callback is executed directly, the current timer values are shown.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"summary_callback = SummaryCallback()","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"We also want to analyze the current state of the solution in regular intervals. The AnalysisCallback outputs some useful statistical information during the solving process every interval time steps.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"analysis_callback = AnalysisCallback(semi, interval = 5)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"It is also possible to control the time step size using the StepsizeCallback if the time integration method isn't adaptive itself. To get more details, look at CFL based step size control.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"stepsize_callback = StepsizeCallback(cfl = 1.6)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To save the current solution in regular intervals we use the SaveSolutionCallback. We would like to save the initial and final solutions as well. The data will be saved as HDF5 files located in the out folder. Afterwards it is possible to visualize a solution from saved files using Trixi2Vtk.jl and ParaView, which is described below in the section Visualize the solution.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"save_solution = SaveSolutionCallback(interval = 5,\n save_initial_solution = true,\n save_final_solution = true)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Alternatively, we have the option to print solution files at fixed time intervals.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"save_solution = SaveSolutionCallback(dt = 0.1,\n save_initial_solution = true,\n save_final_solution = true)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Another useful callback is the SaveRestartCallback. It saves information for restarting in regular intervals. We are interested in saving a restart file for the final solution as well. To perform a restart, you need to configure the restart setup in a special way, which is described in the section Restart simulation.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"save_restart = SaveRestartCallback(interval = 100, save_final_restart = true)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Create a CallbackSet to collect all callbacks so that they can be passed to the solve function.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback, save_solution,\n save_restart)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The last step is to choose the time integration method. OrdinaryDiffEq.jl defines a wide range of ODE solvers, e.g. CarpenterKennedy2N54(williamson_condition = false). We will pass the ODE problem, the ODE solver and the callbacks to the solve function. Also, to use StepsizeCallback, we must explicitly specify the initial trial time step dt, the selected value is not important, because it will be overwritten by the StepsizeCallback. And there is no need to save every step of the solution, we are only interested in the final result.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0,\n save_everystep = false, callback = callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Finally, we print the timer summary.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"summary_callback()","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now you can plot the solution as shown below, analyze it and improve the stability, accuracy or efficiency of your setup.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#Visualize-the-solution","page":"1.2 Create first setup","title":"Visualize the solution","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"In the previous part of the tutorial, we calculated the final solution of the given problem, now we want to visualize it. A more detailed explanation of visualization methods can be found in the section Visualization.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#Using-Plots.jl","page":"1.2 Create first setup","title":"Using Plots.jl","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The first option is to use the Plots.jl package directly after calculations, when the solution is saved in the sol variable. We load the package and use the plot function.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To show the mesh on the plot, we need to extract the visualization data from the solution as a PlotData2D object. Mesh extraction is possible using the getmesh function. Plots.jl has the plot! function that allows you to modify an already built graph.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"pd = PlotData2D(sol)\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#Using-Trixi2Vtk.jl","page":"1.2 Create first setup","title":"Using Trixi2Vtk.jl","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Another way to visualize a solution is to extract it from a saved HDF5 file. After we used the solve function with SaveSolutionCallback there is a file with the final solution. It is located in the out folder and is named as follows: solution_index.h5. The index is the final time step of the solution that is padded to 6 digits with zeros from the beginning. With Trixi2Vtk you can convert the HDF5 output file generated by Trixi.jl into a VTK file. This can be used in visualization tools such as ParaView or VisIt to plot the solution. The important thing is that currently Trixi2Vtk.jl supports conversion only for solutions in 2D and 3D spatial domains.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"If you haven't added Trixi2Vtk.jl to your project yet, you can add it as follows.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"import Pkg\nPkg.add([\"Trixi2Vtk\"])","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now we load the Trixi2Vtk.jl package and convert the file out/solution_000018.h5 with the final solution using the trixi2vtk function saving the resulting file in the out folder.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"using Trixi2Vtk\ntrixi2vtk(joinpath(\"out\", \"solution_000018.h5\"), output_directory=\"out\")","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now two files solution_000018.vtu and solution_000018_celldata.vtu have been generated in the out folder. The first one contains all the information for visualizing the solution, the second one contains all the cell-based or discretization-based information.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now let's visualize the solution from the generated files in ParaView. Follow this short instruction to get the visualization.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Download, install and open ParaView.\nPress Ctrl+O and select the generated files solution_000018.vtu and solution_000018_celldata.vtu from the out folder.\nIn the upper-left corner in the Pipeline Browser window, left-click on the eye-icon near solution_000018.vtu.\nIn the lower-left corner in the Properties window, change the Coloring from Solid Color to scalar. This already generates the visualization of the final solution.\nNow let's add the mesh to the visualization. In the upper-left corner in the Pipeline Browser window, left-click on the eye-icon near solution_000018_celldata.vtu.\nIn the lower-left corner in the Properties window, change the Representation from Surface to Wireframe. Then a white grid should appear on the visualization.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now, if you followed the instructions exactly, you should get a similar image as shown in the section Using Plots.jl:","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"(Image: paraview_trixi2vtk_example)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"After completing this tutorial you are able to set up your own simulations with Trixi.jl. If you have an interest in contributing to Trixi.jl as a developer, refer to the third part of the introduction titled Changing Trixi.jl itself.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Sys.rm(\"out\"; recursive=true, force=true) #hide","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"This page was generated using Literate.jl.","category":"page"},{"location":"visualization/#visualization","page":"Visualization","title":"Visualization","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"There are two possible approaches to visualize results from Trixi.jl: either directly from the REPL using Plots.jl or with ParaView/VisIt by postprocessing Trixi.jl's output files with Trixi2Vtk.","category":"page"},{"location":"visualization/#Plots.jl","page":"Visualization","title":"Plots.jl [experimental]","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By far the easiest and most convenient plotting approach is to use the powerful Plots.jl package to directly visualize Trixi.jl's results from the REPL. In the following, you will find more information on a number of topics for how to use Plots.jl together with Trixi.jl:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Getting started\nCustomizing plot results via a PlotData2D object\nPlotting a 3D solution as a 2D plot\nCreating a 1D plot\nPlotting a 2D or 3D solutions as a 1D plot\nVisualizing results during a simulation","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nPlotting via Plots.jl is still considered an experimental feature and might change in any future releases.","category":"page"},{"location":"visualization/#getting-started-plots-jl","page":"Visualization","title":"Getting started","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"After running a simulation with Trixi.jl in the REPL, load the Plots package with","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Plots","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To visualize the solution, execute","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Here we assume that sol holds the return value of the solve(...) method (with type SciMLBase.ODESolution), which is the default variable name when you use one of the example elixirs. This will generate a grid layout with one subplot for each solution variable, convenient for getting an overview of the current solution:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"You can save the resulting file as a PNG image file by calling savefig(...) with an output file name that ends in .png, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> savefig(\"solution-overview.png\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In Trixi.jl, two plot types are available: 2D heatmap plots and 1D line plots. If you use plot(sol), Trixi.jl will automatically choose the plot type that fits the dimensions of the sol input: 2D/3D data will be visualized as a heatmap, 1D data as a line plot. For more fine-grained control over what to plot, you can create such an object yourself, which can either be a PlotData2D or a PlotData1D object. For further details on both of these see below:","category":"page"},{"location":"visualization/#Customizing-plot-results-via-a-PlotData2D-object","page":"Visualization","title":"Customizing plot results via a PlotData2D object","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"For more fine-grained control over what to plot, first create a PlotData2D object by executing","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(sol)\njulia> pd = PlotData2D(u, semi)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"where u is an array containing the solution and semi is the semidiscretization. For example, if PlotData2D(sol.u[2], semi) is specified, this will create a PlotData2D instance from the 2nd saved time-step. If PlotData2D(sol(0.5), semi) is specified, it will construct a PlotData2D instance using OrdinaryDiffEq.jl's interpolation to evaluate the solution at time t=0.5.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This takes the results generated by Trixi.jl and stores them in a data format that can be understood by the Plots package, and pd holds all data relevant for plotting sol. You can pass variable names as strings to pd using a dictionary-like syntax, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(pd[\"rho\"])","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This will create a single 2D heatmap plot of the variable rho:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The default plot type and style can be overridden by passing any additional arguments that are understood by the Plots package. For example, to change the color scheme and add names to the axes, modify the previous command to","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(pd[\"rho\"], seriescolor = :heat, xguide=\"x\", yguide=\"y\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"to yield","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho-modified)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"For more details on the various format options for plot, please consult the Plots documentation.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In addition, you can plot the mesh lines on top of the solution variables by calling the getmesh(...) function on the PlotData2D object","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot!(getmesh(pd)) # here we use `plot!` with an `!` to add to the previous plot","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"which modifies the previous plot to","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho-modified-mesh)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By default, PlotData2D will convert the conserved variables to primitive variables, but this can be changed by passing an appropriate conversion function in the solution_variables keyword argument, similar to the behavior of the SaveSolutionCallback:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(sol; solution_variables=cons2cons) # Plot conservative variables","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"There are several other keyword arguments that influence how the solution data is processed for visualization with the Plots package. A detailed explanation can be found in the docstring of the PlotData2D constructor.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Another way to change the appearance of a plot is to convert the solution to a uniformly refined mesh before plotting. This can be helpful, e.g., when trying different settings for a simulation with adaptive mesh refinement, where one would like to ignore the mesh changes when comparing solutions. This is achieved with adapt_to_mesh_level, which uses the mesh adaptation routines to adapt the solution to a uniform grid. For example, the AMR solution from above could be preprocessed with","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(adapt_to_mesh_level(sol, 4)...)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"When plotted together with the mesh, this will yield the following visualization:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho-uniform-mesh)","category":"page"},{"location":"visualization/#Plotting-a-user-defined-scalar-field","page":"Visualization","title":"Plotting a user-defined scalar field","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To plot a scalar quantity, one can call plot(ScalarPlotData2D(u, semi)), where u is an array of nodal values of the scalar field to plot. The layout of u should match the layout of the x and y nodal coordinates of the respective solver. For example, after running trixi_include(joinpath(\"examples\", \"unstructured_2d_dgsem\", \"elixir_euler_wall_bc.jl\")), the following can be used to plot the function f(x, y) = x * y:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"x = view(semi.cache.elements.node_coordinates, 1, :, :, :)\ny = view(semi.cache.elements.node_coordinates, 2, :, :, :)\nplot(ScalarPlotData2D(x .* y, semi))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This produces the following plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: scalar-plotting-example)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This routine can be used to visualize scalar quantities which depend on the solution, such as the norm of a velocity vector or two-dimensional vorticity. For example, we can visualize vorticity for a compressible version of the Brown-Minion vortex problem:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Trixi, Plots\n\njulia> redirect_stdout(devnull) do\n # runs the elixir without any output from callbacks etc.\n trixi_include(@__MODULE__,\n joinpath(examples_dir(), \"dgmulti_2d\", \"elixir_euler_brown_minion_vortex.jl\"))\n end\n[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n\njulia> function compute_vorticity(velocity, mesh, equations::CompressibleEulerEquations2D,\n dg::DGMulti, cache)\n rd = dg.basis\n md = mesh.md\n @unpack Dr, Ds = rd\n @unpack rxJ, sxJ, ryJ, syJ, J = md\n v1, v2 = velocity\n dv1dy = ryJ .* (Dr * v1) + syJ .* (Ds * v1)\n dv2dx = rxJ .* (Dr * v2) + sxJ .* (Ds * v2)\n return dv2dx - dv1dy\n end;\n\njulia> compute_vorticity(velocity, semi) =\n compute_vorticity(velocity, Trixi.mesh_equations_solver_cache(semi)...);\n\njulia> function get_velocity(sol)\n rho, rhou, rhov, E = StructArrays.components(sol.u[end])\n v1 = rhou ./ rho\n v2 = rhov ./ rho\n return v1, v2\n end;\n\njulia> vorticity = compute_vorticity(get_velocity(sol), semi);\n\njulia> plot(ScalarPlotData2D(vorticity, semi;\n variable_name = \"Vorticity at t = $(sol.prob.tspan[end])\"))\nPlot{Plots.GRBackend() n=1}","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This produces the following plot of vorticity.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: vorticity-example)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Since the mesh is fairly coarse, we observe numerical artifacts due to the low resolution. These errors vanish under mesh refinement; for example, doubling the mesh resolution by running","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi_include(joinpath(examples_dir(), \"dgmulti_2d\", \"elixir_euler_BM_vortex.jl\"), cells_per_dimension = 32)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"yields the following plot of vorticity:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: vorticity-example-refined)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nWhen visualizing a scalar field, the plotted solution is reinterpolated using a high order polynomial approximation. Thus, small discrepancies may be observed when the underlying data is highly non-smooth or under-resolved.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"ScalarPlotData2D objects can also be used with Makie through iplot. For example, the following code plots two surfaces:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Trixi, CairoMakie\n\njulia> redirect_stdout(devnull) do\n # runs the elixir without any output from callbacks etc.\n trixi_include(@__MODULE__,\n joinpath(examples_dir(), \"unstructured_2d_dgsem\", \"elixir_euler_wall_bc.jl\"))\n end\n[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n\njulia> x = view(semi.cache.elements.node_coordinates, 1, :, :, :); # extracts the node x coordinates\n\njulia> y = view(semi.cache.elements.node_coordinates, 2, :, :, :); # extracts the node y coordinates\n\njulia> fig_ax_plt = iplot(ScalarPlotData2D((@. 1 - .25*(x^2 + y^2)), semi), plot_mesh=true, colormap=:viridis);\n\njulia> fig_ax_plt2 = iplot!(fig_ax_plt, ScalarPlotData2D((@. .125*(x+y)), semi), plot_mesh=true, colormap=:blues)\nFigureAxisPlot()","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This creates the following plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: ScalarPlotData2D_example)","category":"page"},{"location":"visualization/#Plotting-a-3D-solution-as-a-2D-plot","page":"Visualization","title":"Plotting a 3D solution as a 2D plot","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"It is possible to plot 2D slices from 3D simulation data using the TreeMesh with the same commands as above:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol) # `sol` is from a 3D simulation","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By default, plotting sol or creating a PlotData2D object from a 3D simulation will create a 2D slice of the solution in the xy-plane. You can customize this behavior by explicitly creating a PlotData2D object and passing appropriate keyword arguments:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"slice specifies the plane which is being sliced and can be :xy, :xz, or :yz (default: :xy)\npoint specifies a three-dimensional point. The sliced plane is then created such that it lies on the point (default: (0.0, 0.0, 0.0)).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"All other attributes for PlotData2D objects apply here as well.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"For example, to plot the velocity field orthogonal to the yz-plane at different x-axis locations, you can execute","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi_include(joinpath(examples_dir(), \"tree_3d_dgsem\", \"elixir_euler_taylor_green_vortex.jl\"), tspan=(0.0, 1.0))\n[...]\n\njulia> plots = []\nAny[]\n\njulia> for x in range(0, stop=pi/2, length=6)\n pd = PlotData2D(sol, slice=:yz, point=(x, 0.0, 0.0))\n push!(plots, plot(pd[\"v1\"], clims=(-1,1), title=\"x = \"*string(round(x, digits=2))))\n end\n\njulia> plot(plots..., layout=(2, 3), size=(750,350))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"which results in a 2x3 grid of slices of the yz-plane:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-v1-0.0-to-0.5pi)","category":"page"},{"location":"visualization/#Creating-a-1D-plot","page":"Visualization","title":"Creating a 1D plot","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"When plotting a 1D solution with","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol) # `sol` is from a 1D simulation","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Trixi.jl automatically creates a PlotData1D object and visualizes it as a line plot: (Image: 1d-plot)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To customize your 1D plot, you can create a PlotData1D object manually as follows:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData1D(sol)\njulia> pd = PlotData1D(u, semi)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The behavior is analogous to the PlotData2D behavior.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In a very similar fashion to PlotData2D, you can customize your plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"plot(pd) creates the same plot as in plot(sol).\nplot(pd[\"rho\", \"p\"]) only plots specific variables. In this case rho and p.\nplot!(getmesh(pd)) adds mesh lines after creating a plot.\nAny attributes from Plots can be used, e.g., plot(pd, yguide=:temperature).\npd = PlotData1D(adapt_to_mesh_level(sol, 4)...) adapts the mesh before plotting (in this example to a mesh with refinement level 4).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"You can also customize the PlotData1D object itself by passing attributes to the PlotData1D constructor:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"solution_variables specifies the variables to be plotted.\nnvisnodes sets the amount of nodes per element which the solution then is interpolated on.","category":"page"},{"location":"visualization/#Plotting-a-2D-or-3D-solutions-as-a-1D-plot","page":"Visualization","title":"Plotting a 2D or 3D solutions as a 1D plot","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"It is possible to extract a straight, axis-parallel line from a 2D or 3D solution and visualize it as a 1D plot. This is done by creating a PlotData1D object with a 2D/3D solution sol as input:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData1D(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The plot is then created with:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(pd)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By default the x-axis is extracted, which can be changed with following attributes:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"slice specifies the axis which is being extracted and can be :x, :y or :z (:z is only for 3D input and default is :x)\npoint specifies a two or three dimensional point. The sliced axis is then created in such a way, that it lies on the point. (default: (0.0, 0.0) or (0.0, 0.0, 0.0))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"All other attributes for PlotData1D objects apply here as well.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In the following, is an example for a 2D simulation of the linear scalar advection equation. First, we have the regular 2D heatmap plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: 2d-plot-for-slice)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"From this, we can extract a line plot parallel to the y-axis going through the point (1.0, 0.0) with the following commands:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData1D(sol, slice=:y, point=(1.0, 0.0))\njulia> plot(pd)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: 1d-plot-for-slice)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This convenient method of slicing is limited to axis-parallel slices, but for 2D/3D solutions it is also possible to create a plot along any curve you want. To do so, you first need to create a list of 2D/3D points that define your curve. Then you can create a PlotData1D with the keyword argument curve set to your list.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Let's give an example of this with the basic advection equation from above by creating a plot along the circle marked in green:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: 2d-plot-along-circle)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"We can write a function like this, that outputs a list of points on a circle:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"function circle(radius, center, n_points)\n coordinates = zeros(2, n_points)\n for i in 1:n_points\n coordinates[:,i] = radius*[cospi(2*i/n_points), sinpi(2*i/n_points)] .+ center\n end\n return coordinates\nend","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Then create and plot a PlotData1D object along a circle with radius one, center at (1,1), and 100 points:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"pd = PlotData1D(sol, curve=circle(1.0, (1.0, 1.0), 100))\nplot(pd)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This gives you the following plot: (Image: 1d-plot-along-circle)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Creating a plot like this has its downsides. For one, it is unclear what to put on the abscissa of the plot. By default, the arc length of the given curve is used. Also, with this way of plotting you lose the ability to use a mesh plot from getmesh.","category":"page"},{"location":"visualization/#Visualizing-results-during-a-simulation","page":"Visualization","title":"Visualizing results during a simulation","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To visualize solutions while a simulation is still running (also known as in-situ visualization), you can use the VisualizationCallback. It is created as a regular callback and accepts upon creation a number of keyword arguments that allow, e.g., to control the visualization interval, to specify the variables to plot, or to customize the plotting style.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"During the simulation, the visualization callback creates and displays visualizations of the current solution in regular intervals. This can be useful to, e.g., monitor the validity of a long-running simulation or for illustrative purposes. An example for how to create a VisualizationCallback can be found in examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"[...]\n\n# Enable in-situ visualization with a new plot generated every 20 time steps\n# and additional plotting options passed as keyword arguments\nvisualization = VisualizationCallback(interval=20; clims=(0,1))\n\n[...]","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The resulting output of the referenced elixir can be seen in the embedded video below:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":" \n
    ","category":"page"},{"location":"visualization/#Trixi2Vtk","page":"Visualization","title":"Trixi2Vtk","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Trixi2Vtk converts Trixi.jl's .h5 output files to VTK files, which can be read by ParaView, VisIt, and other visualization tools. It automatically interpolates solution data from the original quadrature node locations to equidistant visualization nodes at a higher resolution, to make up for the loss of accuracy from going from a high-order polynomial representation to a piecewise constant representation in VTK.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In the Julia REPL, first load the package Trixi2Vtk","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Trixi2Vtk","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To process an HDF5 file generated by Trixi.jl, execute","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(joinpath(\"out\", \"solution_000000.h5\"), output_directory=\"out\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This will create two unstructured VTK files in the out subdirectory that can be opened with ParaView or VisIt: solution_000000.vtu contains the discontinuous Galerkin solution data while solution_000000_celldata.vtu holds any cell-based values such as the current AMR indicator or the cell refinement level.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: \"solution_000000_scalar_mesh\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This allows you to generate VTK files for solution, restart and mesh files. By default, Trixi2Vtk generates .vtu (unstructured VTK) files for both cell/element data (e.g., cell ids, element ids) and node data (e.g., solution variables). This format visualizes each cell with the same number of nodes, independent of its size. Alternatively, you can provide format=:vti as a keyword argument to trixi2vtk, which causes Trixi2Vtk to generate .vti (image data VTK) files for the solution files, while still using .vtu files for cell-/element-based data. In .vti files, a uniform resolution is used throughout the entire domain, resulting in different number of visualization nodes for each element. This can be advantageous to create publication-quality images, but increases the file size.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"If you want to convert multiple solution/restart files at once, you can just supply multiple input files as the positional arguments to trixi2vtk, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(\"out/solution_000000.h5\", \"out/solution_000040.h5\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"You may also use file globbing to select a range of files based on filename patterns, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(\"out/solution_*.h5\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"to convert all solution files in the out/ directory or","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(\"out/restart_00[0-9]000.h5\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"to convert every one-thousandth restart file (out/restart_000000.h5, out/restart_001000.h5 etc.).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"When multiple solution/restart files are provided, Trixi2Vtk will also generate a .pvd file, which allows ParaView to read all .vtu/.vti files at once and which uses the time attribute in solution/restart files to inform ParaView about the solution time. A comprehensive list of all possible arguments for trixi2vtk can be found in the Trixi2Vtk.jl API.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Further information regarding the development of Trixi2Vtk can be found in the development section.","category":"page"},{"location":"visualization/#Makie.jl","page":"Visualization","title":"Makie.jl [experimental]","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In addition to Plots.jl support, Trixi.jl includes visualization utilities through Makie.jl. Trixi.jl provides Makie-based visualization options both for heatmap-type plots (similar to the Plots.jl recipes) as well as for interactive surface plots. Support is currently limited to the UnstructuredMesh2D type.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nPlotting via Makie.jl is still considered an experimental feature and might change in any future releases.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"A Makie plot can be created as follows: after running a simulation with Trixi.jl in the REPL, load a Makie backend (for example, GLMakie or CairoMakie).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using GLMakie","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To visualize the solution and mesh with a heatmap-type plot, simply run","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nBoth Makie.jl and Plots.jl export plot, so if you load both libraries, you will have to specify which plot function to call via Plots.plot or Makie.plot.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"As with Plots.jl recipes, one can view individual solution components by creating a PlotData2D object and indexing into it with the desired variable name","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(sol)\njulia> plot(pd[\"rho\"])","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Unlike the Plots.jl recipe, mesh plotting is controlled using the keyword argument plot_mesh = false, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol; plot_mesh=false)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The plot command also returns figure and axis handles, which can be used to edit plot titles or labels:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> fig, axes = plot(sol)\njulia> axes[1,1].title = \"New title for subplot (1,1)\"","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Trixi.jl also supports interactive surface plots using iplot. After executing","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi_include(joinpath(\"examples\", \"unstructured_2d_dgsem\", \"elixir_euler_wall_bc.jl\"))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"we can run","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> iplot(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This will open up an interactive visualization window:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: makie-example)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The plot can be rotated (click and hold), zoomed in and out (scroll up and down), and panned (hold right click and drag). Two toggle buttons control whether mesh lines are visible on top of and below the solution.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Both plot and iplot use colormap = :inferno by default. A different colormap can be selected by providing an appropriate keyword argument. For example, plot(sol, colormap=:blues) and iplot(sol, colormap=:blues) produce the following figures:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: makie-plot-example) (Image: makie-iplot-example)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"EditURL = \"../../literate/src/files/adding_new_parabolic_terms.jl\"","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#adding_new_parabolic_terms","page":"13 Adding new parabolic terms","title":"13: Adding new parabolic terms","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"This demo illustrates the steps involved in adding new parabolic terms for the scalar advection equation. In particular, we will add an anisotropic diffusion. We begin by defining the hyperbolic (advection) part of the advection-diffusion equation.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"using OrdinaryDiffEq\nusing Trixi\n\n\nadvection_velocity = (1.0, 1.0)\nequations_hyperbolic = LinearScalarAdvectionEquation2D(advection_velocity);\nnothing #hide","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Define-a-new-parabolic-equation-type","page":"13 Adding new parabolic terms","title":"Define a new parabolic equation type","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Next, we define a 2D parabolic diffusion term type. This is similar to LaplaceDiffusion2D except that the diffusivity field refers to a spatially constant diffusivity matrix now. Note that ConstantAnisotropicDiffusion2D has a field for equations_hyperbolic. It is useful to have information about the hyperbolic system available to the parabolic part so that we can reuse functions defined for hyperbolic equations (such as varnames).","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"The abstract type Trixi.AbstractEquationsParabolic has three parameters: NDIMS (the spatial dimension, e.g., 1D, 2D, or 3D), NVARS (the number of variables), and GradientVariable, which we set as GradientVariablesConservative. This indicates that the gradient should be taken with respect to the conservative variables (e.g., the same variables used in equations_hyperbolic). Users can also take the gradient with respect to a different set of variables; see, for example, the implementation of CompressibleNavierStokesDiffusion2D, which can utilize either \"primitive\" or \"entropy\" variables.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"struct ConstantAnisotropicDiffusion2D{E, T} <: Trixi.AbstractEquationsParabolic{2, 1, GradientVariablesConservative}\n diffusivity::T\n equations_hyperbolic::E\nend\n\nvarnames(variable_mapping, equations_parabolic::ConstantAnisotropicDiffusion2D) =\n varnames(variable_mapping, equations_parabolic.equations_hyperbolic)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Next, we define the viscous flux function. We assume that the mixed hyperbolic-parabolic system is of the form","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"partial_t u(tx) + partial_x (f_1(u) - g_1(u nabla u))\n + partial_y (f_2(u) - g_2(u nabla u)) = 0","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"where f_1(u), f_2(u) are the hyperbolic fluxes and g_1(u nabla u), g_2(u nabla u) denote the viscous fluxes. For anisotropic diffusion, the viscous fluxes are the first and second components of the matrix-vector product involving diffusivity and the gradient vector.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Here, we specialize the flux to our new parabolic equation type ConstantAnisotropicDiffusion2D.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"function Trixi.flux(u, gradients, orientation::Integer, equations_parabolic::ConstantAnisotropicDiffusion2D)\n @unpack diffusivity = equations_parabolic\n dudx, dudy = gradients\n if orientation == 1\n return SVector(diffusivity[1, 1] * dudx + diffusivity[1, 2] * dudy)\n else # if orientation == 2\n return SVector(diffusivity[2, 1] * dudx + diffusivity[2, 2] * dudy)\n end\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Defining-boundary-conditions","page":"13 Adding new parabolic terms","title":"Defining boundary conditions","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Trixi.jl's implementation of parabolic terms discretizes both the gradient and divergence using weak formulation. In other words, we discretize the system","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"beginaligned\nbmq = nabla u \nbmsigma = beginpmatrix g_1(u bmq) g_2(u bmq) endpmatrix \ntextviscous contribution = nabla cdot bmsigma\nendaligned","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Boundary data must be specified for all spatial derivatives, e.g., for both the gradient equation bmq = nabla u and the divergence of the viscous flux nabla cdot bmsigma. We account for this by introducing internal Gradient and Divergence types which are used to dispatch on each type of boundary condition.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"As an example, let us introduce a Dirichlet boundary condition with constant boundary data.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"struct BoundaryConditionConstantDirichlet{T <: Real}\n boundary_value::T\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"This boundary condition contains only the field boundary_value, which we assume to be some real-valued constant which we will impose as the Dirichlet data on the boundary.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Boundary conditions have generally been defined as \"callable structs\" (also known as \"functors\"). For each boundary condition, we need to specify the appropriate boundary data to return for both the Gradient and Divergence. Since the gradient is operating on the solution u, the boundary data should be the value of u, and we can directly impose Dirichlet data.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"@inline function (boundary_condition::BoundaryConditionConstantDirichlet)(flux_inner, u_inner, normal::AbstractVector,\n x, t, operator_type::Trixi.Gradient,\n equations_parabolic::ConstantAnisotropicDiffusion2D)\n return boundary_condition.boundary_value\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"While the gradient acts on the solution u, the divergence acts on the viscous flux bmsigma. Thus, we have to supply boundary data for the Divergence operator that corresponds to bmsigma. However, we've already imposed boundary data on u for a Dirichlet boundary condition, and imposing boundary data for bmsigma might overconstrain our problem.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Thus, for the Divergence boundary data under a Dirichlet boundary condition, we simply return flux_inner, which is boundary data for bmsigma computed using the \"inner\" or interior solution. This way, we supply boundary data for the divergence operation without imposing any additional conditions.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"@inline function (boundary_condition::BoundaryConditionConstantDirichlet)(flux_inner, u_inner, normal::AbstractVector,\n x, t, operator_type::Trixi.Divergence,\n equations_parabolic::ConstantAnisotropicDiffusion2D)\n return flux_inner\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#A-note-on-the-choice-of-gradient-variables","page":"13 Adding new parabolic terms","title":"A note on the choice of gradient variables","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"It is often simpler to transform the solution variables (and solution gradients) to another set of variables prior to computing the viscous fluxes (see CompressibleNavierStokesDiffusion2D for an example of this). If this is done, then the boundary condition for the Gradient operator should be modified accordingly as well.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Putting-things-together","page":"13 Adding new parabolic terms","title":"Putting things together","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Finally, we can instantiate our new parabolic equation type, define boundary conditions, and run a simulation. The specific anisotropic diffusion matrix we use produces more dissipation in the direction (1 -1) as an isotropic diffusion.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"For boundary conditions, we impose that u=1 on the left wall, u=2 on the bottom wall, and u = 0 on the outflow walls. The initial condition is taken to be u = 0. Note that we use BoundaryConditionConstantDirichlet only for the parabolic boundary conditions, since we have not defined its behavior for the hyperbolic part.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"using Trixi: SMatrix\ndiffusivity = 5.0e-2 * SMatrix{2, 2}([2 -1; -1 2])\nequations_parabolic = ConstantAnisotropicDiffusion2D(diffusivity, equations_hyperbolic);\n\nboundary_conditions_hyperbolic = (; x_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(1.0)),\n y_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(2.0)),\n y_pos = boundary_condition_do_nothing,\n x_pos = boundary_condition_do_nothing)\n\nboundary_conditions_parabolic = (; x_neg = BoundaryConditionConstantDirichlet(1.0),\n y_neg = BoundaryConditionConstantDirichlet(2.0),\n y_pos = BoundaryConditionConstantDirichlet(0.0),\n x_pos = BoundaryConditionConstantDirichlet(0.0));\n\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\ncoordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))\ncoordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n periodicity=false, n_cells_max=30_000) # set maximum capacity of tree data structure\n\ninitial_condition = (x, t, equations) -> SVector(0.0)\n\nsemi = SemidiscretizationHyperbolicParabolic(mesh,\n (equations_hyperbolic, equations_parabolic),\n initial_condition, solver;\n boundary_conditions=(boundary_conditions_hyperbolic,\n boundary_conditions_parabolic))\n\ntspan = (0.0, 2.0)\node = semidiscretize(semi, tspan)\ncallbacks = CallbackSet(SummaryCallback())\ntime_int_tol = 1.0e-6\nsol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,\n ode_default_options()..., callback=callbacks);\n\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Package-versions","page":"13 Adding new parabolic terms","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"EditURL = \"../../literate/src/files/p4est_from_gmsh.jl\"","category":"page"},{"location":"tutorials/p4est_from_gmsh/#p4est_from_gmsh","page":"17 P4est mesh from gmsh","title":"17: P4est mesh from gmsh","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Trixi.jl supports numerical approximations from structured and unstructured quadrilateral meshes with the P4estMesh mesh type.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The purpose of this tutorial is to demonstrate how to use the P4estMesh functionality of Trixi.jl for existing meshes with straight-sided (bilinear) elements/cells. This begins by running and visualizing an available unstructured quadrilateral mesh example. Then, the tutorial will cover how to use existing meshes generated by gmsh or any other meshing software that can export to the Abaqus input .inp format.","category":"page"},{"location":"tutorials/p4est_from_gmsh/#Running-the-simulation-of-a-near-field-flow-around-an-airfoil","page":"17 P4est mesh from gmsh","title":"Running the simulation of a near-field flow around an airfoil","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Trixi.jl supports solving hyperbolic-parabolic problems on several mesh types. A somewhat complex example that employs the P4estMesh is the near-field simulation of a Mach 2 flow around the NACA6412 airfoil.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"using Trixi\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi_include(joinpath(examples_dir(), \"p4est_2d_dgsem\", \"elixir_euler_NACA6412airfoil_mach2.jl\"), tspan=(0.0, 0.5))\nend #hide","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Conveniently, we use the Plots package to have a first look at the results:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"using Plots\npd = PlotData2D(sol)\nplot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/p4est_from_gmsh/#Creating-a-mesh-using-gmsh","page":"17 P4est mesh from gmsh","title":"Creating a mesh using gmsh","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The creation of an unstructured quadrilateral mesh using gmsh is driven by a geometry file. There are plenty of possibilities for the user, see the documentation and tutorials.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"To begin, we provide a complete geometry file for the NACA6412 airfoil bounded by a rectangular box. After this we give a breakdown of the most important parts required for successful mesh generation that can later be used by the p4est library and Trixi.jl. We emphasize that this near-field mesh should only be used for instructive purposes and not for actual production runs.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The associated NACA6412.geo file is given below:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":" // GMSH geometry script for a NACA 6412 airfoil with 11 degree angle of attack\n // in a box (near-field mesh).\n // see https://github.com/cfsengineering/GMSH-Airfoil-2D\n // for software to generate gmsh `.geo` geometry files for NACA airfoils.\n\n // outer bounding box\n Point(1) = {-1.25, -0.5, 0, 1.0};\n Point(2) = {1.25, -0.5, 0, 1.0};\n Point(3) = {1.25, 0.5, 0, 1.0};\n Point(4) = {-1.25, 0.5, 0, 1.0};\n\n // lines of the bounding box\n Line(1) = {1, 2};\n Line(2) = {2, 3};\n Line(3) = {3, 4};\n Line(4) = {4, 1};\n // outer box\n Line Loop(8) = {1, 2, 3, 4};\n\n // Settings\n // This value gives the global element size factor (lower -> finer mesh)\n Mesh.CharacteristicLengthFactor = 1.0 * 2^(-3);\n // Insist on quads instead of default triangles\n Mesh.RecombineAll = 1;\n // Violet instead of green base color for better visibility\n Mesh.ColorCarousel = 0;\n\n // points of the airfoil contour\n // Format: {x, y, z, DesiredCellSize}. See the documentation: https://gmsh.info/doc/texinfo/gmsh.html#Points\n // These concrete points are generated using the tool from https://github.com/cfsengineering/GMSH-Airfoil-2D\n Point(5) = {-0.4900332889206208, 0.09933466539753061, 0, 0.125};\n Point(6) = {-0.4900274857651495, 0.1021542752054094, 0, 0.125};\n Point(7) = {-0.4894921489729144, 0.1049830248247787, 0, 0.125};\n Point(8) = {-0.4884253336670712, 0.1078191282319664, 0, 0.125};\n Point(9) = {-0.4868257975566199, 0.1106599068424483, 0, 0.125};\n Point(10) = {-0.4846930063965668, 0.1135018003016681, 0, 0.125};\n Point(11) = {-0.4820271400142729, 0.1163403835785654, 0, 0.125};\n Point(12) = {-0.4788290988083472, 0.1191703902233889, 0, 0.125};\n Point(13) = {-0.4751005105908123, 0.1219857416089041, 0, 0.125};\n Point(14) = {-0.4708437376101668, 0.1247795819332056, 0, 0.125};\n Point(15) = {-0.4660618835629463, 0.1275443187232316, 0, 0.125};\n Point(16) = {-0.4607588003749649, 0.1302716685409717, 0, 0.125};\n Point(17) = {-0.4549390945110529, 0.132952707559475, 0, 0.125};\n Point(18) = {-0.448608132554204, 0.1355779266432996, 0, 0.125};\n Point(19) = {-0.4417720457819508, 0.138137290538182, 0, 0.125};\n Point(20) = {-0.4344377334597768, 0.140620300747629, 0, 0.125};\n Point(21) = {-0.4266128645686593, 0.1430160616500159, 0, 0.125};\n Point(22) = {-0.4183058776865576, 0.1453133493887722, 0, 0.125};\n Point(23) = {-0.4095259787518715, 0.147500683050503, 0, 0.125};\n Point(24) = {-0.4002831364505879, 0.1495663976315875, 0, 0.125};\n Point(25) = {-0.3905880749878933, 0.1514987182830453, 0, 0.125};\n Point(26) = {-0.3804522640292948, 0.1532858353164163, 0, 0.125};\n Point(27) = {-0.3698879056254708, 0.1549159794501833, 0, 0.125};\n Point(28) = {-0.3589079179688306, 0.1563774967770029, 0, 0.125};\n Point(29) = {-0.3475259158676376, 0.1576589229368209, 0, 0.125};\n Point(30) = {-0.3357561878650377, 0.158749055989923, 0, 0.125};\n Point(31) = {-0.3236136699747923, 0.1596370274972017, 0, 0.125};\n Point(32) = {-0.3111139160522804, 0.1603123713324616, 0, 0.125};\n Point(33) = {-0.298273064867608, 0.160765089773461, 0, 0.125};\n Point(34) = {-0.2851078039966239, 0.1609857164445887, 0, 0.125};\n Point(35) = {-0.2716353306943914, 0.160965375714529, 0, 0.125};\n Point(36) = {-0.2578733099632437, 0.1606958381868515, 0, 0.125};\n Point(37) = {-0.2438398300730194, 0.1601695719599709, 0, 0.125};\n Point(38) = {-0.2295533558334121, 0.1593797893750759, 0, 0.125};\n Point(39) = {-0.2150326799566391, 0.1583204890160489, 0, 0.125};\n Point(40) = {-0.2002968728818922, 0.1569864927736143, 0, 0.125};\n Point(41) = {-0.18536523146042, 0.1553734778363979, 0, 0.125};\n Point(42) = {-0.1702572269208345, 0.1534780035235666, 0, 0.125};\n Point(43) = {-0.1549924525477129, 0.1512975329264932, 0, 0.125};\n Point(44) = {-0.1395905715122586, 0.1488304493795921, 0, 0.125};\n Point(45) = {-0.1240712652914332, 0.1460760678321895, 0, 0.125};\n Point(46) = {-0.1084541831014299, 0.1430346412430583, 0, 0.125};\n Point(47) = {-0.09275889275279087, 0.1397073621660917, 0, 0.125};\n Point(48) = {-0.07700483330818747, 0.1360963597385416, 0, 0.125};\n Point(49) = {-0.06151286635366404, 0.1323050298149023, 0, 0.125};\n Point(50) = {-0.04602933219022032, 0.1283521764905442, 0, 0.125};\n Point(51) = {-0.03051345534800332, 0.1242331665904082, 0, 0.125};\n Point(52) = {-0.01498163190522334, 0.1199540932779839, 0, 0.125};\n Point(53) = {0.0005498526140696458, 0.1155214539466913, 0, 0.125};\n Point(54) = {0.01606484191716884, 0.1109421303284033, 0, 0.125};\n Point(55) = {0.03154732664394777, 0.106223368423828, 0, 0.125};\n Point(56) = {0.0469814611314705, 0.1013727584299359, 0, 0.125};\n Point(57) = {0.06235157928986135, 0.09639821481480275, 0, 0.125};\n Point(58) = {0.07764220964363855, 0.09130795666388933, 0, 0.125};\n Point(59) = {0.09283808959671735, 0.08611048839446452, 0, 0.125};\n Point(60) = {0.1079241789809607, 0.08081458090718853, 0, 0.125};\n Point(61) = {0.1228856729475325, 0.07542925321638272, 0, 0.125};\n Point(62) = {0.1377080142575372, 0.06996375457378261, 0, 0.125};\n Point(63) = {0.1523769050236616, 0.06442754707512513, 0, 0.125};\n Point(64) = {0.1668783179480157, 0.05883028871526293, 0, 0.125};\n Point(65) = {0.1811985070933818, 0.05318181683604975, 0, 0.125};\n Point(66) = {0.1953240182159306, 0.04749213189240609, 0, 0.125};\n Point(67) = {0.2092416986775084, 0.04177138144606024, 0, 0.125};\n Point(68) = {0.2229387069452062, 0.03602984428372727, 0, 0.125};\n Point(69) = {0.2364025216754475, 0.03027791454712048, 0, 0.125};\n Point(70) = {0.2496209503696738, 0.02452608575629232, 0, 0.125};\n Point(71) = {0.2625821375791982, 0.01878493460541621, 0, 0.125};\n Point(72) = {0.2752745726282818, 0.01306510441121807, 0, 0.125};\n Point(73) = {0.28768709681727, 0.007377288098728577, 0, 0.125};\n Point(74) = {0.2998089100619555, 0.001732210616722449, 0, 0.125};\n Point(75) = {0.3116295769214332, -0.003859389314124759, 0, 0.125};\n Point(76) = {0.3231390319647309, -0.009386778203927332, 0, 0.125};\n Point(77) = {0.3343275844265582, -0.01483924761490708, 0, 0.125};\n Point(78) = {0.3451859221046181, -0.02020613485126957, 0, 0.125};\n Point(79) = {0.3557051144551212, -0.02547684454806881, 0, 0.125};\n Point(80) = {0.3658766148492779, -0.03064087116872238, 0, 0.125};\n Point(81) = {0.3756922619615632, -0.0356878223992288, 0, 0.125};\n Point(82) = {0.3851442802702071, -0.0406074434050937, 0, 0.125};\n Point(83) = {0.394225279661484, -0.04538964189492445, 0, 0.125};\n Point(84) = {0.4029282541416501, -0.05002451391298904, 0, 0.125};\n Point(85) = {0.4112465796735204, -0.05450237026215737, 0, 0.125};\n Point(86) = {0.4191740111683733, -0.05881376343890812, 0, 0.125};\n Point(87) = {0.4267046786777481, -0.06294951494382847, 0, 0.125};\n Point(88) = {0.4338330828434404, -0.06690074281456823, 0, 0.125};\n Point(89) = {0.4405540896772232, -0.07065888921378868, 0, 0.125};\n Point(90) = {0.4468629247542237, -0.07421574789251445, 0, 0.125};\n Point(91) = {0.4527551669150955, -0.0775634913396257, 0, 0.125};\n Point(92) = {0.4582267415819197, -0.08069469742118066, 0, 0.125};\n Point(93) = {0.4632739138007936, -0.08360237530891265, 0, 0.125};\n Point(94) = {0.4678932811302005, -0.08627999049569551, 0, 0.125};\n Point(95) = {0.4720817664982195, -0.08872148869699745, 0, 0.125};\n Point(96) = {0.4758366111533843, -0.09092131844134463, 0, 0.125};\n Point(97) = {0.4791553678333992, -0.09287445215953141, 0, 0.125};\n Point(98) = {0.4820358942729613, -0.09457640559161551, 0, 0.125};\n Point(99) = {0.4844763471666588, -0.09602325534252773, 0, 0.125};\n Point(100) = {0.4864751766953637, -0.09721165443119822, 0, 0.125};\n Point(101) = {0.4880311217148797, -0.09813884569428721, 0, 0.125};\n Point(102) = {0.4891432056939881, -0.09880267292366274, 0, 0.125};\n Point(103) = {0.4898107334756874, -0.09920158963645126, 0, 0.125};\n Point(104) = {0.4900332889206208, -0.09933466539753058, 0, 0.125};\n Point(105) = {0.4897824225031319, -0.09926905587549506, 0, 0.125};\n Point(106) = {0.4890301110661922, -0.09907236506934192, 0, 0.125};\n Point(107) = {0.4877772173496635, -0.09874500608402761, 0, 0.125};\n Point(108) = {0.48602517690576, -0.09828766683852558, 0, 0.125};\n Point(109) = {0.4837759946062035, -0.09770130916007558, 0, 0.125};\n Point(110) = {0.4810322398085871, -0.09698716747297723, 0, 0.125};\n Point(111) = {0.4777970402368822, -0.09614674703990023, 0, 0.125};\n Point(112) = {0.4740740746447117, -0.09518182170326678, 0, 0.125};\n Point(113) = {0.4698675643422793, -0.09409443106501386, 0, 0.125};\n Point(114) = {0.4651822636784212, -0.09288687703518478, 0, 0.125};\n Point(115) = {0.460023449577924, -0.09156171967354482, 0, 0.125};\n Point(116) = {0.4543969102408585, -0.09012177224394632, 0, 0.125};\n Point(117) = {0.4483089331151018, -0.08857009539864649, 0, 0.125};\n Point(118) = {0.4417662922553667, -0.08690999040934186, 0, 0.125};\n Point(119) = {0.4347762351819332, -0.0851449913634191, 0, 0.125};\n Point(120) = {0.4273464693498908, -0.08327885624791403, 0, 0.125};\n Point(121) = {0.419485148335155, -0.08131555684993674, 0, 0.125};\n Point(122) = {0.411200857836944, -0.07925926741086739, 0, 0.125};\n Point(123) = {0.4025026015879757, -0.07711435198240155, 0, 0.125};\n Point(124) = {0.3933997872536054, -0.07488535044544484, 0, 0.125};\n Point(125) = {0.3839022123897198, -0.07257696316779733, 0, 0.125};\n Point(126) = {0.3740200505167618, -0.07019403429336624, 0, 0.125};\n Point(127) = {0.3637638373540689, -0.06774153367408606, 0, 0.125};\n Point(128) = {0.3531444572451353, -0.06522453747557577, 0, 0.125};\n Point(129) = {0.3421731297908021, -0.06264820750853495, 0, 0.125};\n Point(130) = {0.3308613966940724, -0.06001776935966011, 0, 0.125};\n Point(131) = {0.3192211088076166, -0.05733848941811218, 0, 0.125};\n Point(132) = {0.3072644133633567, -0.05461565091590426, 0, 0.125};\n Point(133) = {0.2950037413531683, -0.05185452912263369, 0, 0.125};\n Point(134) = {0.2824517950208982, -0.04906036585632723, 0, 0.125};\n Point(135) = {0.2696215354188702, -0.04623834349241404, 0, 0.125};\n Point(136) = {0.2565261699769623, -0.04339355867155523, 0, 0.125};\n Point(137) = {0.2431791400293651, -0.04053099592384862, 0, 0.125};\n Point(138) = {0.2295941082432855, -0.03765550144139543, 0, 0.125};\n Point(139) = {0.2157849458952252, -0.03477175724299444, 0, 0.125};\n Point(140) = {0.2017657199439165, -0.03188425598348005, 0, 0.125};\n Point(141) = {0.187550679854507, -0.02899727666564914, 0, 0.125};\n Point(142) = {0.1731542441359161, -0.02611486151457043, 0, 0.125};\n Point(143) = {0.1585909865622793, -0.02324079427214604, 0, 0.125};\n Point(144) = {0.1438756220597465, -0.02037858016395433, 0, 0.125};\n Point(145) = {0.129022992251319, -0.0175314277805827, 0, 0.125};\n Point(146) = {0.1140480506645569, -0.01470223310184333, 0, 0.125};\n Point(147) = {0.09896584761949168, -0.01189356587453844, 0, 0.125};\n Point(148) = {0.08379151482656089, -0.009107658532933174, 0, 0.125};\n Point(149) = {0.06854024973648176, -0.006346397826038436, 0, 0.125};\n Point(150) = {0.05322729969528361, -0.003611319287478529, 0, 0.125};\n Point(151) = {0.03786794596792287, -0.00090360465249055, 0, 0.125};\n Point(152) = {0.0224774877026287, 0.00177591770710904, 0, 0.125};\n Point(153) = {0.007071225915134205, 0.004426769294862437, 0, 0.125};\n Point(154) = {-0.00833555242305456, 0.007048814950562587, 0, 0.125};\n Point(155) = {-0.02372759010533726, 0.009642253300220296, 0, 0.125};\n Point(156) = {-0.03908967513210498, 0.01220760427359278, 0, 0.125};\n Point(157) = {-0.05440665578848514, 0.01474569380579989, 0, 0.125};\n Point(158) = {-0.06966345527617318, 0.01725763587663899, 0, 0.125};\n Point(159) = {-0.08484508582421563, 0.01974481207672138, 0, 0.125};\n Point(160) = {-0.09987987792382108, 0.02219618763023203, 0, 0.125};\n Point(161) = {-0.1145078729404739, 0.02450371976411331, 0, 0.125};\n Point(162) = {-0.1290321771824579, 0.0267015185742735, 0, 0.125};\n Point(163) = {-0.143440065923266, 0.02879471001709845, 0, 0.125};\n Point(164) = {-0.1577189448447794, 0.03078883518202784, 0, 0.125};\n Point(165) = {-0.1718563428491159, 0.03268980457290044, 0, 0.125};\n Point(166) = {-0.1858399037768357, 0.03450385196323842, 0, 0.125};\n Point(167) = {-0.1996573773370766, 0.03623748825421298, 0, 0.125};\n Point(168) = {-0.2132966095779342, 0.03789745574015834, 0, 0.125};\n Point(169) = {-0.2267455332406906, 0.0394906831577609, 0, 0.125};\n Point(170) = {-0.2399921583489679, 0.04102424186233269, 0, 0.125};\n Point(171) = {-0.2530245633834605, 0.04250530343879837, 0, 0.125};\n Point(172) = {-0.2658308873846617, 0.04394109901707172, 0, 0.125};\n Point(173) = {-0.2783993233102972, 0.04533888052223981, 0, 0.125};\n Point(174) = {-0.2907181129514687, 0.04670588405019788, 0, 0.125};\n Point(175) = {-0.3027755436824813, 0.0480492955198111, 0, 0.125};\n Point(176) = {-0.3145599472847223, 0.04937621871394801, 0, 0.125};\n Point(177) = {-0.3260597010456697, 0.05069364578437131, 0, 0.125};\n Point(178) = {-0.337263231291058, 0.05200843025992359, 0, 0.125};\n Point(179) = {-0.3481590194623916, 0.05332726256406103, 0, 0.125};\n Point(180) = {-0.3587356108043638, 0.05465664801682354, 0, 0.125};\n Point(181) = {-0.3689816256782782, 0.0560028872679817, 0, 0.125};\n Point(182) = {-0.3788857734692287, 0.05737205908247899, 0, 0.125};\n Point(183) = {-0.3884368690074614, 0.05877000537646382, 0, 0.125};\n Point(184) = {-0.3976238513788748, 0.06020231838219783, 0, 0.125};\n Point(185) = {-0.40643580495675, 0.06167432980291591, 0, 0.125};\n Point(186) = {-0.4148619824472646, 0.06319110180426264, 0, 0.125};\n Point(187) = {-0.4228918297057104, 0.06475741967717524, 0, 0.125};\n Point(188) = {-0.43051501204915, 0.06637778599795482, 0, 0.125};\n Point(189) = {-0.4377214417649294, 0.06805641610468524, 0, 0.125};\n Point(190) = {-0.4445013064933708, 0.06979723470503821, 0, 0.125};\n Point(191) = {-0.4508450981473512, 0.07160387342876083, 0, 0.125};\n Point(192) = {-0.4567436420215075, 0.073479669138689, 0, 0.125};\n Point(193) = {-0.4621881257395756, 0.07542766281688272, 0, 0.125};\n Point(194) = {-0.4671701276898881, 0.07745059884734995, 0, 0.125};\n Point(195) = {-0.471681644606229, 0.07955092452372269, 0, 0.125};\n Point(196) = {-0.4757151179639407, 0.0817307896190848, 0, 0.125};\n Point(197) = {-0.4792634588791559, 0.0839920458658267, 0, 0.125};\n Point(198) = {-0.4823200712220043, 0.08633624620581726, 0, 0.125};\n Point(199) = {-0.4848788726822436, 0.08876464368523246, 0, 0.125};\n Point(200) = {-0.4869343135575803, 0.09127818988394577, 0, 0.125};\n Point(201) = {-0.4884813930704814, 0.09387753278635144, 0, 0.125};\n Point(202) = {-0.4895156730580155, 0.09656301401871749, 0, 0.125};\n\n // splines of the airfoil\n Spline(5) = {5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104};\n Spline(6) = {104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,5};\n\n // airfoil\n Line Loop(9) = {5, 6};\n // complete domain\n Plane Surface(1) = {8, 9};\n\n // labeling of the boundary parts\n Physical Line(1) = {4}; // inflow\n Physical Line(2) = {2}; // outflow\n Physical Line(3) = {1, 3}; // airfoil\n Physical Line(4) = {5, 6}; // upper/lower wall\n Physical Surface(1) = {10};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"From which we can construct a mesh like this: (Image: mesh_screenshot)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The first four points define the bounding box = (near-field) domain:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":" // outer bounding box\nPoint(1) = {-1.25, -0.5, 0, 1.0};\nPoint(2) = {1.25, -0.5, 0, 1.0};\nPoint(3) = {1.25, 0.5, 0, 1.0};\nPoint(4) = {-1.25, 0.5, 0, 1.0};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which is constructed from connecting the points in lines:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// outer box\nLine(1) = {1, 2};\nLine(2) = {2, 3};\nLine(3) = {3, 4};\nLine(4) = {4, 1};\n// outer box\nLine Loop(8) = {1, 2, 3, 4};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"This is followed by a couple (in principle optional) settings where the most important one is","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// Insist on quads instead of default triangles\nMesh.RecombineAll = 1;","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which forces gmsh to generate quadrilateral elements instead of the default triangles. This is strictly required to be able to use the mesh later with p4est, which supports only straight-sided quads, i.e., C2D4, CPS4, S4 in 2D and C3D in 3D. See for more details the (short) documentation on the interaction of p4est with .inp files. In principle, it should also be possible to use the recombine function of gmsh to convert the triangles to quads, but this is observed to be less robust than enforcing quads from the beginning.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Then the airfoil is defined by a set of points:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// points of the airfoil contour\n Point(5) = {-0.4900332889206208, 0.09933466539753061, 0, 0.125};\n Point(6) = {-0.4900274857651495, 0.1021542752054094, 0, 0.125};\n ...","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which are connected by splines for the upper and lower part of the airfoil:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// splines of the airfoil\n Spline(5) = {5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,\n ...\n 96,97,98,99,100,101,102,103,104};\n Spline(6) = {104,105,106,107,108,109,110,111,112,113,114,115,\n ...\n 200,201,202,5};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which are then connected to form a single line loop for easy physical group assignment:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// airfoil\n Line Loop(9) = {5, 6};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"At the end of the file the physical groups are defined:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// labeling of the boundary parts\n Physical Line(1) = {4}; // Inflow. Label in Abaqus .inp file: PhysicalLine1\n Physical Line(2) = {2}; // Outflow. Label in Abaqus .inp file: PhysicalLine2\n Physical Line(3) = {1, 3}; // Upper and lower wall/farfield/... Label in Abaqus .inp file: PhysicalLine3\n Physical Line(4) = {5, 6}; // Airfoil. Label in Abaqus .inp file: PhysicalLine4","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which are crucial for the correct assignment of boundary conditions in Trixi.jl. In particular, it is the responsibility of a user to keep track on the physical boundary names between the mesh generation and assignment of boundary condition functions in an elixir.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"After opening this file in gmsh, meshing the geometry and exporting to Abaqus .inp format, we can have a look at the input file:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"*Heading\n \n*NODE\n1, -1.25, -0.5, 0\n2, 1.25, -0.5, 0\n3, 1.25, 0.5, 0\n4, -1.25, 0.5, 0\n...\n******* E L E M E N T S *************\n*ELEMENT, type=T3D2, ELSET=Line1\n1, 1, 7\n...\n*ELEMENT, type=CPS4, ELSET=Surface1\n191, 272, 46, 263, 807\n...\n*NSET,NSET=PhysicalLine1\n1, 4, 52, 53, 54, 55, 56, 57, 58,\n*NSET,NSET=PhysicalLine2\n2, 3, 26, 27, 28, 29, 30, 31, 32,\n*NSET,NSET=PhysicalLine3\n1, 2, 3, 4, 7, 8, 9, 10, 11, 12,\n13, 14, 15, 16, 17, 18, 19, 20, 21, 22,\n23, 24, 25, 33, 34, 35, 36, 37, 38, 39,\n40, 41, 42, 43, 44, 45, 46, 47, 48, 49,\n50, 51,\n*NSET,NSET=PhysicalLine4\n5, 6, 59, 60, 61, 62, 63, 64, 65, 66,\n67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\n77, 78, 79, 80, 81, 82, 83, 84, 85, 86,\n87, 88, 89, 90, 91, 92, 93, 94, 95, 96,\n97, 98, 99, 100, 101, 102, 103, 104, 105, 106,\n107, 108, 109, 110, 111, 112, 113, 114, 115, 116,\n117, 118, 119, 120, 121, 122, 123, 124, 125, 126,\n127, 128, 129, 130, 131, 132, 133, 134, 135, 136,\n137, 138, 139, 140, 141, 142, 143, 144, 145, 146,\n147, 148, 149, 150, 151, 152, 153, 154, 155, 156,\n157, 158, 159, 160, 161, 162, 163, 164, 165, 166,\n167, 168, 169, 170, 171, 172, 173, 174, 175, 176,\n177, 178, 179, 180, 181, 182, 183, 184, 185, 186,\n187, 188, 189, 190,","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"First, the coordinates of the nodes are listed, followed by the elements. Note that gmsh exports also line elements of type T3D2 which are ignored by p4est. The relevant elements in 2D which form the gridcells are of type CPS4 which are defined by their four corner nodes. This is followed by the nodesets encoded via *NSET which are used to assign boundary conditions in Trixi.jl. Trixi.jl parses the .inp file and assigns the edges (in 2D, surfaces in 3D) of elements to the corresponding boundary condition based on the supplied boundary_symbols that have to be supplied to the P4estMesh constructor:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"# boundary symbols\nboundary_symbols = [:PhysicalLine1, :PhysicalLine2, :PhysicalLine3, :PhysicalLine4]\nmesh = P4estMesh{2}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The same boundary symbols have then also be supplied to the semidiscretization alongside the corresponding physical boundary conditions:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"# Supersonic inflow boundary condition.\n# Calculate the boundary flux entirely from the external solution state, i.e., set\n# external solution state values for everything entering the domain.\n@inline function boundary_condition_supersonic_inflow(u_inner,\n normal_direction::AbstractVector,\n x, t, surface_flux_function,\n equations::CompressibleEulerEquations2D)\n u_boundary = initial_condition_mach2_flow(x, t, equations)\n flux = Trixi.flux(u_boundary, normal_direction, equations)\n\n return flux\nend\n\n# Supersonic outflow boundary condition.\n# Calculate the boundary flux entirely from the internal solution state. Analogous to supersonic inflow\n# except all the solution state values are set from the internal solution as everything leaves the domain\n@inline function boundary_condition_supersonic_outflow(u_inner,\n normal_direction::AbstractVector, x,\n t,\n surface_flux_function,\n equations::CompressibleEulerEquations2D)\nflux = Trixi.flux(u_inner, normal_direction, equations)\n\nboundary_conditions = Dict(:PhysicalLine1 => boundary_condition_supersonic_inflow, # Left boundary\n :PhysicalLine2 => boundary_condition_supersonic_outflow, # Right boundary\n :PhysicalLine3 => boundary_condition_supersonic_outflow, # Top and bottom boundary\n :PhysicalLine4 => boundary_condition_slip_wall) # Airfoil\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions = boundary_conditions)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Note that you have to supply the boundary_symbols keyword to the P4estMesh constructor to select the boundaries from the available nodesets in the .inp file. If the boundary_symbols keyword is not supplied, all boundaries will be assigned to the default set :all.","category":"page"},{"location":"tutorials/p4est_from_gmsh/#Package-versions","page":"17 P4est mesh from gmsh","title":"Package versions","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\", \"Download\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"This page was generated using Literate.jl.","category":"page"},{"location":"code_of_conduct/","page":"Code of Conduct","title":"Code of Conduct","text":"EditURL = \"https://github.com/trixi-framework/Trixi.jl/blob/main/CODE_OF_CONDUCT.md\"","category":"page"},{"location":"code_of_conduct/#code-of-conduct","page":"Code of Conduct","title":"Code of Conduct","text":"","category":"section"},{"location":"code_of_conduct/","page":"Code of Conduct","title":"Code of Conduct","text":"Contributor Covenant Code of ConductOur PledgeWe as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.Our StandardsExamples of behavior that contributes to a positive environment for our community include:Demonstrating empathy and kindness toward other people\nBeing respectful of differing opinions, viewpoints, and experiences\nGiving and gracefully accepting constructive feedback\nAccepting responsibility and apologizing to those affected by our mistakes, and learning from the experience\nFocusing on what is best not just for us as individuals, but for the overall communityExamples of unacceptable behavior include:The use of sexualized language or imagery, and sexual attention or advances of any kind\nTrolling, insulting or derogatory comments, and personal or political attacks\nPublic or private harassment\nPublishing others' private information, such as a physical or email address, without their explicit permission\nOther conduct which could reasonably be considered inappropriate in a professional settingEnforcement ResponsibilitiesCommunity leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.ScopeThis Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.EnforcementInstances of abusive, harassing, or otherwise unacceptable behavior may be reported to Michael Schlottke-Lakemper, Hendrik Ranocha, or any other of the principal developers responsible for enforcement listed in Authors. All complaints will be reviewed and investigated promptly and fairly.All community leaders are obligated to respect the privacy and security of the reporter of any incident.Enforcement GuidelinesCommunity leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:1. CorrectionCommunity Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.2. WarningCommunity Impact: A violation through a single incident or series of actions.Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.3. Temporary BanCommunity Impact: A serious violation of community standards, including sustained inappropriate behavior.Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.4. Permanent BanCommunity Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.Consequence: A permanent ban from any sort of public interaction within the community.AttributionThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/codeofconduct.html.Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.[homepage]: https://www.contributor-covenant.orgFor answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.","category":"page"},{"location":"conventions/#conventions","page":"Conventions","title":"Conventions","text":"","category":"section"},{"location":"conventions/#Spatial-dimensions-and-directions","page":"Conventions","title":"Spatial dimensions and directions","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"We use the following numbering schemes on Cartesian or curved structured meshes.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"The orientations are numbered as 1 => x, 2 => y, 3 => z. For example, numerical fluxes such as flux_central(u_ll, u_rr, orientation, equations::AbstractEquations) use the orientation in this way.\nThe directions are numbered as 1 => -x, 2 => +x, 3 => -y, 4 => +y, 5 => -z, 6 => +z. For example, the boundary_conditions are ordered in this way when a Tuple of boundary conditions per direction is passed to the constructor of a SemidiscretizationHyperbolic.\nFor structured and unstructured curved meshes the concept of direction is generalized via the variable normal_direction. This variable points in the normal direction at a given, curved surface. For the computation of boundary fluxes the normal_direction is normalized to be a normal_vector used, for example, in FluxRotated.","category":"page"},{"location":"conventions/#Cells-vs.-elements-vs.-nodes","page":"Conventions","title":"Cells vs. elements vs. nodes","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"To uniquely distinguish between different components of the discretization, we use the following naming conventions:","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"The computational domain is discretized by a mesh, which is made up of individual cells. In general, neither the mesh nor the cells should be aware of any solver-specific knowledge, i.e., they should not store anything that goes beyond the geometrical information and the connectivity.\nThe numerical solvers do not directly store their information inside the mesh, but use own data structures. Specifically, for each cell on which a solver wants to operate, the solver creates an element to store solver-specific data.\nFor discretization schemes such as the discontinuous Galerkin or the finite element method, inside each element multiple nodes may be defined, which hold nodal information. The nodes are again a solver-specific component, just like the elements.\nWe often identify elements, nodes, etc. with their (local or global) integer index. Convenience iterators such as eachelement, eachnode use these indices.","category":"page"},{"location":"conventions/#Keywords-in-elixirs","page":"Conventions","title":"Keywords in elixirs","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Trixi.jl is distributed with several examples in the form of elixirs, small Julia scripts containing everything to set up and run a simulation. Working interactively from the Julia REPL with these scripts can be quite convenient while for exploratory research and development of Trixi.jl. For example, you can use the convenience function trixi_include to include an elixir with some modified arguments. To enable this, it is helpful to use a consistent naming scheme in elixirs, since trixi_include can only perform simple replacements. Some standard variables names are","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"polydeg for the polynomial degree of a solver\nsurface_flux for the numerical flux at surfaces\nvolume_flux for the numerical flux used in flux differencing volume terms","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Moreover, convergence_test requires that the spatial resolution is set via the keywords","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"initial_refinement_level (an integer, e.g. for the TreeMesh and the P4estMesh) or\ncells_per_dimension (a tuple of integers, one per spatial dimension, e.g. for the StructuredMesh and the DGMultiMesh).","category":"page"},{"location":"conventions/#Variable-names","page":"Conventions","title":"Variable names","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Use descriptive names (using snake_case for variables/functions and CamelCase for types)\nUse a suffix _ as in name_ for local variables that would otherwise hide existing symbols.\nUse a prefix _ as in _name to indicate internal methods/data that are \"fragile\" in the sense that there's no guarantee that they might get changed without notice. These are also not documented with a docstring (but maybe with comments using #).","category":"page"},{"location":"conventions/#Array-types-and-wrapping","page":"Conventions","title":"Array types and wrapping","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"To allow adaptive mesh refinement efficiently when using time integrators from OrdinaryDiffEq, Trixi.jl allows to represent numerical solutions in two different ways. Some discussion can be found online and in form of comments describing Trixi.wrap_array and Trixi.wrap_array_native in the source code of Trixi.jl. The flexibility introduced by this possible wrapping enables additional performance optimizations. 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.jl). Thus, we use the following conventions to distinguish between arrays visible to the time integrator and wrapped arrays mainly used internally.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Arrays visible to the time integrator have a suffix _ode, e.g., du_ode, u_ode.\nWrapped arrays do not have a suffix, e.g., du, u.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Methods either accept arrays visible to the time integrator or wrapped arrays based on the following rules.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"When some solution is passed together with a semidiscretization semi, the solution must be a u_ode that needs to be wrapped via wrap_array(u_ode, semi) (or wrap_array_native(u_ode, semi)) for further processing.\nWhen some solution is passed together with the mesh, equations, solver, cache, ..., it is already wrapped via wrap_array (or wrap_array_native).\nExceptions of this rule are possible, e.g. for AMR, but must be documented in the code.\nwrap_array should be used as default option. wrap_array_native should only be used when necessary, e.g., to avoid additional overhead when interfacing with external C libraries such as HDF5, MPI, or visualization.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"EditURL = \"../../literate/src/files/non_periodic_boundaries.jl\"","category":"page"},{"location":"tutorials/non_periodic_boundaries/#non_periodic_boundaries","page":"6 Non-periodic boundaries","title":"6: Non-periodic boundaries","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/non_periodic_boundaries/#Dirichlet-boundary-condition","page":"6 Non-periodic boundaries","title":"Dirichlet boundary condition","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"First, let's look at the Dirichlet boundary condition BoundaryConditionDirichlet.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"BoundaryConditionDirichlet(boundary_value_function)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"In Trixi.jl, this creates a Dirichlet boundary condition where the function boundary_value_function is used to set the values at the boundary. It can be used to create a boundary condition that sets exact boundary values by passing the exact solution of the equation.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"It is important to note that standard Dirichlet boundary conditions for hyperbolic PDEs do not make sense in most cases. However, we are using a special weak form of the Dirichlet boundary condition, based on the application of the numerical surface flux. The numerical surface flux takes the solution value from inside the domain and the prescribed value of the outer boundary state as arguments, and solves an approximate Riemann problem to introduce dissipation (and hence stabilization) at the boundary. Hence, the performance of the Dirichlet BC depends on the fidelity of the numerical surface flux. An easy-to read introductory reference on this topic is the paper by Mengaldo et al..","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"The passed boundary value function is called with the same arguments as an initial condition function, i.e.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"boundary_value_function(x, t, equations)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"where x specifies the spatial coordinates, t is the current time, and equations is the corresponding system of equations.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"We want to give a short example for a simulation with such a Dirichlet BC.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Consider the one-dimensional linear advection equation with domain Omega=0 2 and a constant zero initial condition.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"using OrdinaryDiffEq, Trixi\n\nadvection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)\n\ninitial_condition_zero(x, t, equation::LinearScalarAdvectionEquation1D) = SVector(0.0)\ninitial_condition = initial_condition_zero\n\nusing Plots\nplot(x -> sum(initial_condition(x, 0.0, equations)), label=\"initial condition\", ylim=(-1.5, 1.5))","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Using an advection velocity of 1.0 and the (local) Lax-Friedrichs/Rusanov flux FluxLaxFriedrichs as a numerical surface flux, we are able to create an inflow boundary on the left and an outflow boundary on the right, as the Lax-Friedrichs flux is in this case an exact characteristics Riemann solver. We note that for more complex PDEs different strategies for inflow/outflow boundaries are necessary. To define the inflow values, we initialize a boundary_value_function.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"function boundary_condition_sine_sector(x, t, equation::LinearScalarAdvectionEquation1D)\n if 1 <= t <= 3\n scalar = sin(2 * pi * sum(t - 1))\n else\n scalar = zero(t)\n end\n return SVector(scalar)\nend\nboundary_condition = boundary_condition_sine_sector","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"We set the BC in negative and positive x-direction.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"boundary_conditions = (x_neg=BoundaryConditionDirichlet(boundary_condition),\n x_pos=BoundaryConditionDirichlet(boundary_condition))","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\ncoordinates_min = (0.0,)\ncoordinates_max = (2.0,)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"For the mesh type TreeMesh the parameter periodicity must be set to false in the corresponding direction.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"mesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n n_cells_max=10_000,\n periodicity=false)\n\n\nsemi = SemidiscretizationHyperbolic(mesh, equations,\n initial_condition,\n solver,\n boundary_conditions=boundary_conditions)\n\ntspan = (0.0, 6.0)\node = semidiscretize(semi, tspan)\n\nanalysis_callback = AnalysisCallback(semi, interval=100,)\n\nstepsize_callback = StepsizeCallback(cfl=0.9)\n\ncallbacks = CallbackSet(analysis_callback,\n stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"We define some equidistant nodes for the visualization","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"visnodes = range(tspan[1], tspan[2], length=300)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"and run the simulation.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, saveat=visnodes, callback=callbacks);\n\nusing Plots\n@gif for step in 1:length(sol.u)\n plot(sol.u[step], semi, ylim=(-1.5, 1.5), legend=true, label=\"approximation\", title=\"time t=$(round(sol.t[step], digits=5))\")\n scatter!([0.0], [sum(boundary_condition(SVector(0.0), sol.t[step], equations))], label=\"boundary condition\")\nend","category":"page"},{"location":"tutorials/non_periodic_boundaries/#Other-available-example-elixirs-with-non-trivial-BC","page":"6 Non-periodic boundaries","title":"Other available example elixirs with non-trivial BC","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Moreover, there are other boundary conditions in Trixi.jl. For instance, you can use the slip wall boundary condition boundary_condition_slip_wall.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Trixi.jl provides some interesting examples with different combinations of boundary conditions, e.g. using boundary_condition_slip_wall and other self-defined boundary conditions using BoundaryConditionDirichlet.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"For instance, there is a 2D compressible Euler setup for a Mach 3 wind tunnel flow with a forward facing step in the elixir elixir_euler_forward_step_amr.jl discretized with a P4estMesh using adaptive mesh refinement (AMR).","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":" \n
    ","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Source: Video on Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"A double Mach reflection problem for the 2D compressible Euler equations elixir_euler_double_mach_amr.jl exercises a special boundary conditions along the bottom of the domain that is a mixture of Dirichlet and slip wall.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":" \n
    ","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Source: Video on Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"A channel flow around a cylinder at Mach 3 elixir_euler_supersonic_cylinder.jl contains supersonic Mach 3 inflow at the left portion of the domain and supersonic outflow at the right portion of the domain. The top and bottom of the channel as well as the cylinder are treated as Euler slip wall boundaries.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":" \n
    ","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Source: Video on Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/non_periodic_boundaries/#Package-versions","page":"6 Non-periodic boundaries","title":"Package versions","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"This page was generated using Literate.jl.","category":"page"},{"location":"parallelization/#Parallelization","page":"Parallelization","title":"Parallelization","text":"","category":"section"},{"location":"parallelization/#Shared-memory-parallelization-with-threads","page":"Parallelization","title":"Shared-memory parallelization with threads","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Many compute-intensive loops in Trixi.jl are parallelized using the multi-threading support provided by Julia. You can recognize those loops by the @threaded macro prefixed to them, e.g.,","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"@threaded for element in eachelement(dg, cache)\n ...\nend","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"This will statically assign an equal iteration count to each available thread.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"To use multi-threading, you need to tell Julia at startup how many threads you want to use by either setting the environment variable JULIA_NUM_THREADS or by providing the -t/--threads command line argument. For example, to start Julia with four threads, start Julia with","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia --threads=4","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If both the environment variable and the command line argument are specified at the same time, the latter takes precedence.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If you use time integration methods from OrdinaryDiffEq.jl and want to use multiple threads therein, you need to set the keyword argument thread=OrdinaryDiffEq.True() of the algorithms, as described in the section on time integration methods.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"warning: Warning\nNot everything is parallelized yet and there are likely opportunities to improve scalability. Multi-threading isn't considered part of the public API of Trixi.jl yet.","category":"page"},{"location":"parallelization/#Distributed-computing-with-MPI","page":"Parallelization","title":"Distributed computing with MPI","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"In addition to the shared memory parallelization with multi-threading, Trixi.jl supports distributed parallelism via MPI.jl, which leverages the Message Passing Interface (MPI). MPI.jl comes with its own MPI library binaries such that there is no need to install MPI yourself. However, it is also possible to instead use an existing MPI installation, which is recommended if you are running MPI programs on a cluster or supercomputer (see the MPI.jl docs to find out how to select the employed MPI library). Additional notes on how to use a system-provided MPI installation with Trixi.jl can be found in the following subsection.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"warning: Work in progress\nMPI-based parallelization is work in progress and not finished yet. Nothing related to MPI is part of the official API of Trixi.jl yet.","category":"page"},{"location":"parallelization/#parallel_system_MPI","page":"Parallelization","title":"Using a system-provided MPI installation","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"When using Trixi.jl with a system-provided MPI backend, the underlying p4est, t8code and HDF5 libraries need to be compiled with the same MPI installation. If you want to use p4est (via the P4estMesh) or t8code (via the T8codeMesh) from Trixi.jl, you also need to use system-provided p4est or t8code installations (for notes on how to install p4est and t8code see, e.g., here and here, use the configure option --enable-mpi). Otherwise, there will be warnings that no preference is set for P4est.jl and T8code.jl that can be ignored if you do not use these libraries from Trixi.jl. Note that t8code already comes with a p4est installation, so it suffices to install t8code. In order to use system-provided p4est and t8code installations, P4est.jl and T8code.jl need to be configured to use the custom installations. Follow the steps described here and here for the configuration. The paths that point to libp4est.so (and potentially to libsc.so) need to be the same for P4est.jl and T8code.jl. This could, e.g., be libp4est.so that usually can be found in lib/ or local/lib/ in the installation directory of t8code. The preferences for HDF5.jl always need to be set, even if you do not want to use HDF5 from Trixi.jl, see also issue #1079 in HDF5.jl. To set the preferences for HDF5.jl, follow the instructions described here.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"In total, in your active Julia project you should have a LocalPreferences.toml file with sections [MPIPreferences], [T8code] (only needed if T8codeMesh is used), [P4est] (only needed if P4estMesh is used), and [HDF5] as well as an entry MPIPreferences in your Project.toml to use a custom MPI installation. A LocalPreferences.toml file created as described above might look something like the following:","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"[HDF5]\nlibhdf5 = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so\"\nlibhdf5_hl = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so\"\n\n[HDF5_jll]\nlibhdf5_hl_path = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so\"\nlibhdf5_path = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so\"\n\n[MPIPreferences]\n__clear__ = [\"preloads_env_switch\"]\n_format = \"1.0\"\nabi = \"OpenMPI\"\nbinary = \"system\"\ncclibs = []\nlibmpi = \"/lib/x86_64-linux-gnu/libmpi.so\"\nmpiexec = \"mpiexec\"\npreloads = []\n\n[P4est]\nlibp4est = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libp4est.so\"\nlibsc = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libsc.so\"\n\n[T8code]\nlibp4est = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libp4est.so\"\nlibsc = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libsc.so\"\nlibt8 = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libt8.so\"","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"This file is created with the following sequence of commands:","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using MPIPreferences\njulia> MPIPreferences.use_system_binary()","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Restart the Julia REPL","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using P4est\njulia> P4est.set_library_p4est!(\"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libp4est.so\")\njulia> P4est.set_library_sc!(\"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libsc.so\")\njulia> using T8code\njulia> T8code.set_libraries_path!(\"/home/mschlott/hackathon/libtrixi/t8code/install/lib/\")\njulia> using HDF5\njulia> HDF5.API.set_libraries!(\"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so\", \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so\")","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"After the preferences are set, restart the Julia REPL again.","category":"page"},{"location":"parallelization/#parallel_usage","page":"Parallelization","title":"Usage","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"To start Trixi.jl in parallel with MPI, there are three options:","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Run from the REPL with mpiexec(): You can start a parallel execution directly from the REPL by executing\njulia> using MPI\n\njulia> mpiexec() do cmd\n run(`$cmd -n 3 $(Base.julia_cmd()) --threads=1 --project=@. -e 'using Trixi; trixi_include(default_example())'`)\n end\nThe parameter -n 3 specifies that Trixi.jl should run with three processes (or ranks in MPI parlance) and should be adapted to your available computing resources and problem size. The $(Base.julia_cmd()) argument ensures that Julia is executed in parallel with the same optimization level etc. as you used for the REPL; if this is unnecessary or undesired, you can also just use julia. Further, if you are not running Trixi.jl from a local clone but have installed it as a package, you need to omit the --project=@..\nRun from the command line with mpiexecjl: Alternatively, you can use the mpiexecjl script provided by MPI.jl, which allows you to start Trixi.jl in parallel directly from the command line. As a preparation, you need to install the script once by running\njulia> using MPI\n\njulia> MPI.install_mpiexecjl(destdir=\"/somewhere/in/your/PATH\")\nThen, to execute Trixi.jl in parallel, execute the following command from your command line:\nmpiexecjl -n 3 julia --threads=1 --project=@. -e 'using Trixi; trixi_include(default_example())'\nRun interactively with tmpi (Linux/MacOS only): If you are on a Linux/macOS system, you have a third option which lets you run Julia in parallel interactively from the REPL. This comes in handy especially during development, as in contrast to the first two options, it allows to reuse the compilation cache and thus facilitates much faster startup times after the first execution. It requires tmux and the OpenMPI library to be installed before, both of which are usually available through a package manager. Once you have installed both tools, you need to configure MPI.jl to use the OpenMPI for your system, which is explained here. Then, you can download and install the tmpi script by executing\ncurl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /somewhere/in/your/PATH/tmpi\nFinally, you can start and control multiple Julia REPLs simultaneously by running\ntmpi 3 julia --threads=1 --project=@.\nThis will start Julia inside tmux three times and multiplexes all commands you enter in one REPL to all other REPLs (try for yourself to understand what it means). If you have no prior experience with tmux, handling the REPL this way feels slightly weird in the beginning. However, there is a lot of documentation for tmux available and once you get the hang of it, developing Trixi.jl in parallel becomes much smoother this way. Some helpful commands are the following. To close a single pane you can press Ctrl+b and then x followed by y to confirm. To quit the whole session you press Ctrl+b followed by :kill-session. Often you would like to scroll up. You can do that by pressing Ctrl+b and then [, which allows you to use the arrow keys to scroll up and down. To leave the scroll mode you press q. Switching between panes can be done by Ctrl+b followed by o. As of March 2022, newer versions of tmpi also support mpich, which is the default backend of MPI.jl (via MPICH_Jll.jl). To use this setup, you need to install mpiexecjl as described in the documentation of MPI.jl and make it available as mpirun, e.g., via a symlink of the form\nln -s ~/.julia/bin/mpiexecjl /somewhere/in/your/path/mpirun\n(assuming default installations).","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"note: Hybrid parallelism\nIt is possible to combine MPI with shared memory parallelism via threads by starting Julia with more than one thread, e.g. by passing the command line argument julia --threads=2 instead of julia --threads=1 used in the examples above. In that case, you should make sure that your system supports the number of processes/threads that you try to start.","category":"page"},{"location":"parallelization/#parallel_performance","page":"Parallelization","title":"Performance","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"For information on how to evaluate the parallel performance of Trixi.jl, please have a look at the Performance metrics of the AnalysisCallback section, specifically at the descriptions of the performance index (PID).","category":"page"},{"location":"parallelization/#Using-error-based-step-size-control-with-MPI","page":"Parallelization","title":"Using error-based step size control with MPI","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If you use error-based step size control (see also the section on error-based adaptive step sizes) together with MPI you need to pass internalnorm=ode_norm and you should pass unstable_check=ode_unstable_check to OrdinaryDiffEq's solve, which are both included in ode_default_options.","category":"page"},{"location":"parallelization/#Using-parallel-input-and-output","page":"Parallelization","title":"Using parallel input and output","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Trixi.jl allows parallel I/O using MPI by leveraging parallel HDF5.jl. On most systems, this is enabled by default. Additionally, you can also use a local installation of the HDF5 library (with MPI support). For this, you first need to use a system-provided MPI library, see also here and you need to tell HDF5.jl to use this library. To do so with HDF5.jl v0.17 and newer, set the preferences libhdf5 and libhdf5_hl to the local paths of the libraries libhdf5 and libhdf5_hl, which can be done by","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using Preferences, UUIDs\njulia> set_preferences!(\n UUID(\"f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f\"), # UUID of HDF5.jl\n \"libhdf5\" => \"/path/to/your/libhdf5.so\",\n \"libhdf5_hl\" => \"/path/to/your/libhdf5_hl.so\", force = true)","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Alternatively, with HDF5.jl v0.17.1 or higher you can use","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using HDF5\njulia> HDF5.API.set_libraries!(\"/path/to/your/libhdf5.so\", \"/path/to/your/libhdf5_hl.so\")","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"For more information see also the documentation of HDF5.jl. In total, you should have a file called LocalPreferences.toml in the project directory that contains a section [MPIPreferences], a section [HDF5] with entries libhdf5 and libhdf5_hl, a section [P4est] with the entry libp4est as well as a section [T8code] with the entries libt8, libp4est and libsc. If you use HDF5.jl v0.16 or older, instead of setting the preferences for HDF5.jl, you need to set the environment variable JULIA_HDF5_PATH to the path, where the HDF5 binaries are located and then call ]build HDF5 from Julia.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If HDF5 is not MPI-enabled, Trixi.jl will fall back on a less efficient I/O mechanism. In that case, all disk I/O is performed only on rank zero and data is distributed to/gathered from the other ranks using regular MPI communication.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"EditURL = \"../../literate/src/files/behind_the_scenes_simulation_setup.jl\"","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#behind_the_scenes_simulation_setup","page":"2 Behind the scenes of a simulation setup","title":"2: Behind the scenes of a simulation setup","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"This tutorial will guide you through a simple Trixi.jl setup (\"elixir\"), giving an overview of what happens in the background during the initialization of a simulation. While the setup described herein does not cover all details, it involves relatively stable parts of Trixi.jl that are unlikely to undergo significant changes in the near future. The goal is to clarify some of the more fundamental, technical concepts that are applicable to a variety of (also more complex) configurations.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Trixi.jl follows the method of lines concept for solving partial differential equations (PDEs). Firstly, the PDEs are reduced to a (potentially huge) system of ordinary differential equations (ODEs) by discretizing the spatial derivatives. Subsequently, these generated ODEs may be solved with methods available in OrdinaryDiffEq.jl or those specifically implemented in Trixi.jl. The following steps elucidate the process of transitioning from PDEs to ODEs within the framework of Trixi.jl.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Basic-setup","page":"2 Behind the scenes of a simulation setup","title":"Basic setup","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Import essential libraries and specify an equation.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"using Trixi, OrdinaryDiffEq\nequations = LinearScalarAdvectionEquation2D((-0.2, 0.7))","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Generate a spatial discretization using a TreeMesh with a pre-coarsened set of cells.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"coordinates_min = (-2.0, -2.0)\ncoordinates_max = (2.0, 2.0)\n\ncoarsening_patches = ((type = \"box\", coordinates_min = [0.0, -2.0],\n coordinates_max = [2.0, 0.0]),)\n\nmesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2,\n n_cells_max = 30_000,\n coarsening_patches = coarsening_patches)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The created TreeMesh looks like the following:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: TreeMesh_example)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Instantiate a DGSEM solver with a user-specified polynomial degree. The solver will define polydeg + 1 Gauss-Lobatto nodes and their associated weights within the reference interval -1 1 in each spatial direction. These nodes will be subsequently used to approximate solutions on each leaf cell of the TreeMesh.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"solver = DGSEM(polydeg = 3)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Gauss-Lobatto nodes with polydeg = 3:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: Gauss-Lobatto_nodes_example)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Overview-of-the-[SemidiscretizationHyperbolic](@ref)-type","page":"2 Behind the scenes of a simulation setup","title":"Overview of the SemidiscretizationHyperbolic type","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"At this stage, all necessary components for configuring the spatial discretization are in place. The remaining task is to combine these components into a single structure that will be used throughout the entire simulation process. This is where SemidiscretizationHyperbolic comes into play.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,\n solver)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The constructor for the SemidiscretizationHyperbolic object calls numerous sub-functions to perform the necessary initialization steps. A brief description of the key sub-functions is provided below.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"init_elements(leaf_cell_ids, mesh, equations, dg.basis, RealT, uEltype)\nThe fundamental elements for approximating the solution are the leaf cells. The solution is constructed as a polynomial of the degree specified in the DGSEM solver in each spatial direction on each leaf cell. This polynomial approximation is evaluated at the Gauss-Lobatto nodes mentioned earlier. The init_elements function extracts these leaf cells from the TreeMesh, assigns them the label \"elements\", records their coordinates, and maps the Gauss-Lobatto nodes from the 1D interval -1 1 onto each coordinate axis of every element.\n(Image: elements_example)\nThe visualization of elements with nodes shown here includes spaces between elements, which do not exist in reality. This spacing is included only for illustrative purposes to underscore the separation of elements and the independent projection of nodes onto each element.\ninit_interfaces(leaf_cell_ids, mesh, elements)\nAt this point, the elements with nodes have been defined; however, they lack the necessary communication functionality. This is crucial because the local solution polynomials on the elements are not independent of each other. Furthermore, nodes on the boundary of adjacent elements share the same spatial location, which requires a method to combine this into a meaningful solution. Here Riemann solvers come into play which can handle the principal ambiguity of a multi-valued solution at the same spatial location.\nAs demonstrated earlier, the elements can have varying sizes. Let us initially consider neighbors with equal size. For these elements, the init_interfaces function generates interfaces that store information about adjacent elements, their relative positions, and allocate containers for sharing solution data between neighbors during the solution process.\nIn our visualization, these interfaces would conceptually resemble tubes connecting the corresponding elements.\n(Image: interfaces_example)\ninit_mortars(leaf_cell_ids, mesh, elements, dg.mortar)\nReturning to the consideration of different sizes among adjacent elements, within the TreeMesh, adjacent leaf cells can vary in side length by a maximum factor of two. This implies that a large element has one neighbor of equal size with a connection through an interface, or two neighbors at half the size, requiring a connection through so called \"mortars\". In 3D, a large element would have four small neighbor elements.\nMortars store information about the connected elements, their relative positions, and allocate containers for storing the solutions along the boundaries between these elements.\nDue to the differing sizes of adjacent elements, it is not feasible to directly map boundary nodes of adjacent elements. Therefore, the concept of mortars employs a mass-conserving interpolation function to map boundary nodes from a larger element to a smaller one.\nIn our visualization, mortars are represented as branched tubes.\n(Image: mortars_example)\ninit_boundaries(leaf_cell_ids, mesh, elements)\nIn order to apply boundary conditions, it is necessary to identify the locations of the boundaries. Therefore, we initialize a \"boundaries\" object, which records the elements that contain boundaries, specifies which side of an element is a boundary, stores the coordinates of boundary nodes, and allocates containers for managing solutions at these boundaries.\nIn our visualization, boundaries and their corresponding nodes are highlighted with green, semi-transparent lines.\n(Image: boundaries_example)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"All the structures mentioned earlier are collected as a cache of type NamedTuple. Subsequently, an object of type SemidiscretizationHyperbolic is initialized using this cache, initial and boundary conditions, equations, mesh and solver.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"In conclusion, the primary purpose of a SemidiscretizationHyperbolic is to collect equations, the geometric representation of the domain, and approximation instructions, creating specialized structures to interconnect these components in a manner that enables their utilization for the numerical solution of partial differential equations (PDEs).","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"As evident from the earlier description of SemidiscretizationHyperbolic, it comprises numerous functions called subsequently. Without delving into details, the structure of the primary calls are illustrated as follows:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: SemidiscretizationHyperbolic_structure)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Overview-of-the-[semidiscretize](@ref)-function","page":"2 Behind the scenes of a simulation setup","title":"Overview of the semidiscretize function","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"At this stage, we have defined the equations and configured the domain's discretization. The final step before solving is to select a suitable time span and apply the corresponding initial conditions, which are already stored in the initialized SemidiscretizationHyperbolic object.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The purpose of the semidiscretize function is to wrap the semidiscretization as an ODEProblem within the specified time interval. During this procedure the approximate solution is created at the given initial time via the specified initial_condition function from the SemidiscretizationHyperbolic object. This ODEProblem can be subsequently passed to the solve function from the OrdinaryDiffEq.jl package or to Trixi.solve.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"ode = semidiscretize(semi, (0.0, 1.0));\nnothing #hide","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The semidiscretize function involves a deep tree of subsequent calls, with the primary ones explained below.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"allocate_coefficients(mesh, equations, solver, cache)\nTo apply initial conditions, a data structure (\"container\") needs to be generated to store the initial values of the target variables for each node within each element.\nSince only one-dimensional Arrays are resize!able in Julia, we use Vectors as an internal storage for the target variables and resize! them whenever needed, e.g. to change the number of elements. Then, during the solving process the same memory is reused by unsafe_wrapping multi-dimensional Arrays around the internal storage.\nwrap_array(u_ode, semi)\nAs previously noted, u_ode is constructed as a 1D vector to ensure compatibility with OrdinaryDiffEq.jl. However, for internal use within Trixi.jl, identifying which part of the vector relates to specific variables, elements, or nodes can be challenging.\nThis is why the u_ode vector is wrapped by the wrap_array function using unsafe_wrap to form a multidimensional array u. In this array, the first dimension corresponds to variables, followed by N dimensions corresponding to nodes for each of N space dimensions. The last dimension corresponds to the elements. Consequently, navigation within this multidimensional array becomes noticeably easier.\n\"Wrapping\" in this context involves the creation of a reference to the same storage location but with an alternative structural representation. This approach enables the use of both instances u and u_ode as needed, so that changes are simultaneously reflected in both. This is possible because, from a storage perspective, they share the same stored data, while access to this data is provided in different ways.\ncompute_coefficients!(u, initial_conditions, t, mesh::DG, equations, solver, cache)\nNow the variable u, intended to store solutions, has been allocated and wrapped, it is time to apply the initial conditions. The compute_coefficients! function calculates the initial conditions for each variable at every node within each element and properly stores them in the u array.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"At this stage, the semidiscretize function has all the necessary components to initialize and return an ODEProblem object, which will be used by the solve function to compute the solution.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"In summary, the internal workings of semidiscretize with brief descriptions can be presented as follows.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: semidiscretize_structure)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Functions-solve-and-rhs!","page":"2 Behind the scenes of a simulation setup","title":"Functions solve and rhs!","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Once the ODEProblem object is initialized, the solve function and one of the ODE solvers from the OrdinaryDiffEq.jl package can be utilized to compute an approximated solution using the instructions contained in the ODEProblem object.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 0.01,\n save_everystep = false);\nnothing #hide","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Since the solve function and the ODE solver have no knowledge of a particular spatial discretization, it is necessary to define a \"right-hand-side function\", rhs!, within Trixi.jl.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Trixi.jl includes a set of rhs! functions designed to compute du, i.e., fracpartial upartial t according to the structure of the setup. These rhs! functions calculate interface, mortars, and boundary fluxes, in addition to surface and volume integrals, in order to construct the du vector. This du vector is then used by the time integration method to obtain the solution at the subsequent time step. The rhs! function is called by time integration methods in each iteration of the solve loop within OrdinaryDiffEq.jl, with arguments du, u, semidiscretization, and the current time.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Trixi.jl uses a two-levels approach for rhs! functions. The first level is limited to a single function for each semidiscretization type, and its role is to redirect data to the target rhs! for specific solver and mesh types. This target rhs! function is responsible for calculating du.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Path from the solve function call to the appropriate rhs! function call:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: rhs_structure)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Computed solution:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"using Plots\nplot(sol)\npd = PlotData2D(sol)\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"This page was generated using Literate.jl.","category":"page"},{"location":"overview/#Overview-of-the-structure-of-Trixi.jl","page":"Overview","title":"Overview of the structure of Trixi.jl","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"Trixi.jl is designed as a library of components for discretizations of hyperbolic conservation laws. Thus, it is not a monolithic PDE solver that is configured at runtime via parameter files, as it is often found in classical numerical simulation codes. Instead, each simulation is configured by pure Julia code. Many examples of such simulation setups, called elixirs in Trixi.jl, are provided in the examples/ folder.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"Trixi.jl uses the method of lines, i.e., the full space-time discretization is separated into two steps; the spatial semidiscretization is performed at first and the resulting ODE system is solved numerically using a suitable time integration method. Thus, the main ingredients of an elixir designed to solve a PDE numerically are the spatial semidiscretization and the time integration scheme.","category":"page"},{"location":"overview/#overview-semidiscretizations","page":"Overview","title":"Semidiscretizations","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"Semidiscretizations are high-level descriptions of spatial discretizations specialized for certain PDEs. Trixi.jl's main focus is on hyperbolic conservation laws represented in a SemidiscretizationHyperbolic. Such semidiscretizations are usually named semi in Trixi.jl","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"(Image: semidiscretization_overview)","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"The basic building blocks of a semidiscretization are","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"a mesh describing the geometry of the domain\na set of equations describing the physical model\na solver describing the numerical approach","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"In addition, a semidiscretization bundles initial and boundary conditions, and possible source terms. These different ingredients of a semidiscretization can be configured individually and combined together. When a semidiscretization is constructed, it will create an internal cache, i.e., a collection of setup-specific data structures, that is usually passed to all lower level functions.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"Due to Trixi.jl's modular nature using Julia's multiple dispatch features, new ingredients can be created specifically for a certain combination of other ingredients. For example, a new mesh type can be created and implemented at first only for a specific solver. Thus, there is no need to consider all possible combinations of meshes, equations, and solvers when implementing new features. This allows rapid prototyping of new ideas and is one of the main design goals behind Trixi.jl. Below is a brief overview of the availability of different features on different mesh types.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"Feature TreeMesh StructuredMesh UnstructuredMesh2D P4estMesh DGMultiMesh Further reading\nSpatial dimension 1D, 2D, 3D 1D, 2D, 3D 2D 2D, 3D 1D, 2D, 3D \nCoordinates Cartesian curvilinear curvilinear curvilinear curvilinear \nConnectivity h-nonconforming conforming conforming h-nonconforming conforming \nElement type line, square, cube line, quadᵃ, hexᵃ quadᵃ quadᵃ, hexᵃ simplex, quadᵃ, hexᵃ \nAdaptive mesh refinement ✅ ❌ ❌ ✅ ❌ AMRCallback\nSolver type DGSEM DGSEM DGSEM DGSEM DGMulti \nDomain hypercube mapped hypercube arbitrary arbitrary arbitrary \nWeak form ✅ ✅ ✅ ✅ ✅ VolumeIntegralWeakForm\nFlux differencing ✅ ✅ ✅ ✅ ✅ VolumeIntegralFluxDifferencing\nShock capturing ✅ ✅ ✅ ✅ ❌ VolumeIntegralShockCapturingHG\nNonconservative equations ✅ ✅ ✅ ✅ ✅ e.g., GLM MHD or shallow water equations\nParabolic terms ✅ ✅ ❌ ✅ ✅ e.g., CompressibleNavierStokesDiffusion2D","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"ᵃ: quad = quadrilateral, hex = hexahedron","category":"page"},{"location":"overview/#Time-integration-methods","page":"Overview","title":"Time integration methods","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, a spatial semidiscretization can be wrapped in an ODE problem using semidiscretize, which returns an ODEProblem. This ODEProblem is a wrapper of Trixi.rhs!(du_ode, u_ode, semi, t), which gets called in ODE solvers. Further information can be found in the section on time integration methods.","category":"page"},{"location":"overview/#Next-steps","page":"Overview","title":"Next steps","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"We explicitly encourage people interested in Trixi.jl to have a look at the examples/ bundled with Trixi.jl to get an impression of what is possible and the general look and feel of Trixi.jl. Before doing that, it is usually good to get an idea of how to visualize numerical results.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"If you like learning by doing, looking at the tutorials and trying to mix your own elixirs based thereon is probably a good next step. Otherwise, you can further dig into the documentation by looking at Trixi.jl's basic building blocks.","category":"page"},{"location":"callbacks/#callbacks-id","page":"Callbacks","title":"Callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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.jl are either called after each time step (step callbacks) or after each stage of the ODE solver (stage callbacks).","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"(Image: callbacks_illustration)","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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.","category":"page"},{"location":"callbacks/#Step-callbacks","page":"Callbacks","title":"Step callbacks","text":"","category":"section"},{"location":"callbacks/#CFL-based-time-step-control","page":"Callbacks","title":"CFL-based time step control","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Time step control can be performed with a StepsizeCallback. An example making use of this can be found at examples/tree_2d_dgsem/elixir_advection_basic.jl","category":"page"},{"location":"callbacks/#Adaptive-mesh-refinement","page":"Callbacks","title":"Adaptive mesh refinement","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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 to the ODE solver. The AMRCallback requires a controller such as ControllerThreeLevel or ControllerThreeLevelCombined to tell the AMR algorithm which cells to refine/coarsen.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"An example elixir using AMR can be found at examples/tree_2d_dgsem/elixir_advection_amr.jl.","category":"page"},{"location":"callbacks/#Analyzing-the-numerical-solution","page":"Callbacks","title":"Analyzing the numerical solution","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"The AnalysisCallback can be used to analyze the numerical solution, e.g. calculate errors or user-specified integrals, and print the results to the screen. The results can also be saved in a file. An example can be found at examples/tree_2d_dgsem/elixir_euler_vortex.jl. Note that the errors (e.g. L2 error or Linf error) are computed with respect to the initial condition. The percentage of the simulation time refers to the ratio of the current time and the final time, i.e. it does not consider the maximal number of iterations. So the simulation could finish before 100% are reached. Note that, e.g., due to AMR or smaller time step sizes, the simulation can actually take longer than the percentage indicates. In Performance metrics of the AnalysisCallback you can find a detailed description of the different performance metrics the AnalysisCallback computes.","category":"page"},{"location":"callbacks/#I/O","page":"Callbacks","title":"I/O","text":"","category":"section"},{"location":"callbacks/#Solution-and-restart-files","page":"Callbacks","title":"Solution and restart files","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"To save the solution in regular intervals you can use a SaveSolutionCallback. It is also possible to create restart files using the SaveRestartCallback. An example making use of these can be found at examples/tree_2d_dgsem/elixir_advection_extended.jl. An example showing how to restart a simulation from a restart file can be found at examples/tree_2d_dgsem/elixir_advection_restart.jl.","category":"page"},{"location":"callbacks/#Time-series","page":"Callbacks","title":"Time series","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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, which is used, e.g., in examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl. The TimeSeriesCallback constructor expects a semidiscretization and a list of points at which the solution should be recorded in regular time step intervals. After the last time step, the entire record is stored in an HDF5 file.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"For the points, two different input formats are supported: You can either provide them as a list of tuples, which is handy if you specify them by hand on the REPL. Alternatively, you can provide them as a two-dimensional array, where the first dimension is the point number and the second dimension is the coordinate dimension. This is especially useful when reading them from a file.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"For example, to record the primitive variables at the points (0.0, 0.0) and (-1.0, 0.5) every five timesteps and storing the collected data in the file tseries.h5, you can create the TimeSeriesCallback as","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"time_series = TimeSeriesCallback(semi, [(0.0, 0.0), (-1.0, 0.5)];\n interval=5,\n solution_variables=cons2prim,\n filename=\"tseries.h5\")","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"For a full list of possible arguments, please check the documentation for the TimeSeriesCallback. As an alternative to specifying the point coordinates directly in the elixir or on the REPL, you can read them from a file. For instance, with a text file points.dat with content","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":" 0.0 0.0\n-1.0 0.5","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"you can create a time series callback with","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"using DelimitedFiles: readdlm\ntime_series = TimeSeriesCallback(semi, readdlm(\"points.dat\"))","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"To plot the individual point data series over time, you can create a PlotData1D from the TimeSeriesCallback and a given point ID. For example, executing","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"julia> using Trixi, Plots\n\njulia> trixi_include(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_acoustics_gaussian_source.jl\"))\n\njulia> pd1 = PlotData1D(time_series, 1)\n\njulia> pd2 = PlotData1D(time_series, 2)\n\njulia> plot(pd1[\"p_prime\"]); plot!(pd2[\"p_prime\"], xguide=\"t\")","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"will yield the following plot:","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"(Image: image)","category":"page"},{"location":"callbacks/#Miscellaneous","page":"Callbacks","title":"Miscellaneous","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"The AliveCallback prints some information to the screen to show that a simulation is still running.\nThe SummaryCallback prints a human-readable summary of the simulation setup and controls the automated performance measurements, including an output of the recorded timers after a simulation.\nThe VisualizationCallback can be used for in-situ visualization. See Visualizing results during a simulation.\nThe TrivialCallback does nothing and can be used to easily disable some callbacks via trixi_include.","category":"page"},{"location":"callbacks/#Equation-specific-callbacks","page":"Callbacks","title":"Equation-specific callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Some callbacks provided by Trixi.jl implement specific features for certain equations:","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"The LBMCollisionCallback 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\nThe SteadyStateCallback terminates the time integration when the residual steady state falls below a certain threshold. This checks the convergence of the potential phi for hyperbolic diffusion. See e.g. examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl.\nThe GlmSpeedCallback updates the divergence cleaning wave speed c_h for the ideal GLM-MHD equations. See e.g. examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl.","category":"page"},{"location":"callbacks/#Usage-of-step-callbacks","page":"Callbacks","title":"Usage of step callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Step callbacks are passed to the solve method from the ODE solver via the keyword argument callback. If you want to use a single callback cb, pass it as callback=cb. When using two or more callbacks, you need to turn them into a CallbackSet first by calling callbacks = CallbackSet(cb1, cb2) and passing it as callback=callbacks.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"note: Note\nThere are some restrictions regarding the order of callbacks in a CallbackSet.The callbacks are called after each time step but some callbacks actually belong to the next time step. Therefore, the callbacks should be ordered in the following way:Callbacks that belong to the current time step:\nSummaryCallback controls, among other things, timers and should thus be first\nSteadyStateCallback may mark a time step as the last one\nAnalysisCallback may do some checks that mark a time step as the last one\nAliveCallback should be nearby AnalysisCallback\nSaveSolutionCallback/SaveRestartCallback should save the current solution before it is degraded by AMR\nVisualizationCallback should be called before the mesh is adapted\nCallbacks that belong to the next time step:\nAMRCallback\nStepsizeCallback must be called after AMRCallback to accommodate potential changes to the mesh\nGlmSpeedCallback must be called after StepsizeCallback because the step size affects the value of c_h\nLBMCollisionCallback is already part of the calculations of the next time step and should therefore be called after StepsizeCallback","category":"page"},{"location":"callbacks/#Stage-callbacks","page":"Callbacks","title":"Stage callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"PositivityPreservingLimiterZhangShu is a positivity-preserving limiter, used to enforce physical constraints. An example elixir using this feature can be found at examples/tree_2d_dgsem/elixir_euler_positivity.jl.","category":"page"},{"location":"callbacks/#Implementing-new-callbacks","page":"Callbacks","title":"Implementing new callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Since Trixi.jl is compatible with OrdinaryDiffEq.jl, both packages share the same callback interface. A detailed description of it can be found in the OrdinaryDiffEq.jl documentation. Step callbacks are just called callbacks. Stage callbacks are called stage_limiter!.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"An example elixir showing how to implement a new simple stage callback and a new simple step callback can be found at examples/tree_2d_dgsem/elixir_advection_callbacks.jl.","category":"page"},{"location":"#Trixi.jl","page":"Home","title":"Trixi.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Docs-stable) (Image: Docs-dev) (Image: Slack) (Image: Youtube) (Image: Build Status) (Image: Codecov) (Image: Coveralls) (Image: Aqua QA) (Image: License: MIT) (Image: DOI)","category":"page"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl is a numerical simulation framework for conservation laws written in Julia. 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.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures. Its features include:","category":"page"},{"location":"","page":"Home","title":"Home","text":"1D, 2D, and 3D simulations on line/quad/hex/simplex meshes\nCartesian and curvilinear meshes\nConforming and non-conforming meshes\nStructured and unstructured meshes\nHierarchical quadtree/octree grid with adaptive mesh refinement\nForests of quadtrees/octrees with p4est via P4est.jl\nHigh-order accuracy in space and time\nDiscontinuous Galerkin methods\nKinetic energy-preserving and entropy-stable methods based on flux differencing\nEntropy-stable shock capturing\nPositivity-preserving limiting\nFinite difference summation by parts (SBP) methods\nCompatible with the SciML ecosystem for ordinary differential equations\nExplicit low-storage Runge-Kutta time integration\nStrong stability preserving methods\nCFL-based and error-based time step control\nNative support for differentiable programming\nForward mode automatic differentiation via ForwardDiff.jl\nPeriodic and weakly-enforced boundary conditions\nMultiple governing equations:\nCompressible Euler equations\nCompressible Navier-Stokes equations\nMagnetohydrodynamics (MHD) equations\nMulti-component compressible Euler and MHD equations\nLinearized Euler and acoustic perturbation equations\nHyperbolic diffusion equations for elliptic problems\nLattice-Boltzmann equations (D2Q9 and D3Q27 schemes)\nShallow water equations\nScalar advection\nMulti-physics simulations\nSelf-gravitating gas dynamics\nShared-memory parallelization via multithreading\nMulti-node parallelization via MPI\nVisualization and postprocessing of the results\nIn-situ and a posteriori visualization with Plots.jl\nInteractive visualization with Makie.jl\nPostprocessing with ParaView/VisIt via Trixi2Vtk","category":"page"},{"location":"#Installation","page":"Home","title":"Installation","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"If you have not yet installed Julia, please follow the instructions for your operating system. Trixi.jl works with Julia v1.8 and newer. We recommend using the latest stable release of Julia.","category":"page"},{"location":"#For-users","page":"Home","title":"For users","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl and its related tools are registered Julia packages. Hence, you can install Trixi.jl, the visualization tool Trixi2Vtk, OrdinaryDiffEq.jl, and Plots.jl by executing the following commands in the Julia REPL:","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg\n\njulia> Pkg.add([\"Trixi\", \"Trixi2Vtk\", \"OrdinaryDiffEq\", \"Plots\"])","category":"page"},{"location":"","page":"Home","title":"Home","text":"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 provides time integration schemes used by Trixi.jl, while Plots.jl can be used to directly visualize Trixi.jl's results from the REPL.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg; Pkg.update(\"Trixi\"); Pkg.status(\"Trixi\")","category":"page"},{"location":"","page":"Home","title":"Home","text":"to the latest release. If the installed version does not match the current release, please check the Troubleshooting section.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"#for-developers","page":"Home","title":"For developers","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"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:","category":"page"},{"location":"","page":"Home","title":"Home","text":"git clone git@github.com:trixi-framework/Trixi.jl.git\ncd Trixi.jl\nmkdir run\ncd run\njulia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=\"..\"))'","category":"page"},{"location":"","page":"Home","title":"Home","text":"If you installed Trixi.jl this way, you always have to start Julia with the --project flag set to your run directory, e.g.,","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia --project=.","category":"page"},{"location":"","page":"Home","title":"Home","text":"if already inside the run directory.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The advantage of using a separate run directory is that you can also add other related packages (see below, e.g., for time integration or visualization) to the project in the run folder and always have a reproducible environment at hand to share with others.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Since the postprocessing tool Trixi2Vtk.jl typically does not need to be modified, it is recommended to install it as a normal package. Likewise, you can install OrdinaryDiffEq.jl and Plots.jl as ordinary packages. To achieve this, use the following REPL commands:","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg\n\njulia> Pkg.add([\"OrdinaryDiffEq\", \"Trixi2Vtk\", \"Plots\"])","category":"page"},{"location":"","page":"Home","title":"Home","text":"Note that the postprocessing tools Trixi2Vtk.jl and Plots.jl are optional and can be omitted.","category":"page"},{"location":"#Example:-Installing-Trixi.jl-as-a-package","page":"Home","title":"Example: Installing Trixi.jl as a package","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":" ","category":"page"},{"location":"","page":"Home","title":"Home","text":"Please note that the playback speed is set to 3x, thus the entire installation procedure lasts around 45 seconds in real time (depending on the performance of your computer and on how many dependencies had already been installed before).","category":"page"},{"location":"#Usage","page":"Home","title":"Usage","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"In the Julia REPL, first load the package Trixi.jl","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Trixi","category":"page"},{"location":"","page":"Home","title":"Home","text":"Then start a simulation by executing","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> trixi_include(default_example())","category":"page"},{"location":"","page":"Home","title":"Home","text":"Please be patient since Julia will compile the code just before running it. To visualize the results, load the package Plots","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Plots","category":"page"},{"location":"","page":"Home","title":"Home","text":"and generate a heatmap plot of the results with","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> plot(sol) # No trailing semicolon, otherwise no plot is shown","category":"page"},{"location":"","page":"Home","title":"Home","text":"This will open a new window with a 2D visualization of the final solution:","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: image)","category":"page"},{"location":"","page":"Home","title":"Home","text":"The method trixi_include(...) expects a single string argument with the path to a Trixi.jl elixir, i.e., a text file containing Julia code necessary to set up and run a simulation. To quickly see Trixi.jl in action, default_example() returns the path to an example elixir with a short, two-dimensional problem setup. A list of all example elixirs packaged with Trixi.jl can be obtained by running get_examples(). Alternatively, you can also browse the examples/ subdirectory. If you want to modify one of the elixirs to set up your own simulation, download it to your machine, edit the configuration, and pass the file path to trixi_include(...).","category":"page"},{"location":"#Example:-Running-a-simulation-with-Trixi.jl","page":"Home","title":"Example: Running a simulation with Trixi.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":" ","category":"page"},{"location":"","page":"Home","title":"Home","text":"If this produces weird symbols or question marks in the terminal on your system, you are probably using Mac OS with problematic fonts. In that case, please check the Troubleshooting section.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Note on performance: Julia uses just-in-time compilation to transform its source code to native, optimized machine code at the time of execution and caches the compiled methods for further use. That means that the first execution of a Julia method is typically slow, with subsequent runs being much faster. For instance, in the example above the first execution of trixi_include takes about 20 seconds, while subsequent runs require less than 60 milliseconds.","category":"page"},{"location":"#Performing-a-convergence-analysis","page":"Home","title":"Performing a convergence analysis","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"To automatically determine the experimental order of convergence (EOC) for a given setup, execute","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> convergence_test(default_example(), 4)","category":"page"},{"location":"","page":"Home","title":"Home","text":"This will run a convergence test with the elixir default_example(), using four iterations with different initial refinement levels. The initial iteration will use the elixir unchanged, while for each subsequent iteration the initial_refinement_level parameter is incremented by one. Finally, the measured l^2 and l^infty errors and the determined EOCs will be displayed like this:","category":"page"},{"location":"","page":"Home","title":"Home","text":"[...]\nl2\nscalar\nerror EOC\n9.14e-06 -\n5.69e-07 4.01\n3.55e-08 4.00\n2.22e-09 4.00\n\nmean 4.00\n--------------------------------------------------------------------------------\nlinf\nscalar\nerror EOC\n6.44e-05 -\n4.11e-06 3.97\n2.58e-07 3.99\n1.62e-08 4.00\n\nmean 3.99\n--------------------------------------------------------------------------------","category":"page"},{"location":"","page":"Home","title":"Home","text":"An example with multiple variables looks like this:","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> convergence_test(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_source_terms.jl\"), 3)","category":"page"},{"location":"","page":"Home","title":"Home","text":"[...]\nl2\nrho rho_v1 rho_v2 rho_e\nerror EOC error EOC error EOC error EOC\n9.32e-07 - 1.42e-06 - 1.42e-06 - 4.82e-06 -\n7.03e-08 3.73 9.53e-08 3.90 9.53e-08 3.90 3.30e-07 3.87\n4.65e-09 3.92 6.09e-09 3.97 6.09e-09 3.97 2.12e-08 3.96\n\nmean 3.82 mean 3.93 mean 3.93 mean 3.91\n--------------------------------------------------------------------------------\nlinf\nrho rho_v1 rho_v2 rho_e\nerror EOC error EOC error EOC error EOC\n9.58e-06 - 1.17e-05 - 1.17e-05 - 4.89e-05 -\n6.23e-07 3.94 7.48e-07 3.97 7.48e-07 3.97 3.22e-06 3.92\n4.05e-08 3.94 4.97e-08 3.91 4.97e-08 3.91 2.10e-07 3.94\n\nmean 3.94 mean 3.94 mean 3.94 mean 3.93\n--------------------------------------------------------------------------------","category":"page"},{"location":"#Showcase-of-advanced-features","page":"Home","title":"Showcase of advanced features","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The presentation From Mesh Generation to Adaptive Simulation: A Journey in Julia, originally given as part of JuliaCon 2022, outlines how to use Trixi.jl for an adaptive simulation of the compressible Euler equations in two spatial dimensions on a complex domain. More details as well as code to run the simulation presented can be found at the reproducibility repository for the presentation.","category":"page"},{"location":"#Referencing","page":"Home","title":"Referencing","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"If you use Trixi.jl in your own research or write a paper using results obtained with the help of Trixi.jl, please cite the following articles:","category":"page"},{"location":"","page":"Home","title":"Home","text":"@article{ranocha2022adaptive,\n title={Adaptive numerical simulations with {T}rixi.jl:\n {A} case study of {J}ulia for scientific computing},\n author={Ranocha, Hendrik and Schlottke-Lakemper, Michael and Winters, Andrew Ross\n and Faulhaber, Erik and Chan, Jesse and Gassner, Gregor},\n journal={Proceedings of the JuliaCon Conferences},\n volume={1},\n number={1},\n pages={77},\n year={2022},\n doi={10.21105/jcon.00077},\n eprint={2108.06476},\n eprinttype={arXiv},\n eprintclass={cs.MS}\n}\n\n@article{schlottkelakemper2021purely,\n title={A purely hyperbolic discontinuous {G}alerkin approach for\n self-gravitating gas dynamics},\n author={Schlottke-Lakemper, Michael and Winters, Andrew R and\n Ranocha, Hendrik and Gassner, Gregor J},\n journal={Journal of Computational Physics},\n pages={110467},\n year={2021},\n month={06},\n volume={442},\n publisher={Elsevier},\n doi={10.1016/j.jcp.2021.110467},\n eprint={2008.10593},\n eprinttype={arXiv},\n eprintclass={math.NA}\n}","category":"page"},{"location":"","page":"Home","title":"Home","text":"In addition, you can also refer to Trixi.jl directly as","category":"page"},{"location":"","page":"Home","title":"Home","text":"@misc{schlottkelakemper2020trixi,\n title={{T}rixi.jl: {A}daptive high-order numerical simulations\n of hyperbolic {PDE}s in {J}ulia},\n author={Schlottke-Lakemper, Michael and Gassner, Gregor J and\n Ranocha, Hendrik and Winters, Andrew R and Chan, Jesse},\n year={2021},\n month={09},\n howpublished={\\url{https://github.com/trixi-framework/Trixi.jl}},\n doi={10.5281/zenodo.3996439}\n}","category":"page"},{"location":"#authors-index-md","page":"Home","title":"Authors","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl was initiated by Michael Schlottke-Lakemper (RWTH Aachen University/High-Performance Computing Center Stuttgart (HLRS), Germany) and Gregor Gassner (University of Cologne, Germany). Together with Hendrik Ranocha (Johannes Gutenberg University Mainz, Germany) and Andrew Winters (Linköping University, Sweden), and Jesse Chan (Rice University, US), they are the principal developers of Trixi.jl. The full list of contributors can be found under Authors.","category":"page"},{"location":"#License-and-contributing","page":"Home","title":"License and contributing","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl is licensed under the MIT license (see License). Since Trixi.jl is an open-source project, we are very happy to accept contributions from the community. Please refer to Contributing for more details. Note that we strive to be a friendly, inclusive open-source community and ask all members of our community to adhere to our Code of Conduct. To get in touch with the developers, join us on Slack or create an issue.","category":"page"},{"location":"#Acknowledgments","page":"Home","title":"Acknowledgments","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    ","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) through the following grants:","category":"page"},{"location":"","page":"Home","title":"Home","text":"Excellence Strategy EXC 2044-390685587, Mathematics Münster: Dynamics-Geometry-Structure.\nResearch unit FOR 5409 \"Structure-Preserving Numerical Methods for Bulk- and Interface Coupling of Heterogeneous Models (SNuBIC)\" (project number 463312734).\nIndividual grant no. 528753982.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from the European Research Council through the ERC Starting Grant \"An Exascale aware and Un-crashable Space-Time-Adaptive Discontinuous Spectral Element Solver for Non-Linear Conservation Laws\" (Extreme), ERC grant agreement no. 714487.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from Vetenskapsrådet (VR, Swedish Research Council), Sweden through the VR Starting Grant \"Shallow water flows including sediment transport and morphodynamics\", VR grant agreement 2020-03642 VR.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from the United States National Science Foundation (NSF) under awards DMS-1719818 and DMS-1943186.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from the German Federal Ministry of Education and Research (BMBF) through the project grant \"Adaptive earth system modeling with significantly reduced computation time for exascale supercomputers (ADAPTEX)\" (funding id: 16ME0668K).","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding by the Daimler und Benz Stiftung (Daimler and Benz Foundation) through grant no. 32-10/22.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl is supported by NumFOCUS as an Affiliated Project.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"EditURL = \"../../literate/src/files/adding_nonconservative_equation.jl\"","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#adding_nonconservative_equation","page":"11 Adding a non-conservative equation","title":"11: Adding a non-conservative equation","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"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","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"left\nbeginalignedpartial_t u(tx) + a(x) partial_x u(tx) = 0 \nu(0x)=sin(x) \nu(t-pi)=u(tpi)\nendaligned\nright","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"where a(x) = 2 + cos(x). The analytic solution is","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"u(tx)=-sin left(2 tan ^-1left(sqrt3 tan left(fracsqrt3 t2-tan ^-1left(frac1sqrt3tan left(fracx2right)right)right)right)right)","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"In Trixi.jl, such a mathematical model is encoded as a subtype of Trixi.AbstractEquations.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#Basic-setup","page":"11 Adding a non-conservative equation","title":"Basic setup","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Since there is no native support for variable coefficients, we need to transform the PDE to the following system:","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"left\nbeginalignedpartial_t beginpmatrixu(tx)a(tx) endpmatrix +beginpmatrix a(tx) partial_x u(tx) 0 endpmatrix = 0 \nu(0x)=sin(x) \na(0x)=2+cos(x) \nu(t-pi)=u(tpi)\nendaligned\nright","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"# Define new physics\nusing Trixi\nusing Trixi: AbstractEquations, get_node_vars\nimport Trixi: varnames, default_analysis_integrals, flux, max_abs_speed_naive,\n have_nonconservative_terms\n\n# Since there is no native support for variable coefficients, we use two\n# variables: one for the basic unknown `u` and another one for the coefficient `a`\nstruct NonconservativeLinearAdvectionEquation <: AbstractEquations{1 #= spatial dimension =#,\n 2 #= two variables (u,a) =#}\nend\n\nvarnames(::typeof(cons2cons), ::NonconservativeLinearAdvectionEquation) = (\"scalar\", \"advection_velocity\")\n\ndefault_analysis_integrals(::NonconservativeLinearAdvectionEquation) = ()\n\n\n# The conservative part of the flux is zero\nflux(u, orientation, equation::NonconservativeLinearAdvectionEquation) = zero(u)\n\n# Calculate maximum wave speed for local Lax-Friedrichs-type dissipation\nfunction max_abs_speed_naive(u_ll, u_rr, orientation::Integer, ::NonconservativeLinearAdvectionEquation)\n _, advection_velocity_ll = u_ll\n _, advection_velocity_rr = u_rr\n\n return max(abs(advection_velocity_ll), abs(advection_velocity_rr))\nend\n\n\n# We use nonconservative terms\nhave_nonconservative_terms(::NonconservativeLinearAdvectionEquation) = Trixi.True()\n\n# This \"nonconservative numerical flux\" implements the nonconservative terms.\n# In general, nonconservative terms can be written in the form\n# g(u) ∂ₓ h(u)\n# Thus, a discrete difference approximation of this nonconservative term needs\n# - `u mine`: the value of `u` at the current position (for g(u))\n# - `u_other`: the values of `u` in a neighborhood of the current position (for ∂ₓ h(u))\nfunction flux_nonconservative(u_mine, u_other, orientation,\n equations::NonconservativeLinearAdvectionEquation)\n _, advection_velocity = u_mine\n scalar, _ = u_other\n\n return SVector(advection_velocity * scalar, zero(scalar))\nend","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"The implementation of nonconservative terms uses a single \"nonconservative flux\" function flux_nonconservative. It will basically be applied in a loop of the form","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"du_m(D, u) = sum(D[m, l] * flux_nonconservative(u[m], u[l], 1, equations)) # orientation 1: x","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"where D is the derivative matrix and u contains the nodal solution values.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Now, we can run a simple simulation using a DGSEM discretization.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"# Create a simulation setup\nusing Trixi\nusing OrdinaryDiffEq\n\nequation = NonconservativeLinearAdvectionEquation()\n\n# You can derive the exact solution for this setup using the method of\n# characteristics\nfunction initial_condition_sine(x, t, equation::NonconservativeLinearAdvectionEquation)\n x0 = -2 * atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3))))\n scalar = sin(x0)\n advection_velocity = 2 + cos(x[1])\n SVector(scalar, advection_velocity)\nend\n\n# Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries\nmesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates\n initial_refinement_level=4, n_cells_max=10^4)\n\n# Create a DGSEM solver with polynomials of degree `polydeg`\n# Remember to pass a tuple of the form `(conservative_flux, nonconservative_flux)`\n# as `surface_flux` and `volume_flux` when working with nonconservative terms\nvolume_flux = (flux_central, flux_nonconservative)\nsurface_flux = (flux_lax_friedrichs, flux_nonconservative)\nsolver = DGSEM(polydeg=3, surface_flux=surface_flux,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\n# Setup the spatial semidiscretization containing all ingredients\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\n# Create an ODE problem with given time span\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan)\n\n# Set up some standard callbacks summarizing the simulation setup and computing\n# errors of the numerical solution\nsummary_callback = SummaryCallback()\nanalysis_callback = AnalysisCallback(semi, interval=50)\ncallbacks = CallbackSet(summary_callback, analysis_callback)\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes\n# the passed callbacks\nsol = solve(ode, Tsit5(), abstol=1.0e-6, reltol=1.0e-6,\n save_everystep=false, callback=callbacks)\n\n# Print the timer summary\nsummary_callback()\n\n# Plot the numerical solution at the final time\nusing Plots: plot\nplot(sol)","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"You see a plot of the final solution.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"We can check whether everything fits together by refining the grid and comparing the numerical errors. First, we look at the error using the grid resolution above.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"error_1 = analysis_callback(sol).l2 |> first","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Next, we increase the grid resolution by one refinement level and run the simulation again.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"mesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates\n initial_refinement_level=5, n_cells_max=10^4)\n\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\n\nsummary_callback = SummaryCallback()\nanalysis_callback = AnalysisCallback(semi, interval=50)\ncallbacks = CallbackSet(summary_callback, analysis_callback);\n\nsol = solve(ode, Tsit5(), abstol=1.0e-6, reltol=1.0e-6,\n save_everystep=false, callback=callbacks);\nsummary_callback()\n\nerror_2 = analysis_callback(sol).l2 |> first","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"error_1 / error_2","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"As expected, the new error is roughly reduced by a factor of 16, corresponding to an experimental order of convergence of 4 (for polynomials of degree 3).","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#Summary-of-the-code","page":"11 Adding a non-conservative equation","title":"Summary of the code","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Here is the complete code that we used (without the callbacks since these create a lot of unnecessary output in the doctests of this tutorial). In addition, we create the struct inside the new module NonconservativeLinearAdvection. That ensures that we can re-create structs defined therein without having to restart Julia.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Define new physics","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"module NonconservativeLinearAdvection\n\nusing Trixi\nusing Trixi: AbstractEquations, get_node_vars\nimport Trixi: varnames, default_analysis_integrals, flux, max_abs_speed_naive,\n have_nonconservative_terms\n\n# Since there is not yet native support for variable coefficients, we use two\n# variables: one for the basic unknown `u` and another one for the coefficient `a`\nstruct NonconservativeLinearAdvectionEquation <: AbstractEquations{1 #= spatial dimension =#,\n 2 #= two variables (u,a) =#}\nend\n\nvarnames(::typeof(cons2cons), ::NonconservativeLinearAdvectionEquation) = (\"scalar\", \"advection_velocity\")\n\ndefault_analysis_integrals(::NonconservativeLinearAdvectionEquation) = ()\n\n\n# The conservative part of the flux is zero\nflux(u, orientation, equation::NonconservativeLinearAdvectionEquation) = zero(u)\n\n# Calculate maximum wave speed for local Lax-Friedrichs-type dissipation\nfunction max_abs_speed_naive(u_ll, u_rr, orientation::Integer, ::NonconservativeLinearAdvectionEquation)\n _, advection_velocity_ll = u_ll\n _, advection_velocity_rr = u_rr\n\n return max(abs(advection_velocity_ll), abs(advection_velocity_rr))\nend\n\n\n# We use nonconservative terms\nhave_nonconservative_terms(::NonconservativeLinearAdvectionEquation) = Trixi.True()\n\n# This \"nonconservative numerical flux\" implements the nonconservative terms.\n# In general, nonconservative terms can be written in the form\n# g(u) ∂ₓ h(u)\n# Thus, a discrete difference approximation of this nonconservative term needs\n# - `u mine`: the value of `u` at the current position (for g(u))\n# - `u_other`: the values of `u` in a neighborhood of the current position (for ∂ₓ h(u))\nfunction flux_nonconservative(u_mine, u_other, orientation,\n equations::NonconservativeLinearAdvectionEquation)\n _, advection_velocity = u_mine\n scalar, _ = u_other\n\n return SVector(advection_velocity * scalar, zero(scalar))\nend\n\nend # module\n\n\n\n# Create a simulation setup\nimport .NonconservativeLinearAdvection\nusing Trixi\nusing OrdinaryDiffEq\n\nequation = NonconservativeLinearAdvection.NonconservativeLinearAdvectionEquation()\n\n# You can derive the exact solution for this setup using the method of\n# characteristics\nfunction initial_condition_sine(x, t, equation::NonconservativeLinearAdvection.NonconservativeLinearAdvectionEquation)\n x0 = -2 * atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3))))\n scalar = sin(x0)\n advection_velocity = 2 + cos(x[1])\n SVector(scalar, advection_velocity)\nend\n\n# Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries\nmesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates\n initial_refinement_level=4, n_cells_max=10^4)\n\n# Create a DGSEM solver with polynomials of degree `polydeg`\n# Remember to pass a tuple of the form `(conservative_flux, nonconservative_flux)`\n# as `surface_flux` and `volume_flux` when working with nonconservative terms\nvolume_flux = (flux_central, NonconservativeLinearAdvection.flux_nonconservative)\nsurface_flux = (flux_lax_friedrichs, NonconservativeLinearAdvection.flux_nonconservative)\nsolver = DGSEM(polydeg=3, surface_flux=surface_flux,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\n# Setup the spatial semidiscretization containing all ingredients\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\n# Create an ODE problem with given time span\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\n\n# Set up some standard callbacks summarizing the simulation setup and computing\n# errors of the numerical solution\nsummary_callback = SummaryCallback()\nanalysis_callback = AnalysisCallback(semi, interval=50)\ncallbacks = CallbackSet(summary_callback, analysis_callback);\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes\n# the passed callbacks\nsol = solve(ode, Tsit5(), abstol=1.0e-6, reltol=1.0e-6,\n save_everystep=false);\n\n# Plot the numerical solution at the final time\nusing Plots: plot\nplot(sol);\nnothing #hide","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#Package-versions","page":"11 Adding a non-conservative equation","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"EditURL = \"../../literate/src/files/differentiable_programming.jl\"","category":"page"},{"location":"tutorials/differentiable_programming/#differentiable_programming","page":"19 Differentiable programming","title":"19: Differentiable programming","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Julia and its ecosystem provide some tools for differentiable programming. Trixi.jl is designed to be flexible, extendable, and composable with Julia's growing ecosystem for scientific computing and machine learning. Thus, the ultimate goal is to have fast implementations that allow automatic differentiation (AD) without too much hassle for users. If some parts do not meet these requirements, please feel free to open an issue or propose a fix in a PR.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"In the following, we will walk through some examples demonstrating how to differentiate through Trixi.jl.","category":"page"},{"location":"tutorials/differentiable_programming/#Forward-mode-automatic-differentiation","page":"19 Differentiable programming","title":"Forward mode automatic differentiation","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Trixi.jl integrates well with ForwardDiff.jl for forward mode AD.","category":"page"},{"location":"tutorials/differentiable_programming/#Computing-the-Jacobian","page":"19 Differentiable programming","title":"Computing the Jacobian","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"The high-level interface to compute the Jacobian this way is jacobian_ad_forward. First, we load the required packages and compute the Jacobian of a semidiscretization of the compressible Euler equations, a system of nonlinear conservation laws.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra, Plots\n\nequations = CompressibleEulerEquations2D(1.4)\n\nsolver = DGSEM(3, flux_central)\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi);\nsize(J)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we compute the eigenvalues of the Jacobian.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ = eigvals(J)\nscatter(real.(λ), imag.(λ), label=\"central flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"As you can see here, the maximal real part is close to zero.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Interestingly, if we add dissipation by switching to the flux_lax_friedrichs at the interfaces, the maximal real part of the eigenvalues increases.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"solver = DGSEM(3, flux_lax_friedrichs)\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi)\nλ = eigvals(J)\n\nscatter!(real.(λ), imag.(λ), label=\"Lax-Friedrichs flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Although the maximal real part is still somewhat small, it's larger than for the purely central discretization.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"However, we should be careful when using this analysis, since the eigenvectors are not necessarily well-conditioned.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ, V = eigen(J)\ncondition_number = cond(V)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"In one space dimension, the situation is a bit different.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"equations = CompressibleEulerEquations1D(1.4)\n\nsolver = DGSEM(3, flux_central)\nmesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level=6, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi)\n\nλ = eigvals(J)\n\nscatter(real.(λ), imag.(λ), label=\"central flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Here, the maximal real part is basically zero to machine accuracy.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Moreover, the eigenvectors are not as ill-conditioned as in 2D.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ, V = eigen(J)\ncondition_number = cond(V)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"If we add dissipation, the maximal real part is still approximately zero.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"solver = DGSEM(3, flux_lax_friedrichs)\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi)\nλ = eigvals(J)\n\nscatter!(real.(λ), imag.(λ), label=\"Lax-Friedrichs flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"As you can see from the plot generated above, the maximal real part is still basically zero to machine precision.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Let's check the condition number of the eigenvectors.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ, V = eigen(J)\n\ncondition_number = cond(V)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Note that the condition number of the eigenvector matrix increases but is still smaller than for the example in 2D.","category":"page"},{"location":"tutorials/differentiable_programming/#Computing-other-derivatives","page":"19 Differentiable programming","title":"Computing other derivatives","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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 examples/special_elixirs/elixir_euler_ad.jl","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"First, we create a semidiscretization of the compressible Euler equations.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra, ForwardDiff\n\nequations = CompressibleEulerEquations2D(1.4)\n\n\"\"\"\n initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)\n\nThe classical isentropic vortex test case of\n- Chi-Wang Shu (1997)\n Essentially Non-Oscillatory and Weighted Essentially Non-Oscillatory\n Schemes for Hyperbolic Conservation Laws\n [NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)\n\"\"\"\nfunction initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)\n inicenter = SVector(0.0, 0.0) # initial center of the vortex\n iniamplitude = 5.0 # size and strength of the vortex\n\n rho = 1.0 # base flow\n v1 = 1.0\n v2 = 1.0\n vel = SVector(v1, v2)\n p = 25.0\n\n rt = p / rho # ideal gas equation\n t_loc = 0.0\n\n cent = inicenter + vel*t_loc # shift advection of center to handle periodic BC, but only for v1 = v2 = 1.0\n cent = x - cent # distance to center point\n cent = SVector(-cent[2], cent[1])\n\n r2 = cent[1]^2 + cent[2]^2\n du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation\n dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic\n\n rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))\n vel = vel + du * cent\n v1, v2 = vel\n p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))\n\n prim = SVector(rho, v1, v2, p)\n return prim2cons(prim, equations)\nend\n\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsolver = DGSEM(3, flux_lax_friedrichs, VolumeIntegralFluxDifferencing(flux_ranocha))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_isentropic_vortex, solver)\n\nu0_ode = Trixi.compute_coefficients(0.0, semi)\nsize(u0_ode)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we compute the Jacobian using ForwardDiff.jacobian.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"J = ForwardDiff.jacobian((du_ode, γ) -> begin\n equations_inner = CompressibleEulerEquations2D(first(γ))\n semi_inner = Trixi.remake(semi, equations=equations_inner, uEltype=eltype(γ))\n Trixi.rhs!(du_ode, u0_ode, semi_inner, 0.0)\nend, similar(u0_ode), [1.4]); # γ needs to be an `AbstractArray`\n\nround.(extrema(J), sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Note that we create a semidiscretization semi at first to determine the state u0_ode around which we want to perform the linearization. Next, we wrap the RHS evaluation inside a closure and pass that to ForwardDiff.jacobian. There, we need to make sure that the internal caches are able to store dual numbers from ForwardDiff.jl by setting uEltype appropriately. A similar approach is used by jacobian_ad_forward.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Note that the ideal gas constant does not influence the semidiscrete rate of change of the density, as demonstrated by","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"norm(J[1:4:end])","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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.","category":"page"},{"location":"tutorials/differentiable_programming/#Differentiating-through-a-complete-simulation","page":"19 Differentiable programming","title":"Differentiating through a complete simulation","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"It is also possible to differentiate through a complete simulation. As an example, let's differentiate the total energy of a simulation using the linear scalar advection equation with respect to the wave number (frequency) of the initial data.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, OrdinaryDiffEq, ForwardDiff, Plots\n\nfunction energy_at_final_time(k) # k is the wave number of the initial condition\n equations = LinearScalarAdvectionEquation2D(1.0, -0.3)\n mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=3, n_cells_max=10^4)\n solver = DGSEM(3, flux_lax_friedrichs)\n initial_condition = (x, t, equation) -> begin\n x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t)\n return SVector(sinpi(k * sum(x_trans)))\n end\n semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n uEltype=typeof(k))\n ode = semidiscretize(semi, (0.0, 1.0))\n sol = solve(ode, BS3(), save_everystep=false)\n Trixi.integrate(energy_total, sol.u[end], semi)\nend\n\nk_values = range(0.9, 1.1, length=101)\n\nplot(k_values, energy_at_final_time.(k_values), label=\"Energy\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"You see a plot of a curve that resembles a parabola with local maximum around k = 1.0. Why's that? Well, the domain is fixed but the wave number changes. Thus, if the wave number is not chosen as an integer, the initial condition will not be a smooth periodic function in the given domain. Hence, the dissipative surface flux (flux_lax_friedrichs in this example) will introduce more dissipation. In particular, it will introduce more dissipation for \"less smooth\" initial data, corresponding to wave numbers k further away from integers.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"We can compute the discrete derivative of the energy at the final time with respect to the wave number k as follows.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"round(ForwardDiff.derivative(energy_at_final_time, 1.0), sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"This is rather small and we can treat it as zero in comparison to the value of this derivative at other wave numbers k.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"dk_values = ForwardDiff.derivative.((energy_at_final_time,), k_values);\n\nplot(k_values, dk_values, label=\"Derivative\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"If you remember basic calculus, a sufficient condition for a local maximum is that the first derivative vanishes and the second derivative is negative. We can also check this discretely.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"second_derivative = round(ForwardDiff.derivative(\n k -> Trixi.ForwardDiff.derivative(energy_at_final_time, k), 1.0),\n sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Having seen this application, let's break down what happens step by step.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"function energy_at_final_time(k) # k is the wave number of the initial condition\n equations = LinearScalarAdvectionEquation2D(1.0, -0.3)\n mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=3, n_cells_max=10^4)\n solver = DGSEM(3, flux_lax_friedrichs)\n initial_condition = (x, t, equation) -> begin\n x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t)\n return SVector(sinpi(k * sum(x_trans)))\n end\n semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n uEltype=typeof(k))\n ode = semidiscretize(semi, (0.0, 1.0))\n sol = solve(ode, BS3(), save_everystep=false)\n Trixi.integrate(energy_total, sol.u[end], semi)\nend\n\nk = 1.0\nround(ForwardDiff.derivative(energy_at_final_time, k), sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"When calling ForwardDiff.derivative(energy_at_final_time, k) with k=1.0, ForwardDiff.jl will basically use the chain rule and known derivatives of existing basic functions to calculate the derivative of the energy at the final time with respect to the wave number k at k0 = 1.0. To do this, ForwardDiff.jl uses dual numbers, which basically store the result and its derivative w.r.t. a specified parameter at the same time. Thus, we need to make sure that we can treat these ForwardDiff.Dual numbers everywhere during the computation. Fortunately, generic Julia code usually supports these operations. The most basic problem for a developer is to ensure that all types are generic enough, in particular the ones of internal caches.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"The first step in this example creates some basic ingredients of our simulation.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"equations = LinearScalarAdvectionEquation2D(1.0, -0.3)\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=3, n_cells_max=10^4)\nsolver = DGSEM(3, flux_lax_friedrichs);\nnothing #hide","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"These do not have internal caches storing intermediate values of the numerical solution, so we do not need to adapt them. In fact, we could also define them outside of energy_at_final_time (but would need to take care of globals or wrap everything in another function).","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we define the initial condition","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"initial_condition = (x, t, equation) -> begin\n x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t)\n return SVector(sinpi(k * sum(x_trans)))\nend;\nnothing #hide","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"as a closure capturing the wave number k passed to energy_at_final_time. If you call energy_at_final_time(1.0), k will be a Float64. Thus, the return values of initial_condition will be SVectors of Float64s. When calculating the ForwardDiff.derivative, k will be a ForwardDiff.Dual number. Hence, the initial_condition will return SVectors of ForwardDiff.Dual numbers.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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.jl to allow ForwardDiff.Dual numbers in these caches. That's what the keyword argument uEltype=typeof(k) in","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n uEltype=typeof(k));\nnothing #hide","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"ode = semidiscretize(semi, (0.0, 1.0))\nsol = solve(ode, BS3(), save_everystep=false)\nround(Trixi.integrate(energy_total, sol.u[end], semi), sigdigits=5)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"do not need any modifications since they are sufficiently generic (and enough effort has been spend to allow general types inside these calls).","category":"page"},{"location":"tutorials/differentiable_programming/#Propagating-errors-using-Measurements.jl","page":"19 Differentiable programming","title":"Propagating errors using Measurements.jl","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"(Image: Error bars by Randall Munroe) \"Error bars\" by Randall Munroe, linked from https://xkcd.com/2110","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Similar to AD, Trixi.jl also allows propagating uncertainties using linear error propagation theory via 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 sine wave as initial condition, solve the ODE, and plot the resulting uncertainties in the primitive variables.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, OrdinaryDiffEq, Measurements, Plots, LaTeXStrings\n\nequations = LinearScalarAdvectionEquation1D(1.0 ± 0.1)\n\nmesh = TreeMesh((-1.0,), (1.0,), n_cells_max=10^5, initial_refinement_level=5)\n\nsolver = DGSEM(3)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,\n solver, uEltype=Measurement{Float64})\n\node = semidiscretize(semi, (0.0, 1.5))\n\nsol = solve(ode, BS3(), save_everystep=false);\n\nplot(sol)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"You should see a plot where small error bars are shown around the extrema and larger error bars are shown in the remaining parts. This result is in accordance with expectations. Indeed, the uncertain propagation speed will affect the extrema less since the local variation of the solution is relatively small there. In contrast, the local variation of the solution is large around the turning points of the sine wave, so the uncertainties will be relatively large there.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"All this is possible due to allowing generic types and having good abstractions in Julia that allow packages to work together seamlessly.","category":"page"},{"location":"tutorials/differentiable_programming/#Finite-difference-approximations","page":"19 Differentiable programming","title":"Finite difference approximations","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Trixi.jl provides the convenience function jacobian_fd to approximate the Jacobian via central finite differences.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra\n\nequations = CompressibleEulerEquations2D(1.4)\n\nsolver = DGSEM(3, flux_central)\n\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ_fd = jacobian_fd(semi)\n\nJ_ad = jacobian_ad_forward(semi)\n\nrelative_difference = norm(J_fd - J_ad) / size(J_fd, 1)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"This discrepancy is of the expected order of magnitude for central finite difference approximations.","category":"page"},{"location":"tutorials/differentiable_programming/#Linear-systems","page":"19 Differentiable programming","title":"Linear systems","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"When a linear PDE is discretized using a linear scheme such as a standard DG method, the resulting semidiscretization yields an affine ODE of the form","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"partial_t u(t) = A u(t) + b","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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. The resulting operator A can be used in multiplication, e.g. mul! from LinearAlgebra, converted to a sparse matrix using sparse from SparseArrays, or converted to a dense matrix using Matrix for detailed eigenvalue analyses. For example,","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra, Plots\n\nequations = LinearScalarAdvectionEquation2D(1.0, -0.3)\n\nsolver = DGSEM(3, flux_lax_friedrichs)\n\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)\n\nA, b = linear_structure(semi)\n\nsize(A), size(b)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we compute the eigenvalues of the linear operator.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ = eigvals(Matrix(A))\n\nscatter(real.(λ), imag.(λ))","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"As you can see here, the maximal real part is close to machine precision.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ = eigvals(Matrix(A))\nrelative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/#Package-versions","page":"19 Differentiable programming","title":"Package versions","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\", \"ForwardDiff\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"This page was generated using Literate.jl.","category":"page"},{"location":"meshes/tree_mesh/#Tree-mesh","page":"Tree mesh","title":"Tree mesh","text":"","category":"section"},{"location":"meshes/tree_mesh/","page":"Tree mesh","title":"Tree mesh","text":"The TreeMesh is a Cartesian, h-non-conforming mesh type used in many parts of Trixi.jl. Often, the support for this mesh type is developed best since it was the first mesh type in Trixi.jl, and it is available in one, two, and three space dimensions.","category":"page"},{"location":"meshes/tree_mesh/","page":"Tree mesh","title":"Tree mesh","text":"It is limited to hypercube domains but supports AMR via the AMRCallback. Due to its Cartesian nature, (numerical) fluxes need to implement methods dispatching on the orientation::Integer as described in the conventions.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Unstructured-quadrilateral-mesh","page":"Unstructured mesh","title":"Unstructured quadrilateral mesh","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The UnstructuredMesh2D is an unstructured, curvilinear, conforming mesh type in two space dimensions.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Next, we describe the conventions taken in the implementation for two-dimensional unstructured quadrilateral meshes. Principally, this relates to how a file with the extension .mesh encodes information about the numbering and orientation of elements in an unstructured quadrilateral mesh with possibly curved boundaries.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We use the following unstructured mesh with three elements for this discussion:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"(Image: example-mesh)","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Further, a simulation using Trixi.jl on this example unstructured mesh is provided in examples/unstructured_2d_dgsem/elixir_euler_basic.jl.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Mesh-file-header","page":"Unstructured mesh","title":"Mesh file header","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The first two lines of the mesh file lists the mesh file type as well as the total number of corners, surfaces, elements, and the polynomial degree that the mesh will use to represent any curved sides. For the example mesh these quantities are","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"ISM-V2\n 7 9 3 8","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"corresponding to seven corners, nine surfaces, and three elements. The mesh polynomial degree of eight is taken only for illustrative purposes. In practice, this mesh polynomial degree depends on the particular application for which the curved, unstructured mesh is required.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#List-of-corner-nodes","page":"Unstructured mesh","title":"List of corner nodes","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"After these global counts that prescribe information about the mesh skeleton, the mesh file give a list of the physical (x,y) coordinates of all the corners. The corner nodes are listed in the order prescribed by mesh generator. Thus, for the example mesh this node list would be","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 1.0 -1.0\n 3.0 0.0\n 1.0 1.0\n 2.0 0.0\n 0.0 0.0\n 3.0 1.0\n 3.0 -1.0","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The corner nodes are internally referenced by their position in the list above. For example, here the node at (1.0, -1.0) would have node id 1, node id 2 would be at (3.0, 0.0) etc.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#List-of-neighbor-connectivity","page":"Unstructured mesh","title":"List of neighbor connectivity","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"After the corner list comes the neighbor connectivity along each surface in the mesh. This includes local indexing and orientation information necessary to compute the coupling between elements in the mesh. In 2D each surface is defined by connecting two nodes indexed as with the numbering above. We adopt the convention that node id 1 < node id 2.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Each surface will have two neighbors where the element on the left locally as one \"walks\" from node id 1 to node id 2 is taken to be the primary element and the element locally on the right is taken to be the secondary element. If, however, there is no secondary element index, then the surface lies along a physical boundary. In this case the only available element index is considered to be primary and the secondary index is set to zero.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The final two index numbers within the neighbor information list are used to identify the local surface within each element. The first local surface index (on the primary element) will always be positive whereas the second local surface index (on the primary element) can be positive or negative. If the second local surface index is positive, then the local coordinate systems in the primary element and secondary element match, i.e., the indexing on either side runs from 1:polydeg+1. However, if the local surface index of the secondary element is negative in the mesh file, then the coordinate system in the secondary element is flipped with respect to the primary element. Therefore, care must be taken in the implementation to ensure that the primary element indexing runs from 1:polydeg+1 whereas the secondary element indexing must run in reverse from polydeg+1:-1:1. Finally, if the secondary element index is zero, then so will be the local surface index because the surface is on a physical boundary. Also, there is no flipping of coordinate indexing required at the physical boundary because only the primary element's coordinate system exists.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Three-examples:-One-along-a-physical-boundary-and-two-along-interior-surfaces.","page":"Unstructured mesh","title":"Three examples: One along a physical boundary and two along interior surfaces.","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Along edge {8} we connect node (2) to node (7) and are along a physical boundary in element 3 with the local surface index 1 and the neighbor information:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 2 7 3 0 1 0","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Along edge {1} we connect node (2) to node (4) such that the primary element is 3 with local surface index 2 and the secondary element is 2 with local surface index 1. Furthermore, we see that coordinate system in the secondary element 2 is flipped with respect to the primary element's coordinate system such that the sign of the local surface index in the secondary element flips. This gives the following neighbor information:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 2 4 3 2 2 -1","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Along edge {4} we connect node (1) to node (4) such that the primary element is 1 with local surface index 2 and the secondary element is 3 with local surface index 3. The coordinate systems in both elements match and no sign change is required on the local surface index in the secondary element:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 1 4 1 3 2 3","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We collect the complete neighbor information for the example mesh above:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 2 4 3 2 2 -1\n 3 5 1 0 4 0\n 1 5 1 0 1 0\n 1 4 1 3 2 3\n 2 6 2 0 2 0\n 1 7 3 0 4 0\n 3 6 2 0 3 0\n 2 7 3 0 1 0\n 3 4 2 1 4 -3","category":"page"},{"location":"meshes/unstructured_quad_mesh/#List-of-elements","page":"Unstructured mesh","title":"List of elements","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Each quadrilateral element in the unstructured mesh is dictated by four corner points with indexing taken from the numbering given by the corner list above. We connect a set of four corner points (starting from the bottom left) in an anti-clockwise fashion thus making the element right-handed indicated using the circular arrow in the figure above. In turn, this right-handedness defines the local surface indexing (i.e. the four local sides) and the local (xi eta) coordinate system. For example, the four corners for element 1 would be listed as","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 5 1 4 3","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The mesh file also encodes information for curved surfaces either interior to the domain (as surface {9} above) or along the physical boundaries. A set of check digits are included directly below the four corner indexes to indicate whether the local surface index (1, 2, 3, or 4) within the element is straight sided, 0, or is curved, 1. If the local surface is straight sided no additional information is necessary during the mesh file read in. But for any curved surfaces the mesh file provides (x,y) coordinate values in order to construct an interpolant of this surface with the mesh polynomial order at the Chebyshev-Gauss-Lobatto nodes. This list of (x,y) data will be given in the direction of the local coordinate system.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The last piece of information provided by the mesh file are labels for the different surfaces of an element. These labels are useful to set boundary conditions along physical surfaces. The labels can be short descriptive words. The label --- indicates an internal surface where no boundary condition is required.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"As an example, the complete information for element 1 in the example mesh would be","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 5 1 4 3\n 0 0 1 1\n 1.000000000000000 1.000000000000000\n 1.024948365654583 0.934461926834452\n 1.116583018200151 0.777350964621867\n 1.295753434047077 0.606254343587194\n 1.537500000000000 0.462500000000000\n 1.768263070247418 0.329729152118310\n 1.920916981799849 0.185149035378133\n 1.986035130050921 0.054554577460044\n 2.000000000000000 0.0\n 0.0 0.0\n 0.035513826946206 0.105291711848750\n 0.148591270347399 0.317731556850611\n 0.340010713990041 0.452219430075470\n 0.575000000000000 0.462500000000000\n 0.788022294598950 0.483764065630034\n 0.926408729652601 0.644768443149389\n 0.986453164464803 0.883724792445746\n 1.000000000000000 1.000000000000000\n Slant --- --- Bezier","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"where the curved boundary information is encoded \"back to back\". That is, the first nine (x,y) nodes in the list above correspond to the interior boundary curve along local side 3 in element 1 and the next nine (x,y) nodes denote the curved physical boundary named Bezier along local side 4.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We collect the complete set of element information for the example mesh","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 5 1 4 3\n 0 0 1 1\n 1.000000000000000 1.000000000000000\n 1.024948365654583 0.934461926834452\n 1.116583018200151 0.777350964621867\n 1.295753434047077 0.606254343587194\n 1.537500000000000 0.462500000000000\n 1.768263070247418 0.329729152118310\n 1.920916981799849 0.185149035378133\n 1.986035130050921 0.054554577460044\n 2.000000000000000 0.0\n 0.0 0.0\n 0.035513826946206 0.105291711848750\n 0.148591270347399 0.317731556850611\n 0.340010713990041 0.452219430075470\n 0.575000000000000 0.462500000000000\n 0.788022294598950 0.483764065630034\n 0.926408729652601 0.644768443149389\n 0.986453164464803 0.883724792445746\n 1.000000000000000 1.000000000000000\n Slant --- --- Bezier\n 4 2 6 3\n 0 0 0 1\n 2.000000000000000 0.0\n 1.986035130050921 0.054554577460044\n 1.920916981799849 0.185149035378133\n 1.768263070247418 0.329729152118310\n 1.537500000000000 0.462500000000000\n 1.295753434047077 0.606254343587194\n 1.116583018200151 0.777350964621867\n 1.024948365654583 0.934461926834452\n 1.000000000000000 1.000000000000000\n --- Right Top ---\n 7 2 4 1\n 0 0 0 0\n Right --- --- Bottom","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Trixi.jl-on-an-unstructured-quadrilateral-mesh","page":"Unstructured mesh","title":"Trixi.jl on an unstructured quadrilateral mesh","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We provide an example simulation on an unstructured quadrilateral mesh by executing","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"julia> trixi_include(default_example_unstructured())","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Note this may download a copy of the mesh file described above for the three element unstructured mesh. This elixir provides the solution for the compressible Euler equations in two spatial dimensions for a smooth propagating wave solution. Below we provide the time evolution of the pressure wave for this example created with the Trixi2Vtk tool and visualized using ParaView.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" \n
    ","category":"page"},{"location":"reference-trixibase/#TrixiBase.jl-API","page":"TrixiBase.jl","title":"TrixiBase.jl API","text":"","category":"section"},{"location":"reference-trixibase/","page":"TrixiBase.jl","title":"TrixiBase.jl","text":"CurrentModule = TrixiBase","category":"page"},{"location":"reference-trixibase/","page":"TrixiBase.jl","title":"TrixiBase.jl","text":"Modules = [TrixiBase]","category":"page"},{"location":"reference-trixibase/#TrixiBase.trixi_include-Tuple{Module, AbstractString}","page":"TrixiBase.jl","title":"TrixiBase.trixi_include","text":"trixi_include([mod::Module=Main,] elixir::AbstractString; kwargs...)\n\ninclude 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. Its basic purpose is to make it easier to modify some parameters while running simulations 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.\n\nBefore replacing assignments in elixir, the keyword argument maxiters is inserted into calls to solve with it's default value used in the SciML ecosystem for ODEs, see the \"Miscellaneous\" section of the documentation.\n\nExamples\n\njulia> using TrixiBase, Trixi\n\njulia> redirect_stdout(devnull) do\n trixi_include(@__MODULE__, joinpath(examples_dir(), \"tree_1d_dgsem\", \"elixir_advection_extended.jl\"),\n tspan=(0.0, 0.1))\n sol.t[end]\n end\n[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n0.1\n\n\n\n\n\n","category":"method"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"EditURL = \"../../literate/src/files/time_stepping.jl\"","category":"page"},{"location":"tutorials/time_stepping/#time_stepping","page":"18 Explicit time stepping","title":"18: Explicit time stepping","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"For the time integration, Trixi.jl uses the package OrdinaryDiffEq.jl from the SciML ecosystem. The interface to this package is the solve(...) function. It always requires an ODE problem and a time integration algorithm as input parameters.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"solve(ode, alg; kwargs...)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"In Trixi.jl, the ODE problem is created by semidiscretize(semi, tspan) for a semidiscretization semi and the time span tspan. In particular, semidiscretize returns an ODEProblem used by OrdinaryDiffEq.jl.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"OrdinaryDiffEq.jl provides many integration algorithms, which are summarized in the documentation. Particularly interesting for Trixi.jl are their strong stability preserving (SSP) methods and low-storage methods. There are some differences regarding the choice of the used time step.","category":"page"},{"location":"tutorials/time_stepping/#adaptive_step_sizes","page":"18 Explicit time stepping","title":"Error-based adaptive step sizes","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"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 or elixir_euler_astro_jet_amr.jl.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"Other error-based adaptive integration algorithms are for instance RDPK3SpFSAL35, RDPK3Sp35, RDPK3SpFSAL49, RDPK3Sp49, RDPK3SpFSAL510, RDPK3Sp510.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"They already contain an error-based adaptive step size control and heuristics to guess 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.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"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.","category":"page"},{"location":"tutorials/time_stepping/#CFL-based-step-size-control","page":"18 Explicit time stepping","title":"CFL-based step size control","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"The SciML ecosystem also provides time integration algorithms without adaptive time stepping on their own, such as CarpenterKennedy2N54. Moreover, you also can deactivate the automatic adaptivity of adaptive integration algorithms by passing adaptive=false in the solve function.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"These algorithms require another way of setting the step size. You have to pass dt=... in the solve function. Without other settings, the simulation uses this fixed time step.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"For hyperbolic PDEs, it is natural to use an adaptive CFL-based step size control. Here, the time step is proportional to a ratio of the local measure of mesh spacing Delta x_i for an element i and the maximum (local) wave speed lambda_max related to the largest-magnitude eigenvalue of the flux Jacobian of the hyperbolic system.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"Delta t_n = textCFL * min_i fracDelta x_ilambda_max(u_i^n)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"We compute Delta x_i by scaling the element size by a factor of 1(N+1), cf. Gassner and Kopriva (2011), Section 5.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"Trixi.jl provides such a CFL-based step size control. It is implemented as the callback StepsizeCallback.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"stepsize_callback = StepsizeCallback(; cfl=1.0)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"A suitable CFL number depends on many parameters such as the chosen grid, the integration algorithm and the polynomial degree of the spatial DG discretization. So, the optimal number for an example is mostly determined experimentally.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"You can add this CFL-based step size control to your simulation like any other callback.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"callbacks = CallbackSet(stepsize_callback)\nalg = CarpenterKennedy2N54(williamson_condition=false)\nsolve(ode, alg;\n dt=1.0 # solve needs some value here but it will be overwritten by the stepsize_callback\n callback=callbacks)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"You can find simple examples with a CFL-based step size control for instance in the elixirs elixir_advection_basic.jl or elixir_euler_source_terms.jl.","category":"page"},{"location":"tutorials/time_stepping/#Package-versions","page":"18 Explicit time stepping","title":"Package versions","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"This page was generated using Literate.jl.","category":"page"},{"location":"contributing/#Contributing","page":"Contributing","title":"Contributing","text":"","category":"section"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"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).","category":"page"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"Trixi.jl and its contributions are licensed under the MIT license (see License). 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.","category":"page"},{"location":"contributing/#Developer-Certificate-of-Origin-(Version-1.1)","page":"Contributing","title":"Developer Certificate of Origin (Version 1.1)","text":"","category":"section"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"The following text was taken from https://developercertificate.org:","category":"page"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"Developer Certificate of Origin\nVersion 1.1\n\nCopyright (C) 2004, 2006 The Linux Foundation and its contributors.\n1 Letterman Drive\nSuite D4700\nSan Francisco, CA, 94129\n\nEveryone is permitted to copy and distribute verbatim copies of this\nlicense document, but changing it is not allowed.\n\n\nDeveloper's Certificate of Origin 1.1\n\nBy making a contribution to this project, I certify that:\n\n(a) The contribution was created in whole or in part by me and I\n have the right to submit it under the open source license\n indicated in the file; or\n\n(b) The contribution is based upon previous work that, to the best\n of my knowledge, is covered under an appropriate open source\n license and I have the right under that license to submit that\n work with modifications, whether created in whole or in part\n by me, under the same open source license (unless I am\n permitted to submit under a different license), as indicated\n in the file; or\n\n(c) The contribution was provided directly to me by some other\n person who certified (a), (b) or (c) and I have not modified\n it.\n\n(d) I understand and agree that this project and the contribution\n are public and that a record of the contribution (including all\n personal information I submit with it, including my sign-off) is\n maintained indefinitely and may be redistributed consistent with\n this project or the open source license(s) involved.","category":"page"},{"location":"performance/#Performance","page":"Performance","title":"Performance","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"Trixi.jl is designed to balance performance and readability. Since Julia provides a lot of zero-cost abstractions, it is often possible to optimize both goals simultaneously.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"The usual development workflow in Julia is","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Make it work.\nMake it nice.\nMake it fast.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"To achieve the third step, you should be familiar with (at least) the section on performance tips in the Julia manual. Here, we just list some important aspects you should consider when developing Trixi.jl.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Consider using @views/view(...) when using array slices, except on the left-side of an assignment (further details).\nFunctions are essentially for free, since they are usually automatically inlined where it makes sense (using @inline can be used as an additional hint to the compiler) (further details).\nFunction barriers can improve performance due to type stability (further details).\nLook for type instabilities using @code_warntype. Consider using @descend from Cthulhu.jl to investigate deeper call chains.","category":"page"},{"location":"performance/#Manual-benchmarking","page":"Performance","title":"Manual benchmarking","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"If you modify some internal parts of Trixi.jl, you should check the impact on performance. Hence, you should at least investigate the performance roughly by comparing the reported timings of several elixirs. Deeper investigations and micro-benchmarks should usually use BenchmarkTools.jl. For example, the following steps were used to benchmark the changes introduced in PR #256.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"git checkout e7ebf3846b3fd62ee1d0042e130afb50d7fe8e48 (new version)\nStart julia --threads=1 --check-bounds=no.\nExecute the following code in the REPL to benchmark the rhs! call at the final state.\njulia> using BenchmarkTools, Revise; using Trixi\n\njulia> trixi_include(\"examples/2d/elixir_euler_sedov_blast_wave.jl\")\n\njulia> du_test = copy(sol.u[end]); u_test = copy(sol.u[end]);\n\njulia> @benchmark Trixi.rhs!(\n $(du_test),\n $(u_test),\n $(semi),\n $(sol.t[end]))\nBenchmarkTools.Trial:\n memory estimate: 10.48 KiB\n allocs estimate: 67\n --------------\n minimum time: 4.510 ms (0.00% GC)\n median time: 4.646 ms (0.00% GC)\n mean time: 4.699 ms (0.00% GC)\n maximum time: 7.183 ms (0.00% GC)\n --------------\n samples: 1065\n evals/sample: 1\n\nshell> git checkout 222241ff54f8a4ca9876cc1fc25ae262416a4ea0\n\njulia> trixi_include(\"examples/2d/elixir_euler_sedov_blast_wave.jl\")\n\njulia> @benchmark Trixi.rhs!(\n $(du_test),\n $(u_test),\n $(semi),\n $(sol.t[end]))\nBenchmarkTools.Trial:\n memory estimate: 10.36 KiB\n allocs estimate: 67\n --------------\n minimum time: 4.500 ms (0.00% GC)\n median time: 4.635 ms (0.00% GC)\n mean time: 4.676 ms (0.00% GC)\n maximum time: 5.880 ms (0.00% GC)\n --------------\n samples: 1070\n evals/sample: 1\nRun the @benchmark ... commands multiple times to see whether there are any significant fluctuations.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Follow these steps for both commits you want to compare. The relevant benchmark results you should typically be looking at are the median and mean values of the runtime and the memory/allocs estimate. In this example, the differences of the runtimes are of the order of the fluctuations one gets when running the benchmarks multiple times. Since the memory/allocs are (roughly) the same, there doesn't seem to be a significant performance regression here.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"You can also make it more detailed by benchmarking only, e.g., the calculation of the volume terms, but whether that's necessary depends on the modifications you made and their (potential) impact.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Some more detailed description of manual profiling and benchmarking as well as resulting performance improvements of Trixi.jl are given in the following blog posts.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Improving performance of AMR with p4est, cf. #638\nImproving performance of EC methods, cf. #643","category":"page"},{"location":"performance/#Automated-benchmarking","page":"Performance","title":"Automated benchmarking","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"We use PkgBenchmark.jl to provide a standard set of benchmarks for Trixi.jl. The relevant benchmark script is benchmark/benchmarks.jl. To benchmark the changes made in a PR, please proceed as follows:","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Check out the latest main branch of your Trixi.jl development repository.\nCheck out the latest development branch of your PR.\nChange your working directory to the benchmark directory of Trixi.jl.\nExecute julia run_benchmarks.jl.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"This will take some hours to complete and requires at least 8 GiB of RAM. When everything is finished, some output files will be created in the benchmark directory of Trixi.jl.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"warning: Warning\nPlease note that the benchmark scripts use --check-bounds=no at the moment. Thus, they will not work in any useful way for Julia v1.10 (and newer?), see Julia issue #50985.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"You can also run a standard set of benchmarks manually via","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"julia> using PkgBenchmark, Trixi\n\njulia> results = benchmarkpkg(Trixi, BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`))\n\njulia> export_markdown(pkgdir(Trixi, \"benchmark\", \"single_benchmark.md\"), results)","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"This will save a markdown file with a summary of the benchmark results similar to this example. Note that this will take quite some time. Additional options are described in the docs of PkgBenchmark.jl. A particularly useful option is to specify a BenchmarkConfig including Julia command line options affecting the performance such as disabling bounds-checking and setting the number of threads.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"A useful feature when developing Trixi.jl is to compare the performance of Trixi.jl's current state vs. the main branch. This can be achieved by executing","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"julia> using PkgBenchmark, Trixi\n\njulia> results = judge(Trixi,\n BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`), # target\n BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`, id=\"main\") # baseline\n )\n\njulia> export_markdown(pkgdir(Trixi, \"benchmark\", \"results.md\"), results)","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"By default, the target is the current state of the repository. Remember that you need to be in a clean state (commit or stash your changes) to run this successfully. You can also run this comparison and an additional one using two threads via","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"julia> include(\"benchmark/run_benchmarks.jl\")","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Then, markdown files including the results are saved in benchmark/. This example result was obtained using a GitHub action for the PR #535. Note that GitHub actions run on in the cloud in a virtual machine. Hence, we do not really have control over it and performance results must be taken with a grain of salt. Nevertheless, significant runtime differences and differences of memory allocations should be robust indicators of performance changes.","category":"page"},{"location":"performance/#Runtime-performance-vs.-latency-aka-using-@nospecialize-selectively","page":"Performance","title":"Runtime performance vs. latency aka using @nospecialize selectively","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"Usually, Julia will compile specialized versions of each method, using as much information from the types of function arguments as possible (based on some heuristics). The compiler will generate code that is as efficient as comparable code written in a low-level language such as C or Fortran. However, there are cases where the runtime performance does not really matter but the time needed to compile specializations becomes significant. This is related to latency or the time-to-first-plot problem, well-known in the Julia community. In such a case, it can be useful to remove some burden from the compiler by avoiding specialization on every possible argument types using the macro @nospecialize. A prime example of such a case is pretty printing of structs in the Julia REPL, see the associated PR for further discussions.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"As a rule of thumb:","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Do not use @nospecialize in performance-critical parts, in particular not for methods involved in computing Trixi.rhs!.\nConsider using @nospecialize for methods like custom implementations of Base.show.","category":"page"},{"location":"performance/#performance-metrics","page":"Performance","title":"Performance metrics of the AnalysisCallback","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"The AnalysisCallback computes two performance indicators that you can use to evaluate the serial and parallel performance of Trixi.jl. They represent measured run times that are normalized by the number of rhs! evaluations and the number of degrees of freedom of the problem setup. The normalization ensures that we can compare different measurements for each type of indicator independent of the number of time steps or mesh size. All indicators have in common that they are still in units of time, thus lower is better for each of them.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Here, the term \"degrees of freedom\" (DOFs) refers to the number of independent state vectors that are used to represent the numerical solution. For example, if you use a DGSEM-type scheme in 2D on a mesh with 8 elements and with 5-by-5 Gauss-Lobatto nodes in each element (i.e., a polynomial degree of 4), the total number of DOFs would be","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"n_textDOFsDGSEM = textnumber of elements cdot textnumber of nodes per element = 8 cdot (5 cdot 5) = 200","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"In contrast, for a finite volume-type scheme on a mesh with 8 elements, the total number of DOFs would be (independent of the number of spatial dimensions)","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"n_textDOFsFV = textnumber of elements = 8","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"since for standard finite volume methods you store a single state vector in each element. Note that we specifically count the number of state vectors and not the number of state variables for the DOFs. That is, in the previous example n_textDOFsFV is equal to 8 independent of whether this is a compressible Euler setup with 5 state variables or a linear scalar advection setup with one state variable.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"For each indicator, the measurements are always since the last invocation of the AnalysisCallback. That is, if the analysis callback is called multiple times, the indicators are repeatedly computed and can thus also be used to track the performance over the course of a longer simulation, e.g., to analyze setups with varying performance characteristics. Note that the time spent in the AnalysisCallback itself is always excluded, i.e., the performance measurements are not distorted by potentially expensive solution analysis computations. All other parts of a Trixi.jl simulation are included, however, thus make sure that you disable everything you do not want to be measured (such as I/O callbacks, visualization etc.).","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"note: Performance indicators and adaptive mesh refinement\nCurrently it is not possible to compute meaningful performance indicators for a simulation with arbitrary adaptive mesh refinement, since this would require to explicitly keep track of the number of DOF updates due to the mesh size changing repeatedly. The only way to do this at the moment is by setting the analysis interval to the same value as the AMR interval.","category":"page"},{"location":"performance/#Local,-rhs!-only-indicator","page":"Performance","title":"Local, rhs!-only indicator","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"The local, rhs!-only indicator is computed as","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"texttimeDOFrhs = fract_texttextttrhsn_textDOFslocal cdot n_textcallstextttrhs","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"where t_texttextttrhs is the accumulated time spent in rhs!, n_textDOFslocal is the local number of DOFs (i.e., on the current MPI rank; if doing a serial run, you can just think of this as the number of DOFs), and n_textcallstextttrhs is the number of times the rhs! function has been evaluated. Note that for this indicator, we measure only the time spent in rhs!, i.e., by definition all computations outside of rhs! - specifically all other callbacks and the time integration method - are not taken into account.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"The local, rhs!-only indicator is usually most useful if you do serial measurements and are interested in the performance of the implementation of your core numerical methods (e.g., when doing performance tuning).","category":"page"},{"location":"performance/#Performance-index-(PID)","page":"Performance","title":"Performance index (PID)","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"The performance index (PID) is computed as","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"textPID = fract_textwall cdot n_textranksMPIn_textDOFsglobal cdot n_textcallstextttrhs","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"where t_textwall is the walltime since the last call to the AnalysisCallback, n_textranksMPI is the number of MPI ranks used, n_textDOFsglobal is the global number of DOFs (i.e., the sum of DOFs over all MPI ranks; if doing a serial run, you can just think of this as the number of DOFs), and n_textcallstextttrhs is the number of times the rhs! function has been evaluated since the last call to the AnalysisCallback. The PID measures everything except the time spent in the AnalysisCallback itself - specifically, all other callbacks and the time integration method itself are included.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"The PID is usually most useful if you would like to compare the parallel performance of your code to its serial performance. Specifically, it allows you to evaluate the parallelization overhead of your code by giving you a measure of the resources that are necessary to solve a given simulation setup. In a sense, it mimics the \"core hours\" metric that is often used by supercomputer centers to measure how many resources a particular compute job requires. It can thus be seen as a proxy for \"energy used\" and, as an extension, \"monetary cost\".","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"note: Initialization overhead in measurements\nWhen using one of the integration schemes from OrdinaryDiffEq.jl, their implementation will initialize some OrdinaryDiffEq.jl-specific information during the first time step. Among other things, one additional call to rhs! is performed. Therefore, make sure that for performance measurements using the PID either the number of timesteps or the workload per rhs! call is large enough to make the initialization overhead negligible. Note that the extra call to rhs! is properly accounted for in both the number of calls and the measured time, so you do not need to worry about it being expensive. If you want a perfect timing result, you need to set the analysis interval such that the AnalysisCallback is invoked at least once during the course of the simulation and discard the first PID value.","category":"page"},{"location":"performance/#Performance-issues-with-multi-threaded-reductions","page":"Performance","title":"Performance issues with multi-threaded reductions","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"False sharing is a known performance issue for systems with distributed caches. It also occurred for the implementation of a thread parallel bounds checking routine for the subcell IDP limiting in PR #1736. After some testing and discussion, it turned out that initializing a vector of length n * Threads.nthreads() and only using every n-th entry instead of a vector of length Threads.nthreads() fixes the problem. Since there are no processors with caches over 128B, we use n = 128B / size(uEltype). Now, the bounds checking routine of the IDP limiting scales as hoped.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"EditURL = \"../../literate/src/files/custom_semidiscretization.jl\"","category":"page"},{"location":"tutorials/custom_semidiscretization/#custom_semidiscretization","page":"20 Custom semidiscretizations","title":"20: Custom semidiscretizations","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"As described in the overview section, semidiscretizations are high-level descriptions of spatial discretizations in Trixi.jl. Trixi.jl's main focus is on hyperbolic conservation laws represented in a SemidiscretizationHyperbolic. Hyperbolic-parabolic problems based on the advection-diffusion equation or the compressible Navier-Stokes equations can be represented in a SemidiscretizationHyperbolicParabolic. This is described in the basic tutorial on parabolic terms and its extension to custom parabolic terms. In this tutorial, we will describe how these semidiscretizations work and how they can be used to create custom semidiscretizations involving also other tasks.","category":"page"},{"location":"tutorials/custom_semidiscretization/#Overview-of-the-right-hand-side-evaluation","page":"20 Custom semidiscretizations","title":"Overview of the right-hand side evaluation","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"The semidiscretizations provided by Trixi.jl are set up to create ODEProblems from the SciML ecosystem for ordinary differential equations. In particular, a spatial semidiscretization can be wrapped in an ODE problem using semidiscretize, which returns an ODEProblem. This ODEProblem bundles an initial condition, a right-hand side (RHS) function, the time span, and possible parameters. The ODEProblems created by Trixi.jl use the semidiscretization passed to semidiscretize as a parameter. For a SemidiscretizationHyperbolic, the ODEProblem wraps Trixi.rhs! as ODE RHS. For a SemidiscretizationHyperbolicParabolic, Trixi.jl uses a SplitODEProblem combining Trixi.rhs_parabolic! for the (potentially) stiff part and Trixi.rhs! for the other part.","category":"page"},{"location":"tutorials/custom_semidiscretization/#Standard-Trixi.jl-setup","page":"20 Custom semidiscretizations","title":"Standard Trixi.jl setup","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"In this tutorial, we will consider the linear advection equation with source term","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"partial_t u(tx) + partial_x u(tx) = -exp(-t) sinbigl(pi (x - t) bigr)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"with periodic boundary conditions in the domain [-1, 1] as a model problem. The initial condition is","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"u(0x) = sin(pi x)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"The source term results in some damping and the analytical solution","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"u(tx) = exp(-t) sinbigl(pi (x - t) bigr)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"First, we discretize this equation using the standard functionality of Trixi.jl.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"using Trixi, OrdinaryDiffEq, Plots","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"The linear scalar advection equation is already implemented in Trixi.jl as LinearScalarAdvectionEquation1D. We construct it with an advection velocity 1.0.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"equations = LinearScalarAdvectionEquation1D(1.0)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we use a standard DGSEM solver.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"solver = DGSEM(polydeg = 3)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We create a simple TreeMesh in 1D.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"coordinates_min = (-1.0,)\ncoordinates_max = (+1.0,)\nmesh = TreeMesh(coordinates_min, coordinates_max;\n initial_refinement_level = 4,\n n_cells_max = 10^4,\n periodicity = true)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We wrap everything in in a semidiscretization and pass the source terms as a standard Julia function. Please note that Trixi.jl uses SVectors from StaticArrays.jl to store the conserved variables u. Thus, the return value of the source terms must be wrapped in an SVector - even if we consider just a scalar problem.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function initial_condition(x, t, equations)\n return SVector(exp(-t) * sinpi(x[1] - t))\nend\n\nfunction source_terms_standard(u, x, t, equations)\n return -initial_condition(x, t, equations)\nend\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition,\n solver;\n source_terms = source_terms_standard)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Now, we can create the ODEProblem, solve the resulting ODE using a time integration method from OrdinaryDiffEq.jl, and visualize the numerical solution at the final time using Plots.jl.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"tspan = (0.0, 3.0)\node = semidiscretize(semi, tspan)\n\nsol = solve(ode, RDPK3SpFSAL49(); ode_default_options()...)\n\nplot(sol; label = \"numerical sol.\", legend = :topright)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We can also plot the analytical solution for comparison. Since Trixi.jl uses SVectors for the variables, we take their first (and only) component to get the scalar value for manual plotting.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"let\n x = range(-1.0, 1.0; length = 200)\n plot!(x, first.(initial_condition.(x, sol.t[end], equations)),\n label = \"analytical sol.\", linestyle = :dash, legend = :topright)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We can also add the initial condition to the plot.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"plot!(sol.u[1], semi, label = \"u0\", linestyle = :dot, legend = :topleft)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"You can of course also use some callbacks provided by Trixi.jl as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"summary_callback = SummaryCallback()\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi; interval = analysis_interval)\nalive_callback = AliveCallback(; analysis_interval)\ncallbacks = CallbackSet(summary_callback,\n analysis_callback,\n alive_callback)\n\nsol = solve(ode, RDPK3SpFSAL49();\n ode_default_options()..., callback = callbacks)\nsummary_callback()","category":"page"},{"location":"tutorials/custom_semidiscretization/#Using-a-custom-ODE-right-hand-side-function","page":"20 Custom semidiscretizations","title":"Using a custom ODE right-hand side function","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we will solve the same problem but use our own ODE RHS function. To demonstrate this, we will artificially create a global variable containing the current time of the simulation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"const GLOBAL_TIME = Ref(0.0)\n\nfunction source_terms_custom(u, x, t, equations)\n t = GLOBAL_TIME[]\n return -initial_condition(x, t, equations)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we create our own RHS function to update the global time of the simulation before calling the RHS function from Trixi.jl.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function rhs_source_custom!(du_ode, u_ode, semi, t)\n GLOBAL_TIME[] = t\n Trixi.rhs!(du_ode, u_ode, semi, t)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we create an ODEProblem manually copying over the data from the one we got from semidiscretize earlier.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"ode_source_custom = ODEProblem(rhs_source_custom!,\n ode.u0,\n ode.tspan,\n ode.p #= semi =#)\nsol_source_custom = solve(ode_source_custom, RDPK3SpFSAL49();\n ode_default_options()...)\n\nplot(sol_source_custom; label = \"numerical sol.\")\nlet\n x = range(-1.0, 1.0; length = 200)\n plot!(x, first.(initial_condition.(x, sol_source_custom.t[end], equations)),\n label = \"analytical sol.\", linestyle = :dash, legend = :topleft)\nend\nplot!(sol_source_custom.u[1], semi, label = \"u0\", linestyle = :dot, legend = :topleft)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"This also works with callbacks as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"summary_callback = SummaryCallback()\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi; interval = analysis_interval)\nalive_callback = AliveCallback(; analysis_interval)\ncallbacks = CallbackSet(summary_callback,\n analysis_callback,\n alive_callback)\n\nsol = solve(ode_source_custom, RDPK3SpFSAL49();\n ode_default_options()..., callback = callbacks)\nsummary_callback()","category":"page"},{"location":"tutorials/custom_semidiscretization/#Setting-up-a-custom-semidiscretization","page":"20 Custom semidiscretizations","title":"Setting up a custom semidiscretization","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Using a global constant is of course not really nice from a software engineering point of view. Thus, it can often be useful to collect additional data in the parameters of the ODEProblem. Thus, it is time to create our own semidiscretization. Here, we create a small wrapper of a standard semidiscretization of Trixi.jl and the current global time of the simulation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"struct CustomSemidiscretization{Semi, T} <: Trixi.AbstractSemidiscretization\n semi::Semi\n t::T\nend\n\nsemi_custom = CustomSemidiscretization(semi, Ref(0.0))","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"To get pretty printing in the REPL, you can consider specializing","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Base.show(io::IO, parameters::CustomSemidiscretization)\nBase.show(io::IO, ::MIME\"text/plain\", parameters::CustomSemidiscretization)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"for your custom semidiscretiation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we create our own source terms that use the global time stored in the custom semidiscretiation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"source_terms_custom_semi = let semi_custom = semi_custom\n function source_terms_custom_semi(u, x, t, equations)\n t = semi_custom.t[]\n return -initial_condition(x, t, equations)\n end\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We also create a custom ODE RHS to update the current global time stored in the custom semidiscretization. We unpack the standard semidiscretization created by Trixi.jl and pass it to Trixi.rhs!.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function rhs_semi_custom!(du_ode, u_ode, semi_custom, t)\n semi_custom.t[] = t\n Trixi.rhs!(du_ode, u_ode, semi_custom.semi, t)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Finally, we set up an ODEProblem and solve it numerically.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"ode_semi_custom = ODEProblem(rhs_semi_custom!,\n ode.u0,\n ode.tspan,\n semi_custom)\nsol_semi_custom = solve(ode_semi_custom, RDPK3SpFSAL49();\n ode_default_options()...)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"If we want to make use of additional functionality provided by Trixi.jl, e.g., for plotting, we need to implement a few additional specializations. In this case, we forward everything to the standard semidiscretization provided by Trixi.jl wrapped in our custom semidiscretization.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Base.ndims(semi::CustomSemidiscretization) = ndims(semi.semi)\nfunction Trixi.mesh_equations_solver_cache(semi::CustomSemidiscretization)\n Trixi.mesh_equations_solver_cache(semi.semi)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Now, we can plot the numerical solution as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"plot(sol_semi_custom; label = \"numerical sol.\")\nlet\n x = range(-1.0, 1.0; length = 200)\n plot!(x, first.(initial_condition.(x, sol_semi_custom.t[end], equations)),\n label = \"analytical sol.\", linestyle = :dash, legend = :topleft)\nend\nplot!(sol_semi_custom.u[1], semi, label = \"u0\", linestyle = :dot, legend = :topleft)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"This also works with many callbacks as usual. However, the AnalysisCallback requires some special handling since it makes use of a performance counter contained in the standard semidiscretizations of Trixi.jl to report some performance metrics. Here, we forward all accesses to the performance counter to the wrapped semidiscretization.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function Base.getproperty(semi::CustomSemidiscretization, s::Symbol)\n if s === :performance_counter\n wrapped_semi = getfield(semi, :semi)\n wrapped_semi.performance_counter\n else\n getfield(semi, s)\n end\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Moreover, the AnalysisCallback also performs some error calculations. We also need to forward them to the wrapped semidiscretization.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function Trixi.calc_error_norms(func, u, t, analyzer,\n semi::CustomSemidiscretization,\n cache_analysis)\n Trixi.calc_error_norms(func, u, t, analyzer,\n semi.semi,\n cache_analysis)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Now, we can work with the callbacks used before as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"summary_callback = SummaryCallback()\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi_custom;\n interval = analysis_interval)\nalive_callback = AliveCallback(; analysis_interval)\ncallbacks = CallbackSet(summary_callback,\n analysis_callback,\n alive_callback)\n\nsol = solve(ode_semi_custom, RDPK3SpFSAL49();\n ode_default_options()..., callback = callbacks)\nsummary_callback()","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"For even more advanced usage of custom semidiscretizations, you may look at the source code of the ones contained in Trixi.jl, e.g.,","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"SemidiscretizationHyperbolicParabolic\nSemidiscretizationEulerGravity\nSemidiscretizationEulerAcoustics\nSemidiscretizationCoupled","category":"page"},{"location":"tutorials/custom_semidiscretization/#Package-versions","page":"20 Custom semidiscretizations","title":"Package versions","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"EditURL = \"../../literate/src/files/DGSEM_FluxDiff.jl\"","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#DGSEM_FluxDiff","page":"4 DGSEM with flux differencing","title":"4: DGSEM with flux differencing","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This tutorial starts with a presentation of the weak formulation of the discontinuous Galerkin spectral element method (DGSEM) in order to fix the notation of the used operators. Then, the DGSEM formulation with flux differencing (split form DGSEM) and its implementation in Trixi.jl is shown.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We start with the one-dimensional conservation law","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"u_t + f(u)_x = 0 qquad tin mathbbR^+ xinOmega","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"with the physical flux f.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We split the domain Omega into elements K with center x_K and size Delta x. With the transformation mapping x(xi)=x_K + fracDelta x2 xi we can transform the reference element -11 to every physical element. So, the equation can be restricted to the reference element using the determinant of the Jacobian matrix of the transformation mapping J=fracpartial xpartial xi=fracDelta x2.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"J u_t + f(u)_xi = 0 qquad tin mathbbR^+ xiin -11","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#The-weak-form-of-the-DGSEM","page":"4 DGSEM with flux differencing","title":"The weak form of the DGSEM","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We consider the so-called discontinuous Galerkin spectral element method (DGSEM) with collocation. It results from choosing a nodal DG ansatz using N+1 Gauss-Lobatto nodes xi_i in -11 with matching interpolation weights w_i, which are used for numerical integration and interpolation with the Lagrange polynomial basis l_i of degree N. The Lagrange functions are created with those nodes and hence fulfil a Kronecker property at the GL nodes. The weak formulation of the DGSEM for one element is","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"J underlinedotu(t) = - M^-1 B underlinef^* + M^-1 D^T M underlinef","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"where underlineu=(u_0 u_1 dots u_N)^TinmathbbR^N+1 is the collected pointwise evaluation of u at the discretization nodes and dotu = partial u partial t = u_t is the temporal derivative. The nodal values of the flux function f results with collocation in underlinef, since underlinef_j=f(underlineu_j). Moreover, we got the numerical flux f^*=f^*(u^- u^+).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We will now have a short overview over the operators we used.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The derivative matrix DinmathbbR^(N+1)times (N+1) mimics a spatial derivation on a discrete level with underlinef_x approx D underlinef. It is defined by D_ij = l_j(xi_i).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The diagonal mass matrix M is defined by M_ij=langle l_j l_irangle_N with the numerical scalar product langle cdot cdotrangle_N defined for functions f and g by","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"langle f grangle_N = int_-1 N^1 f(xi) g(xi) dxi = sum_k=0^N f(xi_k) g(xi_k) w_k","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The multiplication by M matches a discrete integration","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":" int_-1^1 f(xi) underlinel(xi) dxi approx M underlinef","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The boundary matrix B=textdiag(-1 0 0 1) represents an evaluation of a function at the boundaries xi_0=-1 and xi_N=1.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"For these operators the following property holds:","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":" M D + (M D)^T = B","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This is called the summation-by-parts (SBP) property since it mimics integration by parts on a discrete level (Gassner (2013)).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"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 or in more detail in Kopriva (2009).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This property shows the equivalence between the weak form and the following strong formulation of the DGSEM.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"beginalign*\nJ underlinedotu(t)\n= - M^-1 B underlinef^* + M^-1 D^T M underlinef5pt\n= - M^-1 B underlinef^* + M^-1 (B - MD) underlinef5pt\n= - M^-1 B (underlinef^* - underlinef) - D underlinef\nendalign*","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"More information about the equivalence you can find in Kopriva, Gassner (2010).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#DGSEM-with-flux-differencing","page":"4 DGSEM with flux differencing","title":"DGSEM with flux differencing","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"When using the diagonal SBP property it is possible to rewrite the application of the derivative operator D in the calculation of the volume integral into a subcell based finite volume type differencing formulation (Fisher, Carpenter (2013)). Generalizing","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"(D underlinef)_i = sum_j D_ij underlinef_j\n= 2sum_j frac12 D_ij (underlinef_j + underlinef_i)\neqqcolon 2sum_j D_ij f_textcentral(u_i u_j)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"we replace D underlinef in the strong form by 2D underlinef_vol(u^- u^+) with the consistent two-point volume flux f_vol and receive the DGSEM formulation with flux differencing (split form DGSEM) (Gassner, Winters, Kopriva (2016)).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"beginalign*\nJ underlinedotu(t) = - M^-1 B (underlinef^* - underlinef) - 2D underlinef_vol(u^- u^+)5pt\n= - M^-1 B (underlinef^* - underlinef_vol(underlineu underlineu)) - 2D underlinef_vol(u^- u^+)5pt\n= - M^-1 B underlinef_surface^* - (2D - M^-1 B) underlinef_vol5pt\n= - M^-1 B underlinef_surface^* - D_split underlinef_vol\nendalign*","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This formulation is in a weak form type formulation and can be implemented by using the derivative split matrix D_split=(2D-M^-1B) and two different fluxes. We divide between the surface flux f=f_surface used for the numerical flux f_surface^* and the already mentioned volume flux f_vol especially for this formulation.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This formulation creates a more stable version of DGSEM, because it fulfils entropy stability. Moreover it allows the construction of entropy conserving discretizations without relying on exact integration. This is achieved when using a two-point entropy conserving flux function as volume flux in the volume flux differencing formulation. Then, the numerical surface flux can be used to control the dissipation of the discretization and to guarantee decreasing entropy, i.e. entropy stability.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#fluxDiffExample","page":"4 DGSEM with flux differencing","title":"Implementation in Trixi.jl","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"Now, we have a look at the implementation of DGSEM with flux differencing with Trixi.jl.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using OrdinaryDiffEq, Trixi","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We implement a simulation for the compressible Euler equations in 2D","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"partial_t beginpmatrix rho rho v_1 rho v_2 rho e endpmatrix\n+ partial_x beginpmatrix rho v_1 rho v_1^2 + p rho v_1 v_2 (rho e +p) v_1 endpmatrix\n+ partial_y beginpmatrix rho v_2 rho v_1 v_2 rho v_2^2 + p (rho e +p) v_2 endpmatrix\n= beginpmatrix 0 0 0 0 endpmatrix","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"for an ideal gas with ratio of specific heats gamma=14. Here, rho is the density, v_1, v_2 the velocities, e the specific total energy and","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"p = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2) right)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"the pressure.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"gamma = 1.4\nequations = CompressibleEulerEquations2D(gamma)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"As our initial condition we will use a weak blast wave from Hennemann, Gassner (2020). The primitive variables are defined by","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"beginpmatrix rho v_1 v_2 p endpmatrix\n= beginpmatrix 10 00 00 10 endpmatrix textif x_2 05\ntextand beginpmatrix rho v_1 v_2 p endpmatrix\n= beginpmatrix 11691 01882 * cos(phi) 01882 * sin(phi) 1245 endpmatrix textelse","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"with phi = tan^-1(fracx_2x_1).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This initial condition is implemented in Trixi.jl under the name initial_condition_weak_blast_wave.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"initial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"In Trixi.jl, flux differencing for the volume integral can be implemented with VolumeIntegralFluxDifferencing using symmetric two-point volume fluxes. First, we set up a simulation with the entropy conserving and kinetic energy preserving flux flux_ranocha by Hendrik Ranocha (2018) as surface and volume flux.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We will confirm the entropy conservation property numerically.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"volume_flux = flux_ranocha # = f_vol\nsolver = DGSEM(polydeg=3, surface_flux=volume_flux,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"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 or some basic elixirs.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"coordinates_min = (-2.0, -2.0)\ncoordinates_max = ( 2.0, 2.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=5,\n n_cells_max=10_000,\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_condition_periodic)\n\n# ODE solvers\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"To analyse the entropy conservation of the approximation, we will use the analysis calllback implemented in Trixi. It provides some information about the approximation including the entropy change.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"analysis_callback = AnalysisCallback(semi, interval=100);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We now run the simulation using flux_ranocha for both surface and volume flux.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=analysis_callback);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"A look at the change in entropy sum partial Spartial U cdot U_t in the analysis callback confirms that the flux is entropy conserving since the change is about machine precision.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We can plot the approximated solution at the time t=0.4.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"Now, we can use for instance the dissipative flux flux_lax_friedrichs as surface flux to get an entropy stable method.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using OrdinaryDiffEq, Trixi\n\ngamma = 1.4\nequations = CompressibleEulerEquations2D(gamma)\n\ninitial_condition = initial_condition_weak_blast_wave\n\nvolume_flux = flux_ranocha # = f_vol\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\ncoordinates_min = (-2.0, -2.0)\ncoordinates_max = ( 2.0, 2.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=5,\n n_cells_max=10_000,\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_condition_periodic)\n\n# ODE solvers\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan);\n\nanalysis_callback = AnalysisCallback(semi, interval=100);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We now run the simulation using the volume flux flux_ranocha and surface flux flux_lax_friedrichs.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=analysis_callback);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The change in entropy confirms the expected entropy stability.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"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.jl provides for example flux_ranocha, flux_shima_etal, flux_chandrashekar, flux_kennedy_gruber. As surface flux you can use all volume fluxes and additionally for instance flux_lax_friedrichs, flux_hll, flux_hllc.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#Package-versions","page":"4 DGSEM with flux differencing","title":"Package versions","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This page was generated using Literate.jl.","category":"page"},{"location":"multi-physics_coupling/#multi-physics-coupling","page":"Coupling","title":"Multi-physics coupling","text":"","category":"section"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"A complex simulation can consist of different spatial domains in which different equations are being solved, different numerical methods being used or the grid structure is different. One example would be a fluid in a tank and an extended hot plate attached to it. We would then like to solve the Navier-Stokes equations in the fluid domain and the heat conduction equations in the plate. The coupling would happen at the interface through the exchange of thermal energy.","category":"page"},{"location":"multi-physics_coupling/#Converter-coupling","page":"Coupling","title":"Converter coupling","text":"","category":"section"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"It may happen that the two systems to be coupled do not share any variables, but share some of the physics. In such a situation, the same physics is just represented in a different form and with a different set of variables. This is the case, for instance assuming two domains, if there is a fluid system in one domain and a Vlasov system in the other domain. In that case we would have variables representing distribution functions of the Vlasov system on one side and variables representing the mechanical quantities, like density, of the fluid system. To translate the fields from one description to the other one needs to use converter functions. These functions need to be hand tailored by the user in the elixir file where each pair of coupled systems requires two coupling functions, one for each direction.","category":"page"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"In the general case, we have a system A with m variables u_Ai i = 1 dots m and another system B with n variables u_Bj j = 1 dots n. We then define two coupling functions, one that transforms u_A into u_B and one that goes the other way.","category":"page"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"In their minimal form they take the position vector x, state vector u and the equations of the two coupled systems and return the transformed variables. By passing the equations we can make use of their parameters, if they are required. Examples can be seen in examples/structured_2d_dgsem/elixir_advection_coupled.jl.","category":"page"},{"location":"multi-physics_coupling/#Warning-about-binary-compatibility","page":"Coupling","title":"Warning about binary compatibility","text":"","category":"section"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"Currently the coordinate values on the nodes can differ by machine precision when simulating the mesh and when splitting the mesh in multiple domains. This is an issue coming from the coordinate interpolation on the nodes. As a result, running a simulation in a single system and in two coupled domains may result in a difference of the order of the machine precision. While this is not an issue for most practical problems, it is best to keep this in mind when comparing test runs.","category":"page"},{"location":"meshes/dgmulti_mesh/#DGMulti","page":"DGMulti mesh","title":"Unstructured meshes and the DGMulti solver","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Trixi.jl includes support for simplicial and tensor product meshes via the DGMulti solver type, which is based on the StartUpDG.jl package. DGMulti solvers also provide support for quadrilateral and hexahedral meshes, though this feature is currently restricted to Cartesian grids. On these line/quad/hex meshes, the DGMulti solver also allows to use all (finite domain) SBP derivative operators provided by SummationByPartsOperators.jl, including several finite difference SBP methods.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"We make a few simplifying assumptions about supported meshes:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"meshes consist of a single type of element\nmeshes are conforming (e.g., each face of an element is shared with at most one other element).\nthe geometric mapping from reference to physical elements is polynomial (currently, only affine mappings are supported).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"StartUpDG.jl includes both simple uniform meshes via uniform_mesh, as well as support for triangular meshes constructed using Triangulate.jl, a wrapper around Jonathan Shewchuk's Triangle package.","category":"page"},{"location":"meshes/dgmulti_mesh/#The-DGMulti-solver-type","page":"DGMulti mesh","title":"The DGMulti solver type","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Trixi.jl solvers on simplicial meshes use the DGMulti solver type, which allows users to specify element_type and approximation_type in addition to polydeg, surface_flux, surface_integral, and volume_integral.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"DGMulti(; polydeg::Integer,\n element_type::AbstractElemShape,\n approximation_type=Polynomial(),\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n RefElemData_kwargs...)","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Here, element_type can be Tri(), Quad(), Tet(), or Hex(), and approximation_type can be","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Polynomial(), which specifies a DG discretization using a polynomial basis using quadrature rules which are exact for degree 2 * polydeg integrands, or\nSBP(), which specifies a DG discretization using multi-dimensional SBP operators. Types of SBP discretizations available include: SBP{Kubatko{LobattoFaceNodes}}() (the default choice), SBP{Kubatko{LegendreFaceNodes}}(), and SBP{Hicken}(). For polydeg = 1, ..., 4, the SBP{Kubatko{LegendreFaceNodes}}() SBP nodes are identical to the SBP nodes of Chen and Shu. More detailed descriptions of each SBP node set can be found in the StartUpDG.jl docs. Trixi.jl will also specialize certain parts of the solver based on the SBP approximation type.\na (periodic or non-periodic) derivative operator from SummationByPartsOperators.jl, usually constructed as D = derivative_operator(...). In this case, you do not need to pass a polydeg. Periodic derivative operators will only work with single-element meshes constructed using DGMultiMesh.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Additional options can also be specified through RefElemData_kwargs:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"quad_rule_vol = quad_nodes(Tri(), Nq) will substitute in a volume quadrature rule of degree Nq instead of the default (which is a quadrature rule of degree polydeg). Here, a degree Nq rule will be exact for at least degree 2*Nq integrands (such that the mass matrix is integrated exactly). Quadrature rules of which exactly integrate degree Nq integrands may also be specified (for example, quad_rule_vol = StartUpDG.quad_nodes_tri(Nq) on triangles).\nquad_rule_face = quad_nodes(Line(), Nq)) will use a face quadrature rule of degree Nq rather than the default. This rule is also exact for at least degree 2*Nq integrands.","category":"page"},{"location":"meshes/dgmulti_mesh/#The-GaussSBP()-approximation-type-on-Quad()-and-Hex()-meshes","page":"DGMulti mesh","title":"The GaussSBP() approximation type on Quad() and Hex() meshes","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"When using VolumeIntegralFluxDifferencing on Quad() and Hex() meshes, one can also specify approximation_type = GaussSBP() to use an entropy stable Gauss collocation scheme. Here, GaussSBP() refers to \"generalized\" summation-by-parts operators (see for example Ranocha 2018 or Fernandez and Zingg 2015).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Unlike traditional SBP operators, generalized SBP operators are constructed from nodes which do not include boundary nodes (i.e., Gauss quadrature nodes as opposed to Gauss-Lobatto quadrature nodes). This makes the computation of interface fluxes slightly more expensive, but also usually results in a more accurate solution. Roughly speaking, an entropy stable Gauss collocation scheme will yield results similar to a modal entropy stable scheme using a Polynomial() approximation type, but will be more efficient at high orders of approximation.","category":"page"},{"location":"meshes/dgmulti_mesh/#Trixi.jl-elixirs-on-simplicial-and-tensor-product-element-meshes","page":"DGMulti mesh","title":"Trixi.jl elixirs on simplicial and tensor product element meshes","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Example elixirs with triangular, quadrilateral, and tetrahedral meshes can be found in the examples/dgmulti_2d/ and examples/dgmulti_3d/ folders. Some key elixirs to look at:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"examples/dgmulti_2d/elixir_euler_weakform.jl: basic weak form DG discretization on a uniform triangular mesh. Changing element_type = Quad() or approximation_type = SBP() will switch to a quadrilateral mesh or an SBP-type discretization. Changing surface_integral = SurfaceIntegralWeakForm(flux_ec) and volume_integral = VolumeIntegralFluxDifferencing(flux_ec) for some entropy conservative flux (e.g., flux_chandrashekar or flux_ranocha) will switch to an entropy conservative formulation.\nexamples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl: uses an unstructured mesh generated by Triangulate.jl.\nexamples/dgmulti_3d/elixir_euler_weakform.jl: ´basic weak form DG discretization on a uniform tetrahedral mesh. Changing element_type = Hex() will switch to a hexahedral mesh. Changing surface_integral = SurfaceIntegralWeakForm(flux_ec) and volume_integral = VolumeIntegralFluxDifferencing(flux_ec) for some entropy conservative flux (e.g., flux_chandrashekar or flux_ranocha) will switch to an entropy conservative formulation.","category":"page"},{"location":"meshes/dgmulti_mesh/#For-developers","page":"DGMulti mesh","title":"For developers","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/#DGMultiMesh-wrapper-type","page":"DGMulti mesh","title":"DGMultiMesh wrapper type","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"DGMulti meshes in Trixi.jl are represented using a DGMultiMesh{NDIMS, ...} type. This mesh type is assumed to have fields md::MeshData, which contains geometric terms derived from the mapping between the reference and physical elements, and boundary_faces, which contains a Dict of boundary segment names (symbols) and list of faces which lie on that boundary segment.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"A DGMultiMesh can be constructed in several ways. For example, DGMultiMesh(dg::DGMulti) will return a Cartesian mesh on -1 1^d with element types specified by dg. DGMulti meshes can also be constructed by specifying a list of vertex coordinates vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z and a connectivity matrix EToV where EToV[e,:] gives the vertices which correspond to element e. These quantities are available from most unstructured mesh generators.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Initial support for curved DGMultiMeshes is available for flux differencing solvers using SBP and GaussSBP approximation types on quadrilateral and hexahedral meshes. These can be called by specifying mesh = DGMultiMesh(dg, cells_per_dimension, mapping), where mapping is a function which specifies the warping of the mesh (e.g., mapping(xi, eta) = SVector{2}(xi, eta) is the identity mapping) similar to the mapping argument used by StructuredMesh.","category":"page"},{"location":"meshes/dgmulti_mesh/#Variable-naming-conventions","page":"DGMulti mesh","title":"Variable naming conventions","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"We use the convention that coordinates on the reference element are r in 1D, r s in 2D, or r s t in 3D. Physical coordinates use the standard conventions x (1D), x y (2D), and x y z (3D).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"(Image: \"Ref-to-physical mapping\")","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Derivatives of reference coordinates with respect to physical coordinates are abbreviated, e.g., fracpartial rpartial x = r_x. Additionally, J is used to denote the determinant of the Jacobian of the reference-to-physical mapping.","category":"page"},{"location":"meshes/dgmulti_mesh/#Variable-meanings-and-conventions-in-StartUpDG.jl","page":"DGMulti mesh","title":"Variable meanings and conventions in StartUpDG.jl","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"StartUpDG.jl exports structs RefElemData{NDIMS, ElemShape, ...} (which contains data associated with the reference element, such as interpolation points, quadrature rules, face nodes, normals, and differentiation/interpolation/projection matrices) and MeshData{NDIMS} (which contains geometric data associated with a mesh). These are currently used for evaluating DG formulations in a matrix-free fashion. These structs contain fields similar (but not identical) to those in Globals1D, Globals2D, Globals3D in the Matlab codes from \"Nodal Discontinuous Galerkin Methods\" by Hesthaven and Warburton (2007).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"In general, we use the following code conventions:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"variables such as r, s,... and x, y,... correspond to values at nodal interpolation points.\nvariables ending in q (e.g., rq, sq,... and xq, yq,...) correspond to values at volume quadrature points.\nvariables ending in f (e.g., rf, sf,... and xf, yf,...) correspond to values at face quadrature points.\nvariables ending in p (e.g., rp, sp,...) correspond to \"plotting\" points, which are usually a fine grid of equispaced points.\nV matrices correspond to interpolation matrices from nodal interpolation points, e.g., Vq interpolates to volume quadrature points, Vf interpolates to face quadrature points.\ngeometric quantities in MeshData are stored as matrices of dimension textnumber of points per element times textnumber of elements.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Quantities in rd::RefElemData:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"rd.Np, rd.Nq, rd.Nf: the number of nodal interpolation points, volume quadrature points, and face quadrature points on the reference element, respectively.\nrd.Vq: interpolation matrices from values at nodal interpolation points to volume quadrature points\nrd.wq: volume quadrature weights on the reference element\nrd.Vf: interpolation matrices from values at nodal interpolation points to face quadrature points\nrd.wf: a vector containing face quadrature weights on the reference element\nrd.M: the quadrature-based mass matrix, computed via rd.Vq' * diagm(rd.wq) * rd.Vq.\nrd.Pq: a quadrature-based L^2 projection matrix rd.Pq = rd.M \\ rd.Vq' * diagm(rd.wq) which maps between values at quadrature points and values at nodal points.\nDr, Ds, Dt matrices are nodal differentiation matrices with respect to the rst coordinates, e.g., Dr*f.(r,s) approximates the derivative of f(rs) at nodal points.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Quantities in md::MeshData:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"md.xyz is a tuple of matrices md.x, md.y, md.z, where column e contains coordinates of physical interpolation points.\nmd.xyzq is a tuple of matrices md.xq, md.yq, md.zq, where column e contains coordinates of physical quadrature points.\nmd.rxJ, md.sxJ, ... are matrices where column e contains values of Jfracpartial rpartial x, Jfracpartial spartial x, etc. at nodal interpolation points on the element e.\nmd.J is a matrix where column e contains values of the Jacobian J at nodal interpolation points.\nmd.Jf is a matrix where column e contains values of the face Jacobian (e.g., determinant of the geometric mapping between a physical face and a reference face) at face quadrature points.\nmd.nxJ, md.nyJ, ... are matrices where column e contains values of components of the unit normal scaled by the face Jacobian md.Jf at face quadrature points.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"For more details, please see the StartUpDG.jl docs.","category":"page"},{"location":"meshes/p4est_mesh/#P4est-based-mesh","page":"P4est-based mesh","title":"P4est-based mesh","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The P4estMesh is an unstructured, curvilinear, nonconforming mesh type for quadrilateral (2D) and hexahedral (3D) cells. It supports quadtree/octree-based adaptive mesh refinement (AMR) via the C library p4est. See AMRCallback for further information.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.","category":"page"},{"location":"meshes/p4est_mesh/#Construction-of-a-P4estMesh-from-an-Abaqus-file","page":"P4est-based mesh","title":"Construction of a P4estMesh from an Abaqus file","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"One available option to construct a P4estMesh is to read in an Abaqus (.inp) mesh file. We briefly describe the structure of this file, the conventions it uses, and how the mesh file is parsed to create an initial unstructured, curvilinear, and conforming mesh.","category":"page"},{"location":"meshes/p4est_mesh/#Mesh-in-two-spatial-dimensions","page":"P4est-based mesh","title":"Mesh in two spatial dimensions","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For this discussion we use the following two-dimensional unstructured curved mesh with three elements:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"(Image: abaqus-2dmesh-docs)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"We note that the corner and element connectivity information parsed from the Abaqus file creates a straight sided (linear) mesh. From this linear mesh there are two strategies available to make the mesh curvilinear:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Apply a mapping function to describe a transformation of the linear mesh to another physical domain. The mapping is approximated using interpolation polynomial of a user specified polynomial degree. The default value of this polynomial degree is 1 that corresponds to an uncurved geometry.\nHigh-order boundary information is available in the .inp mesh file because it was created with the HOHQMesh mesh generator, which is available via the Julia package HOHQMesh.jl. This information is used to create appropriate transfinite mappings during the mesh construction.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"We divide our discussion into two parts. The first part discusses the standard corner and element information contained in the .inp mesh file. The second part specifically deals with the mesh file parsing of an Abaqus file created by HOHQMesh.jl.","category":"page"},{"location":"meshes/p4est_mesh/#Mesh-file-header","page":"P4est-based mesh","title":"Mesh file header","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"An Abaqus .inp mesh file typically begins with a *Heading. Though optional, the *Heading is helpful to give users some information about the mesh described by the mesh file. In particular, a .inp mesh file created with HOHQMesh will contain the header","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*Heading\n File created by HOHQMesh","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"This heading is used to indicate to the mesh constructor which of the above mapping strategies to apply in order to create a curvilinear mesh. If the Abaqus file header is not present then the P4estMesh is created with the first strategy above.","category":"page"},{"location":"meshes/p4est_mesh/#corner-node-list","page":"P4est-based mesh","title":"List of corner nodes","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Next, prefaced with *NODE, comes a list of the physical (x,y,z) coordinates of all the corners. The first integer in the list of the corners provides its id number. Thus, for the two-dimensional example mesh this block of corner information is","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*NODE\n1, 1.0, -1.0, 0.0\n2, 3.0, 0.0, 0.0\n3, 1.0, 1.0, 0.0\n4, 2.0, 0.0, 0.0\n5, 0.0, 0.0, 0.0\n6, 3.0, 1.0, 0.0\n7, 3.0, -1.0, 0.0","category":"page"},{"location":"meshes/p4est_mesh/#element-list","page":"P4est-based mesh","title":"List of elements","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The element connectivity is given after the list of corners. The header for this information block is","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*ELEMENT, type=CPS4, ELSET=Surface1","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The Abaqus element type CPS4 corresponds to a quadrilateral element. Each quadrilateral element in the unstructured mesh is dictated by four corner points with indexing taken from the numbering given by the corner list above. The elements connect a set of four corner points (starting from the bottom left) in an anti-clockwise fashion; making the element right-handed. This element handedness is indicated using the circular arrow in the figure above. Just as with the corner list, the first integer in the element connectivity list indicates the element id number. Thus, the element connectivity list for the three element example mesh is","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*ELEMENT, type=CPS4, ELSET=Surface1\n1, 5, 1, 4, 3\n2, 4, 2, 6, 3\n3, 7, 2, 4, 1","category":"page"},{"location":"meshes/p4est_mesh/#Element-neighbor-connectivity","page":"P4est-based mesh","title":"Element neighbor connectivity","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The construction of the element neighbor ids and identifying physical boundary surfaces is done using functionality directly from the p4est library. For example, the neighbor connectivity is created in the mesh constructor using the wrapper read_inp_p4est function.","category":"page"},{"location":"meshes/p4est_mesh/#Encoding-of-boundaries","page":"P4est-based mesh","title":"Encoding of boundaries","text":"","category":"section"},{"location":"meshes/p4est_mesh/#HOHQMesh-boundary-information","page":"P4est-based mesh","title":"HOHQMesh boundary information","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"If present, any additional information in the mesh file that was created by HOHQMesh is prefaced with ** to make it an Abaqus comment. This ensures that the read in of the file by a standard Abaqus file parser, as done in the read_inp_p4est function, is done correctly.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The high-order, curved boundary information and labels of the physical boundary created by HOHQMesh is found below the comment line","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** ***** HOHQMesh boundary information ***** **","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Next comes the polynomial degree that the mesh will use to represent any curved sides","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** mesh polynomial degree = 8","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The mesh file then, again, provides the element connectivity as well as information for curved surfaces either interior to the domain or along the physical boundaries. A set of check digits are included directly below the four corner indexes to indicate whether the local surface index (-y, +x, +y, or -x) within the element is straight sided, 0, or is curved, 1. If the local surface is straight sided no additional information is necessary during the mesh file read in. But for any curved surfaces the mesh file provides (x,y,z) coordinate values in order to construct an interpolant of this surface with the mesh polynomial order at the Chebyshev-Gauss-Lobatto nodes. This list of (x,y,z) data will be given in the direction of the local coordinate system. Given below is the element curvature information for the example mesh:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** 5 1 4 3\n** 0 0 1 1\n** 1.000000000000000 1.000000000000000 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 2.000000000000000 0.0 0.0\n** 0.0 0.0 0.0\n** 0.035513826946206 0.105291711848750 0.0\n** 0.148591270347399 0.317731556850611 0.0\n** 0.340010713990041 0.452219430075470 0.0\n** 0.575000000000000 0.462500000000000 0.0\n** 0.788022294598950 0.483764065630034 0.0\n** 0.926408729652601 0.644768443149389 0.0\n** 0.986453164464803 0.883724792445746 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 4 2 6 3\n** 0 0 0 1\n** 2.000000000000000 0.0 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 7 2 4 1\n** 0 0 0 0","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The last piece of information provided by HOHQMesh are labels for the different surfaces of an element. These labels are useful to set boundary conditions along physical surfaces. The labels can be short descriptive words up to 32 characters in length. The label --- indicates an internal surface where no boundary condition is required.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"It is important to note that these labels are given in the following order according to the local surface index -x +x -y +y as required by the p4est library.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** Bezier --- Slant ---\n** --- Right --- Top\n** Bottom --- Right ---","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For completeness, we provide the entire Abaqus mesh file for the example mesh in the figure above:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*Heading\n File created by HOHQMesh\n*NODE\n1, 1.0, -1.0, 0.0\n2, 3.0, 0.0, 0.0\n3, 1.0, 1.0, 0.0\n4, 2.0, 0.0, 0.0\n5, 0.0, 0.0, 0.0\n6, 3.0, 1.0, 0.0\n7, 3.0, -1.0, 0.0\n*ELEMENT, type=CPS4, ELSET=Surface1\n1, 5, 1, 4, 3\n2, 4, 2, 6, 3\n3, 7, 2, 4, 1\n** ***** HOHQMesh boundary information ***** **\n** mesh polynomial degree = 8\n** 5 1 4 3\n** 0 0 1 1\n** 1.000000000000000 1.000000000000000 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 2.000000000000000 0.0 0.0\n** 0.0 0.0 0.0\n** 0.035513826946206 0.105291711848750 0.0\n** 0.148591270347399 0.317731556850611 0.0\n** 0.340010713990041 0.452219430075470 0.0\n** 0.575000000000000 0.462500000000000 0.0\n** 0.788022294598950 0.483764065630034 0.0\n** 0.926408729652601 0.644768443149389 0.0\n** 0.986453164464803 0.883724792445746 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 4 2 6 3\n** 0 0 0 1\n** 2.000000000000000 0.0 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 7 2 4 1\n** 0 0 0 0\n** Bezier --- Slant ---\n** --- Right --- Top\n** Bottom --- Right ---","category":"page"},{"location":"meshes/p4est_mesh/#Standard-Abaqus-format-boundary-information","page":"P4est-based mesh","title":"Standard Abaqus format boundary information","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"As an alternative to an Abaqus mesh generated by HOHQMesh, .inp files with boundary information encoded as nodesets *NSET,NSET= can be used to construct a p4est mesh. This is especially useful for usage of existing meshes (consisting of bilinear elements) which could stem from the popular gmsh meshing software.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"In addition to the list of nodes and elements given above, there are nodesets of the form ","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*NSET,NSET=PhysicalLine1\n1, 4, 52, 53, 54, 55, 56, 57, 58, ","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"present which are used to associate the edges defined through their corner nodes with a label. In this case it is called PhysicalLine1. By looping over every element and its associated edges, consisting of two nodes, we query the read in NSETs if the current node pair is present.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"To prevent that every nodeset following *NSET,NSET= is treated as a boundary, the user must supply a boundary_symbols keyword to the P4estMesh constructor:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"boundary_symbols = [:PhysicalLine1]\n\nmesh = P4estMesh{2}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"By doing so, only nodesets with a label present in boundary_symbols are treated as physical boundaries. Other nodesets that could be used for diagnostics are not treated as external boundaries. Note that there is a leading colon : compared to the label in the .inp mesh file. This is required to turn the label into a Symbol. Important: In Julia, a symbol cannot contain a hyphen/dash -, i.e., :BC-1 is not a valid symbol. Keep this in mind when importing boundaries, you might have to convert hyphens/dashes - to underscores _ in the .inp mesh file, i.e., BC_1 instead of BC-1.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"A 2D example for this mesh, which is read-in for an unstructured mesh file created with gmsh, is presented in examples/p4est_2d_dgsem/elixir_euler_NACA6412airfoil_mach2.jl.","category":"page"},{"location":"meshes/p4est_mesh/#Mesh-in-three-spatial-dimensions","page":"P4est-based mesh","title":"Mesh in three spatial dimensions","text":"","category":"section"},{"location":"meshes/p4est_mesh/#HOHQMesh-Extended-Abaqus-format","page":"P4est-based mesh","title":"HOHQMesh-Extended Abaqus format","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The 3D Abaqus file format with high-order boundary information from HOHQMesh is very similar to the 2D version discussed above. There are only three changes:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The element connectivity would be given in terms of the eight corners that define a hexahedron. The corners are numbered as shown in the figure below. The header of the element list changes to be\n*ELEMENT, type=C3D8, ELSET=Volume1\nwhere C3D8 corresponds to a Abaqus hexahedral element.\nThere are six check digits included directly below the eight corner indexes to indicate whether the local face within the element is straight sided, 0, or is curved, 1. For curved faces (x,y,z) coordinate values are available in order to construct an face interpolant with the mesh polynomial order at the Chebyshev-Gauss-Lobatto nodes.\nThe boundary labels are given in the following order according to the local surface index -x +x -y +y -z +z as required by the p4est library.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For completeness, we also give a short description and derivation of the three-dimensional transfinite mapping formulas used to compute the physical coordinates mathbfx=(xyz) of a (possibly curved) hexahedral element give the reference coordinates boldsymbolxi = (xi eta zeta) which lie in -11^3. That is, we will create an expression mathbfx= mathbfX(boldsymbolxi).","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Below we provide a sketch of a single hexahedral element with curved faces. This is done to introduce the numbering conventions for corners, edges, and faces of the element.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"(Image: abaqus-3dmesh-docs)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"When the hexahedron is a straight sided (linear) element we compute the transfinite mapping directly from the element corner points according to","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"beginaligned\nmathbfX_linear(boldsymbolxi) = frac18quad mathbfx_1(1-xi)(1-eta)(1-zeta)\n + mathbfx_2(1+xi)(1-eta)(1-zeta)-015cm\n qquad + mathbfx_3(1+xi)(1+eta)(1-zeta)\n + mathbfx_4(1-xi)(1+eta)(1-zeta) \n qquad + mathbfx_5(1-xi)(1-eta)(1+zeta)\n + mathbfx_6(1+xi)(1-eta)(1+zeta) \n qquad + mathbfx_7(1+xi)(1+eta)(1+zeta)\n + mathbfx_8(1-xi)(1+eta)(1+zeta)quad\nendaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Next, we create a transfinite mapping function, mathbfX(boldsymbolxi), for a hexahedron that has one or more curved faces. For this we assume that have a set of six interpolating polynomials Gamma_i_i=1^6 that approximate the faces. The interpolating polynomial for any curved faces is provided by the information in a HOHQMesh Abaqus mesh file or is constructed on the fly via a bi-linear interpolation routine for any linear faces. Explicitly, these six face interpolation polynomials depend on the computational coordinates boldsymbolxi as follows","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":" beginaligned\n Gamma_1(xi zeta) quad quad Gamma_3(xi eta) quad quad Gamma_4(eta zeta)01cm\n Gamma_2(xi zeta) quad quad Gamma_5(xi eta) quad quad Gamma_6(eta zeta)\n endaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"To determine the form of the mapping we first create linear interpolations between two opposing faces, e.g., Gamma_3 and Gamma_5 and sum them together to have","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"beginaligned\n boldsymbolSigma(boldsymbolxi) = frac12quad(1-xi)Gamma_6(etazeta) + (1+xi)Gamma_4(etazeta) -015cm\n qquad+ (1-eta)Gamma_1(xizeta) + (1+eta)Gamma_2(xizeta) -015cm\n qquad +(1-zeta)Gamma_3(xieta) + (1+zeta)Gamma_5(xieta)quad\nendaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Unfortunately, the linear interpolations boldsymbolSigma(boldsymbolxi) no longer match at the faces, e.g., evaluating at eta = -1 we have","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"boldsymbolSigma(xi-1zeta) = Gamma_1(xizeta) + frac12(1-xi)Gamma_6(-1zeta) + (1+xi)Gamma_4(-1zeta)\n +(1-zeta)Gamma_3(xi-1) + (1+zeta)Gamma_5(xi-1)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"which is the desired face Gamma_1(xizeta) plus four edge error terms. Analogous edge error terms occur at the other faces evaluating boldsymbolSigma(boldsymbolxi) at eta=1, xi=pm 1, and zeta=pm 1. In order to match the faces, we subtract a linear interpolant in the xi, eta, and zeta directions of the edge error terms, e.g., the terms in braces in the above equation. So, continuing the example above, the correction term to be subtracted for face Gamma_1 to match would be","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"left(frac1-eta2right) bigg frac12 (1-xi)Gamma_6(-1zeta) + (1+xi)Gamma_4(-1zeta)+(1-zeta)Gamma_3(xi-1)\n + (1+zeta)Gamma_5(xi-1) bigg","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For clarity, and to allow an easier comparison to the implementation, we introduce auxiliary notation for the 12 edge values present in the complete correction term. That is, for given values of xi, eta, and zeta we have","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":" beginaligned\n textttedge_1 = Gamma_1(xi -1) quad quad textttedge_5 = Gamma_2(xi -1) quad quad textttedge_9 = Gamma_6(eta -1)01cm\n textttedge_2 = Gamma_1(1 zeta) quad quadtextttedge_6 = Gamma_2(1 zeta) quad quad textttedge_10 = Gamma_4(eta -1)01cm\n textttedge_3 = Gamma_1(xi 1) quad quad textttedge_7 = Gamma_2(xi 1) quad quad textttedge_11 = Gamma_4(eta 1)01cm\n textttedge_4 = Gamma_1(-1 zeta) quad quad textttedge_8 = Gamma_2(-1 zeta) quad quad textttedge_12 = Gamma_6(eta 1)\n endaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"With this notation for the edge terms (and after some algebraic manipulation) we write the complete edge correction term, mathcalC_textttedge(boldsymbolxi), as","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"beginaligned\nmathcalC_textttedge(boldsymbolxi) = frac14quad (1-eta)(1-zeta)textttedge_1-015cm\n qquad + (1+xi)(1-eta)textttedge_2 \n qquad + (1-eta)(1+zeta)textttedge_3 \n qquad + (1-xi)(1-eta)textttedge_4 \n qquad + (1+eta)(1-zeta)textttedge_5 \n qquad + (1+xi)(1+eta)textttedge_6 \n qquad + (1+eta)(1+zeta)textttedge_7 \n qquad + (1-xi)(1+eta)textttedge_8 \n qquad + (1-xi)(1-zeta)textttedge_9 \n qquad + (1+xi)(1-zeta)textttedge_10 \n qquad + (1+xi)(1+zeta)textttedge_11 \n qquad + (1-xi)(1+zeta)textttedge_12quad\nendaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"However, subtracting the edge correction terms mathcalC_textttedge(boldsymbolxi) from boldsymbolSigma(boldsymbolxi) removes the interior element contributions twice. Thus, to complete the construction of the transfinite mapping mathbfX(boldsymbolxi) we add the transfinite map of the straight sided hexahedral element to find","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"mathbfX(boldsymbolxi) = boldsymbolSigma(boldsymbolxi)\n - mathcalC_textttedge(boldsymbolxi)\n + mathbfX_linear(boldsymbolxi)","category":"page"},{"location":"meshes/p4est_mesh/#Construction-from-standard-Abaqus","page":"P4est-based mesh","title":"Construction from standard Abaqus","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Also for a mesh in standard Abaqus format there are no qualitative changes when going from 2D to 3D. The most notable difference is that boundaries are formed in 3D by faces defined by four nodes while in 2D boundaries are edges consisting of two elements. A simple mesh file, which is used also in examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl, is given below:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*Heading\n\n*NODE\n1, -2, 0, 0\n2, -1, 0, 0\n3, -1, 1, 0\n4, -2, 1, 0\n5, -2, 0, 1\n6, -1, 0, 1\n7, -1, 1, 1\n8, -2, 1, 1\n9, -1.75, 1, 0\n10, -1.5, 1, 0\n11, -1.25, 1, 0\n12, -1, 0.75000000000035, 0\n13, -1, 0.50000000000206, 0\n14, -1, 0.25000000000104, 0\n15, -1.25, 0, 0\n16, -1.5, 0, 0\n17, -1.75, 0, 0\n18, -2, 0.24999999999941, 0\n19, -2, 0.49999999999869, 0\n20, -2, 0.74999999999934, 0\n21, -1.75, 0, 1\n22, -1.5, 0, 1\n23, -1.25, 0, 1\n24, -1, 0.24999999999941, 1\n25, -1, 0.49999999999869, 1\n26, -1, 0.74999999999934, 1\n27, -1.25, 1, 1\n28, -1.5, 1, 1\n29, -1.75, 1, 1\n30, -2, 0.75000000000035, 1\n31, -2, 0.50000000000206, 1\n32, -2, 0.25000000000104, 1\n33, -2, 0, 0.24999999999941\n34, -2, 0, 0.49999999999869\n35, -2, 0, 0.74999999999934\n36, -2, 1, 0.24999999999941\n37, -2, 1, 0.49999999999869\n38, -2, 1, 0.74999999999934\n39, -1, 0, 0.24999999999941\n40, -1, 0, 0.49999999999869\n41, -1, 0, 0.74999999999934\n42, -1, 1, 0.24999999999941\n43, -1, 1, 0.49999999999869\n44, -1, 1, 0.74999999999934\n45, -1.25, 0.25000000000063, 0\n46, -1.25, 0.50000000000122, 0\n47, -1.25, 0.7500000000001, 0\n48, -1.5, 0.25000000000023, 0\n49, -1.5, 0.50000000000038, 0\n50, -1.5, 0.74999999999984, 0\n51, -1.75, 0.24999999999982, 0\n52, -1.75, 0.49999999999953, 0\n53, -1.75, 0.74999999999959, 0\n54, -1.75, 0.25000000000063, 1\n55, -1.75, 0.50000000000122, 1\n56, -1.75, 0.7500000000001, 1\n57, -1.5, 0.25000000000023, 1\n58, -1.5, 0.50000000000038, 1\n59, -1.5, 0.74999999999984, 1\n60, -1.25, 0.24999999999982, 1\n61, -1.25, 0.49999999999953, 1\n62, -1.25, 0.74999999999959, 1\n63, -2, 0.24999999999982, 0.24999999999941\n64, -2, 0.49999999999953, 0.24999999999941\n65, -2, 0.74999999999959, 0.24999999999941\n66, -2, 0.25000000000023, 0.49999999999869\n67, -2, 0.50000000000038, 0.49999999999869\n68, -2, 0.74999999999984, 0.49999999999869\n69, -2, 0.25000000000063, 0.74999999999934\n70, -2, 0.50000000000122, 0.74999999999934\n71, -2, 0.7500000000001, 0.74999999999934\n72, -1.25, 1, 0.74999999999934\n73, -1.25, 1, 0.49999999999869\n74, -1.25, 1, 0.24999999999941\n75, -1.5, 1, 0.74999999999934\n76, -1.5, 1, 0.49999999999869\n77, -1.5, 1, 0.24999999999941\n78, -1.75, 1, 0.74999999999934\n79, -1.75, 1, 0.49999999999869\n80, -1.75, 1, 0.24999999999941\n81, -1, 0.25000000000063, 0.24999999999941\n82, -1, 0.50000000000122, 0.24999999999941\n83, -1, 0.7500000000001, 0.24999999999941\n84, -1, 0.25000000000023, 0.49999999999869\n85, -1, 0.50000000000038, 0.49999999999869\n86, -1, 0.74999999999984, 0.49999999999869\n87, -1, 0.24999999999982, 0.74999999999934\n88, -1, 0.49999999999953, 0.74999999999934\n89, -1, 0.74999999999959, 0.74999999999934\n90, -1.75, 0, 0.74999999999934\n91, -1.75, 0, 0.49999999999869\n92, -1.75, 0, 0.24999999999941\n93, -1.5, 0, 0.74999999999934\n94, -1.5, 0, 0.49999999999869\n95, -1.5, 0, 0.24999999999941\n96, -1.25, 0, 0.74999999999934\n97, -1.25, 0, 0.49999999999869\n98, -1.25, 0, 0.24999999999941\n99, -1.75, 0.25000000000043, 0.74999999999934\n100, -1.75, 0.25000000000023, 0.49999999999869\n101, -1.75, 0.25000000000002, 0.24999999999941\n102, -1.75, 0.5000000000008, 0.74999999999934\n103, -1.75, 0.50000000000038, 0.49999999999869\n104, -1.75, 0.49999999999995, 0.24999999999941\n105, -1.75, 0.74999999999997, 0.74999999999934\n106, -1.75, 0.74999999999984, 0.49999999999869\n107, -1.75, 0.74999999999972, 0.24999999999941\n108, -1.5, 0.25000000000023, 0.74999999999934\n109, -1.5, 0.25000000000023, 0.49999999999869\n110, -1.5, 0.25000000000023, 0.24999999999941\n111, -1.5, 0.50000000000038, 0.74999999999934\n112, -1.5, 0.50000000000038, 0.49999999999869\n113, -1.5, 0.50000000000038, 0.24999999999941\n114, -1.5, 0.74999999999984, 0.74999999999934\n115, -1.5, 0.74999999999984, 0.49999999999869\n116, -1.5, 0.74999999999984, 0.24999999999941\n117, -1.25, 0.25000000000002, 0.74999999999934\n118, -1.25, 0.25000000000023, 0.49999999999869\n119, -1.25, 0.25000000000043, 0.24999999999941\n120, -1.25, 0.49999999999995, 0.74999999999934\n121, -1.25, 0.50000000000038, 0.49999999999869\n122, -1.25, 0.5000000000008, 0.24999999999941\n123, -1.25, 0.74999999999972, 0.74999999999934\n124, -1.25, 0.74999999999984, 0.49999999999869\n125, -1.25, 0.74999999999997, 0.24999999999941\n******* E L E M E N T S *************\n*ELEMENT, type=C3D8, ELSET=Volume1\n153, 54, 21, 5, 32, 99, 90, 35, 69\n154, 99, 90, 35, 69, 100, 91, 34, 66\n155, 100, 91, 34, 66, 101, 92, 33, 63\n156, 101, 92, 33, 63, 51, 17, 1, 18\n157, 55, 54, 32, 31, 102, 99, 69, 70\n158, 102, 99, 69, 70, 103, 100, 66, 67\n159, 103, 100, 66, 67, 104, 101, 63, 64\n160, 104, 101, 63, 64, 52, 51, 18, 19\n161, 56, 55, 31, 30, 105, 102, 70, 71\n162, 105, 102, 70, 71, 106, 103, 67, 68\n163, 106, 103, 67, 68, 107, 104, 64, 65\n164, 107, 104, 64, 65, 53, 52, 19, 20\n165, 29, 56, 30, 8, 78, 105, 71, 38\n166, 78, 105, 71, 38, 79, 106, 68, 37\n167, 79, 106, 68, 37, 80, 107, 65, 36\n168, 80, 107, 65, 36, 9, 53, 20, 4\n169, 57, 22, 21, 54, 108, 93, 90, 99\n170, 108, 93, 90, 99, 109, 94, 91, 100\n171, 109, 94, 91, 100, 110, 95, 92, 101\n172, 110, 95, 92, 101, 48, 16, 17, 51\n173, 58, 57, 54, 55, 111, 108, 99, 102\n174, 111, 108, 99, 102, 112, 109, 100, 103\n175, 112, 109, 100, 103, 113, 110, 101, 104\n176, 113, 110, 101, 104, 49, 48, 51, 52\n177, 59, 58, 55, 56, 114, 111, 102, 105\n178, 114, 111, 102, 105, 115, 112, 103, 106\n179, 115, 112, 103, 106, 116, 113, 104, 107\n180, 116, 113, 104, 107, 50, 49, 52, 53\n181, 28, 59, 56, 29, 75, 114, 105, 78\n182, 75, 114, 105, 78, 76, 115, 106, 79\n183, 76, 115, 106, 79, 77, 116, 107, 80\n184, 77, 116, 107, 80, 10, 50, 53, 9\n185, 60, 23, 22, 57, 117, 96, 93, 108\n186, 117, 96, 93, 108, 118, 97, 94, 109\n187, 118, 97, 94, 109, 119, 98, 95, 110\n188, 119, 98, 95, 110, 45, 15, 16, 48\n189, 61, 60, 57, 58, 120, 117, 108, 111\n190, 120, 117, 108, 111, 121, 118, 109, 112\n191, 121, 118, 109, 112, 122, 119, 110, 113\n192, 122, 119, 110, 113, 46, 45, 48, 49\n193, 62, 61, 58, 59, 123, 120, 111, 114\n194, 123, 120, 111, 114, 124, 121, 112, 115\n195, 124, 121, 112, 115, 125, 122, 113, 116\n196, 125, 122, 113, 116, 47, 46, 49, 50\n197, 27, 62, 59, 28, 72, 123, 114, 75\n198, 72, 123, 114, 75, 73, 124, 115, 76\n199, 73, 124, 115, 76, 74, 125, 116, 77\n200, 74, 125, 116, 77, 11, 47, 50, 10\n201, 24, 6, 23, 60, 87, 41, 96, 117\n202, 87, 41, 96, 117, 84, 40, 97, 118\n203, 84, 40, 97, 118, 81, 39, 98, 119\n204, 81, 39, 98, 119, 14, 2, 15, 45\n205, 25, 24, 60, 61, 88, 87, 117, 120\n206, 88, 87, 117, 120, 85, 84, 118, 121\n207, 85, 84, 118, 121, 82, 81, 119, 122\n208, 82, 81, 119, 122, 13, 14, 45, 46\n209, 26, 25, 61, 62, 89, 88, 120, 123\n210, 89, 88, 120, 123, 86, 85, 121, 124\n211, 86, 85, 121, 124, 83, 82, 122, 125\n212, 83, 82, 122, 125, 12, 13, 46, 47\n213, 7, 26, 62, 27, 44, 89, 123, 72\n214, 44, 89, 123, 72, 43, 86, 124, 73\n215, 43, 86, 124, 73, 42, 83, 125, 74\n216, 42, 83, 125, 74, 3, 12, 47, 11\n*NSET,NSET=PhysicalSurface1\n1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \n11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \n21, 22, 23, 24, 25, 26, 27, 28, 29, 30, \n31, 32, 33, 34, 35, 36, 37, 38, 45, 46, \n47, 48, 49, 50, 51, 52, 53, 54, 55, 56, \n57, 58, 59, 60, 61, 62, 63, 64, 65, 66, \n67, 68, 69, 70, 71, \n*NSET,NSET=PhysicalSurface2\n1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \n11, 12, 13, 14, 15, 16, 17, 21, 22, 23, \n24, 25, 26, 27, 28, 29, 33, 34, 35, 36, \n37, 38, 39, 40, 41, 42, 43, 44, 72, 73, \n74, 75, 76, 77, 78, 79, 80, 81, 82, 83, \n84, 85, 86, 87, 88, 89, 90, 91, 92, 93, \n94, 95, 96, 97, 98, ","category":"page"},{"location":"troubleshooting/#Troubleshooting-and-FAQ","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"In general, Trixi.jl works best with the newest Julia release and up-to-date dependencies. If something does not work as expected, try updating your installed Julia packages via the package manager, e.g., by running","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"julia> import Pkg; Pkg.update()","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"If you do not use the latest stable release of Julia from the official website, consider updating your Julia installation.","category":"page"},{"location":"troubleshooting/#old-release","page":"Troubleshooting and FAQ","title":"Installing Trixi.jl as a package only provides an older release","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Trixi.jl requires fairly recent versions of several of its dependencies, which sometimes causes issues when other installed packages have conflicting version requirements. In this case, Julia's package manager Pkg will try to handle this gracefully by going back in history until it finds a Trixi.jl release whose version requirements can be met, resulting in an older - and usually outdated - version of Trixi.jl being installed.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"The following example illustrates this issue:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"The current Trixi.jl release v0.3.6 requires package Foo with a minimum version of v0.2.\nAn older Trixi.jl release v0.2.1 requires package Foo only with a minimum version of v0.1.\nA user has already installed package Bar, which itself requires Foo with a maximum version of v0.1.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"In this case, installing Trixi.jl via Pkg will result in version v0.2.1 to be installed instead of the current release v0.3.6. That is, a specific release of Trixi.jl may not be installable if it has a dependency with a higher minimum version that at the same time is restricted to a lower maximum version by another installed package.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"You can check whether an outdated version of Trixi.jl is installed by executing","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"julia> import Pkg; Pkg.update(\"Trixi\"); Pkg.status(\"Trixi\")","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"in the REPL and comparing the reported Trixi.jl version with the version of the latest release. If the versions differ, you can confirm that it is due to a version conflict by forcing Pkg to install the latest Trixi.jl release, where version is the current release:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"julia> Pkg.add(name=\"Trixi\", version=\"0.3.6\")","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"In case of a conflict, the command above will produce an error that informs you about the offending packages, similar to the following:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":" Updating registry at `~/.julia/registries/General`\n Resolving package versions...\nERROR: Unsatisfiable requirements detected for package DataStructures [864edb3b]:\n DataStructures [864edb3b] log:\n ├─possible versions are: [0.9.0, 0.10.0, 0.11.0-0.11.1, 0.12.0, 0.13.0, 0.14.0-0.14.1, 0.15.0, 0.16.1, 0.17.0-0.17.20, 0.18.0-0.18.8] or uninstalled\n ├─restricted by compatibility requirements with DiffEqCallbacks [459566f4] to versions: 0.18.0-0.18.8\n │ └─DiffEqCallbacks [459566f4] log:\n │ ├─possible versions are: [2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0-2.5.2, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.12.0-2.12.1, 2.13.0-2.13.5, 2.14.0-2.14.1, 2.15.0] or uninstalled\n │ ├─restricted by compatibility requirements with Trixi [a7f1ee26] to versions: [2.14.0-2.14.1, 2.15.0]\n │ │ └─Trixi [a7f1ee26] log:\n │ │ ├─possible versions are: [0.1.0-0.1.2, 0.2.0-0.2.6, 0.3.0-0.3.6] or uninstalled\n │ │ └─restricted to versions 0.3.6 by an explicit requirement, leaving only versions 0.3.6\n │ └─restricted by compatibility requirements with StaticArrays [90137ffa] to versions: 2.15.0 or uninstalled, leaving only versions: 2.15.0\n │ └─StaticArrays [90137ffa] log:\n │ ├─possible versions are: [0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0, 0.10.2-0.10.3, 0.11.0-0.11.1, 0.12.0-0.12.5, 1.0.0-1.0.1] or uninstalled\n │ └─restricted by compatibility requirements with Trixi [a7f1ee26] to versions: 1.0.0-1.0.1\n │ └─Trixi [a7f1ee26] log: see above\n └─restricted by compatibility requirements with JLD2 [033835bb] to versions: [0.9.0, 0.10.0, 0.11.0-0.11.1, 0.12.0, 0.13.0, 0.14.0-0.14.1, 0.15.0, 0.16.1, 0.17.0-0.17.20] — no versions left\n └─JLD2 [033835bb] log:\n ├─possible versions are: [0.1.0-0.1.14, 0.2.0-0.2.4, 0.3.0-0.3.1] or uninstalled\n └─restricted by compatibility requirements with BinaryBuilder [12aac903] to versions: 0.1.0-0.1.14\n └─BinaryBuilder [12aac903] log:\n ├─possible versions are: [0.1.0-0.1.2, 0.1.4, 0.2.0-0.2.6] or uninstalled\n └─restricted to versions * by an explicit requirement, leaving only versions [0.1.0-0.1.2, 0.1.4, 0.2.0-0.2.6]","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"From the error message, we can see that ultimately BinaryBuilder is the problem here: It restricts the package DataStructures to version v0.17 (via its dependency JLD2), while Trixi.jl requires at least v0.18 (via its dependency DiffEqCallbacks). Following the official Pkg documentation, there are a number of things you can try to fix such errors:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Try updating all packages with julia -e 'using Pkg; Pkg.update()'. A newer version of the problematic package may exist that has updated version requirements.\nRemove the offending package. Running\njulia> import Pkg; Pkg.rm(\"BinaryBuilder\"); Pkg.update(); Pkg.status()\nin the REPL will remove BinaryBuilder and (hopefully) update Trixi.jl to the latest version.\nReport the versioning issue to us and/or the development repository of the conflicting package. Maybe it is possible to lift the version restrictions such that both packages can live side by side.\nInstead of installing Trixi.jl and conflicting packages in the same (default) environment, consider creating new environments/projects and install only packages required for the specific tasks, as explained in the official Pkg documentation. For example, if you use Trixi.jl for a research project (Bachelor/Master thesis or a paper), you should create a new Julia project/environment for that research and add Trixi.jl as a dependency. If you track all your code and the Project.toml, Manifest.toml files (generated by Pkg) in a version control system such as git, you can make your research easily reproducible (if you also record the version of Julia you are using and leave some comments for others who do not know what you are trying to do, including your future self 😉).","category":"page"},{"location":"troubleshooting/#font-issues","page":"Troubleshooting and FAQ","title":"There are many questions marks and weird symbols in the output of Trixi.jl","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"This probably means that the default font used by your operating system does not support enough Unicode symbols. Try installing a modern font with decent unicode support, e.g. JuliaMono. Detailed installation instructions are available there.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"This problems affects users of Mac OS particularly often. At the time of writing, installing JuliaMono is as simple as","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"$ brew tap homebrew/cask-fonts\n$ brew install --cask font-juliamono","category":"page"},{"location":"troubleshooting/#There-are-no-timing-results-of-the-initial-mesh-creation","page":"Troubleshooting and FAQ","title":"There are no timing results of the initial mesh creation","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"By default, the SummaryCallback resets the timer used internally by Trixi.jl when it is initialized (when solve is called). If this step needs to be timed, e.g. to debug performance problems, explicit timings can be used as follows.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"using Trixi\n\nbegin\n Trixi.reset_timer!(Trixi.timer())\n\n equations = LinearScalarAdvectionEquation2D(0.2, -0.7)\n mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), n_cells_max=10^5, initial_refinement_level=5)\n solver = DGSEM(3)\n semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)\n\n Trixi.print_timer(Trixi.timer())\nend","category":"page"},{"location":"troubleshooting/#MPI-ranks-are-assigned-zero-cells-in-[P4estMesh](@ref)-even-though-there-are-enough-cells","page":"Troubleshooting and FAQ","title":"MPI ranks are assigned zero cells in P4estMesh even though there are enough cells","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"The P4estMesh allows one to coarsen the mesh by default. When Trixi.jl is parallelized with multiple MPI ranks, this has the consequence that sibling cells (i.e., child cells with the same parent cell) are kept on the same MPI rank to be able to coarsen them easily. This might cause an unbalanced distribution of cells on different ranks. For 2D meshes, this also means that initially each rank will at least own 4 cells, and for 3D meshes, initially each rank will at least own 8 cells. See issue #1329.","category":"page"},{"location":"troubleshooting/#Installing-and-updating-everything-takes-a-lot-of-time","page":"Troubleshooting and FAQ","title":"Installing and updating everything takes a lot of time","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Julia compiles code to get good (C/Fortran-like) performance. At the same time, Julia provides a dynamic environment and usually compiles code just before using it. Over time, Julia has improved its caching infrastructure, allowing to store and reuse more results from (pre-)compilation. This often results in an increased time to install/update packages, in particular when updating to Julia v1.8 or v1.9 from older versions.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Some packages used together with Trixi.jl provide options to configure the amount of precompilation. For example, OrdinaryDiffEq.jl precompiles many ODE solvers for a good runtime experience of average users. Currently, Trixi.jl does not use all of the available solvers. Thus, you can save some time at every update by setting their precompilation options.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"At the time of writing, this could look as follows. First, you need to activate the environment where you have installed OrdinaryDiffEq.jl. Then, you need to execute the following Julia code.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"using Preferences, UUIDs\nlet uuid = UUID(\"1dea7af3-3e70-54e6-95c3-0bf5283fa5ed\")\n set_preferences!(uuid, \"PrecompileAutoSpecialize\" => false)\n set_preferences!(uuid, \"PrecompileAutoSwitch\" => false)\n set_preferences!(uuid, \"PrecompileDefaultSpecialize\" => true)\n set_preferences!(uuid, \"PrecompileFunctionWrapperSpecialize\" => false)\n set_preferences!(uuid, \"PrecompileLowStorage\" => true)\n set_preferences!(uuid, \"PrecompileNoSpecialize\" => false)\n set_preferences!(uuid, \"PrecompileNonStiff\" => true)\n set_preferences!(uuid, \"PrecompileStiff\" => false)\nend","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"This disables precompilation of all implicit methods. This should usually not affect the runtime latency with Trixi.jl since most setups use explicit time integration methods.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"EditURL = \"../../literate/src/files/shock_capturing.jl\"","category":"page"},{"location":"tutorials/shock_capturing/#shock_capturing","page":"5 Shock capturing with flux differencing and stage limiter","title":"5: Shock capturing with flux differencing and stage limiter","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This tutorial contains a short summary of the idea of shock capturing for DGSEM with flux differencing and its implementation in Trixi.jl. In the second part, an implementation of a positivity preserving limiter is added to the simulation.","category":"page"},{"location":"tutorials/shock_capturing/#Shock-capturing-with-flux-differencing","page":"5 Shock capturing with flux differencing and stage limiter","title":"Shock capturing with flux differencing","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The following rough explanation is on a very basic level. More information about an entropy stable shock-capturing strategy for DGSEM discretizations of advection dominated problems, such as the compressible Euler equations or the compressible Navier-Stokes equations, can be found in Hennemann et al. (2021). In Rueda-Ramírez et al. (2021) you find the extension to the systems with non-conservative terms, such as the compressible magnetohydrodynamics (MHD) equations.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The strategy for a shock-capturing method presented by Hennemann et al. is based on a hybrid blending of a high-order DG method with a low-order variant. The low-order subcell finite volume (FV) method is created directly with the Legendre-Gauss-Lobatto (LGL) nodes already used for the high-order DGSEM. Then, the final method is a convex combination with regulating indicator alpha of these two methods.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Since the surface integral is equal for both the DG and the subcell FV method, only the volume integral divides between the two methods.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This strategy for the volume integral is implemented in Trixi.jl under the name of VolumeIntegralShockCapturingHG with the three parameters of the indicator and the volume fluxes for the DG and the subcell FV method.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Note, that the DG method is based on the flux differencing formulation. Hence, you have to use a two-point flux, such as flux_ranocha, flux_shima_etal, flux_chandrashekar or flux_kennedy_gruber, for the DG volume flux. We would recommend to use the entropy conserving flux flux_ranocha by Ranocha (2018) for the compressible Euler equations.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;\n volume_flux_dg=volume_flux_dg,\n volume_flux_fv=volume_flux_fv)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We now focus on a choice of the shock capturing indicator indicator_sc. A possible indicator is alpha_HG presented by Hennemann et al. (p.10), which depends on the current approximation with modal coefficients m_j_j=0^N of a given variable.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The indicator is calculated for every DG element by itself. First, we calculate a smooth alpha by","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"alpha = frac11+exp(-frac-smathbbT(mathbbE-mathbbT))","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"with the total energy mathbbE=maxbig(fracm_N^2sum_j=0^N m_j^2 fracm_N-1^2sum_j=0^N-1 m_j^2big), threshold mathbbT= 05 * 10^-18*(N+1)^14 and parameter s=lnbig(frac1-0000100001big)approx 921024.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"For computational efficiency, alpha_min is introduced and used for","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"tildealpha = begincases\n0 textif alphaalpha_min\nalpha textif alpha_minleq alpha leq 1- alpha_min\n1 textif 1-alpha_minalpha\nendcases","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Moreover, the parameter alpha_max sets a maximal value for alpha by","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"alpha = mintildealpha alpha_max","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This allows to control the maximal dissipation.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"To remove numerical artifact the final indicator is smoothed with all the neighboring elements' indicators. This is activated with alpha_smooth=true.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"alpha_HG = max_E alpha 05 * alpha_E","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"where E are all elements sharing a face with the current element.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Furthermore, you can specify the variable used for the calculation. For instance you can choose 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.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This indicator is implemented in Trixi.jl and called IndicatorHennemannGassner with the parameters equations, basis, alpha_max, alpha_min, alpha_smooth and variable.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"indicator_sc = IndicatorHennemannGassner(equations, basis,\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable=variable)","category":"page"},{"location":"tutorials/shock_capturing/#Positivity-preserving-limiter","page":"5 Shock capturing with flux differencing and stage limiter","title":"Positivity preserving limiter","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Some numerical solutions are physically meaningless, for instance negative values of pressure 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.jl provides the fully-discrete positivity-preserving limiter of Zhang, Shu (2011).","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"It works the following way. For every passed (scalar) variable and for every DG element we calculate the minimal value value_min. If this value falls below the given threshold varepsilon, the approximation is slightly adapted such that the minimal value of the relevant variable lies now above the threshold.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"underlineu^new = theta * underlineu + (1-theta) * u_mean","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"where underlineu are the collected pointwise evaluation coefficients in element e and u_mean the integral mean of the quantity in e. The new coefficients are a convex combination of these two values with factor","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"theta = fracvalue_mean - varepsilonvalue_mean - value_min","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"where value_mean is the relevant variable evaluated for the mean value u_mean.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The adapted approximation keeps the exact same mean value, but the relevant variable is now greater or equal the threshold varepsilon at every node in every element.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We specify the variables the way we did before for the shock capturing variables. For the compressible Euler equations density, pressure or the combined variable density_pressure are a reasonable choice.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"You can implement the limiter in Trixi.jl using PositivityPreservingLimiterZhangShu with parameters threshold and variables.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=thresholds,\n variables=variables)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Then, the limiter is added to the time integration method in the solve function. For instance, like","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"CarpenterKennedy2N54(stage_limiter!, williamson_condition=false)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"or","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"SSPRK43(stage_limiter!).","category":"page"},{"location":"tutorials/shock_capturing/#Simulation-with-shock-capturing-and-positivity-preserving","page":"5 Shock capturing with flux differencing and stage limiter","title":"Simulation with shock capturing and positivity preserving","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Now, we can run a simulation using the described methods of shock capturing and positivity preserving limiters. We want to give an example for the 2D compressible Euler equations.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"using OrdinaryDiffEq, Trixi\n\nequations = CompressibleEulerEquations2D(1.4)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"As our initial condition we use the Sedov blast wave setup.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)\n # Set up polar coordinates\n inicenter = SVector(0.0, 0.0)\n x_norm = x[1] - inicenter[1]\n y_norm = x[2] - inicenter[2]\n r = sqrt(x_norm^2 + y_norm^2)\n\n r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)\n # r0 = 0.5 # = more reasonable setup\n E = 1.0\n p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)\n p0_outer = 1.0e-5 # = true Sedov setup\n # p0_outer = 1.0e-3 # = more reasonable setup\n\n # Calculate primitive variables\n rho = 1.0\n v1 = 0.0\n v2 = 0.0\n p = r > r0 ? p0_outer : p0_inner\n\n return prim2cons(SVector(rho, v1, v2, p), equations)\nend\ninitial_condition = initial_condition_sedov_blast_wave","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"basis = LobattoLegendreBasis(3)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We set the numerical fluxes and divide between the surface flux and the two volume fluxes for the DG and FV method. Here, we are using flux_lax_friedrichs and flux_ranocha.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"surface_flux = flux_lax_friedrichs\nvolume_flux = flux_ranocha","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Now, we specify the shock capturing indicator alpha.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We implement the described indicator of Hennemann, Gassner as explained above with parameters equations, basis, alpha_max, alpha_min, alpha_smooth and variable. Since density and pressure are the critical variables in this example, we use density_pressure = density * pressure = rho * p as indicator variable.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"indicator_sc = IndicatorHennemannGassner(equations, basis,\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable=density_pressure)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Now, we can use the defined fluxes and the indicator to implement the volume integral using shock capturing.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;\n volume_flux_dg=volume_flux,\n volume_flux_fv=surface_flux)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We finalize the discretization by implementing Trixi.jl's solver, mesh, semi and ode, while solver now has the extra parameter volume_integral.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"solver = DGSEM(basis, surface_flux, volume_integral)\n\ncoordinates_min = (-2.0, -2.0)\ncoordinates_max = ( 2.0, 2.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=6,\n n_cells_max=10_000)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We add some callbacks to get an solution analysis and use a CFL-based time step size calculation.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"analysis_callback = AnalysisCallback(semi, interval=100)\n\nstepsize_callback = StepsizeCallback(cfl=0.8)\n\ncallbacks = CallbackSet(analysis_callback, stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We now run the simulation using the positivity preserving limiter of Zhang and Shu for the variables density and pressure.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),\n variables=(Trixi.density, pressure))\n\nsol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\n\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/shock_capturing/#Package-versions","page":"5 Shock capturing with flux differencing and stage limiter","title":"Package versions","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"EditURL = \"../../literate/src/files/DGMulti_1.jl\"","category":"page"},{"location":"tutorials/DGMulti_1/#DGMulti_1","page":"7 DG schemes via DGMulti solver","title":"7: DG schemes via DGMulti solver","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"DGMulti is a DG solver that allows meshes with simplex elements. The basic idea and implementation of this solver is explained in section \"Meshes\". Here, we want to give some examples and a quick overview about the options with DGMulti.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We start with a simple example we already used in the tutorial about flux differencing. There, we implemented a simulation with initial_condition_weak_blast_wave for the 2D compressible Euler equations CompressibleEulerEquations2D and used the DG formulation with flux differencing using volume flux flux_ranocha and surface flux flux_lax_friedrichs.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Here, we want to implement the equivalent example, only now using the DGMulti solver instead of DGSEM.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq\n\nequations = CompressibleEulerEquations2D(1.4)\n\ninitial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"To use the Gauss-Lobatto nodes again, we choose approximation_type=SBP() in the solver. Since we want to start with a Cartesian domain discretized with squares, we use the element type Quad().","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3,\n element_type = Quad(),\n approximation_type = SBP(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))\n\ncells_per_dimension = (32, 32)\nmesh = DGMultiMesh(dg,\n cells_per_dimension, # initial_refinement_level = 5\n coordinates_min=(-2.0, -2.0),\n coordinates_max=( 2.0, 2.0),\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n boundary_conditions=boundary_condition_periodic)\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=10)\nanalysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))\ncallbacks = CallbackSet(analysis_callback, alive_callback);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Run the simulation with the same time integration algorithm as before.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6,\n callback=callbacks, save_everystep=false);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"plot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"This simulation is not as fast as the equivalent with TreeMesh since no special optimizations for quads (for instance tensor product structure) have been implemented. Figure 4 in \"Efficient implementation of modern entropy stable and kinetic energy preserving discontinuous Galerkin methods for conservation laws\" (2021) provides a nice runtime comparison between the different mesh types. On the other hand, the functions are more general and thus we have more option we can choose from.","category":"page"},{"location":"tutorials/DGMulti_1/#Simulation-with-Gauss-nodes","page":"7 DG schemes via DGMulti solver","title":"Simulation with Gauss nodes","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"For instance, we can change the approximation type of our simulation.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq\nequations = CompressibleEulerEquations2D(1.4)\ninitial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We now use Gauss nodes instead of Gauss-Lobatto nodes which can be done for the element types Quad() and Hex(). Therefore, we set approximation_type=GaussSBP(). Alternatively, we can use a modal approach using the approximation type Polynomial().","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3,\n element_type = Quad(),\n approximation_type = GaussSBP(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))\n\ncells_per_dimension = (32, 32)\nmesh = DGMultiMesh(dg,\n cells_per_dimension, # initial_refinement_level = 5\n coordinates_min=(-2.0, -2.0),\n coordinates_max=( 2.0, 2.0),\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n boundary_conditions=boundary_condition_periodic)\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=10)\nanalysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))\ncallbacks = CallbackSet(analysis_callback, alive_callback);\n\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)","category":"page"},{"location":"tutorials/DGMulti_1/#Simulation-with-triangular-elements","page":"7 DG schemes via DGMulti solver","title":"Simulation with triangular elements","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Also, we can set another element type. We want to use triangles now.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq\nequations = CompressibleEulerEquations2D(1.4)\ninitial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Since there is no direct equivalent to Gauss-Lobatto nodes on triangles, the approximation type SBP() now uses Gauss-Lobatto nodes on faces and special nodes in the interior of the triangular. More details can be found in the documentation of StartUpDG.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3,\n element_type = Tri(),\n approximation_type = SBP(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))\n\ncells_per_dimension = (32, 32)\nmesh = DGMultiMesh(dg,\n cells_per_dimension, # initial_refinement_level = 5\n coordinates_min=(-2.0, -2.0),\n coordinates_max=( 2.0, 2.0),\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n boundary_conditions=boundary_condition_periodic)\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=10)\nanalysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))\ncallbacks = CallbackSet(analysis_callback, alive_callback);\n\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"plot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/DGMulti_1/#Triangular-meshes-on-non-Cartesian-domains","page":"7 DG schemes via DGMulti solver","title":"Triangular meshes on non-Cartesian domains","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"To use triangular meshes on a non-Cartesian domain, Trixi.jl uses the package StartUpDG.jl. The following example is based on elixir_euler_triangulate_pkg_mesh.jl and uses a pre-defined mesh from StartUpDG.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We want to simulate the smooth initial condition initial_condition_convergence_test with source terms source_terms_convergence_test for the 2D compressible Euler equations.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"equations = CompressibleEulerEquations2D(1.4)\ninitial_condition = initial_condition_convergence_test\nsource_terms = source_terms_convergence_test","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We create the solver DGMulti with triangular elements (Tri()) as before.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3, element_type = Tri(),\n approximation_type=Polynomial(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"StartUpDG.jl provides for instance a pre-defined Triangulate geometry for a rectangular domain with hole RectangularDomainWithHole. Other pre-defined Triangulate geometries are e.g., SquareDomain, Scramjet, and CircularDomain.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole());\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"The pre-defined Triangulate geometry in StartUpDG has integer boundary tags. With DGMultiMesh we assign boundary faces based on these integer boundary tags and create a mesh compatible with Trixi.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary=>1, :inner_boundary=>2))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)\nboundary_conditions = (; :outer_boundary => boundary_condition_convergence_test,\n :inner_boundary => boundary_condition_convergence_test)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n source_terms = source_terms,\n boundary_conditions = boundary_conditions)\n\ntspan = (0.0, 0.2)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=20)\nanalysis_callback = AnalysisCallback(semi, interval=200, uEltype=real(dg))\ncallbacks = CallbackSet(alive_callback, analysis_callback);\n\nsol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"For more information, please have a look in the StartUpDG.jl documentation.","category":"page"},{"location":"tutorials/DGMulti_1/#Package-versions","page":"7 DG schemes via DGMulti solver","title":"Package versions","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"StartUpDG\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"EditURL = \"../../literate/src/files/adding_new_scalar_equations.jl\"","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#adding_new_scalar_equations","page":"10 Adding a new scalar conservation law","title":"10: Adding a new scalar conservation law","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"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","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"partial_t u(tx) + partial_x u(tx)^3 = 0","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"in a periodic domain in one space dimension. In Trixi.jl, such a mathematical model is encoded as a subtype of Trixi.AbstractEquations.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Basic-setup","page":"10 Adding a new scalar conservation law","title":"Basic setup","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using Trixi\n\nstruct CubicEquation <: Trixi.AbstractEquations{1 #= number of spatial dimensions =#,\n 1 #= number of primary variables, i.e. scalar =#};\nend","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"We create CubicEquation as an empty struct since we do not use any parameters for this equation. Other models could bundle arbitrary parameters, e.g., the ideal gas constant for the compressible Euler equations.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Next, we define the physical flux f(u) = u^3 using the calling structure used in Trixi.jl.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Trixi.flux(u, orientation, equation::CubicEquation) = u.^3\nTrixi.varnames(_, ::CubicEquation) = (\"scalar\",)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"In Trixi.jl, the conserved variables u are usually passed as SVectors of variables at a single physical location. Hence, we must use u.^3 instead of the scalar operation u^3.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"That's already enough to run a simple simulation with a standard DGSEM discretization using the non-dissipative central flux at interfaces.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using OrdinaryDiffEq\n\n# Create a simulation setup\nequation = CubicEquation()\n\ninitial_condition_sine(x, t, equation::CubicEquation) = SVector(sinpi(x[1]))\n\nmesh = TreeMesh(-1.0, 1.0, # min/max coordinates\n initial_refinement_level=4,\n n_cells_max=10^4)\n\nsolver = DGSEM(3 #= polynomial degree =#, flux_central)\n\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"We wrap the return value of the initial_condition_sine inside an SVector since that's the approach used in Trixi.jl also for systems of equations. We need to index the spatial coordinate x[1], since it is an SVector with one component. In multiple space dimensions, all spatial coordinates are passed together.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Next, we create an ODEProblem from the SciML/DifferentialEquations ecosystem. We can solve this ODE numerically using any time integration method, e.g., SSPRK43 from OrdinaryDiffEq.jl. Before, we set up a callback to summarize the simulation setup.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# Create ODE problem with given time span\ntspan = (0.0, 0.09)\node = semidiscretize(semi, tspan)\n\nsummary_callback = SummaryCallback()\ncallbacks = CallbackSet(summary_callback)\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks\nsol = solve(ode, SSPRK43();\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"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.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"You can already see that discontinuities will develop and oscillations start to occur around steep parts of the wave. That's expected from our central discretization. To avoid these issues, we need to use dissipative numerical fluxes (approximate Riemann solvers) at interfaces.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Advanced-setup","page":"10 Adding a new scalar conservation law","title":"Advanced setup","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Thus, we add a Godunov's flux for our cubic equation. That is easy for this equation since the wave speed f'(u) = 3u^2 is always non-negative.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"@inline Trixi.flux_godunov(u_ll, u_rr, orientation, equation::CubicEquation) = flux(u_ll, orientation, equation)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Let's run the example again but with a dissipative numerical flux at interfaces. remake will recreate the semidiscretization we used before and only change selected parameters, in this case the solver.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# A new setup with dissipation\nsemi = remake(semi, solver=DGSEM(3, flux_godunov))\node = semidiscretize(semi, tspan)\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot!(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"You can see that there are fewer oscillations, in particular around steep edges. Now let's increase the final time (and also the spatial resolution).","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12)\nsemi = remake(semi, mesh=TreeMesh(-1.0, 1.0, initial_refinement_level=8, n_cells_max=10^5))\node = semidiscretize(semi, (0.0, 0.5) #= tspan =#)\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"You can observe that nonclassical shocks develop and are stable under grid refinement, e.g. for initial_refinement_level=12. In this case, these nonclassical shocks can be avoided by using an entropy-dissipative semidiscretization. Thus, we need to define an entropy-conservative numerical flux","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"@inline function Trixi.flux_ec(u_ll, u_rr, orientation, equation::CubicEquation)\n return SVector(0.25 * (u_ll[1]^3 + u_ll[1]^2 * u_rr[1] + u_ll[1] * u_rr[1]^2 + u_rr[1]^3))\nend","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"and use a VolumeIntegralFluxDifferencing instead of the standard VolumeIntegralWeakForm in the DGSEM.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# Let's use a provably entropy-dissipative semidiscretization\nsemi = remake(semi, solver=DGSEM(3, flux_godunov, VolumeIntegralFluxDifferencing(flux_ec)))\node = semidiscretize(semi, (0.0, 0.5))\nsol = solve(ode, SSPRK43(); ode_default_options()...);\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Possible next steps could be","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"to define Trixi.max_abs_speeds(u, equations::CubicEquation) = 3 * u[1]^2 to use CFL-based time step control via a StepsizeCallback\nto define quantities of interest like Trixi.entropy(u, equations::CubicEquation) = u[1]^2 and integrate them in a simulation using the AnalysisCallback\nto experiment with shock-capturing volume integrals VolumeIntegralShockCapturingHG and adaptive mesh refinement AMRCallback","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"For further reading, Trixi.jl provides another example on adding a scalar equation. In the elixir about the KPP problem, the 2D scalar \"KPP equation\" from Kurganov, Petrova, Popov (2007) is implemented.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Summary-of-the-code","page":"10 Adding a new scalar conservation law","title":"Summary of the code","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"To sum up, here is the complete code that we used (without the callbacks since these create a lot of unnecessary output in the doctests of this tutorial). In addition, we create the struct inside the new module CubicConservationLaw. That ensures that we can re-create structs defined therein without having to restart Julia.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# Define new physics\nmodule CubicConservationLaw\n\nusing Trixi\n\nstruct CubicEquation <: Trixi.AbstractEquations{1 #= number of spatial dimensions =#,\n 1 #= number of primary variables, i.e. scalar =#}\nend\n\n@inline Trixi.flux(u, orientation, equation::CubicEquation) = u.^3\nTrixi.varnames(_, ::CubicEquation) = (\"scalar\",)\n\n@inline Trixi.flux_godunov(u_ll, u_rr, orientation, equation::CubicEquation) = flux(u_ll, orientation, equation)\n@inline function Trixi.flux_ec(u_ll, u_rr, orientation, equation::CubicEquation)\n return SVector(0.25 * (u_ll[1]^3 + u_ll[1]^2 * u_rr[1] + u_ll[1] * u_rr[1]^2 + u_rr[1]^3))\nend\n\nend # module\n\n\n# Create a simulation setup\nimport .CubicConservationLaw\nusing Trixi\nusing OrdinaryDiffEq\nusing Plots\n\nequation = CubicConservationLaw.CubicEquation()\n\ninitial_condition_sine(x, t, equation::CubicConservationLaw.CubicEquation) = SVector(sinpi(x[1]))\n\nmesh = TreeMesh(-1.0, 1.0, # min/max coordinates\n initial_refinement_level=4,\n n_cells_max=10^4)\n\nsolver = DGSEM(3 #= polynomial degree =#, flux_central)\n\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\n# Create ODE problem with given time span\ntspan = (0.0, 0.1)\node = semidiscretize(semi, tspan)\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)\n\n\n# A new setup with dissipation\nsemi = remake(semi, solver=DGSEM(3, flux_godunov))\node = semidiscretize(semi, tspan)\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot!(sol)\n\n\n# A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12)\nsemi = remake(semi, mesh=TreeMesh(-1.0, 1.0, initial_refinement_level=8, n_cells_max=10^5))\node = semidiscretize(semi, (0.0, 0.5))\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)\n\n\n# Let's use a provably entropy-dissipative semidiscretization\nsemi = remake(semi, solver=DGSEM(3, flux_godunov, VolumeIntegralFluxDifferencing(flux_ec)))\node = semidiscretize(semi, (0.0, 0.5))\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Package-versions","page":"10 Adding a new scalar conservation law","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"This page was generated using Literate.jl.","category":"page"},{"location":"time_integration/#time-integration","page":"Time integration","title":"Time integration methods","text":"","category":"section"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, explicit Runge-Kutta methods from OrdinaryDiffEq.jl are tested extensively. Interesting classes of time integration schemes are","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"Explicit low-storage Runge-Kutta methods\nStrong stability preserving methods","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"Some common options for solve from OrdinaryDiffEq.jl are the following. Further documentation can be found in the SciML docs.","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"If you use a fixed time step method like CarpenterKennedy2N54, you need to pass a time step as dt=.... If you use a StepsizeCallback, the value passed as dt=... is irrelevant since it will be overwritten by the StepsizeCallback. If you want to use an adaptive time step method such as SSPRK43 or RDPK3SpFSAL49 and still want to use CFL-based step size control via the StepsizeCallback, you need to pass the keyword argument adaptive=false to solve.\nYou should usually set save_everystep=false. Otherwise, OrdinaryDiffEq.jl will (try to) save the numerical solution after every time step in RAM (until you run out of memory or start to swap).\nYou can set the maximal number of time steps via maxiters=....\nSSP methods and many low-storage methods from OrdinaryDiffEq.jl support stage_limiter!s and step_limiter!s, e.g., PositivityPreservingLimiterZhangShu from Trixi.jl.\nIf you start Julia with multiple threads and want to use them also in the time integration method from OrdinaryDiffEq.jl, you need to pass the keyword argument thread=OrdinaryDiffEq.True() to the algorithm, e.g., RDPK3SpFSAL49(thread=OrdinaryDiffEq.True()) or CarpenterKennedy2N54(thread=OrdinaryDiffEq.True(), williamson_condition=false). For more information on using thread-based parallelism in Trixi.jl, please refer to Shared-memory parallelization with threads.\nIf you use error-based step size control (see also the section on error-based adaptive step sizes together with MPI, you need to pass internalnorm=ode_norm and you should pass unstable_check=ode_unstable_check to OrdinaryDiffEq's solve, which are both included in ode_default_options.","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"note: Number of `rhs!` calls\nIf you use explicit Runge-Kutta methods from OrdinaryDiffEq.jl, the total number of rhs! calls can be (slightly) bigger than the number of steps times the number of stages, e.g. to allow for interpolation (dense output), root-finding for continuous callbacks, and error-based time step control. In general, you often should not need to worry about this if you use Trixi.jl.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"EditURL = \"../../../literate/src/files/first_steps/getting_started.jl\"","category":"page"},{"location":"tutorials/first_steps/getting_started/#getting_started","page":"1.1 Getting started","title":"1.1: First steps in Trixi.jl: Getting started","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Trixi.jl is a numerical simulation framework for conservation laws and is written in the Julia programming language. This tutorial is intended for beginners in Julia and Trixi.jl. After reading it, you will know how to install Julia and Trixi.jl on your computer, and you will be able to download setup files from our GitHub repository, modify them, and run simulations.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"The contents of this tutorial:","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Julia installation\nTrixi.jl installation\nRunning a simulation\nGetting an existing setup file\nModifying an existing setup","category":"page"},{"location":"tutorials/first_steps/getting_started/#Julia-installation","page":"1.1 Getting started","title":"Julia installation","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Trixi.jl is compatible with the latest stable release of Julia. Additional details regarding Julia support can be found in the README.md file. The current default Julia installation is managed through juliaup. You may follow our concise installation guidelines for Windows, Linux, and MacOS provided below. In the event of any issues during the installation process, please consult the official Julia installation instruction.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Windows","page":"1.1 Getting started","title":"Windows","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Open a terminal by pressing Win+r and entering cmd in the opened window.\nTo install Julia, execute the following command in the terminal:\nwinget install julia -s msstore\nVerify the successful installation of Julia by executing the following command in the terminal:\njulia\nTo exit Julia, execute exit() or press Ctrl+d.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Linux-and-MacOS","page":"1.1 Getting started","title":"Linux and MacOS","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To install Julia, run the following command in a terminal:\ncurl -fsSL https://install.julialang.org | sh\nFollow the instructions displayed in the terminal during the installation process.\nIf an error occurs during the execution of the previous command, you may need to install curl. On Ubuntu-type systems, you can use the following command:\nsudo apt install curl\nAfter installing curl, repeat the first step once more to proceed with Julia installation.\nVerify the successful installation of Julia by executing the following command in the terminal:\njulia\nTo exit Julia, execute exit() or press Ctrl+d.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Trixi.jl-installation","page":"1.1 Getting started","title":"Trixi.jl installation","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Trixi.jl and its related tools are registered Julia packages, thus their installation happens inside Julia. For a smooth workflow experience with Trixi.jl, you need to install Trixi.jl, OrdinaryDiffEq.jl, and Plots.jl.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Open a terminal and start Julia.\nExecute following commands:\nimport Pkg\nPkg.add([\"OrdinaryDiffEq\", \"Plots\", \"Trixi\"])","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Now you have installed all these packages. OrdinaryDiffEq.jl provides time integration schemes used by Trixi.jl and Plots.jl can be used to directly visualize Trixi.jl results from the Julia REPL.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Usage","page":"1.1 Getting started","title":"Usage","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/#Running-a-simulation","page":"1.1 Getting started","title":"Running a simulation","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To get you started, Trixi.jl has a large set of example setups, that can be taken as a basis for your future investigations. In Trixi.jl, we call these setup files \"elixirs\", since they contain Julia code that takes parts of Trixi.jl and combines them into something new.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Any of the examples can be executed using the trixi_include function. trixi_include(...) expects a single string argument with a path to a file containing Julia code. For convenience, the examples_dir function returns a path to the examples folder, which has been locally downloaded while installing Trixi.jl. joinpath(...) can be used to join path components into a full path.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Let's execute a short two-dimensional problem setup. It approximates the solution of the compressible Euler equations in 2D for an ideal gas (CompressibleEulerEquations2D) with a weak blast wave as the initial condition.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Start Julia in a terminal and execute the following code:","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"using Trixi, OrdinaryDiffEq\ntrixi_include(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_ec.jl\"))","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"using Trixi, OrdinaryDiffEq #hide\ntrixi_include(@__MODULE__,joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_ec.jl\")) #hide","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To analyze the result of the computation, we can use the Plots.jl package and the function plot(...), which creates a graphical representation of the solution. sol is a variable defined in the executed example and it contains the solution at the final moment of the simulation.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To obtain a list of all Trixi.jl elixirs execute get_examples. It returns the paths to all example setups.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"get_examples()","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Editing an existing elixir is the best way to start your first own investigation using Trixi.jl.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Getting-an-existing-setup-file","page":"1.1 Getting started","title":"Getting an existing setup file","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To edit an existing elixir, you first have to find a suitable one and then copy it to a local folder. Let's have a look at how to download the elixir_euler_ec.jl elixir used in the previous section from the Trixi.jl GitHub repository.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"All examples are located inside the examples folder.\nNavigate to the file elixir_euler_ec.jl.\nRight-click the Raw button on the right side of the webpage and choose Save as... (or Save Link As...).\nChoose a folder and save the file.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Modifying-an-existing-setup","page":"1.1 Getting started","title":"Modifying an existing setup","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"As an example, we will change the initial condition for calculations that occur in elixir_euler_ec.jl. In this example we consider the compressible Euler equations in two spatial dimensions,","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"fracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1 rho v_1^2 + p rho v_1 v_2 (rho e + p) v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + p (rho e + p) v_2\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0\nendpmatrix","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"for an ideal gas with the specific heat ratio gamma. Here, rho is the density, v_1 and v_2 are the velocities, e is the specific total energy, and","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"p = (gamma - 1) left( rho e - frac12 rho (v_1^2 + v_2^2) right)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"is the pressure. Initial conditions consist of initial values for rho, rho v_1, rho v_2 and rho e. One of the common initial conditions for the compressible Euler equations is a simple density wave. Let's implement it.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Open the downloaded file elixir_euler_ec.jl with a text editor.\nGo to the line with the following code:\ninitial_condition = initial_condition_weak_blast_wave\nHere, initial_condition_weak_blast_wave is used as the initial condition.\nComment out the line using the # symbol:\n# initial_condition = initial_condition_weak_blast_wave\nNow you can create your own initial conditions. Add the following code after the commented line:","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"function initial_condition_density_waves(x, t, equations::CompressibleEulerEquations2D)\n v1 = 0.1 # velocity along x-axis\n v2 = 0.2 # velocity along y-axis\n rho = 1.0 + 0.98 * sinpi(sum(x) - t * (v1 + v2)) # density wave profile\n p = 20 # pressure\n rho_e = p / (equations.gamma - 1) + 1/2 * rho * (v1^2 + v2^2)\n return SVector(rho, rho*v1, rho*v2, rho_e)\nend\ninitial_condition = initial_condition_density_waves","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Execute the following code one more time, but instead of path/to/file paste the path to the elixir_euler_ec.jl file that you just edited.\nusing Trixi\ntrixi_include(path/to/file)\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Then you will obtain a new solution from running the simulation with a different initial condition.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"trixi_include(@__MODULE__,joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_ec.jl\"), #hide\n initial_condition=initial_condition) #hide\npd = PlotData2D(sol) #hide\np1 = plot(pd[\"rho\"]) #hide\np2 = plot(pd[\"v1\"], clim=(0.05, 0.15)) #hide\np3 = plot(pd[\"v2\"], clim=(0.15, 0.25)) #hide\np4 = plot(pd[\"p\"], clim=(10, 30)) #hide\nplot(p1, p2, p3, p4) #hide","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To get exactly the same picture execute the following.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"pd = PlotData2D(sol)\np1 = plot(pd[\"rho\"])\np2 = plot(pd[\"v1\"], clim=(0.05, 0.15))\np3 = plot(pd[\"v2\"], clim=(0.15, 0.25))\np4 = plot(pd[\"p\"], clim=(10, 30))\nplot(p1, p2, p3, p4)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Feel free to make further changes to the initial condition to observe different solutions.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Now you are able to download, modify and execute simulation setups for Trixi.jl. To explore further details on setting up a new simulation with Trixi.jl, refer to the second part of the introduction titled Create first setup.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Sys.rm(\"out\"; recursive=true, force=true) #hide","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"EditURL = \"../../literate/src/files/upwind_fdsbp.jl\"","category":"page"},{"location":"tutorials/upwind_fdsbp/#upwind_fdsbp","page":"9 Upwind FD SBP schemes","title":"9: Upwind FD SBP schemes","text":"","category":"section"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"General tensor product SBP methods are supported via the DGMulti solver in a reasonably complete way, see the previous tutorial. Nevertheless, there is also experimental support for SBP methods with other solver and mesh types.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"The first step is to set up an SBP operator. A classical (central) SBP operator can be created as follows.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"using Trixi\nD_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),\n derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Instead of prefixing the source of coefficients MattssonNordström2004(), you can also load the package SummationByPartsOperators.jl. Either way, this yields an object representing the operator efficiently. If you want to compare it to coefficients presented in the literature, you can convert it to a matrix.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Matrix(D_SBP)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Upwind SBP operators are a concept introduced in 2017 by Ken Mattsson. You can create them as follows.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,\n derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Upwind operators are derivative operators biased towards one direction. The \"minus\" variants has a bias towards the left side, i.e., it uses values from more nodes to the left than from the right to compute the discrete derivative approximation at a given node (in the interior of the domain). In matrix form, this means more non-zero entries are left from the diagonal.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Matrix(D_upw.minus)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Analogously, the \"plus\" variant has a bias towards the right side.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Matrix(D_upw.plus)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"For more information on upwind SBP operators, please refer to the documentation of SummationByPartsOperators.jl and references cited there.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"The basic idea of upwind SBP schemes is to apply a flux vector splitting and use appropriate upwind operators for both parts of the flux. In 1D, this means to split the flux","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"f(u) = f^-(u) + f^+(u)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"such that f^-(u) is associated with left-going waves and f^+(u) with right-going waves. Then, we apply upwind SBP operators D^- D^+ with an appropriate upwind bias, resulting in","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"partial_x f(u) approx D^+ f^-(u) + D^- f^+(u)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Note that the established notations of upwind operators D^pm and flux splittings f^pm clash. The right-going waves from f^+ need an operator biased towards their upwind side, i.e., the left side. This upwind bias is provided by the operator D^-.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Many classical flux vector splittings have been developed for finite volume methods and are described in the book \"Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction\" of Eleuterio F. Toro (2009), DOI: 10.1007/b79761. One such a well-known splitting provided by Trixi.jl is splitting_steger_warming.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Trixi.jl comes with several example setups using upwind SBP methods with flux vector splitting, e.g.,","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"elixir_euler_vortex.jl\nelixir_euler_taylor_green_vortex.jl","category":"page"},{"location":"tutorials/upwind_fdsbp/#Package-versions","page":"9 Upwind FD SBP schemes","title":"Package versions","text":"","category":"section"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"SummationByPartsOperators\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"EditURL = \"../../literate/src/files/hohqmesh_tutorial.jl\"","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#hohqmesh_tutorial","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16: Unstructured meshes with HOHQMesh.jl","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Trixi.jl supports numerical approximations on unstructured quadrilateral meshes with the UnstructuredMesh2D mesh type.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The purpose of this tutorial is to demonstrate how to use the UnstructuredMesh2D functionality of Trixi.jl. This begins by running and visualizing an available unstructured quadrilateral mesh example. Then, the tutorial will demonstrate how to conceptualize a problem with curved boundaries, generate a curvilinear mesh using the available software in the Trixi.jl ecosystem, and then run a simulation using Trixi.jl on said mesh.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Unstructured quadrilateral meshes can be made with the High-Order Hex-Quad Mesh (HOHQMesh) generator created and developed by David Kopriva. HOHQMesh is a mesh generator specifically designed for spectral element methods. It provides high-order boundary curve information (needed to accurately set boundary conditions) and elements can be larger (due to the high accuracy of the spatial approximation) compared to traditional finite element mesh generators. For more information about the design and features of HOHQMesh one can refer to its official documentation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"HOHQMesh is incorporated into the Trixi.jl framework via the registered Julia package HOHQMesh.jl. This package provides a Julia wrapper for the HOHQMesh generator that allows users to easily create mesh files without the need to build HOHQMesh from source. To install the HOHQMesh package execute","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"import Pkg; Pkg.add(\"HOHQMesh\")","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Now we are ready to generate an unstructured quadrilateral mesh that can be used by Trixi.jl.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Running-and-visualizing-an-unstructured-simulation","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Running and visualizing an unstructured simulation","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Trixi.jl supports solving hyperbolic problems on several mesh types. There is a default example for this mesh type that can be executed by","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using Trixi\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi_include(default_example_unstructured())\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This will compute a smooth, manufactured solution test case for the 2D compressible Euler equations on the curved quadrilateral mesh described in the Trixi.jl documentation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"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 unstructured quadrilateral meshes is post-processing the Trixi.jl output file(s) with the Trixi2Vtk tool and plotting them with ParaView.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"To convert the HDF5-formatted .h5 output file(s) from Trixi.jl into VTK format execute the following","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using Trixi2Vtk\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi2vtk(\"out/solution_000180.h5\", output_directory=\"out\")\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Note this step takes about 15-30 seconds as the package Trixi2Vtk must be precompiled and executed for the first time in your REPL session. The trixi2vtk command above will convert the solution file at the final time into a .vtu file which can be read in and visualized with ParaView. Optional arguments for trixi2vtk are: (1) Pointing to the output_directory where the new files will be saved; it defaults to the current directory. (2) Specifying a higher number of visualization nodes. For instance, if we want to use 12 uniformly spaced nodes for visualization we can execute","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"redirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi2vtk(\"out/solution_000180.h5\", output_directory=\"out\", nvisnodes=12)\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"By default trixi2vtk sets nvisnodes to be the same as the number of nodes specified in the elixir file used to run the simulation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Finally, if you want to convert all the solution files to VTK execute","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"redirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi2vtk(\"out/solution_000*.h5\", output_directory=\"out\", nvisnodes=12)\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"then it is possible to open the .pvd file with ParaView and create a video of the simulation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Creating-a-mesh-using-HOHQMesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Creating a mesh using HOHQMesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The creation of an unstructured quadrilateral mesh using HOHQMesh.jl is driven by a control file. In this file the user dictates the domain to be meshed, prescribes any desired boundary curvature, the polynomial order of said boundaries, etc. In this tutorial we cover several basic features of the possible control inputs. For a complete discussion on this topic see the HOHQMesh control file documentation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"To begin, we provide a complete control file in this tutorial. After this we give a breakdown of the control file components to explain the chosen parameters.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Suppose we want to create a mesh of a domain with straight sided outer boundaries and a curvilinear \"ice cream cone\" shaped object at its center.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: mesh_boundary_cartoon)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The associated ice_cream_straight_sides.control file is created below.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"open(\"out/ice_cream_straight_sides.control\", \"w\") do io\n println(io, raw\"\"\"\n\\begin{CONTROL_INPUT}\n \\begin{RUN_PARAMETERS}\n mesh file name = ice_cream_straight_sides.mesh\n plot file name = ice_cream_straight_sides.tec\n stats file name = none\n mesh file format = ISM-v2\n polynomial order = 4\n plot file format = skeleton\n \\end{RUN_PARAMETERS}\n\n \\begin{BACKGROUND_GRID}\n x0 = [-8.0, -8.0, 0.0]\n dx = [1.0, 1.0, 0.0]\n N = [16,16,1]\n \\end{BACKGROUND_GRID}\n\n \\begin{SPRING_SMOOTHER}\n smoothing = ON\n smoothing type = LinearAndCrossBarSpring\n number of iterations = 25\n \\end{SPRING_SMOOTHER}\n\n\\end{CONTROL_INPUT}\n\n\\begin{MODEL}\n\n \\begin{INNER_BOUNDARIES}\n\n \\begin{CHAIN}\n name = IceCreamCone\n \\begin{END_POINTS_LINE}\n name = LeftSlant\n xStart = [-2.0, 1.0, 0.0]\n xEnd = [ 0.0, -3.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{END_POINTS_LINE}\n name = RightSlant\n xStart = [ 0.0, -3.0, 0.0]\n xEnd = [ 2.0, 1.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{CIRCULAR_ARC}\n name = IceCream\n units = degrees\n center = [ 0.0, 1.0, 0.0]\n radius = 2.0\n start angle = 0.0\n end angle = 180.0\n \\end{CIRCULAR_ARC}\n \\end{CHAIN}\n\n \\end{INNER_BOUNDARIES}\n\n\\end{MODEL}\n\\end{FILE}\n\"\"\")\nend","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The first three blocks of information are wrapped within a CONTROL_INPUT environment block as they define the core components of the quadrilateral mesh that will be generated.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The first block of information in RUN_PARAMETERS is","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{RUN_PARAMETERS}\n mesh file name = ice_cream_straight_sides.mesh\n plot file name = ice_cream_straight_sides.tec\n stats file name = none\n mesh file format = ISM-v2\n polynomial order = 4\n plot file format = skeleton\n\\end{RUN_PARAMETERS}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The mesh and plot file names will be the files created by HOHQMesh once successfully executed. The stats file name is 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.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.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The second block of information in BACKGROUND_GRID is","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{BACKGROUND_GRID}\n x0 = [-8.0, -8.0, 0.0]\n dx = [1.0, 1.0, 0.0]\n N = [16,16,1]\n\\end{BACKGROUND_GRID}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This lays a grid of Cartesian elements for the domain beginning at the point x0 as its bottom-left corner. The value of dx, which could differ in each direction if desired, controls the step size taken in each Cartesian direction. The values in N set how many Cartesian box elements are set in each coordinate direction. The above parameters define a 16times 16 element square mesh on -88^2. Further, this sets up four outer boundaries of the domain that are given the default names: Top, Left, Bottom, Right.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The third block of information in SPRING_SMOOTHER is","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{SPRING_SMOOTHER}\n smoothing = ON\n smoothing type = LinearAndCrossBarSpring\n number of iterations = 25\n\\end{SPRING_SMOOTHER}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Once HOHQMesh generates the mesh, a spring-mass-dashpot model is created to smooth the mesh and create \"nicer\" quadrilateral elements. The default parameters of Hooke's law for the spring-mass-dashpot model have been selected after a fair amount of experimentation across many meshes. If you wish to deactivate this feature you can set smoothing = OFF (or remove this block from the control file).","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"After the CONTROL_INPUT environment block comes the MODEL environment block. It is here where the user prescribes curved boundary information with either:","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"An OUTER_BOUNDARY (covered in the next section of this tutorial).\nOne or more INNER_BOUNDARIES.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"There are several options to describe the boundary curve data to HOHQMesh like splines or parametric curves.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"For the example ice_cream_straight_sides.control we define three internal boundaries; two straight-sided and one as a circular arc. Within the HOHQMesh control input each curve must be assigned to a CHAIN as shown below in the complete INNER_BOUNDARIES block.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{INNER_BOUNDARIES}\n\n \\begin{CHAIN}\n name = IceCreamCone\n \\begin{END_POINTS_LINE}\n name = LeftSlant\n xStart = [-2.0, 1.0, 0.0]\n xEnd = [ 0.0, -3.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{END_POINTS_LINE}\n name = RightSlant\n xStart = [ 0.0, -3.0, 0.0]\n xEnd = [ 2.0, 1.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{CIRCULAR_ARC}\n name = IceCream\n units = degrees\n center = [ 0.0, 1.0, 0.0]\n radius = 2.0\n start angle = 0.0\n end angle = 180.0\n \\end{CIRCULAR_ARC}\n \\end{CHAIN}\n\n\\end{INNER_BOUNDARIES}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"It is important to note there are two name quantities one for the CHAIN and one for the PARAMETRIC_EQUATION_CURVE. The name for the CHAIN is used internally by HOHQMesh, so if you have multiple CHAINs they must be given a unique name. The name for the PARAMETRIC_EQUATION_CURVE will be printed to the appropriate boundaries within the .mesh file produced by HOHQMesh.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We create the mesh file ice_cream_straight_sides.mesh and its associated file for plotting ice_cream_straight_sides.tec by using HOHQMesh.jl's function generate_mesh.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using HOHQMesh\ncontrol_file = joinpath(\"out\", \"ice_cream_straight_sides.control\")\noutput = generate_mesh(control_file);\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The mesh file ice_cream_straight_sides.mesh and its associated file for plotting ice_cream_straight_sides.tec are placed in the out folder. The resulting mesh generated by HOHQMesh.jl is given in the following figure.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: mesh_straight_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We note that Trixi.jl uses the boundary name information from the control file to assign boundary conditions in an elixir file. Therefore, the name should start with a letter and consist only of alphanumeric characters and underscores. Please note that the name will be treated as case sensitive.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Example-simulation-on-ice_cream_straight_sides.mesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Example simulation on ice_cream_straight_sides.mesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"With this newly generated mesh we are ready to run a Trixi.jl simulation on an unstructured quadrilateral mesh. For this we must create a new elixir file.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The elixir file given below creates an initial condition for a uniform background flow state with a free stream Mach number of 0.3. A focus for this part of the tutorial is to specify the boundary conditions and to construct the new mesh from the file that was generated in the previous exercise.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"It is straightforward to set the different boundary condition types in an elixir by assigning a particular function to a boundary name inside a Julia dictionary, Dict, variable. Observe that the names of these boundaries match those provided by HOHQMesh either by default, e.g. Bottom, or user assigned, e.g. IceCream. For this problem setup use","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Freestream boundary conditions on the four box edges.\nFree slip wall boundary condition on the interior curved boundaries.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"To construct the unstructured quadrilateral mesh from the HOHQMesh file we point to the appropriate location with the variable mesh_file and then feed this into the constructor for the UnstructuredMesh2D type in Trixi.jl","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"# create the unstructured mesh from your mesh file\nusing Trixi\nmesh_file = joinpath(\"out\", \"ice_cream_straight_sides.mesh\")\nmesh = UnstructuredMesh2D(mesh_file);","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The complete elixir file for this simulation example is given below.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using OrdinaryDiffEq, Trixi\n\nequations = CompressibleEulerEquations2D(1.4) # set gas gamma = 1.4\n\n# freestream flow state with Ma_inf = 0.3\n@inline function uniform_flow_state(x, t, equations::CompressibleEulerEquations2D)\n\n # set the freestream flow parameters\n rho_freestream = 1.0\n u_freestream = 0.3\n p_freestream = inv(equations.gamma)\n\n theta = 0.0 # zero angle of attack\n si, co = sincos(theta)\n v1 = u_freestream * co\n v2 = u_freestream * si\n\n prim = SVector(rho_freestream, v1, v2, p_freestream)\n return prim2cons(prim, equations)\nend\n\n# initial condition\ninitial_condition = uniform_flow_state\n\n# boundary condition types\nboundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state)\n\n# boundary condition dictionary\nboundary_conditions = Dict( :Bottom => boundary_condition_uniform_flow,\n :Top => boundary_condition_uniform_flow,\n :Right => boundary_condition_uniform_flow,\n :Left => boundary_condition_uniform_flow,\n :LeftSlant => boundary_condition_slip_wall,\n :RightSlant => boundary_condition_slip_wall,\n :IceCream => boundary_condition_slip_wall );\n\n# DGSEM solver.\n# 1) polydeg must be >= the polynomial order set in the HOHQMesh control file to guarantee\n# freestream preservation. As a extra task try setting polydeg=3\n# 2) VolumeIntegralFluxDifferencing with central volume flux is activated\n# for dealiasing\nvolume_flux = flux_ranocha\nsolver = DGSEM(polydeg=4, surface_flux=flux_hll,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\n# create the unstructured mesh from your mesh file\nmesh_file = joinpath(\"out\", \"ice_cream_straight_sides.mesh\")\nmesh = UnstructuredMesh2D(mesh_file)\n\n# Create semidiscretization with all spatial discretization-related components\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_conditions)\n\n# Create ODE problem from semidiscretization with time span from 0.0 to 2.0\ntspan = (0.0, 2.0)\node = semidiscretize(semi, tspan)\n\n\n# Create the callbacks to output solution files and adapt the time step\nsummary_callback = SummaryCallback()\nsave_solution = SaveSolutionCallback(interval=10,\n save_initial_solution=true,\n save_final_solution=true)\nstepsize_callback = StepsizeCallback(cfl=1.0)\n\ncallbacks = CallbackSet(summary_callback, save_solution, stepsize_callback)\n\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\n# Evolve ODE problem in time using `solve` from OrdinaryDiffEq\nsol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\n# print the timer summary\nsummary_callback()\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Visualization of the solution is carried out in a similar way as above. That is, one converts the .h5 output files with trixi2vtk and then plot the solution in ParaView. An example plot of the pressure at the final time is shown below.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: simulation_straight_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Making-a-mesh-with-a-curved-outer-boundary","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Making a mesh with a curved outer boundary","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Let us modify the mesh from the previous task and place a circular outer boundary instead of straight-sided outer boundaries. Note, the \"ice cream cone\" shape is still placed at the center of the domain.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We create the new control file ice_cream_curved_sides.control file below and will then highlight the major differences compared to ice_cream_straight_sides.control.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"open(\"out/ice_cream_curved_sides.control\", \"w\") do io\n println(io, raw\"\"\"\n\\begin{CONTROL_INPUT}\n \\begin{RUN_PARAMETERS}\n mesh file name = ice_cream_curved_sides.mesh\n plot file name = ice_cream_curved_sides.tec\n stats file name = none\n mesh file format = ISM-v2\n polynomial order = 4\n plot file format = skeleton\n \\end{RUN_PARAMETERS}\n\n \\begin{BACKGROUND_GRID}\n background grid size = [1.0, 1.0, 0.0]\n \\end{BACKGROUND_GRID}\n\n \\begin{SPRING_SMOOTHER}\n smoothing = ON\n smoothing type = LinearAndCrossBarSpring\n number of iterations = 25\n \\end{SPRING_SMOOTHER}\n\n\\end{CONTROL_INPUT}\n\n\\begin{MODEL}\n\n \\begin{OUTER_BOUNDARY}\n \\begin{PARAMETRIC_EQUATION_CURVE}\n name = OuterCircle\n xEqn = x(t) = 8.0*sin(2.0*pi*t)\n yEqn = y(t) = 8.0*cos(2.0*pi*t)\n zEqn = z(t) = 0.0\n \\end{PARAMETRIC_EQUATION_CURVE}\n\n \\end{OUTER_BOUNDARY}\n\n \\begin{INNER_BOUNDARIES}\n\n \\begin{CHAIN}\n name = IceCreamCone\n \\begin{END_POINTS_LINE}\n name = LeftSlant\n xStart = [-2.0, 1.0, 0.0]\n xEnd = [ 0.0, -3.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{END_POINTS_LINE}\n name = RightSlant\n xStart = [ 0.0, -3.0, 0.0]\n xEnd = [ 2.0, 1.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{CIRCULAR_ARC}\n name = IceCream\n units = degrees\n center = [ 0.0, 1.0, 0.0]\n radius = 2.0\n start angle = 0.0\n end angle = 180.0\n \\end{CIRCULAR_ARC}\n \\end{CHAIN}\n\n \\end{INNER_BOUNDARIES}\n\n\\end{MODEL}\n\\end{FILE}\n\"\"\")\nend","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The first alteration is that we have altered the second block of information BACKGROUND_GRID within the CONTROL_INPUT to be","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{BACKGROUND_GRID}\n background grid size = [1.0, 1.0, 0.0]\n\\end{BACKGROUND_GRID}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This mesh control file has an outer boundary that determines the extent of the domain to be meshed. Therefore, we only need to supply the background grid size to the BACKGROUND_GRID control input.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The second alteration is that the MODEL now contains information for an OUTER_BOUNDARY. In this case it is a circle of radius 8 centered at [0.0, 0.0, 0.0] written as a set of PARAMETRIC_EQUATION_CURVEs.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":" \\begin{OUTER_BOUNDARY}\n\n \\begin{PARAMETRIC_EQUATION_CURVE}\n name = OuterCircle\n xEqn = x(t) = 8.0*sin(2.0*pi*t)\n yEqn = y(t) = 8.0*cos(2.0*pi*t)\n zEqn = z(t) = 0.0\n \\end{PARAMETRIC_EQUATION_CURVE}\n\n \\end{OUTER_BOUNDARY}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Just as with the inner boundary curves, we must assign a name to the OUTER_BOUNDARY. It will be included in the generated .mesh file and is used within the Trixi.jl elixir file to set boundary conditions.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Again, we create the .mesh and .tec files with HOHQMesh.jl's function generate_mesh","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"control_file = joinpath(\"out\", \"ice_cream_curved_sides.control\")\noutput = generate_mesh(control_file);\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The files are placed in the out folder.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The resulting mesh generated by HOHQMesh.jl is given in the following figure.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: mesh_curved_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Running-Trixi.jl-on-ice_cream_curved_sides.mesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Running Trixi.jl on ice_cream_curved_sides.mesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"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 OuterCircle instead of four edges of a bounding box.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"# boundary condition dictionary\nboundary_conditions = Dict( :OuterCircle => boundary_condition_uniform_flow,\n :LeftSlant => boundary_condition_slip_wall,\n :RightSlant => boundary_condition_slip_wall,\n :IceCream => boundary_condition_slip_wall );\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Also, we must update the construction of the mesh from our new mesh file ice_cream_curved_sides.mesh that is located in the out folder.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"# create the unstructured mesh from your mesh file\nmesh_file = joinpath(\"out\", \"ice_cream_curved_sides.mesh\")\nmesh = UnstructuredMesh2D(mesh_file);\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We can then post-process the solution file at the final time on the new mesh with Trixi2Vtk and visualize with ParaView.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: simulation_curved_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Setting-up-a-simulation-with-AMR-via-P4estMesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Setting up a simulation with AMR via P4estMesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The above explained mesh file format of ISM-V2 only works with UnstructuredMesh2D and so does not support AMR. On the other hand, the mesh type P4estMesh allows AMR. The mesh constructor for the P4estMesh imports an unstructured, conforming mesh from an Abaqus mesh file (.inp).","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"As described above, the first block of the HOHQMesh control file contains the parameter mesh file format. If you set mesh file format = ABAQUS instead of ISM-V2, HOHQMesh.jl's function generate_mesh creates an Abaqus mesh file .inp.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using HOHQMesh\ncontrol_file = joinpath(\"out\", \"ice_cream_straight_sides.control\")\noutput = generate_mesh(control_file);","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Now, you can create a P4estMesh from your mesh file. It is described in detail in the P4est-based mesh part of the Trixi.jl docs.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using Trixi\nmesh_file = joinpath(\"out\", \"ice_cream_straight_sides.inp\")\nmesh = P4estMesh{2}(mesh_file)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"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.jl, see the matching tutorial.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"amr_indicator = IndicatorLöhner(semi, variable=density)\n\namr_controller = ControllerThreeLevel(semi, amr_indicator,\n base_level=0,\n med_level =1, med_threshold=0.05,\n max_level =3, max_threshold=0.1)\n\namr_callback = AMRCallback(semi, amr_controller,\n interval=5,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true)\n\ncallbacks = CallbackSet(..., amr_callback)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We can then post-process the solution file at the final time on the new mesh with Trixi2Vtk and visualize with ParaView, see the appropriate visualization section for details.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: simulation_straight_sides_p4est_amr)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Package-versions","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Package versions","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\", \"Trixi2Vtk\", \"HOHQMesh\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"EditURL = \"../../literate/src/files/DGMulti_2.jl\"","category":"page"},{"location":"tutorials/DGMulti_2/#DGMulti_2","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8: Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"","category":"section"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"For a tutorial about DG schemes via the DGMulti solver please visit the previous tutorial. The DGMulti solver also supports other methods than DG. The important property a method has to fulfill is the summation-by-parts (SBP) property. The package SummationByPartsOperators.jl provides such methods, like a finite difference SBP (FD SBP) scheme. To do this, you need to create an SBP derivative operator and pass that as approximation_type to the DGMulti constructor. For example, the classical second-order FD SBP operator can be created as","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly\nD = derivative_operator(MattssonNordström2004(), derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"Here, the arguments xmin and xmax do not matter beyond setting the real type used for the operator - they just set a reference element and are rescaled on the physical elements. The parameter N determines the number of finite difference nodes. Then, D can be used as approximation_type like SBP() in a multi-block fashion. In multiple dimensions, such a 1D SBP operator will be used in a tensor product fashion, i.e., in each coordinate direction. In particular, you can use them only on 1D, 2D Quad(), and 3D Hex() elements.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"You can also use fully periodic single-block FD methods by creating a periodic SBP operator. For example, a fully periodic FD operator can be constructed as","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"D = periodic_derivative_operator(derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"An example using such an FD method is implemented in elixir_euler_fdsbp_periodic.jl. For all parameters and other calling options, please have a look in the documentation of SummationByPartsOperators.jl.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"Another possible method is for instance a continuous Galerkin (CGSEM) method. You can use such a method with polynomial degree of 3 (N=4 Legendre Lobatto nodes on [0, 1]) coupled continuously on a uniform mesh with Nx=10 elements by setting approximation_type to","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly\nD = couple_continuously(legendre_derivative_operator(xmin=0.0, xmax=1.0, N=4),\n UniformPeriodicMesh1D(xmin=-1.0, xmax=1.0, Nx=10))","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"To choose a discontinuous coupling (DGSEM), use couple_discontinuously() instead of couple_continuously().","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"For more information and other SBP operators, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.","category":"page"},{"location":"tutorials/DGMulti_2/#Package-versions","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"Package versions","text":"","category":"section"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"StartUpDG\", \"SummationByPartsOperators\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"EditURL = \"../../literate/src/files/parabolic_terms.jl\"","category":"page"},{"location":"tutorials/parabolic_terms/#parabolic_terms","page":"12 Parabolic terms","title":"12: Parabolic terms","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"Experimental support for parabolic diffusion terms is available in Trixi.jl. This demo illustrates parabolic terms for the advection-diffusion equation.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"using OrdinaryDiffEq\nusing Trixi","category":"page"},{"location":"tutorials/parabolic_terms/#Splitting-a-system-into-hyperbolic-and-parabolic-parts.","page":"12 Parabolic terms","title":"Splitting a system into hyperbolic and parabolic parts.","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"For a mixed hyperbolic-parabolic system, we represent the hyperbolic and parabolic parts of the system separately. We first define the hyperbolic (advection) part of the advection-diffusion equation.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"advection_velocity = (1.5, 1.0)\nequations_hyperbolic = LinearScalarAdvectionEquation2D(advection_velocity);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"Next, we define the parabolic diffusion term. The constructor requires knowledge of equations_hyperbolic to be passed in because the LaplaceDiffusion2D applies diffusion to every variable of the hyperbolic system.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"diffusivity = 5.0e-2\nequations_parabolic = LaplaceDiffusion2D(diffusivity, equations_hyperbolic);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/#Boundary-conditions","page":"12 Parabolic terms","title":"Boundary conditions","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"As with the equations, we define boundary conditions separately for the hyperbolic and parabolic part of the system. For this example, we impose inflow BCs for the hyperbolic system (no condition is imposed on the outflow), and we impose Dirichlet boundary conditions for the parabolic equations. Both BoundaryConditionDirichlet and BoundaryConditionNeumann are defined for LaplaceDiffusion2D.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"The hyperbolic and parabolic boundary conditions are assumed to be consistent with each other.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"boundary_condition_zero_dirichlet = BoundaryConditionDirichlet((x, t, equations) -> SVector(0.0))\n\nboundary_conditions_hyperbolic = (; x_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 + 0.5 * x[2])),\n y_neg = boundary_condition_zero_dirichlet,\n y_pos = boundary_condition_do_nothing,\n x_pos = boundary_condition_do_nothing)\n\nboundary_conditions_parabolic = (; x_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 + 0.5 * x[2])),\n y_neg = boundary_condition_zero_dirichlet,\n y_pos = boundary_condition_zero_dirichlet,\n x_pos = boundary_condition_zero_dirichlet);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/#Defining-the-solver-and-mesh","page":"12 Parabolic terms","title":"Defining the solver and mesh","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"The process of creating the DG solver and mesh is the same as for a purely hyperbolic system of equations.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\ncoordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))\ncoordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n periodicity=false, n_cells_max=30_000) # set maximum capacity of tree data structure\n\ninitial_condition = (x, t, equations) -> SVector(0.0);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/#Semidiscretizing-and-solving","page":"12 Parabolic terms","title":"Semidiscretizing and solving","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"To semidiscretize a hyperbolic-parabolic system, we create a SemidiscretizationHyperbolicParabolic. This differs from a SemidiscretizationHyperbolic in that we pass in a Tuple containing both the hyperbolic and parabolic equation, as well as a Tuple containing the hyperbolic and parabolic boundary conditions.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"semi = SemidiscretizationHyperbolicParabolic(mesh,\n (equations_hyperbolic, equations_parabolic),\n initial_condition, solver;\n boundary_conditions=(boundary_conditions_hyperbolic,\n boundary_conditions_parabolic))","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"The rest of the code is identical to the hyperbolic case. We create a system of ODEs through semidiscretize, defining callbacks, and then passing the system to OrdinaryDiffEq.jl.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"tspan = (0.0, 1.5)\node = semidiscretize(semi, tspan)\ncallbacks = CallbackSet(SummaryCallback())\ntime_int_tol = 1.0e-6\nsol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"We can now visualize the solution, which develops a boundary layer at the outflow boundaries.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/parabolic_terms/#Package-versions","page":"12 Parabolic terms","title":"Package versions","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"EditURL = \"../../literate/src/files/index.jl\"","category":"page"},{"location":"tutorials/introduction/#Tutorials-for-Trixi.jl","page":"Introduction","title":"Tutorials for Trixi.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"The tutorial section for Trixi.jl also contains interactive step-by-step explanations via Binder.","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Right now, you are using the classic documentation. The corresponding interactive notebooks can be opened in Binder and viewed in nbviewer via the icons (Image: ) and (Image: ) in the respective tutorial. You can also open the raw notebook files via (Image: ).","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.jl at the time of caching.","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"There are tutorials for the following topics:","category":"page"},{"location":"tutorials/introduction/#[1-First-steps-in-Trixi.jl](@ref-getting_started)","page":"Introduction","title":"1 First steps in Trixi.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial provides guidance for getting started with Trixi.jl, and Julia as well. It outlines the installation procedures for both Julia and Trixi.jl, the execution of Trixi.jl elixirs, the fundamental structure of a Trixi.jl setup, the visualization of results, and the development process for Trixi.jl.","category":"page"},{"location":"tutorials/introduction/#[2-Behind-the-scenes-of-a-simulation-setup](@ref-behind_the_scenes_simulation_setup)","page":"Introduction","title":"2 Behind the scenes of a simulation setup","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial will guide you through a simple Trixi.jl setup (\"elixir\"), giving an overview of what happens in the background during the initialization of a simulation. While the setup described herein does not cover all details, it involves relatively stable parts of Trixi.jl that are unlikely to undergo significant changes in the near future. The goal is to clarify some of the more fundamental, technical concepts that are applicable to a variety of (also more complex) configurations.s","category":"page"},{"location":"tutorials/introduction/#[3-Introduction-to-DG-methods](@ref-scalar_linear_advection_1d)","page":"Introduction","title":"3 Introduction to DG methods","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial gives an introduction to discontinuous Galerkin (DG) methods with the example of the scalar linear advection equation in 1D. Starting with some theoretical explanations, we first implement a raw version of a discontinuous Galerkin spectral element method (DGSEM). Then, we will show how to use features of Trixi.jl to achieve the same result.","category":"page"},{"location":"tutorials/introduction/#[4-DGSEM-with-flux-differencing](@ref-DGSEM_FluxDiff)","page":"Introduction","title":"4 DGSEM with flux differencing","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.jl and analyse entropy conservation for two different flux combinations.","category":"page"},{"location":"tutorials/introduction/#[5-Shock-capturing-with-flux-differencing-and-stage-limiter](@ref-shock_capturing)","page":"Introduction","title":"5 Shock capturing with flux differencing and stage limiter","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.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.","category":"page"},{"location":"tutorials/introduction/#[6-Non-periodic-boundary-conditions](@ref-non_periodic_boundaries)","page":"Introduction","title":"6 Non-periodic boundary conditions","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.","category":"page"},{"location":"tutorials/introduction/#[7-DG-schemes-via-DGMulti-solver](@ref-DGMulti_1)","page":"Introduction","title":"7 DG schemes via DGMulti solver","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial is about the more general DG solver DGMulti, introduced here. We are showing some examples for this solver, for instance with discretization nodes by Gauss or triangular elements. Moreover, we present a simple way to include pre-defined triangulate meshes for non-Cartesian domains using the package StartUpDG.jl.","category":"page"},{"location":"tutorials/introduction/#[8-Other-SBP-schemes-(FD,-CGSEM)-via-DGMulti-solver](@ref-DGMulti_2)","page":"Introduction","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Supplementary to the previous tutorial about DG schemes via the DGMulti solver we now present the possibility for DGMulti to use other SBP schemes via the package SummationByPartsOperators.jl. For instance, we show how to set up a finite differences (FD) scheme and a continuous Galerkin (CGSEM) method.","category":"page"},{"location":"tutorials/introduction/#[9-Upwind-FD-SBP-schemes](@ref-upwind_fdsbp)","page":"Introduction","title":"9 Upwind FD SBP schemes","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"General SBP schemes can not only be used via the DGMulti solver but also with a general DG solver. In particular, upwind finite difference SBP methods can be used together with the TreeMesh. Similar to general SBP schemes in the DGMulti framework, the interface is based on the package SummationByPartsOperators.jl.","category":"page"},{"location":"tutorials/introduction/#[10-Adding-a-new-scalar-conservation-law](@ref-adding_new_scalar_equations)","page":"Introduction","title":"10 Adding a new scalar conservation law","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial explains how to add a new physics model using the example of the cubic conservation law. First, we define the equation using a struct CubicEquation and the physical flux. Then, the corresponding standard setup in Trixi.jl (mesh, solver, semi and ode) is implemented and the ODE problem is solved by OrdinaryDiffEq's solve method.","category":"page"},{"location":"tutorials/introduction/#[11-Adding-a-non-conservative-equation](@ref-adding_nonconservative_equation)","page":"Introduction","title":"11 Adding a non-conservative equation","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"In this part, another physics model is implemented, the nonconservative linear advection equation. We run two different simulations with different levels of refinement and compare the resulting errors.","category":"page"},{"location":"tutorials/introduction/#[12-Parabolic-terms](@ref-parabolic_terms)","page":"Introduction","title":"12 Parabolic terms","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes how parabolic terms are implemented in Trixi.jl, e.g., to solve the advection-diffusion equation.","category":"page"},{"location":"tutorials/introduction/#[13-Adding-new-parabolic-terms](@ref-adding_new_parabolic_terms)","page":"Introduction","title":"13 Adding new parabolic terms","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes how new parabolic terms can be implemented using Trixi.jl.","category":"page"},{"location":"tutorials/introduction/#[14-Adaptive-mesh-refinement](@ref-adaptive_mesh_refinement)","page":"Introduction","title":"14 Adaptive mesh refinement","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Adaptive mesh refinement (AMR) helps to increase the accuracy in sensitive or turbolent regions while 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.","category":"page"},{"location":"tutorials/introduction/#[15-Structured-mesh-with-curvilinear-mapping](@ref-structured_mesh_mapping)","page":"Introduction","title":"15 Structured mesh with curvilinear mapping","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"In this tutorial, the use of Trixi.jl's structured curved mesh type StructuredMesh 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.","category":"page"},{"location":"tutorials/introduction/#[16-Unstructured-meshes-with-HOHQMesh.jl](@ref-hohqmesh_tutorial)","page":"Introduction","title":"16 Unstructured meshes with HOHQMesh.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"The purpose of this tutorial is to demonstrate how to use the UnstructuredMesh2D functionality of Trixi.jl. This begins by running and visualizing an available unstructured quadrilateral mesh example. Then, the tutorial will demonstrate how to conceptualize a problem with curved boundaries, generate a curvilinear mesh using the available HOHQMesh software in the Trixi.jl ecosystem, and then run a simulation using Trixi.jl on said mesh. In the end, the tutorial briefly explains how to simulate an example using AMR via P4estMesh.","category":"page"},{"location":"tutorials/introduction/#[17-P4est-mesh-from-gmsh](@ref-p4est_from_gmsh)","page":"Introduction","title":"17 P4est mesh from gmsh","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes how to obtain a P4estMesh from an existing mesh generated by gmsh or any other meshing software that can export to the Abaqus input .inp format. The tutorial demonstrates how edges/faces can be associated with boundary conditions based on the physical nodesets.","category":"page"},{"location":"tutorials/introduction/#[18-Explicit-time-stepping](@ref-time_stepping)","page":"Introduction","title":"18 Explicit time stepping","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial is about time integration using 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.","category":"page"},{"location":"tutorials/introduction/#[19-Differentiable-programming](@ref-differentiable_programming)","page":"Introduction","title":"19 Differentiable programming","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This part deals with some basic differentiable programming topics. For example, a Jacobian, its eigenvalues and a curve of total energy (through the simulation) are calculated and plotted for a few semidiscretizations. Moreover, we calculate an example for propagating errors with Measurement.jl at the end.","category":"page"},{"location":"tutorials/introduction/#[20-Custom-semidiscretization](@ref-custom_semidiscretization)","page":"Introduction","title":"20 Custom semidiscretization","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes the semidiscretiations of Trixi.jl and explains how to extend them for custom tasks.","category":"page"},{"location":"tutorials/introduction/#Examples-in-Trixi.jl","page":"Introduction","title":"Examples in Trixi.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Trixi.jl already contains several more coding examples, the so-called elixirs. You can find them in the folder 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 advection or euler) and other special characteristics like the initial condition (e.g. gauss, astro_jet, blast_wave) or the included simulation features (e.g. amr, shockcapturing).","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"EditURL = \"../../../literate/src/files/first_steps/changing_trixi.jl\"","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#changing_trixi","page":"1.3 Changing Trixi.jl itself","title":"1.3: First steps in Trixi.jl: Changing Trixi.jl itself","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"If you plan on editing Trixi.jl itself, you can download Trixi.jl locally and run it from the cloned directory.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#Cloning-Trixi.jl","page":"1.3 Changing Trixi.jl itself","title":"Cloning Trixi.jl","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/#Windows","page":"1.3 Changing Trixi.jl itself","title":"Windows","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"If you are using Windows, you can clone Trixi.jl by using the GitHub Desktop tool:","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"If you do not have a GitHub account yet, create it on the GitHub website.\nDownload and install GitHub Desktop and then log in to your account.\nOpen GitHub Desktop, press Ctrl+Shift+O.\nIn the opened window, paste trixi-framework/Trixi.jl and choose the path to the folder where you want to save Trixi.jl. Then click Clone and Trixi.jl will be cloned to your computer.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Now you cloned Trixi.jl and only need to tell Julia to use the local clone as the package sources:","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Open a terminal using Win+r and cmd. Navigate to the folder with the cloned Trixi.jl using cd.\nCreate a new directory run, enter it, and start Julia with the --project=. flag:\nmkdir run\ncd run\njulia --project=.\nNow run the following commands to install all relevant packages:\nusing Pkg; Pkg.develop(PackageSpec(path=\"..\")) # Tell Julia to use the local Trixi.jl clone\nPkg.add([\"OrdinaryDiffEq\", \"Plots\"]) # Install additional packages","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Now you already installed Trixi.jl from your local clone. Note that if you installed Trixi.jl this way, you always have to start Julia with the --project flag set to your run directory, e.g.,","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"julia --project=.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"if already inside the run directory.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#Linux","page":"1.3 Changing Trixi.jl itself","title":"Linux","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"You can clone Trixi.jl to your computer by executing the following commands:","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"git clone git@github.com:trixi-framework/Trixi.jl.git\n# If an error occurs, try the following:\n# git clone https://github.com/trixi-framework/Trixi.jl\ncd Trixi.jl\nmkdir run\ncd run\njulia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=\"..\"))' # Tell Julia to use the local Trixi.jl clone\njulia --project=. -e 'using Pkg; Pkg.add([\"OrdinaryDiffEq\", \"Plots\"])' # Install additional packages","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Note that if you installed Trixi.jl this way, you always have to start Julia with the --project flag set to your run directory, e.g.,","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"julia --project=.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"if already inside the run directory.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#Additional-reading","page":"1.3 Changing Trixi.jl itself","title":"Additional reading","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"To further delve into Trixi.jl, you may have a look at the following introductory tutorials.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Introduction to DG methods will teach you how to set up a simple way to approximate the solution of a hyperbolic partial differential equation. It will be especially useful to learn about the Discontinuous Galerkin method and the way it is implemented in Trixi.jl.\nAdding a new scalar conservation law and Adding a non-conservative equation describe how to add new physics models that are not yet included in Trixi.jl.\nCallbacks gives an overview of how to regularly execute specific actions during a simulation, e.g., to store the solution or adapt the mesh.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"This page was generated using Literate.jl.","category":"page"},{"location":"reference-trixi/#Trixi.jl-API","page":"Trixi.jl","title":"Trixi.jl API","text":"","category":"section"},{"location":"reference-trixi/","page":"Trixi.jl","title":"Trixi.jl","text":"CurrentModule = Trixi","category":"page"},{"location":"reference-trixi/","page":"Trixi.jl","title":"Trixi.jl","text":"Modules = [Trixi]","category":"page"},{"location":"reference-trixi/#Trixi.Trixi","page":"Trixi.jl","title":"Trixi.Trixi","text":"Trixi\n\nTrixi.jl is a numerical simulation framework for hyperbolic conservation laws. 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.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures.\n\nTo get started, run your first simulation with Trixi.jl using\n\ntrixi_include(default_example())\n\nSee also: trixi-framework/Trixi.jl\n\n\n\n\n\n","category":"module"},{"location":"reference-trixi/#Trixi.boundary_condition_do_nothing","page":"Trixi.jl","title":"Trixi.boundary_condition_do_nothing","text":"boundary_condition_do_nothing = Trixi.BoundaryConditionDoNothing()\n\nImposing no boundary condition just evaluates the flux at the inner state.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.boundary_condition_periodic","page":"Trixi.jl","title":"Trixi.boundary_condition_periodic","text":"boundary_condition_periodic = Trixi.BoundaryConditionPeriodic()\n\nA singleton struct indicating periodic boundary conditions.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.flux_hll","page":"Trixi.jl","title":"Trixi.flux_hll","text":"flux_hll\n\nSee FluxHLL.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.flux_hlle","page":"Trixi.jl","title":"Trixi.flux_hlle","text":"flux_hlle\n\nSee min_max_speed_einfeldt. This is a FluxHLL-type two-wave solver with special estimates of the wave speeds.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.flux_lax_friedrichs","page":"Trixi.jl","title":"Trixi.flux_lax_friedrichs","text":"flux_lax_friedrichs\n\nSee FluxLaxFriedrichs.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.AMRCallback","page":"Trixi.jl","title":"Trixi.AMRCallback","text":"AMRCallback(semi, controller [,adaptor=AdaptorAMR(semi)];\n interval,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true,\n dynamic_load_balancing=true)\n\nPerforms adaptive mesh refinement (AMR) every interval time steps for a given semidiscretization semi using the chosen controller.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AbstractEquations","page":"Trixi.jl","title":"Trixi.AbstractEquations","text":"AbstractEquations{NDIMS, NVARS}\n\nAn abstract supertype of specific equations such as the compressible Euler equations. The type parameters encode the number of spatial dimensions (NDIMS) and the number of primary variables (NVARS) of the physics model.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AbstractMesh","page":"Trixi.jl","title":"Trixi.AbstractMesh","text":"AbstractMesh{NDIMS}\n\nAn abstract supertype of specific mesh types such as TreeMesh or StructuredMesh. The type parameters encode the number of spatial dimensions (NDIMS).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AcousticPerturbationEquations2D","page":"Trixi.jl","title":"Trixi.AcousticPerturbationEquations2D","text":"AcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global)\n\nAcoustic perturbation equations (APE) in two space dimensions. The equations are given by\n\nbeginaligned\n fracpartialmathbfvpartial t + nabla (barmathbfvcdotmathbfv)\n + nablaleft( fracbarc^2 tildepbarrho right) = 0 \n fracpartial tildeppartial t +\n nablacdot (barrho mathbfv + barmathbfv tildep) = 0\nendaligned\n\nThe bar bar(cdot) indicates time-averaged quantities. The unknowns of the APE are the perturbed velocities mathbfv = (v_1 v_2)^T and the scaled perturbed pressure tildep = fracpbarc^2, where p denotes the perturbed pressure and the perturbed variables are defined by phi = phi - barphi.\n\nIn addition to the unknowns, Trixi.jl currently stores the mean values in the state vector, i.e. the state vector used internally is given by\n\nmathbfu =\n beginpmatrix\n v_1 v_2 tildep barv_1 barv_2 barc barrho\n endpmatrix\n\nThis affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the mean values must be zero.\nThe mean values have to be considered when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes these variables too.\nTrixi.jl's visualization tools will visualize the mean values by default.\n\nThe constructor accepts a 2-tuple v_mean_global and scalars c_mean_global and rho_mean_global which can be used to make the definition of initial conditions for problems with constant mean flow more flexible. These values are ignored if the mean values are defined internally in an initial condition.\n\nThe equations are based on the APE-4 system introduced in the following paper:\n\nRoland Ewert and Wolfgang Schröder (2003) Acoustic perturbation equations based on flow decomposition via source filtering DOI: 10.1016/S0021-9991(03)00168-2\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.Adiabatic","page":"Trixi.jl","title":"Trixi.Adiabatic","text":"struct Adiabatic\n\nUsed to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_normal_flux_function should be a function with signature boundary_value_normal_flux_function(x, t, equations) and return a scalar value for the normal heat flux at point x and time t.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AliveCallback","page":"Trixi.jl","title":"Trixi.AliveCallback","text":"AliveCallback(analysis_interval=0, alive_interval=analysis_interval÷10)\n\nInexpensive callback showing that a simulation is still running by printing some information such as the current time to the screen every alive_interval time steps. If analysis_interval ≂̸ 0, the output is omitted every analysis_interval time steps.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AnalysisCallback","page":"Trixi.jl","title":"Trixi.AnalysisCallback","text":"AnalysisCallback(semi; interval=0,\n save_analysis=false,\n output_directory=\"out\",\n analysis_filename=\"analysis.dat\",\n extra_analysis_errors=Symbol[],\n extra_analysis_integrals=())\n\nAnalyze a numerical solution every interval time steps and print the results to the screen. If save_analysis, the results are also saved in joinpath(output_directory, analysis_filename).\n\nAdditional errors can be computed, e.g. by passing extra_analysis_errors = (:l2_error_primitive, :linf_error_primitive) or extra_analysis_errors = (:conservation_error,).\n\nIf you want to omit the computation (to safe compute-time) of the default_analysis_errors, specify analysis_errors = Symbol[]. Note: default_analysis_errors are :l2_error and :linf_error for all equations. If you want to compute extra_analysis_errors such as :conservation_error solely, i.e., without :l2_error, :linf_error you need to specify analysis_errors = [:conservation_error] instead of extra_analysis_errors = [:conservation_error].\n\nFurther scalar functions func in extra_analysis_integrals are applied to the numerical solution and integrated over the computational domain. Some examples for this are entropy, energy_kinetic, energy_internal, and energy_total. You can also write your own function with the same signature as the examples listed above and pass it via extra_analysis_integrals. See the developer comments about Trixi.analyze, Trixi.pretty_form_utf, and Trixi.pretty_form_ascii for further information on how to create custom analysis quantities.\n\nIn addition, the analysis callback records and outputs a number of quantities that are useful for evaluating the computational performance, such as the total runtime, the performance index (time/DOF/rhs!), the time spent in garbage collection (GC), or the current memory usage (alloc'd memory).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AnalysisCallbackCoupled","page":"Trixi.jl","title":"Trixi.AnalysisCallbackCoupled","text":"AnalysisCallbackCoupled(semi, callbacks...)\n\nCombine multiple analysis callbacks for coupled simulations with a SemidiscretizationCoupled. For each coupled system, an indididual AnalysisCallback must be created and passed to the AnalysisCallbackCoupled in order, i.e., in the same sequence as the indidvidual semidiscretizations are stored in the SemidiscretizationCoupled.\n\nwarning: Experimental code\nThis is an experimental feature and can change any time.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AveragingCallback","page":"Trixi.jl","title":"Trixi.AveragingCallback","text":"AveragingCallback(semi::SemidiscretizationHyperbolic, tspan; output_directory=\"out\",\n filename=\"averaging.h5\")\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nA callback that averages the flow field described by semi which must be a semidiscretization of the compressible Euler equations in two dimensions. The callback records the mean velocity, mean speed of sound, mean density, and mean vorticity for each node over the time interval given by tspan and stores the results in an HDF5 file filename in the directory output_directory. Note that this callback does not support adaptive mesh refinement (AMRCallback).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionCoupled","page":"Trixi.jl","title":"Trixi.BoundaryConditionCoupled","text":"BoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter)\n\nBoundary condition to glue two meshes together. Solution values at the boundary of another mesh will be used as boundary values. This requires the use of SemidiscretizationCoupled. The other mesh is specified by other_semi_index, which is the index of the mesh in the tuple of semidiscretizations.\n\nNote that the elements and nodes of the two meshes at the coupled boundary must coincide. This is currently only implemented for StructuredMesh.\n\nArguments\n\nother_semi_index: the index in SemidiscretizationCoupled of the semidiscretization from which the values are copied\nindices::Tuple: node/cell indices at the boundary of the mesh in the other semidiscretization. See examples below.\nuEltype::Type: element type of solution\ncoupling_converter::CouplingConverter: function to call for converting the solution state of one system to the other system\n\nExamples\n\n# Connect the left boundary of mesh 2 to our boundary such that our positive\n# boundary direction will match the positive y direction of the other boundary\nBoundaryConditionCoupled(2, (:begin, :i), Float64, fun)\n\n# Connect the same two boundaries oppositely oriented\nBoundaryConditionCoupled(2, (:begin, :i_backwards), Float64, fun)\n\n# Using this as y_neg boundary will connect `our_cells[i, 1, j]` to `other_cells[j, end-i, end]`\nBoundaryConditionCoupled(2, (:j, :i_backwards, :end), Float64, fun)\n\nwarning: Experimental code\nThis is an experimental feature and can change any time.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionDirichlet","page":"Trixi.jl","title":"Trixi.BoundaryConditionDirichlet","text":"BoundaryConditionDirichlet(boundary_value_function)\n\nCreate a Dirichlet boundary condition that uses the function boundary_value_function to specify the values at the boundary. This can be used to create a boundary condition that specifies exact boundary values by passing the exact solution of the equation. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as\n\nboundary_value_function(x, t, equations)\n\nwhere x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.\n\nExamples\n\njulia> BoundaryConditionDirichlet(initial_condition_convergence_test)\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionNavierStokesWall","page":"Trixi.jl","title":"Trixi.BoundaryConditionNavierStokesWall","text":"struct BoundaryConditionNavierStokesWall\n\nCreates a wall-type boundary conditions for the compressible Navier-Stokes equations. The fields boundary_condition_velocity and boundary_condition_heat_flux are intended to be boundary condition types such as the NoSlip velocity boundary condition and the Adiabatic or Isothermal heat boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionNeumann","page":"Trixi.jl","title":"Trixi.BoundaryConditionNeumann","text":"BoundaryConditionNeumann(boundary_normal_flux_function)\n\nSimilar to BoundaryConditionDirichlet, but creates a Neumann boundary condition for parabolic equations that uses the function boundary_normal_flux_function to specify the values of the normal flux at the boundary. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as\n\nboundary_normal_flux_function(x, t, equations)\n\nwhere x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundsCheckCallback","page":"Trixi.jl","title":"Trixi.BoundsCheckCallback","text":"BoundsCheckCallback(; output_directory=\"out\", save_errors=false, interval=1)\n\nSubcell limiting techniques with SubcellLimiterIDP are constructed to adhere certain local or global bounds. To make sure that these bounds are actually met, this callback calculates the maximum deviation from the bounds. The maximum deviation per applied bound is printed to the screen at the end of the simulation. For more insights, when setting save_errors=true the occurring errors are exported every interval time steps during the simulation. Then, the maximum deviations since the last export are saved in \"output_directory/deviations.txt\". The BoundsCheckCallback has to be applied as a stage callback for the SSPRK time integration scheme.\n\nnote: Note\nFor SubcellLimiterIDP, the solution is corrected in the a posteriori correction stage SubcellLimiterIDPCorrection. So, to check the final solution, this bounds check callback must be called after the correction stage.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CarpenterKennedy2N43","page":"Trixi.jl","title":"Trixi.CarpenterKennedy2N43","text":" CarpenterKennedy2N43()\n\nCarpenter, Kennedy (1994) Third order 2N storage RK schemes with error control\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CarpenterKennedy2N54","page":"Trixi.jl","title":"Trixi.CarpenterKennedy2N54","text":"CarpenterKennedy2N54()\n\nThe following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of\n\nCarpenter, Kennedy (1994) Fourth order 2N storage RK schemes, Solution 3\n\nusing the same interface as OrdinaryDiffEq.jl.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquations1D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquations1D","text":"CompressibleEulerEquations1D(gamma)\n\nThe compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1 rho v_1^2 + p (rho e +p) v_1\nendpmatrix\n=\nbeginpmatrix\n0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in one space dimension. Here, rho is the density, v_1 the velocity, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho v_1^2 right)\n\nthe pressure.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquations2D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquations2D","text":"CompressibleEulerEquations2D(gamma)\n\nThe compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v_1 rho v_1^2 + p rho v_1 v_2 (rho e +p) v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + p (rho e +p) v_2\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in two space dimensions. Here, rho is the density, v_1, v_2 the velocities, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2) right)\n\nthe pressure.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquations3D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquations3D","text":"CompressibleEulerEquations3D(gamma)\n\nThe compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2 rho v_3 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v_1 rho v_1^2 + p rho v_1 v_2 rho v_1 v_3 ( rho e +p) v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + p rho v_1 v_3 ( rho e +p) v_2\nendpmatrix\n+\nfracpartialpartial z\nbeginpmatrix\nrho v_3 rho v_1 v_3 rho v_2 v_3 rho v_3^2 + p ( rho e +p) v_3\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in three space dimensions. Here, rho is the density, v_1, v_2, v_3 the velocities, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2+v_3^2) right)\n\nthe pressure.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquationsQuasi1D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquationsQuasi1D","text":"CompressibleEulerEquationsQuasi1D(gamma)\n\nThe quasi-1d compressible Euler equations (see Chan et al. DOI: 10.48550/arXiv.2307.12089 for details)\n\nfracpartialpartial t\nbeginpmatrix\na rho a rho v_1 a e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\na rho v_1 a rho v_1^2 a v_1 (e +p)\nendpmatrix\n+ \na fracpartialpartial x\nbeginpmatrix\n0 p 0 \nendpmatrix\n=\nbeginpmatrix\n0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in one space dimension. Here, rho is the density, v_1 the velocity, e the specific total energy rather than specific internal energy, a the (possibly) variable nozzle width, and\n\np = (gamma - 1) left( e - frac12 rho v_1^2 right)\n\nthe pressure.\n\nThe nozzle width function a(x) is set inside the initial condition routine for a particular problem setup. To test the conservative form of the compressible Euler equations one can set the nozzle width variable a to one. \n\nIn addition to the unknowns, Trixi.jl currently stores the nozzle width values at the approximation points despite being fixed in time. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the nozzle width must be zero.\nThe nozzle width values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the nozzle width by default.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerMulticomponentEquations1D","page":"Trixi.jl","title":"Trixi.CompressibleEulerMulticomponentEquations1D","text":"CompressibleEulerMulticomponentEquations1D(; gammas, gas_constants)\n\nMulticomponent version of the compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho v_1 rho e rho_1 rho_2 vdots rho_n\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1^2 + p (rho e +p) v_1 rho_1 v_1 rho_2 v_1 vdots rho_n v_1\nendpmatrix\n\n=\nbeginpmatrix\n0 0 0 0 vdots 0\nendpmatrix\n\nfor calorically perfect gas in one space dimension. Here, rho_i is the density of component i, rho=sum_i=1^nrho_i the sum of the individual rho_i, v_1 the velocity, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho v_1^2 right)\n\nthe pressure,\n\ngamma=fracsum_i=1^nrho_i C_vigamma_isum_i=1^nrho_i C_vi\n\ntotal heat capacity ratio, gamma_i heat capacity ratio of component i,\n\nC_vi=fracRgamma_i-1\n\nspecific heat capacity at constant volume of component i.\n\nIn case of more than one component, the specific heat ratios gammas and the gas constants gas_constants should be passed as tuples, e.g., gammas=(1.4, 1.667).\n\nThe remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerMulticomponentEquations2D","page":"Trixi.jl","title":"Trixi.CompressibleEulerMulticomponentEquations2D","text":"CompressibleEulerMulticomponentEquations2D(; gammas, gas_constants)\n\nMulticomponent version of the compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho v_1 rho v_2 rho e rho_1 rho_2 vdots rho_n\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1^2 + p rho v_1 v_2 ( rho e +p) v_1 rho_1 v_1 rho_2 v_1 vdots rho_n v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_1 v_2 rho v_2^2 + p ( rho e +p) v_2 rho_1 v_2 rho_2 v_2 vdots rho_n v_2\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0 0 vdots 0\nendpmatrix\n\nfor calorically perfect gas in two space dimensions. Here, rho_i is the density of component i, rho=sum_i=1^nrho_i the sum of the individual rho_i, v_1, v_2 the velocities, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2 + v_2^2) right)\n\nthe pressure,\n\ngamma=fracsum_i=1^nrho_i C_vigamma_isum_i=1^nrho_i C_vi\n\ntotal heat capacity ratio, gamma_i heat capacity ratio of component i,\n\nC_vi=fracRgamma_i-1\n\nspecific heat capacity at constant volume of component i.\n\nIn case of more than one component, the specific heat ratios gammas and the gas constants gas_constants in [kJ/(kg*K)] should be passed as tuples, e.g., gammas=(1.4, 1.667).\n\nThe remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleNavierStokesDiffusion1D","page":"Trixi.jl","title":"Trixi.CompressibleNavierStokesDiffusion1D","text":"CompressibleNavierStokesDiffusion1D(equations; mu, Pr,\n gradient_variables=GradientVariablesPrimitive())\n\nContains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations1D.\n\nequations: instance of the CompressibleEulerEquations1D\nmu: dynamic viscosity,\nPr: Prandtl number,\ngradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().\n\nFluid properties such as the dynamic viscosity mu can be provided in any consistent unit system, e.g., [mu] = kg m⁻¹ s⁻¹.\n\nThe particular form of the compressible Navier-Stokes implemented is\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v rho v^2 + p (rho e + p) v\nendpmatrix\n=\nfracpartialpartial x\nbeginpmatrix\n0 tau tau v - q\nendpmatrix\n\nwhere the system is closed with the ideal gas assumption giving\n\np = (gamma - 1) left( rho e - frac12 rho v^2 right)\n\nas the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations1D. The terms on the right hand side of the system above are built from the viscous stress\n\ntau = mu fracpartialpartial x v\n\nwhere the heat flux is\n\nq = -kappa fracpartialpartial x left(Tright)quad T = fracpRrho\n\nwhere T is the temperature and kappa is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is\n\nkappa = fracgamma mu R(gamma - 1)textrmPr\n\nFrom this combination of temperature T and thermal conductivity kappa we see that the gas constant R cancels and the heat flux becomes\n\nq = -kappa fracpartialpartial x left(Tright) = -fracgamma mu(gamma - 1)textrmPr fracpartialpartial x left(fracprhoright)\n\nwhich is the form implemented below in the flux function.\n\nIn one spatial dimensions we require gradients for two quantities, e.g., primitive quantities\n\nfracpartialpartial x v fracpartialpartial x T\n\nor the entropy variables\n\nfracpartialpartial x w_2 fracpartialpartial x w_3\n\nwhere\n\nw_2 = fracrho v1p w_3 = -fracrhop\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleNavierStokesDiffusion2D","page":"Trixi.jl","title":"Trixi.CompressibleNavierStokesDiffusion2D","text":"CompressibleNavierStokesDiffusion2D(equations; mu, Pr,\n gradient_variables=GradientVariablesPrimitive())\n\nContains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations2D.\n\nequations: instance of the CompressibleEulerEquations2D\nmu: dynamic viscosity,\nPr: Prandtl number,\ngradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().\n\nFluid properties such as the dynamic viscosity mu can be provided in any consistent unit system, e.g., [mu] = kg m⁻¹ s⁻¹.\n\nThe particular form of the compressible Navier-Stokes implemented is\n\nfracpartialpartial t\nbeginpmatrix\nrho rho mathbfv rho e\nendpmatrix\n+\nnabla cdot\nbeginpmatrix\n rho mathbfv rho mathbfvmathbfv^T + p underlineI (rho e + p) mathbfv\nendpmatrix\n=\nnabla cdot\nbeginpmatrix\n0 underlinetau underlinetaumathbfv - mathbfq\nendpmatrix\n\nwhere the system is closed with the ideal gas assumption giving\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2) right)\n\nas the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor\n\nunderlinetau = mu left(nablamathbfv + left(nablamathbfvright)^Tright) - frac23 mu left(nablacdotmathbfvright)underlineI\n\nwhere underlineI is the 2times 2 identity matrix and the heat flux is\n\nmathbfq = -kappanablaleft(Tright)quad T = fracpRrho\n\nwhere T is the temperature and kappa is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is\n\nkappa = fracgamma mu R(gamma - 1)textrmPr\n\nFrom this combination of temperature T and thermal conductivity kappa we see that the gas constant R cancels and the heat flux becomes\n\nmathbfq = -kappanablaleft(Tright) = -fracgamma mu(gamma - 1)textrmPrnablaleft(fracprhoright)\n\nwhich is the form implemented below in the flux function.\n\nIn two spatial dimensions we require gradients for three quantities, e.g., primitive quantities\n\nnabla v_1 nabla v_2 nabla T\n\nor the entropy variables\n\nnabla w_2 nabla w_3 nabla w_4\n\nwhere\n\nw_2 = fracrho v_1p w_3 = fracrho v_2p w_4 = -fracrhop\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleNavierStokesDiffusion3D","page":"Trixi.jl","title":"Trixi.CompressibleNavierStokesDiffusion3D","text":"CompressibleNavierStokesDiffusion3D(equations; mu, Pr,\n gradient_variables=GradientVariablesPrimitive())\n\nContains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations3D.\n\nequations: instance of the CompressibleEulerEquations3D\nmu: dynamic viscosity,\nPr: Prandtl number,\ngradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().\n\nFluid properties such as the dynamic viscosity mu can be provided in any consistent unit system, e.g., [mu] = kg m⁻¹ s⁻¹.\n\nThe particular form of the compressible Navier-Stokes implemented is\n\nfracpartialpartial t\nbeginpmatrix\nrho rho mathbfv rho e\nendpmatrix\n+\nnabla cdot\nbeginpmatrix\n rho mathbfv rho mathbfvmathbfv^T + p underlineI (rho e + p) mathbfv\nendpmatrix\n=\nnabla cdot\nbeginpmatrix\n0 underlinetau underlinetaumathbfv - mathbfq\nendpmatrix\n\nwhere the system is closed with the ideal gas assumption giving\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2+v_3^2) right)\n\nas the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor\n\nunderlinetau = mu left(nablamathbfv + left(nablamathbfvright)^Tright) - frac23 mu left(nablacdotmathbfvright)underlineI\n\nwhere underlineI is the 3times 3 identity matrix and the heat flux is\n\nmathbfq = -kappanablaleft(Tright)quad T = fracpRrho\n\nwhere T is the temperature and kappa is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is\n\nkappa = fracgamma mu R(gamma - 1)textrmPr\n\nFrom this combination of temperature T and thermal conductivity kappa we see that the gas constant R cancels and the heat flux becomes\n\nmathbfq = -kappanablaleft(Tright) = -fracgamma mu(gamma - 1)textrmPrnablaleft(fracprhoright)\n\nwhich is the form implemented below in the flux function.\n\nIn two spatial dimensions we require gradients for three quantities, e.g., primitive quantities\n\nnabla v_1 nabla v_2 nabla v_3 nabla T\n\nor the entropy variables\n\nnabla w_2 nabla w_3 nabla w_4 nabla w_5\n\nwhere\n\nw_2 = fracrho v_1p w_3 = fracrho v_2p w_4 = fracrho v_3p w_5 = -fracrhop\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ControllerThreeLevel","page":"Trixi.jl","title":"Trixi.ControllerThreeLevel","text":"ControllerThreeLevel(semi, indicator; base_level=1,\n med_level=base_level, med_threshold=0.0,\n max_level=base_level, max_threshold=1.0)\n\nAn AMR controller based on three levels (in descending order of precedence):\n\nset the target level to max_level if indicator > max_threshold\nset the target level to med_level if indicator > med_threshold; if med_level < 0, set the target level to the current level\nset the target level to base_level otherwise\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ControllerThreeLevelCombined","page":"Trixi.jl","title":"Trixi.ControllerThreeLevelCombined","text":"ControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;\n base_level=1,\n med_level=base_level, med_threshold=0.0,\n max_level=base_level, max_threshold=1.0,\n max_threshold_secondary=1.0)\n\nAn AMR controller based on three levels (in descending order of precedence):\n\nset the target level to max_level if indicator_primary > max_threshold\nset the target level to med_level if indicator_primary > med_threshold; if med_level < 0, set the target level to the current level\nset the target level to base_level otherwise\n\nIf indicator_secondary >= max_threshold_secondary, set the target level to max_level.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DG","page":"Trixi.jl","title":"Trixi.DG","text":"DG(; basis, mortar, surface_integral, volume_integral)\n\nCreate a discontinuous Galerkin method. If basis isa LobattoLegendreBasis, this creates a DGSEM.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DGMulti-Tuple{SummationByPartsOperators.AbstractDerivativeOperator}","page":"Trixi.jl","title":"Trixi.DGMulti","text":"DGMulti(approximation_type::AbstractDerivativeOperator;\n element_type::AbstractElemShape,\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n kwargs...)\n\nCreate a summation by parts (SBP) discretization on the given element_type using a tensor product structure based on the 1D SBP derivative operator passed as approximation_type.\n\nFor more info, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMulti-Tuple{}","page":"Trixi.jl","title":"Trixi.DGMulti","text":"DGMulti(; polydeg::Integer,\n element_type::AbstractElemShape,\n approximation_type=Polynomial(),\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n RefElemData_kwargs...)\n\nCreate a discontinuous Galerkin method which uses\n\napproximations of polynomial degree polydeg\nelement type element_type (Tri(), Quad(), Tet(), and Hex() currently supported)\n\nOptional:\n\napproximation_type (default is Polynomial(); SBP() also supported for Tri(), Quad(), and Hex() element types).\nRefElemData_kwargs are additional keyword arguments for RefElemData, such as quad_rule_vol. For more info, see the StartUpDG.jl docs.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh{NDIMS, ...}\n\nDGMultiMesh describes a mesh type which wraps StartUpDG.MeshData and boundary_faces in a dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Tuple{DGMulti{2, Tri, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{2, Tri, ApproxType}} where {ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any, Dict{Symbol, Int64}}","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti{2, Tri}, triangulateIO, boundary_dict::Dict{Symbol, Int})\n\ndg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).\ntriangulateIO is a TriangulateIO mesh representation\nboundary_dict is a Dict{Symbol, Int} which associates each integer TriangulateIO boundary tag with a Symbol.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType<:SummationByPartsOperators.AbstractPeriodicDerivativeOperator, SurfaceIntegral, VolumeIntegral, Mortar}}, Tuple{NDIMS}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti)\n\nConstructs a single-element DGMultiMesh for a single periodic element given a DGMulti with approximation_type set to a periodic (finite difference) SBP operator from SummationByPartsOperators.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any, AbstractArray}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti{NDIMS}, vertex_coordinates, EToV;\n is_on_boundary=nothing,\n periodicity=ntuple(_->false, NDIMS)) where {NDIMS}\n\ndg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).\nvertex_coordinates is a tuple of vectors containing x,y,... components of the vertex coordinates\nEToV is a 2D array containing element-to-vertex connectivities for each element\nis_on_boundary specifies boundary using a Dict{Symbol, <:Function}\nperiodicity is a tuple of booleans specifying if the domain is periodic true/false in the (x,y,z) direction.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any, Any}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension, mapping;\n is_on_boundary=nothing,\n periodicity=ntuple(_ -> false, NDIMS), kwargs...) where {NDIMS}\n\nConstructs a Curved() DGMultiMesh with element type dg.basis.element_type.\n\nmapping is a function which maps from a reference [-1, 1]^NDIMS domain to a mapped domain, e.g., xy = mapping(x, y) in 2D.\nis_on_boundary specifies boundary using a Dict{Symbol, <:Function}\nperiodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti, cells_per_dimension;\n coordinates_min=(-1.0, -1.0), coordinates_max=(1.0, 1.0),\n is_on_boundary=nothing,\n periodicity=ntuple(_ -> false, NDIMS))\n\nConstructs a Cartesian DGMultiMesh with element type dg.basis.element_type. The domain is the tensor product of the intervals [coordinates_min[i], coordinates_max[i]].\n\nis_on_boundary specifies boundary using a Dict{Symbol, <:Function}\nperiodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, String}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti, filename::String)\n\ndg::DGMulti contains information associated with the reference element (e.g., quadrature, basis evaluation, differentiation, etc).\nfilename is a path specifying a .mesh file generated by HOHQMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGSEM","page":"Trixi.jl","title":"Trixi.DGSEM","text":"DGSEM(; RealT=Float64, polydeg::Integer,\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n mortar=MortarL2(basis))\n\nCreate a discontinuous Galerkin spectral element method (DGSEM) using a LobattoLegendreBasis with polynomials of degree polydeg.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DissipationGlobalLaxFriedrichs","page":"Trixi.jl","title":"Trixi.DissipationGlobalLaxFriedrichs","text":"DissipationGlobalLaxFriedrichs(λ)\n\nCreate a global Lax-Friedrichs dissipation operator with dissipation coefficient λ.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DissipationLocalLaxFriedrichs","page":"Trixi.jl","title":"Trixi.DissipationLocalLaxFriedrichs","text":"DissipationLocalLaxFriedrichs(max_abs_speed=max_abs_speed_naive)\n\nCreate a local Lax-Friedrichs dissipation operator where the maximum absolute wave speed is estimated as max_abs_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to max_abs_speed_naive.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.EulerAcousticsCouplingCallback","page":"Trixi.jl","title":"Trixi.EulerAcousticsCouplingCallback","text":"EulerAcousticsCouplingCallback\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nA callback that couples the acoustic perturbation equations and compressible Euler equations. Must be used in conjunction with SemidiscretizationEulerAcoustics. This callback manages the flow solver - which is always one time step ahead of the acoustics solver - and calculates the acoustic source term after each time step. The linearized Lamb vector is used as the source term, i.e.\n\nmathbfs = -(mathbfomega times barmathbfv\n + barmathbfomega times mathbfv)\n\nwhere mathbfv denotes the velocity, mathbfomega denotes the vorticity, the bar bar(cdot) indicates time-averaged quantities (see AveragingCallback) and prime (cdot) denotes perturbed quantities defined by phi = phi - barphi. Note that the perturbed quantities here are based entirely on the pure flow solution and should not be confused with the state variables of the acoustic perturbation equations.\n\nIn addition, this callback manages the time step size for both solvers and initializes the mean values of the acoustic perturbation equations using results obtained with the AveragingCallback.\n\nMichael Schlottke-Lakemper (2017) A direct-hybrid method for aeroacoustic analysis DOI: 10.18154/RWTH-2017-04082\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.EulerAcousticsCouplingCallback-Tuple{Any, AbstractString, Any, Real, Real}","page":"Trixi.jl","title":"Trixi.EulerAcousticsCouplingCallback","text":"EulerAcousticsCouplingCallback(ode_euler, averaging_file::AbstractString, alg,\n cfl_acoustics::Real, cfl_euler::Real; kwargs...)\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nCreates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_file (see AveragingCallback).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.EulerAcousticsCouplingCallback-Tuple{Any, DiscreteCallback{<:Any, <:AveragingCallback}, Any, Real, Real}","page":"Trixi.jl","title":"Trixi.EulerAcousticsCouplingCallback","text":"EulerAcousticsCouplingCallback(ode_euler,\n averaging_callback::DiscreteCallback{<:Any, <:AveragingCallback},\n alg, cfl_acoustics::Real, cfl_euler::Real; kwargs...)\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nCreates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_callback (see AveragingCallback).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.FDSBP","page":"Trixi.jl","title":"Trixi.FDSBP","text":"FDSBP(D_SBP; surface_integral, volume_integral)\n\nSpecialization of DG methods that uses general summation by parts (SBP) operators from SummationByPartsOperators.jl. In particular, this includes classical finite difference (FD) SBP methods. These methods have the same structure as classical DG methods - local operations on elements with connectivity through interfaces without imposing any continuity constraints.\n\nD_SBP is an SBP derivative operator from SummationByPartsOperators.jl. The other arguments have the same meaning as in DG or DGSEM.\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxHLL","page":"Trixi.jl","title":"Trixi.FluxHLL","text":"FluxHLL(min_max_speed=min_max_speed_davis)\n\nCreate an HLL (Harten, Lax, van Leer) numerical flux where the minimum and maximum wave speeds are estimated as λ_min, λ_max = min_max_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to min_max_speed_davis. Original paper:\n\nAmiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxHydrostaticReconstruction","page":"Trixi.jl","title":"Trixi.FluxHydrostaticReconstruction","text":"FluxHydrostaticReconstruction(numerical_flux, hydrostatic_reconstruction)\n\nwarning: Experimental code\nThis numerical flux is experimental and may change in any future release.\n\nAllow for some kind of hydrostatic reconstruction of the solution state prior to the surface flux computation. This is a particular strategy to ensure that the method remains well-balanced for the shallow water equations, see ShallowWaterEquations1D or ShallowWaterEquations2D.\n\nFor example, the hydrostatic reconstruction from Audusse et al. is implemented in one and two spatial dimensions, see hydrostatic_reconstruction_audusse_etal or the original paper\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\nOther hydrostatic reconstruction techniques are available, particularly to handle wet / dry fronts. A good overview of the development and application of hydrostatic reconstruction can be found in\n\nGuoxian Chen and Sebastian Noelle A unified surface-gradient and hydrostatic reconstruction scheme for the shallow water equations (2021) RWTH Aachen preprint\nAndreas Buttinger-Kreuzhuber, Zsolt Horváth, Sebastian Noelle, Günter Blöschl and Jürgen Waser (2019) A fast second-order shallow water scheme on two-dimensional structured grids over abrupt topography DOI: 10.1016/j.advwatres.2019.03.010\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxLMARS","page":"Trixi.jl","title":"Trixi.FluxLMARS","text":"FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nLow Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.\n\nReferences:\n\nXi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxLMARS-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.FluxLMARS","text":"FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nLow Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.\n\nReferences:\n\nXi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.FluxLaxFriedrichs","page":"Trixi.jl","title":"Trixi.FluxLaxFriedrichs","text":"FluxLaxFriedrichs(max_abs_speed=max_abs_speed_naive)\n\nLocal Lax-Friedrichs (Rusanov) flux with maximum wave speed estimate provided by max_abs_speed, cf. DissipationLocalLaxFriedrichs and max_abs_speed_naive.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxPlusDissipation","page":"Trixi.jl","title":"Trixi.FluxPlusDissipation","text":"FluxPlusDissipation(numerical_flux, dissipation)\n\nCombine a numerical_flux with a dissipation operator to create a new numerical flux.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxRotated","page":"Trixi.jl","title":"Trixi.FluxRotated","text":"FluxRotated(numerical_flux)\n\nCompute a numerical_flux flux in direction of a normal vector by rotating the solution, computing the numerical flux in x-direction, and rotating the calculated flux back.\n\nRequires a rotationally invariant equation with equation-specific functions rotate_to_x and rotate_from_x.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxUpwind","page":"Trixi.jl","title":"Trixi.FluxUpwind","text":"FluxUpwind(splitting)\n\nA numerical flux f(u_left, u_right) = f⁺(u_left) + f⁻(u_right) based on flux vector splitting.\n\nThe SurfaceIntegralUpwind with a given splitting is equivalent to the SurfaceIntegralStrongForm with FluxUpwind(splitting) as numerical flux (up to floating point differences). Note, that SurfaceIntegralUpwind is only available on TreeMesh.\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.GlmSpeedCallback","page":"Trixi.jl","title":"Trixi.GlmSpeedCallback","text":"GlmSpeedCallback(; glm_scale=0.5, cfl)\n\nUpdate the divergence cleaning wave speed c_h according to the time step computed in StepsizeCallback for the ideal GLM-MHD equations. The cfl number should be set to the same value as for the time step size calculation. The glm_scale ensures that the GLM wave speed is lower than the fastest physical waves in the MHD solution and should thus be set to a value within the interval [0,1]. Note that glm_scale = 0 deactivates the divergence cleaning.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.GradientVariablesPrimitive","page":"Trixi.jl","title":"Trixi.GradientVariablesPrimitive","text":"GradientVariablesPrimitive and GradientVariablesEntropy are gradient variable type parameters for CompressibleNavierStokesDiffusion1D. By default, the gradient variables are set to be GradientVariablesPrimitive. Specifying GradientVariablesEntropy instead uses the entropy variable formulation from\n\nHughes, Mallet, Franca (1986) A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the compressible Euler and Navier-Stokes equations and the second law of thermodynamics. https://doi.org/10.1016/0045-7825(86)90127-1\n\nUnder GradientVariablesEntropy, the Navier-Stokes discretization is provably entropy stable.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HypDiffN3Erk3Sstar52","page":"Trixi.jl","title":"Trixi.HypDiffN3Erk3Sstar52","text":"HypDiffN3Erk3Sstar52()\n\nFive stage, second-order accurate explicit Runge-Kutta scheme with stability region optimized for the hyperbolic diffusion equation with LLF flux and polynomials of degree polydeg=3.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HyperbolicDiffusionEquations1D","page":"Trixi.jl","title":"Trixi.HyperbolicDiffusionEquations1D","text":"HyperbolicDiffusionEquations1D\n\nThe linear hyperbolic diffusion equations in one space dimension. A description of this system can be found in Sec. 2.5 of the book\n\nMasatsuka (2013) I Do Like CFD, Too: Vol 1. Freely available at http://www.cfdbooks.com/\n\nFurther analysis can be found in the paper\n\nNishikawa (2007) A first-order system approach for diffusion equation. I: Second-order residual-distribution schemes DOI: 10.1016/j.jcp.2007.07.029\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HyperbolicDiffusionEquations2D","page":"Trixi.jl","title":"Trixi.HyperbolicDiffusionEquations2D","text":"HyperbolicDiffusionEquations2D\n\nThe linear hyperbolic diffusion equations in two space dimensions. A description of this system can be found in Sec. 2.5 of the book \"I Do Like CFD, Too: Vol 1\". The book is freely available at http://www.cfdbooks.com/ and further analysis can be found in the paper by Nishikawa DOI: 10.1016/j.jcp.2007.07.029\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HyperbolicDiffusionEquations3D","page":"Trixi.jl","title":"Trixi.HyperbolicDiffusionEquations3D","text":"HyperbolicDiffusionEquations3D\n\nThe linear hyperbolic diffusion equations in three space dimensions. A description of this system can be found in Sec. 2.5 of the book \"I Do Like CFD, Too: Vol 1\". The book is freely available at http://www.cfdbooks.com/ and further analysis can be found in the paper by Nishikawa DOI: 10.1016/j.jcp.2007.07.029\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdEquations1D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdEquations1D","text":"IdealGlmMhdEquations1D(gamma)\n\nThe ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in one space dimension.\n\nnote: Note\nThere is no divergence cleaning variable psi because the divergence-free constraint is satisfied trivially in one spatial dimension.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdEquations2D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdEquations2D","text":"IdealGlmMhdEquations2D(gamma)\n\nThe ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in two space dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdEquations3D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdEquations3D","text":"IdealGlmMhdEquations3D(gamma)\n\nThe ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in three space dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdMulticomponentEquations1D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdMulticomponentEquations1D","text":"IdealGlmMhdMulticomponentEquations1D\n\nThe ideal compressible multicomponent GLM-MHD equations in one space dimension.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdMulticomponentEquations2D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdMulticomponentEquations2D","text":"IdealGlmMhdMulticomponentEquations2D\n\nThe ideal compressible multicomponent GLM-MHD equations in two space dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IndicatorHennemannGassner","page":"Trixi.jl","title":"Trixi.IndicatorHennemannGassner","text":"IndicatorHennemannGassner(equations::AbstractEquations, basis;\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable)\nIndicatorHennemannGassner(semi::AbstractSemidiscretization;\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable)\n\nIndicator used for shock-capturing (when passing the equations and the basis) or adaptive mesh refinement (AMR, when passing the semi).\n\nSee also VolumeIntegralShockCapturingHG.\n\nReferences\n\nHennemann, Gassner (2020) \"A provably entropy stable subcell shock capturing approach for high order split form DG\" arXiv: 2008.12044\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IndicatorLöhner","page":"Trixi.jl","title":"Trixi.IndicatorLöhner","text":"IndicatorLöhner (equivalent to IndicatorLoehner)\n\nIndicatorLöhner(equations::AbstractEquations, basis;\n f_wave=0.2, variable)\nIndicatorLöhner(semi::AbstractSemidiscretization;\n f_wave=0.2, variable)\n\nAMR indicator adapted from a FEM indicator by Löhner (1987), also used in the FLASH code as standard AMR indicator. The indicator estimates a weighted second derivative of a specified variable locally.\n\nWhen constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.\n\nReferences\n\nLöhner (1987) \"An adaptive finite element scheme for transient problems in CFD\" doi: 10.1016/0045-7825(87)90098-3\nhttps://flash.rochester.edu/site/flashcode/usersupport/flash4ug_4p62/node59.html#SECTION05163100000000000000\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IndicatorMax","page":"Trixi.jl","title":"Trixi.IndicatorMax","text":"IndicatorMax(equations::AbstractEquations, basis; variable)\nIndicatorMax(semi::AbstractSemidiscretization; variable)\n\nA simple indicator returning the maximum of variable in an element. When constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.InviscidBurgersEquation1D","page":"Trixi.jl","title":"Trixi.InviscidBurgersEquation1D","text":"InviscidBurgersEquation1D\n\nThe inviscid Burgers' equation\n\npartial_t u + frac12 partial_1 u^2 = 0\n\nin one space dimension.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.Isothermal","page":"Trixi.jl","title":"Trixi.Isothermal","text":"struct Isothermal\n\nUsed to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and return a scalar value for the temperature at point x and time t.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LaplaceDiffusion1D","page":"Trixi.jl","title":"Trixi.LaplaceDiffusion1D","text":"LaplaceDiffusion1D(diffusivity, equations)\n\nLaplaceDiffusion1D represents a scalar diffusion term nabla cdot (kappanabla u)) with diffusivity kappa applied to each solution component defined by equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LaplaceDiffusion2D","page":"Trixi.jl","title":"Trixi.LaplaceDiffusion2D","text":"LaplaceDiffusion2D(diffusivity, equations)\n\nLaplaceDiffusion2D represents a scalar diffusion term nabla cdot (kappanabla u)) with diffusivity kappa applied to each solution component defined by equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LaplaceDiffusion3D","page":"Trixi.jl","title":"Trixi.LaplaceDiffusion3D","text":"LaplaceDiffusion3D(diffusivity, equations)\n\nLaplaceDiffusion3D represents a scalar diffusion term nabla cdot (kappanabla u)) with diffusivity kappa applied to each solution component defined by equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LatticeBoltzmannEquations2D","page":"Trixi.jl","title":"Trixi.LatticeBoltzmannEquations2D","text":"LatticeBoltzmannEquations2D(; Ma, Re, collision_op=collision_bgk,\n c=1, L=1, rho0=1, u0=nothing, nu=nothing)\n\nThe Lattice-Boltzmann equations\n\npartial_t u_alpha + v_alpha1 partial_1 u_alpha + v_alpha2 partial_2 u_alpha = 0\n\nin two space dimensions for the D2Q9 scheme.\n\nThe characteristic Mach number and Reynolds numbers are specified as Ma and Re. By the default, the collision operator collision_op is set to the BGK model. c, L, and rho0 specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0 directly (Ma needs to be set to nothing in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu directly (in this case, Re needs to be set to nothing).\n\nThe nine discrete velocity directions of the D2Q9 scheme are sorted as follows [4]:\n\n 6 2 5 y\n ┌───┼───┐ │\n │ │ │\n 3 ┼ 9 ┼ 1 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 7 4 8 z\n\nNote that usually the velocities are numbered from 0 to 8, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 9, where 1 through 8 correspond to the velocity directions in [4] and 9 is the zero velocity.\n\nThe corresponding opposite directions are:\n\n1 ←→ 3\n2 ←→ 4\n3 ←→ 1\n4 ←→ 2\n5 ←→ 7\n6 ←→ 8\n7 ←→ 5\n8 ←→ 6\n9 ←→ 9\n\nThe main sources for the base implementation were\n\nMisun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024\nKarsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.\nDieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0\nDieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LatticeBoltzmannEquations3D","page":"Trixi.jl","title":"Trixi.LatticeBoltzmannEquations3D","text":"LatticeBoltzmannEquations3D(; Ma, Re, collision_op=collision_bgk,\n c=1, L=1, rho0=1, u0=nothing, nu=nothing)\n\nThe Lattice-Boltzmann equations\n\npartial_t u_alpha + v_alpha1 partial_1 u_alpha + v_alpha2 partial_2 u_alpha + v_alpha3 partial_3 u_alpha = 0\n\nin three space dimensions for the D3Q27 scheme.\n\nThe characteristic Mach number and Reynolds numbers are specified as Ma and Re. By the default, the collision operator collision_op is set to the BGK model. c, L, and rho0 specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0 directly (Ma needs to be set to nothing in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu directly (in this case, Re needs to be set to nothing).\n\nThe twenty-seven discrete velocity directions of the D3Q27 scheme are sorted as follows [4]:\n\nplane at z = -1:\n 24 17 21 y\n ┌───┼───┐ │\n │ │ │\n 10 ┼ 6 ┼ 15 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 20 12 26 z\nplane at z = 0:\n 14 3 7 y\n ┌───┼───┐ │\n │ │ │\n 2 ┼ 27 ┼ 1 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 8 4 13 z\nplane at z = +1:\n 25 11 19 y\n ┌───┼───┐ │\n │ │ │\n 16 ┼ 5 ┼ 9 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 22 18 23 z\n\nNote that usually the velocities are numbered from 0 to 26, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 27, where 1 through 26 correspond to the velocity directions in [4] and 27 is the zero velocity.\n\nThe corresponding opposite directions are:\n\n1 ←→ 2\n2 ←→ 1\n3 ←→ 4\n4 ←→ 3\n5 ←→ 6\n6 ←→ 5\n7 ←→ 8\n8 ←→ 7\n9 ←→ 10\n10 ←→ 9\n11 ←→ 12\n12 ←→ 11\n13 ←→ 14\n14 ←→ 13\n15 ←→ 16\n16 ←→ 15\n17 ←→ 18\n18 ←→ 17\n19 ←→ 20\n20 ←→ 19\n21 ←→ 22\n22 ←→ 21\n23 ←→ 24\n24 ←→ 23\n25 ←→ 26\n26 ←→ 25\n27 ←→ 27\n\nThe main sources for the base implementation were\n\nMisun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024\nKarsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.\nDieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0\nDieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearScalarAdvectionEquation1D","page":"Trixi.jl","title":"Trixi.LinearScalarAdvectionEquation1D","text":"LinearScalarAdvectionEquation1D\n\nThe linear scalar advection equation\n\npartial_t u + a partial_1 u = 0\n\nin one space dimension with constant velocity a.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearScalarAdvectionEquation2D","page":"Trixi.jl","title":"Trixi.LinearScalarAdvectionEquation2D","text":"LinearScalarAdvectionEquation2D\n\nThe linear scalar advection equation\n\npartial_t u + a_1 partial_1 u + a_2 partial_2 u = 0\n\nin two space dimensions with constant velocity a.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearScalarAdvectionEquation3D","page":"Trixi.jl","title":"Trixi.LinearScalarAdvectionEquation3D","text":"LinearScalarAdvectionEquation3D\n\nThe linear scalar advection equation\n\npartial_t u + a_1 partial_1 u + a_2 partial_2 u + a_3 partial_3 u = 0\n\nin three space dimensions with constant velocity a.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearizedEulerEquations2D","page":"Trixi.jl","title":"Trixi.LinearizedEulerEquations2D","text":"LinearizedEulerEquations2D(v_mean_global, c_mean_global, rho_mean_global)\n\nLinearized euler equations in two space dimensions. The equations are given by\n\npartial_t\nbeginpmatrix\n rho v_1 v_2 p\nendpmatrix\n+\npartial_x\nbeginpmatrix\n barrho v_1 + barv_1 rho barv_1 v_1 + fracpbarrho barv_1 v_2 barv_1 p + c^2 barrho v_1\nendpmatrix\n+\npartial_y\nbeginpmatrix\n barrho v_2 + barv_2 rho barv_2 v_1 barv_2 v_2 + fracpbarrho barv_2 p + c^2 barrho v_2\nendpmatrix\n=\nbeginpmatrix\n 0 0 0 0\nendpmatrix\n\nThe bar bar(cdot) indicates uniform mean flow variables and c is the speed of sound. The unknowns are the acoustic velocities v = (v_1 v_2), the pressure p and the density rho.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LobattoLegendreBasis","page":"Trixi.jl","title":"Trixi.LobattoLegendreBasis","text":"LobattoLegendreBasis([RealT=Float64,] polydeg::Integer)\n\nCreate a nodal Lobatto-Legendre basis for polynomials of degree polydeg.\n\nFor the special case polydeg=0 the DG method reduces to a finite volume method. Therefore, this function sets the center point of the cell as single node. This exceptional case is currently only supported for TreeMesh!\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.NoSlip","page":"Trixi.jl","title":"Trixi.NoSlip","text":"struct NoSlip\n\nUse to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and should return a SVector{NDIMS} whose entries are the velocity vector at a point x and time t.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.NonConservativeLocal","page":"Trixi.jl","title":"Trixi.NonConservativeLocal","text":"NonConservativeLocal()\n\nStruct used for multiple dispatch on non-conservative flux functions in the format of \"local * symmetric\". When the argument nonconservative_type is of type NonConservativeLocal, the function returns the local part of the non-conservative term.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.NonConservativeSymmetric","page":"Trixi.jl","title":"Trixi.NonConservativeSymmetric","text":"NonConservativeSymmetric()\n\nStruct used for multiple dispatch on non-conservative flux functions in the format of \"local * symmetric\". When the argument nonconservative_type is of type NonConservativeSymmetric, the function returns the symmetric part of the non-conservative term.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.P4estMesh","page":"Trixi.jl","title":"Trixi.P4estMesh","text":"P4estMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nAn unstructured curved mesh based on trees that uses the C library p4est to manage trees and mesh refinement.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.P4estMesh-Tuple{Any}","page":"Trixi.jl","title":"Trixi.P4estMesh","text":"P4estMesh(trees_per_dimension; polydeg,\n mapping=nothing, faces=nothing, coordinates_min=nothing, coordinates_max=nothing,\n RealT=Float64, initial_refinement_level=0, periodicity=true, unsaved_changes=true,\n p4est_partition_allow_for_coarsening=true)\n\nCreate a structured curved P4estMesh of the specified size.\n\nThere are three ways to map the mesh to the physical domain.\n\nDefine a mapping that maps the hypercube [-1, 1]^n.\nSpecify a Tuple faces of functions that parametrize each face.\nCreate a rectangular mesh by specifying coordinates_min and coordinates_max.\n\nNon-periodic boundaries will be called :x_neg, :x_pos, :y_neg, :y_pos, :z_neg, :z_pos.\n\nArguments\n\ntrees_per_dimension::NTupleE{NDIMS, Int}: the number of trees in each dimension.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.\nmapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.\nfaces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\np4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.P4estMesh-Union{Tuple{String}, Tuple{NDIMS}} where NDIMS","page":"Trixi.jl","title":"Trixi.P4estMesh","text":"P4estMesh{NDIMS}(meshfile::String;\n mapping=nothing, polydeg=1, RealT=Float64,\n initial_refinement_level=0, unsaved_changes=true,\n p4est_partition_allow_for_coarsening=true,\n boundary_symbols = nothing)\n\nMain mesh constructor for the P4estMesh that imports an unstructured, conforming mesh from an Abaqus mesh file (.inp). Each element of the conforming mesh parsed from the meshfile is created as a p4est tree datatype.\n\nTo create a curved unstructured mesh P4estMesh two strategies are available:\n\np4est_mesh_from_hohqmesh_abaqus: High-order, curved boundary information created by HOHQMesh.jl is available in the meshfile. The mesh polynomial degree polydeg of the boundaries is provided from the meshfile. The computation of the mapped tree coordinates is done with transfinite interpolation with linear blending similar to UnstructuredMesh2D. Boundary name information is also parsed from the meshfile such that different boundary conditions can be set at each named boundary on a given tree.\np4est_mesh_from_standard_abaqus: By default, with mapping=nothing and polydeg=1, this creates a straight-sided from the information parsed from the meshfile. If a mapping function is specified then it computes the mapped tree coordinates via polynomial interpolants with degree polydeg. The mesh created by this function will only have one boundary :all if boundary_symbols is not specified. If boundary_symbols is specified the mesh file will be parsed for nodesets defining the boundary nodes from which boundary edges (2D) and faces (3D) will be assigned.\n\nNote that the mapping and polydeg keyword arguments are only used by the p4est_mesh_from_standard_abaqus function. The p4est_mesh_from_hohqmesh_abaqus function obtains the mesh polydeg directly from the meshfile and constructs the transfinite mapping internally.\n\nThe particular strategy is selected according to the header present in the meshfile where the constructor checks whether or not the meshfile was created with HOHQMesh.jl. If the Abaqus file header is not present in the meshfile then the P4estMesh is created with the function p4est_mesh_from_standard_abaqus.\n\nThe default keyword argument initial_refinement_level=0 corresponds to a forest where the number of trees is the same as the number of elements in the original meshfile. Increasing the initial_refinement_level allows one to uniformly refine the base mesh given in the meshfile to create a forest with more trees before the simulation begins. For example, if a two-dimensional base mesh contains 25 elements then setting initial_refinement_level=1 creates an initial forest of 2^2 * 25 = 100 trees.\n\nArguments\n\nmeshfile::String: an uncurved Abaqus mesh file that can be imported by p4est.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\np4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.\nboundary_symbols::Vector{Symbol}: A vector of symbols that correspond to the boundary names in the meshfile. If nothing is passed then all boundaries are named :all. \n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ParametersEulerGravity","page":"Trixi.jl","title":"Trixi.ParametersEulerGravity","text":"ParametersEulerGravity(; background_density=0.0,\n gravitational_constant=1.0,\n cfl=1.0,\n resid_tol=1.0e-4,\n n_iterations_max=10^4,\n timestep_gravity=timestep_gravity_erk52_3Sstar!)\n\nSet up parameters for the gravitational part of a SemidiscretizationEulerGravity.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ParsaniKetchesonDeconinck3Sstar32","page":"Trixi.jl","title":"Trixi.ParsaniKetchesonDeconinck3Sstar32","text":"ParsaniKetchesonDeconinck3Sstar32()\n\nParsani, Ketcheson, Deconinck (2013) Optimized explicit RK schemes for the spectral difference method applied to wave propagation problems DOI: 10.1137/120885899\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ParsaniKetchesonDeconinck3Sstar94","page":"Trixi.jl","title":"Trixi.ParsaniKetchesonDeconinck3Sstar94","text":"ParsaniKetchesonDeconinck3Sstar94()\n\nParsani, Ketcheson, Deconinck (2013) Optimized explicit RK schemes for the spectral difference method applied to wave propagation problems DOI: 10.1137/120885899\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PerformanceCounter","page":"Trixi.jl","title":"Trixi.PerformanceCounter","text":"PerformanceCounter()\n\nA PerformanceCounter can be used to track the runtime performance of some calls. Add a new runtime measurement via put!(counter, runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PerformanceCounterList","page":"Trixi.jl","title":"Trixi.PerformanceCounterList","text":"PerformanceCounterList{N}()\n\nA PerformanceCounterList{N} can be used to track the runtime performance of calls to multiple functions, adding them up. Add a new runtime measurement via put!(counter.counters[i], runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PlotData1D","page":"Trixi.jl","title":"Trixi.PlotData1D","text":"PlotData1D\n\nHolds all relevant data for creating 1D plots of multiple solution variables and to visualize the mesh.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PlotData1D-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.PlotData1D","text":"PlotData1D(u, semi [or mesh, equations, solver, cache];\n solution_variables=nothing, nvisnodes=nothing)\n\nCreate a new PlotData1D object that can be used for visualizing 1D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.\n\nnvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.\n\nWhen visualizing data from a two-dimensional simulation, a 1D slice is extracted for plotting. slice specifies the axis along which the slice is extracted and may be :x, or :y. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0). Both of these values are ignored when visualizing 1D data. This applies analogously to three-dimensional simulations, where slice may be :xy, :xz, or :yz.\n\nAnother way to visualize 2D/3D data is by creating a plot along a given curve. This is done with the keyword argument curve. It can be set to a list of 2D/3D points which define the curve. When using curve any other input from slice or point will be ignored.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData1D-Tuple{Union{ODESolution{T, N, uType, uType2, DType, tType, rateType, P} where {T, N, uType, uType2, DType, tType, rateType, P<:(ODEProblem{uType_, tType_, isinplace, P_} where {uType_, tType_, isinplace, P_<:Trixi.AbstractSemidiscretization})}, Trixi.TimeIntegratorSolution}}","page":"Trixi.jl","title":"Trixi.PlotData1D","text":"PlotData1D(sol; kwargs...)\n\nCreate a PlotData1D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData2DCartesian","page":"Trixi.jl","title":"Trixi.PlotData2DCartesian","text":"PlotData2D\n\nHolds all relevant data for creating 2D plots of multiple solution variables and to visualize the mesh.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PolytropicEulerEquations2D","page":"Trixi.jl","title":"Trixi.PolytropicEulerEquations2D","text":"PolytropicEulerEquations2D(gamma, kappa)\n\nThe polytropic Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v_1 rho v_1^2 + kapparho^gamma rho v_1 v_2\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + kapparho^gamma\nendpmatrix\n=\nbeginpmatrix\n0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in two space dimensions. Here, rho is the density and v_1 andv_2 the velocities and\n\np = kapparho^gamma\n\nthe pressure, which we replaced using this relation.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PositivityPreservingLimiterZhangShu","page":"Trixi.jl","title":"Trixi.PositivityPreservingLimiterZhangShu","text":"PositivityPreservingLimiterZhangShu(; threshold, variables)\n\nThe fully-discrete positivity-preserving limiter of\n\nZhang, Shu (2011) Maximum-principle-satisfying and positivity-preserving high-order schemes for conservation laws: survey and new developments doi: 10.1098/rspa.2011.0153\n\nThe limiter is applied to all scalar variables in their given order using the associated thresholds to determine the minimal acceptable values. The order of the variables is important and might have a strong influence on the robustness.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SaveRestartCallback","page":"Trixi.jl","title":"Trixi.SaveRestartCallback","text":"SaveRestartCallback(; interval=0,\n save_final_restart=true,\n output_directory=\"out\")\n\nSave the current numerical solution in a restart file every interval time steps.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SaveSolutionCallback","page":"Trixi.jl","title":"Trixi.SaveSolutionCallback","text":"SaveSolutionCallback(; interval::Integer=0,\n dt=nothing,\n save_initial_solution=true,\n save_final_solution=true,\n output_directory=\"out\",\n solution_variables=cons2prim)\n\nSave the current numerical solution in regular intervals. Either pass interval to save every interval time steps or pass dt to save in intervals of dt in terms of integration time by adding additional (shortened) time steps where necessary (note that this may change the solution). solution_variables can be any callable that converts the conservative variables at a single point to a set of solution variables. The first parameter passed to solution_variables will be the set of conservative variables and the second parameter is the equation struct.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationCoupled","page":"Trixi.jl","title":"Trixi.SemidiscretizationCoupled","text":"SemidiscretizationCoupled\n\nA struct used to bundle multiple semidiscretizations. semidiscretize will return an ODEProblem that synchronizes time steps between the semidiscretizations. Each call of rhs! will call rhs! for each semidiscretization individually. The semidiscretizations can be coupled by gluing meshes together using BoundaryConditionCoupled.\n\nwarning: Experimental code\nThis is an experimental feature and can change any time.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationCoupled-Tuple","page":"Trixi.jl","title":"Trixi.SemidiscretizationCoupled","text":"SemidiscretizationCoupled(semis...)\n\nCreate a coupled semidiscretization that consists of the semidiscretizations passed as arguments.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SemidiscretizationEulerAcoustics","page":"Trixi.jl","title":"Trixi.SemidiscretizationEulerAcoustics","text":"SemidiscretizationEulerAcoustics(semi_acoustics::SemiAcoustics, semi_euler::SemiEuler;\n source_region=x->true, weights=x->1.0)\n\nwarning: Experimental code\nThis semidiscretization is experimental and may change in any future release.\n\nConstruct a semidiscretization of the acoustic perturbation equations that is coupled with the compressible Euler equations via source terms for the perturbed velocity. Both semidiscretizations have to use the same mesh and solvers with a shared basis. The coupling region is described by a function source_region that maps the coordinates of a single node to true or false depending on whether the point lies within the coupling region or not. A weighting function weights that maps coordinates to weights is applied to the acoustic source terms. Note that this semidiscretization should be used in conjunction with EulerAcousticsCouplingCallback and only works in two dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationEulerGravity","page":"Trixi.jl","title":"Trixi.SemidiscretizationEulerGravity","text":"SemidiscretizationEulerGravity\n\nA struct containing everything needed to describe a spatial semidiscretization of a the compressible Euler equations with self-gravity, reformulating the Poisson equation for the gravitational potential as steady-state problem of the hyperblic diffusion equations.\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) \"A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics\" arXiv: 2008.10593\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationEulerGravity-Union{Tuple{SemiGravity}, Tuple{SemiEuler}, Tuple{Mesh}, Tuple{SemiEuler, SemiGravity, Any}} where {Mesh, SemiEuler<:(SemidiscretizationHyperbolic{Mesh, <:Trixi.AbstractCompressibleEulerEquations}), SemiGravity<:(SemidiscretizationHyperbolic{Mesh, <:Trixi.AbstractHyperbolicDiffusionEquations})}","page":"Trixi.jl","title":"Trixi.SemidiscretizationEulerGravity","text":"SemidiscretizationEulerGravity(semi_euler::SemiEuler, semi_gravity::SemiGravity, parameters)\n\nConstruct a semidiscretization of the compressible Euler equations with self-gravity. parameters should be given as ParametersEulerGravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolic","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolic","text":"SemidiscretizationHyperbolic\n\nA struct containing everything needed to describe a spatial semidiscretization of a hyperbolic conservation law.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolic-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolic","text":"SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;\n source_terms=nothing,\n boundary_conditions=boundary_condition_periodic,\n RealT=real(solver),\n uEltype=RealT,\n initial_cache=NamedTuple())\n\nConstruct a semidiscretization of a hyperbolic PDE.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolicParabolic","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolicParabolic","text":"SemidiscretizationHyperbolicParabolic\n\nA struct containing everything needed to describe a spatial semidiscretization of a mixed hyperbolic-parabolic conservation law.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolicParabolic-Tuple{Any, Tuple, Any, Any}","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolicParabolic","text":"SemidiscretizationHyperbolicParabolic(mesh, both_equations, initial_condition, solver;\n solver_parabolic=default_parabolic_solver(),\n source_terms=nothing,\n both_boundary_conditions=(boundary_condition_periodic, boundary_condition_periodic),\n RealT=real(solver),\n uEltype=RealT,\n both_initial_caches=(NamedTuple(), NamedTuple()))\n\nConstruct a semidiscretization of a hyperbolic-parabolic PDE.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ShallowWaterEquations1D","page":"Trixi.jl","title":"Trixi.ShallowWaterEquations1D","text":"ShallowWaterEquations1D(; gravity, H0 = 0)\n\nShallow water equations (SWE) in one space dimension. The equations are given by\n\nbeginaligned\n fracpartial hpartial t + fracpartialpartial x(h v) = 0 \n fracpartialpartial t(h v) + fracpartialpartial xleft(h v^2 + fracg2h^2right)\n + g h fracpartial bpartial x = 0\nendaligned\n\nThe unknown quantities of the SWE are the water height h and the velocity v. The gravitational constant is denoted by g and the (possibly) variable bottom topography function b(x). Conservative variable water height h is measured from the bottom topography b, therefore one also defines the total water height as H = h + b.\n\nThe additional quantity H_0 is also available to store a reference value for the total water height that is useful to set initial conditions or test the \"lake-at-rest\" well-balancedness.\n\nThe bottom topography function b(x) is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.\n\nIn addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height H or the entropy variables. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the bottom topography must be zero.\nThe bottom topography values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the bottom topography by default.\n\nReferences for the SWE are many but a good introduction is available in Chapter 13 of the book:\n\nRandall J. LeVeque (2002) Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ShallowWaterEquations2D","page":"Trixi.jl","title":"Trixi.ShallowWaterEquations2D","text":"ShallowWaterEquations2D(; gravity, H0 = 0)\n\nShallow water equations (SWE) in two space dimensions. The equations are given by\n\nbeginaligned\n fracpartial hpartial t + fracpartialpartial x(h v_1)\n + fracpartialpartial y(h v_2) = 0 \n fracpartialpartial t(h v_1) + fracpartialpartial xleft(h v_1^2 + fracg2h^2right)\n + fracpartialpartial y(h v_1 v_2) + g h fracpartial bpartial x = 0 \n fracpartialpartial t(h v_2) + fracpartialpartial x(h v_1 v_2)\n + fracpartialpartial yleft(h v_2^2 + fracg2h^2right) + g h fracpartial bpartial y = 0\nendaligned\n\nThe unknown quantities of the SWE are the water height h and the velocities mathbfv = (v_1 v_2)^T. The gravitational constant is denoted by g and the (possibly) variable bottom topography function b(xy). Conservative variable water height h is measured from the bottom topography b, therefore one also defines the total water height as H = h + b.\n\nThe additional quantity H_0 is also available to store a reference value for the total water height that is useful to set initial conditions or test the \"lake-at-rest\" well-balancedness.\n\nThe bottom topography function b(xy) is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.\n\nIn addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height H or the entropy variables. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the bottom topography must be zero.\nThe bottom topography values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the bottom topography by default.\n\nReferences for the SWE are many but a good introduction is available in Chapter 13 of the book:\n\nRandall J. LeVeque (2002) Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ShallowWaterEquationsQuasi1D","page":"Trixi.jl","title":"Trixi.ShallowWaterEquationsQuasi1D","text":"ShallowWaterEquationsQuasi1D(; gravity, H0 = 0, threshold_limiter = nothing threshold_wet = nothing)\n\nThe quasi-1D shallow water equations (SWE). The equations are given by\n\nbeginaligned\n fracpartialpartial t(a h) + fracpartialpartial x(a h v) = 0 \n fracpartialpartial t(a h v) + fracpartialpartial x(a h v^2)\n + g a h fracpartialpartial x(h + b) = 0\nendaligned\n\nThe unknown quantities of the Quasi-1D SWE are the water height h and the scaled velocity v. The gravitational constant is denoted by g, the (possibly) variable bottom topography function b(x), and (possibly) variable channel width a(x). The water height h is measured from the bottom topography b, therefore one also defines the total water height as H = h + b.\n\nThe additional quantity H_0 is also available to store a reference value for the total water height that is useful to set initial conditions or test the \"lake-at-rest\" well-balancedness.\n\nThe bottom topography function b(x) and channel width a(x) are set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero and a to one. \n\nIn addition to the unknowns, Trixi.jl currently stores the bottom topography and channel width values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height H or the entropy variables. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the bottom topography and channel width must be zero.\nThe bottom topography and channel width values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the bottom topography and channel width by default.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SimpleSSPRK33","page":"Trixi.jl","title":"Trixi.SimpleSSPRK33","text":"SimpleSSPRK33(; stage_callbacks=())\n\nThe third-order SSP Runge-Kutta method of Shu and Osher.\n\nReferences\n\nShu, Osher (1988) \"Efficient Implementation of Essentially Non-oscillatory Shock-Capturing Schemes\" (Eq. 2.18) DOI: 10.1016/0021-9991(88)90177-5\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SteadyStateCallback","page":"Trixi.jl","title":"Trixi.SteadyStateCallback","text":"SteadyStateCallback(; abstol=1.0e-8, reltol=1.0e-6)\n\nTerminates the integration when the residual_steady_state(du, equations) falls below the threshold specified by abstol, reltol.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StepsizeCallback","page":"Trixi.jl","title":"Trixi.StepsizeCallback","text":"StepsizeCallback(; cfl=1.0)\n\nSet the time step size according to a CFL condition with CFL number cfl if the time integration method isn't adaptive itself.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StructuredMesh","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nA structured curved mesh.\n\nDifferent numbers of cells per dimension are possible and arbitrary functions can be used as domain faces.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StructuredMesh-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; periodicity=true)\n\nCreate a StructuredMesh that represents a uncurved structured mesh with a rectangular domain.\n\nArguments\n\ncells_per_dimension::NTuple{NDIMS, Int}: the number of cells in each dimension.\ncoordinates_min::NTuple{NDIMS, RealT}: coordinate of the corner in the negative direction of each dimension.\ncoordinates_max::NTuple{NDIMS, RealT}: coordinate of the corner in the positive direction of each dimension.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.StructuredMesh-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh(cells_per_dimension, mapping; RealT=Float64, unsaved_changes=true, mapping_as_string=mapping2string(mapping, length(cells_per_dimension)))\n\nCreate a StructuredMesh of the given size and shape that uses RealT as coordinate type.\n\nArguments\n\ncells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.\nmapping: a function of NDIMS variables to describe the mapping, which transforms the reference mesh to the physical domain. If no mapping_as_string is defined, this function must be defined with the name mapping to allow for restarts. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.\nRealT::Type: the type that should be used for coordinates.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\nmapping_as_string::String: the code that defines the mapping. If CodeTracking can't find the function definition, it can be passed directly here. The code string must define the mapping function with the name mapping. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.StructuredMesh-Tuple{Any, Tuple}","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh(cells_per_dimension, faces; RealT=Float64, unsaved_changes=true, faces_as_string=faces2string(faces))\n\nCreate a StructuredMesh of the given size and shape that uses RealT as coordinate type.\n\nArguments\n\ncells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.\nfaces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D).\nRealT::Type: the type that should be used for coordinates.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SubcellLimiterIDP","page":"Trixi.jl","title":"Trixi.SubcellLimiterIDP","text":"SubcellLimiterIDP(equations::AbstractEquations, basis;\n local_minmax_variables_cons = String[],\n positivity_variables_cons = String[],\n positivity_variables_nonlinear = [],\n positivity_correction_factor = 0.1,\n max_iterations_newton = 10,\n newton_tolerances = (1.0e-12, 1.0e-14),\n gamma_constant_newton = 2 * ndims(equations))\n\nSubcell invariant domain preserving (IDP) limiting used with VolumeIntegralSubcellLimiting including:\n\nLocal maximum/minimum Zalesak-type limiting for conservative variables (local_minmax_variables_cons)\nPositivity limiting for conservative variables (positivity_variables_cons) and nonlinear variables\n\n(positivity_variables_nonlinear)\n\nConservative variables to be limited are passed as a vector of strings, e.g. local_minmax_variables_cons = [\"rho\"] and positivity_variables_cons = [\"rho\"]. For nonlinear variables the specific functions are passed in a vector, e.g. positivity_variables_nonlinear = [pressure].\n\nThe bounds are calculated using the low-order FV solution. The positivity limiter uses positivity_correction_factor such that u^new >= positivity_correction_factor * u^FV. The limiting of nonlinear variables uses a Newton-bisection method with a maximum of max_iterations_newton iterations, relative and absolute tolerances of newton_tolerances and a provisional update constant gamma_constant_newton (gamma_constant_newton>=2*d, where d = #dimensions). See equation (20) of Pazner (2020) and equation (30) of Rueda-Ramírez et al. (2022).\n\nnote: Note\nThis limiter and the correction callback SubcellLimiterIDPCorrection only work together. Without the callback, no correction takes place, leading to a standard low-order FV scheme.\n\nReferences\n\nRueda-Ramírez, Pazner, Gassner (2022) Subcell Limiting Strategies for Discontinuous Galerkin Spectral Element Methods DOI: 10.1016/j.compfluid.2022.105627\nPazner (2020) Sparse invariant domain preserving discontinuous Galerkin methods with subcell convex limiting DOI: 10.1016/j.cma.2021.113876\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SubcellLimiterIDPCorrection","page":"Trixi.jl","title":"Trixi.SubcellLimiterIDPCorrection","text":"SubcellLimiterIDPCorrection()\n\nPerform antidiffusive correction stage for the a posteriori IDP limiter SubcellLimiterIDP called with VolumeIntegralSubcellLimiting.\n\nnote: Note\nThis callback and the actual limiter SubcellLimiterIDP only work together. This is not a replacement but a necessary addition.\n\nReferences\n\nRueda-Ramírez, Pazner, Gassner (2022) Subcell Limiting Strategies for Discontinuous Galerkin Spectral Element Methods DOI: 10.1016/j.compfluid.2022.105627\nPazner (2020) Sparse invariant domain preserving discontinuous Galerkin methods with subcell convex limiting DOI: 10.1016/j.cma.2021.113876\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SurfaceIntegralStrongForm","page":"Trixi.jl","title":"Trixi.SurfaceIntegralStrongForm","text":"SurfaceIntegralStrongForm(surface_flux=flux_central)\n\nThe classical strong form surface integral type for FD/DG methods.\n\nSee also VolumeIntegralStrongForm.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SurfaceIntegralUpwind","page":"Trixi.jl","title":"Trixi.SurfaceIntegralUpwind","text":"SurfaceIntegralUpwind(splitting)\n\nCouple elements with upwind simultaneous approximation terms (SATs) that use a particular flux splitting, e.g., splitting_steger_warming.\n\nSee also VolumeIntegralUpwind.\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SurfaceIntegralWeakForm","page":"Trixi.jl","title":"Trixi.SurfaceIntegralWeakForm","text":"SurfaceIntegralWeakForm(surface_flux=flux_central)\n\nThe classical weak form surface integral type for DG methods as explained in standard textbooks.\n\nSee also VolumeIntegralWeakForm.\n\nReferences\n\nKopriva (2009) Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers doi: 10.1007/978-90-481-2261-5\nHesthaven, Warburton (2007) Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications doi: 10.1007/978-0-387-72067-8\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.T8codeMesh","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nAn unstructured curved mesh based on trees that uses the C library 't8code' to manage trees and mesh refinement.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Any}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(trees_per_dimension; polydeg, mapping=identity,\n RealT=Float64, initial_refinement_level=0, periodicity=true)\n\nCreate a structured potentially curved 'T8codeMesh' of the specified size.\n\nNon-periodic boundaries will be called ':xneg', ':xpos', ':yneg', ':ypos', ':zneg', ':zpos'.\n\nArguments\n\n'treesperdimension::NTupleE{NDIMS, Int}': the number of trees in each dimension.\n'polydeg::Integer': polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.\nmapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.\nfaces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\n'RealT::Type': the type that should be used for coordinates.\n'initialrefinementlevel::Integer': refine the mesh uniformly to this level before the simulation starts.\n'periodicity': either a 'Bool' deciding if all of the boundaries are periodic or an 'NTuple{NDIMS, Bool}' deciding for each dimension if the boundaries in this dimension are periodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Ptr{P4est.LibP4est.p4est_connectivity}}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(conn::Ptr{p4est_connectivity}; kwargs...)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.\n\nArguments\n\nconn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Ptr{P4est.LibP4est.p8est_connectivity}}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(conn::Ptr{p8est_connectivity}; kwargs...)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.\n\nArguments\n\nconn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Ptr{T8code.Libt8.t8_cmesh}}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(cmesh::Ptr{t8_cmesh},\n mapping=nothing, polydeg=1, RealT=Float64,\n initial_refinement_level=0)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a t8_cmesh data structure.\n\nArguments\n\ncmesh::Ptr{t8_cmesh}: Pointer to a cmesh object.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{String, Any}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(meshfile::String, ndims; kwargs...)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a Gmsh mesh file (.msh).\n\nArguments\n\nmeshfile::String: path to a Gmsh mesh file.\nndims: Mesh file dimension: 2 or 3.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.TimeSeriesCallback","page":"Trixi.jl","title":"Trixi.TimeSeriesCallback","text":"TimeSeriesCallback(semi, point_coordinates;\n interval=1, solution_variables=cons2cons,\n output_directory=\"out\", filename=\"time_series.h5\",\n RealT=real(solver), uEltype=eltype(cache.elements))\n\nCreate a callback that records point-wise data at points given in point_coordinates every interval time steps. The point coordinates are to be specified either as a vector of coordinate tuples or as a two-dimensional array where the first dimension is the point number and the second dimension is the coordinate dimension. By default, the conservative variables are recorded, but this can be controlled by passing a different conversion function to solution_variables.\n\nAfter the last time step, the results are stored in an HDF5 file filename in directory output_directory.\n\nThe real data type RealT and data type for solution variables uEltype default to the respective types used in the solver and the cache.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.TrafficFlowLWREquations1D","page":"Trixi.jl","title":"Trixi.TrafficFlowLWREquations1D","text":"TrafficFlowLWREquations1D\n\nThe classic Lighthill-Witham Richards (LWR) model for 1D traffic flow. The car density is denoted by u in 0 1 and the maximum possible speed (e.g. due to speed limits) is v_textmax.\n\npartial_t u + v_textmax partial_1 u (1 - u) = 0\n\nFor more details see e.g. Section 11.1 of \n\nRandall LeVeque (2002)\n\nFinite Volume Methods for Hyperbolic Problems [DOI: 10.1017/CBO9780511791253]https://doi.org/10.1017/CBO9780511791253\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.TreeMesh","page":"Trixi.jl","title":"Trixi.TreeMesh","text":"TreeMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nA Cartesian mesh based on trees of hypercubes to support adaptive mesh refinement.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.UnstructuredMesh2D","page":"Trixi.jl","title":"Trixi.UnstructuredMesh2D","text":"UnstructuredMesh2D <: AbstractMesh{2}\n\nAn unstructured (possibly curved) quadrilateral mesh.\n\nUnstructuredMesh2D(filename; RealT=Float64, periodicity=false)\n\nAll mesh information, neighbour coupling, and boundary curve information is read in from a mesh file filename.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.UnstructuredSortedBoundaryTypes","page":"Trixi.jl","title":"Trixi.UnstructuredSortedBoundaryTypes","text":"UnstructuredSortedBoundaryTypes\n\nGeneral container to sort the boundary conditions by type for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type to expedite computation during the call to calc_boundary_flux!. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ViscousFormulationBassiRebay1","page":"Trixi.jl","title":"Trixi.ViscousFormulationBassiRebay1","text":"ViscousFormulationBassiRebay1()\n\nThe classical BR1 flux from\n\nF. Bassi, S. Rebay (1997) A High-Order Accurate Discontinuous Finite Element Method for the Numerical Solution of the Compressible Navier-Stokes Equations DOI: 10.1006/jcph.1996.5572\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ViscousFormulationLocalDG","page":"Trixi.jl","title":"Trixi.ViscousFormulationLocalDG","text":"ViscousFormulationLocalDG(penalty_parameter)\n\nThe local DG (LDG) flux from \"The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems\" by Cockburn and Shu (1998).\n\nNote that, since this implementation does not involve the parabolic \"upwinding\" vector, the LDG solver is equivalent to ViscousFormulationBassiRebay1 with an LDG-type penalization.\n\nCockburn and Shu (1998). The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems DOI: 10.1137/S0036142997316712\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VisualizationCallback-Tuple{}","page":"Trixi.jl","title":"Trixi.VisualizationCallback","text":"VisualizationCallback(; interval=0,\n solution_variables=cons2prim,\n variable_names=[],\n show_mesh=false,\n plot_data_creator=PlotData2D,\n plot_creator=show_plot,\n plot_arguments...)\n\nCreate a callback that visualizes results during a simulation, also known as in-situ visualization.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in any future releases.\n\nThe interval specifies the number of time step iterations after which a new plot is generated. The available variables to plot are configured with the solution_variables parameter, which acts the same way as for the SaveSolutionCallback. The variables to be actually plotted can be selected by providing a single string or a list of strings to variable_names, and if show_mesh is true, an additional plot with the mesh will be generated.\n\nTo customize the generated figure, plot_data_creator allows to use different plot data types. With plot_creator you can further specify an own function to visualize results, which must support the same interface as the default implementation show_plot. All remaining keyword arguments are collected and passed as additional arguments to the plotting command.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.VolumeIntegralFluxDifferencing","page":"Trixi.jl","title":"Trixi.VolumeIntegralFluxDifferencing","text":"VolumeIntegralFluxDifferencing(volume_flux)\n\nVolume integral type for DG methods based on SBP operators and flux differencing using a symmetric two-point volume_flux. This volume_flux needs to satisfy the interface of numerical fluxes in Trixi.jl.\n\nReferences\n\nLeFloch, Mercier, Rohde (2002) Fully Discrete, Entropy Conservative Schemes of Arbitrary Order doi: 10.1137/S003614290240069X\nFisher, Carpenter (2013) High-order entropy stable finite difference schemes for nonlinear conservation laws: Finite domains doi: 10.1016/j.jcp.2013.06.014\nHendrik Ranocha (2017) Comparison of Some Entropy Conservative Numerical Fluxes for the Euler Equations arXiv: 1701.02264 doi: 10.1007/s10915-017-0618-1\nChen, Shu (2017) Entropy stable high order discontinuous Galerkin methods with suitable quadrature rules for hyperbolic conservation laws doi: 10.1016/j.jcp.2017.05.025\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralPureLGLFiniteVolume","page":"Trixi.jl","title":"Trixi.VolumeIntegralPureLGLFiniteVolume","text":"VolumeIntegralPureLGLFiniteVolume(volume_flux_fv)\n\nA volume integral that only uses the subcell finite volume schemes of the VolumeIntegralShockCapturingHG.\n\nThis gives a formally O(1)-accurate finite volume scheme on an LGL-type subcell mesh (LGL = Legendre-Gauss-Lobatto).\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nHennemann, Gassner (2020) \"A provably entropy stable subcell shock capturing approach for high order split form DG\" arXiv: 2008.12044\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralShockCapturingHG","page":"Trixi.jl","title":"Trixi.VolumeIntegralShockCapturingHG","text":"VolumeIntegralShockCapturingHG(indicator; volume_flux_dg=flux_central,\n volume_flux_fv=flux_lax_friedrichs)\n\nShock-capturing volume integral type for DG methods using a convex blending of the finite volume method with numerical flux volume_flux_fv and the VolumeIntegralFluxDifferencing with volume flux volume_flux_dg. The amount of blending is determined by the indicator, e.g., IndicatorHennemannGassner.\n\nReferences\n\nHennemann, Gassner (2020) \"A provably entropy stable subcell shock capturing approach for high order split form DG\" arXiv: 2008.12044\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralStrongForm","page":"Trixi.jl","title":"Trixi.VolumeIntegralStrongForm","text":"VolumeIntegralStrongForm()\n\nThe classical strong form volume integral type for FD/DG methods.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralSubcellLimiting","page":"Trixi.jl","title":"Trixi.VolumeIntegralSubcellLimiting","text":"VolumeIntegralSubcellLimiting(limiter;\n volume_flux_dg, volume_flux_fv)\n\nA subcell limiting volume integral type for DG methods based on subcell blending approaches with a low-order FV method. Used with limiter SubcellLimiterIDP.\n\nnote: Note\nSubcell limiting methods are not fully functional on non-conforming meshes. This is mainly because the implementation assumes that low- and high-order schemes have the same surface terms, which is not guaranteed for non-conforming meshes. The low-order scheme with a high-order mortar is not invariant domain preserving.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralUpwind","page":"Trixi.jl","title":"Trixi.VolumeIntegralUpwind","text":"VolumeIntegralUpwind(splitting)\n\nSpecialized volume integral for finite difference summation-by-parts (FDSBP) solvers. Can be used together with the upwind SBP operators of Mattsson (2017) implemented in SummationByPartsOperators.jl. The splitting controls the discretization.\n\nSee also splitting_steger_warming, splitting_lax_friedrichs, splitting_vanleer_haenel.\n\nReferences\n\nMattsson (2017) Diagonal-norm upwind SBP operators doi: 10.1016/j.jcp.2017.01.042\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralWeakForm","page":"Trixi.jl","title":"Trixi.VolumeIntegralWeakForm","text":"VolumeIntegralWeakForm()\n\nThe classical weak form volume integral type for DG methods as explained in standard textbooks.\n\nReferences\n\nKopriva (2009) Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers doi: 10.1007/978-90-481-2261-5\nHesthaven, Warburton (2007) Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications doi: 10.1007/978-0-387-72067-8\n\nVolumeIntegralWeakForm() is only implemented for conserved terms as non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, see VolumeIntegralFluxDifferencing. This treatment is required to achieve, e.g., entropy-stability or well-balancedness.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Base.getindex-Tuple{Trixi.AbstractPlotData, Any}","page":"Trixi.jl","title":"Base.getindex","text":"Base.getindex(pd::AbstractPlotData, variable_name)\n\nExtract a single variable variable_name from pd for plotting with Plots.plot.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Base.resize!-Tuple{Trixi.AbstractContainer, Any}","page":"Trixi.jl","title":"Base.resize!","text":"resize!(c::AbstractContainer, new_length) -> AbstractContainer\n\nResize c to contain new_length elements. If new_length is smaller than the current container length, the first new_length elements will be retained. If new_length is larger, the new elements are invalidated.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.compute_coefficients!-Tuple{Any, Any, Any, Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"PolynomialBases.compute_coefficients!","text":"compute_coefficients!(u_ode, func, t, semi::AbstractSemidiscretization)\n\nSame as compute_coefficients but stores the result in u_ode.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.compute_coefficients-Tuple{Any, Any, Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"PolynomialBases.compute_coefficients","text":"compute_coefficients(func, t, semi::AbstractSemidiscretization)\n\nCompute the discrete coefficients of the continuous function func at time t associated with the semidiscretization semi. For example, the discrete coefficients of func for a discontinuous Galerkin spectral element method (DGSEM) are the values of func at the Lobatto-Legendre nodes. Similarly, a classical finite difference method will use the values of func at the nodes of the grid assoociated with the semidiscretization semi.\n\nFor semidiscretizations semi associated with an initial condition, func can be omitted to use the given initial condition at time t.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.integrate-Tuple{Any, Any, LobattoLegendreBasis}","page":"Trixi.jl","title":"PolynomialBases.integrate","text":"integrate(f, u, basis::LobattoLegendreBasis)\n\nMap the function f to the coefficients u and integrate with respect to the quadrature rule given by basis.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.integrate-Union{Tuple{Func}, Tuple{Func, Any, Trixi.AbstractSemidiscretization}} where Func","page":"Trixi.jl","title":"PolynomialBases.integrate","text":"integrate([func=(u_node,equations)->u_node,] u_ode, semi::AbstractSemidiscretization; normalize=true)\n\nCall func(u_node, equations) for each vector of nodal variables u_node in u_ode and integrate the result using a quadrature associated with the semidiscretization semi.\n\nIf normalize is true, the result is divided by the total volume of the computational domain.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SciMLBase.add_tstop!-Tuple{Trixi.SimpleIntegratorSSP, Any}","page":"Trixi.jl","title":"SciMLBase.add_tstop!","text":"add_tstop!(integrator::SimpleIntegratorSSP, t)\n\nAdd a time stop during the time integration process. This function is called after the periodic SaveSolutionCallback to specify the next stop to save the solution.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SummationByPartsOperators.semidiscretize-Tuple{SemidiscretizationHyperbolicParabolic, Any}","page":"Trixi.jl","title":"SummationByPartsOperators.semidiscretize","text":"semidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan)\n\nWrap the semidiscretization semi as a split ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The parabolic right-hand side is the first function of the split ODE problem and will be used by default by the implicit part of IMEX methods from the SciML ecosystem.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SummationByPartsOperators.semidiscretize-Tuple{Trixi.AbstractSemidiscretization, Any, AbstractString}","page":"Trixi.jl","title":"SummationByPartsOperators.semidiscretize","text":"semidiscretize(semi::AbstractSemidiscretization, tspan, restart_file::AbstractString)\n\nWrap the semidiscretization semi as an ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The initial condition etc. is taken from the restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SummationByPartsOperators.semidiscretize-Tuple{Trixi.AbstractSemidiscretization, Any}","page":"Trixi.jl","title":"SummationByPartsOperators.semidiscretize","text":"semidiscretize(semi::AbstractSemidiscretization, tspan)\n\nWrap the semidiscretization semi as an ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiBasis-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.DGMultiBasis","text":"DGMultiBasis(element_type, polydeg; approximation_type = Polynomial(), kwargs...)\n\nConstructs a basis for DGMulti solvers. Returns a \"StartUpDG.RefElemData\" object. The kwargs arguments are additional keyword arguments for RefElemData, such as quad_rule_vol. These are the same as the RefElemData_kwargs used in DGMulti. For more info, see the StartUpDG.jl docs.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.LBMCollisionCallback-Tuple{}","page":"Trixi.jl","title":"Trixi.LBMCollisionCallback","text":"LBMCollisionCallback()\n\nApply the Lattice-Boltzmann method (LBM) collision operator before each time step. See LatticeBoltzmannEquations2D for further details.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.P4estMeshCubedSphere-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.P4estMeshCubedSphere","text":"P4estMeshCubedSphere(trees_per_face_dimension, layers, inner_radius, thickness;\n polydeg, RealT=Float64,\n initial_refinement_level=0, unsaved_changes=true,\n p4est_partition_allow_for_coarsening=true)\n\nBuild a \"Cubed Sphere\" mesh as P4estMesh with 6 * trees_per_face_dimension^2 * layers trees.\n\nThe mesh will have two boundaries, :inside and :outside.\n\nArguments\n\ntrees_per_face_dimension::Integer: the number of trees in the first two local dimensions of each face.\nlayers::Integer: the number of trees in the third local dimension of each face, i.e., the number of layers of the sphere.\ninner_radius::Integer: the inner radius of the sphere.\nthickness::Integer: the thickness of the sphere. The outer radius will be inner_radius + thickness.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\np4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData2D-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.PlotData2D","text":"PlotData2D(u, semi [or mesh, equations, solver, cache];\n solution_variables=nothing,\n grid_lines=true, max_supported_level=11, nvisnodes=nothing,\n slice=:xy, point=(0.0, 0.0, 0.0))\n\nCreate a new PlotData2D object that can be used for visualizing 2D/3D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.\n\nIf grid_lines is true, also extract grid vertices for visualizing the mesh. The output resolution is indirectly set via max_supported_level: all data is interpolated to 2^max_supported_level uniformly distributed points in each spatial direction, also setting the maximum allowed refinement level in the solution. nvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.\n\nWhen visualizing data from a three-dimensional simulation, a 2D slice is extracted for plotting. slice specifies the plane that is being sliced and may be :xy, :xz, or :yz. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0, 0.0). Both of these values are ignored when visualizing 2D data.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nExamples\n\njulia> using Trixi, Plots\n\njulia> trixi_include(default_example())\n[...]\n\njulia> pd = PlotData2D(sol)\nPlotData2D(...)\n\njulia> plot(pd) # To plot all available variables\n\njulia> plot(pd[\"scalar\"]) # To plot only a single variable\n\njulia> plot!(getmesh(pd)) # To add grid lines to the plot\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData2D-Tuple{Union{ODESolution{T, N, uType, uType2, DType, tType, rateType, P} where {T, N, uType, uType2, DType, tType, rateType, P<:(ODEProblem{uType_, tType_, isinplace, P_} where {uType_, tType_, isinplace, P_<:Trixi.AbstractSemidiscretization})}, Trixi.TimeIntegratorSolution}}","page":"Trixi.jl","title":"Trixi.PlotData2D","text":"PlotData2D(sol; kwargs...)\n\nCreate a PlotData2D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ScalarPlotData2D-Tuple{Any, Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.ScalarPlotData2D","text":"ScalarPlotData2D(u, semi::AbstractSemidiscretization; kwargs...)\n\nReturns an PlotData2DTriangulated object which is used to visualize a single scalar field. u should be an array whose entries correspond to values of the scalar field at nodal points.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SummaryCallback","page":"Trixi.jl","title":"Trixi.SummaryCallback","text":"SummaryCallback()\n\nCreate and return a callback that prints a human-readable summary of the simulation setup at the beginning of a simulation and then resets the timer. When the returned callback is executed directly, the current timer values are shown.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.TrivialCallback-Tuple{}","page":"Trixi.jl","title":"Trixi.TrivialCallback","text":"TrivialCallback()\n\nA callback that does nothing. This can be useful to disable some callbacks easily via trixi_include.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.adapt!-Tuple{T8codeMesh, Any}","page":"Trixi.jl","title":"Trixi.adapt!","text":"Trixi.adapt!(mesh::T8codeMesh, adapt_callback; kwargs...)\n\nAdapt a T8codeMesh according to a user-defined adapt_callback.\n\nArguments\n\nmesh::T8codeMesh: Initialized mesh object.\nadapt_callback: A user-defined callback which tells the adaption routines if an element should be refined, coarsened or stay unchanged.\nThe expected callback signature is as follows:\n`adapt_callback(forest, ltreeid, eclass_scheme, lelemntid, elements, is_family, user_data)`\n # Arguments\n - `forest`: Pointer to the analyzed forest.\n - `ltreeid`: Local index of the current tree where the analyzed elements are part of.\n - `eclass_scheme`: Element class of `elements`.\n - `lelemntid`: Local index of the first element in `elements`.\n - `elements`: Array of elements. If consecutive elements form a family\n they are passed together, otherwise `elements` consists of just one element.\n - `is_family`: Boolean signifying if `elements` represents a family or not.\n - `user_data`: Void pointer to some arbitrary user data. Default value is `C_NULL`.\n # Returns\n -1 : Coarsen family of elements.\n 0 : Stay unchanged.\n 1 : Refine element.\nkwargs:\nrecursive = true: Adapt the forest recursively. If true the caller must ensure that the callback returns 0 for every analyzed element at some point to stop the recursion.\nbalance = true: Make sure the adapted forest is 2^(NDIMS-1):1 balanced.\npartition = true: Partition the forest to redistribute elements evenly among MPI ranks.\nghost = true: Create a ghost layer for MPI data exchange.\nuser_data = C_NULL: Pointer to some arbitrary user-defined data.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.adapt_to_mesh_level!-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.adapt_to_mesh_level!","text":"adapt_to_mesh_level!(u_ode, semi, level)\nadapt_to_mesh_level!(sol::Trixi.TrixiODESolution, level)\n\nLike adapt_to_mesh_level, but modifies the solution and parts of the semidiscretization (mesh and caches) in place.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.adapt_to_mesh_level-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.adapt_to_mesh_level","text":"adapt_to_mesh_level(u_ode, semi, level)\nadapt_to_mesh_level(sol::Trixi.TrixiODESolution, level)\n\nUse the regular adaptive mesh refinement routines to adaptively refine/coarsen the solution u_ode with semidiscretization semi towards a uniformly refined grid with refinement level level. The solution and semidiscretization are copied such that the original objects remain unaltered.\n\nA convenience method accepts an ODE solution object, from which solution and semidiscretization are extracted as needed.\n\nSee also: adapt_to_mesh_level!\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.balance!-Tuple{T8codeMesh}","page":"Trixi.jl","title":"Trixi.balance!","text":"Trixi.balance!(mesh::T8codeMesh)\n\nBalance a T8codeMesh to ensure 2^(NDIMS-1):1 face neighbors.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_x-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_x","text":"boundary_condition_linear_x(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation1D)\n\nBoundary conditions for initial_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_x-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_x","text":"boundary_condition_linear_x(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation2D)\n\nBoundary conditions for initial_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_x_y-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_x_y","text":"boundary_condition_linear_x_y(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation2D)\n\nBoundary conditions for initial_condition_linear_x_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_y-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_y","text":"boundary_condition_linear_y(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation2D)\n\nBoundary conditions for initial_condition_linear_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_z-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_z","text":"boundary_condition_linear_z(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation1D)\n\nBoundary conditions for boundary_condition_linear_z.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_noslip_wall-Tuple{Any, Any, Any, Any, Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_noslip_wall","text":"boundary_condition_noslip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equations::LatticeBoltzmannEquations2D)\n\nNo-slip wall boundary condition using the bounce-back approach.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_poisson_nonperiodic-Tuple{Any, Any, Any, Any, Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_poisson_nonperiodic","text":"boundary_condition_poisson_nonperiodic(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equations::HyperbolicDiffusionEquations1D)\n\nBoundary conditions used for convergence tests in combination with initial_condition_poisson_nonperiodic and source_terms_poisson_nonperiodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::AcousticPerturbationEquations2D)\n\nUse an orthogonal projection of the perturbed velocities to zero out the normal velocity while retaining the possibility of a tangential velocity in the boundary state. Further details are available in the paper:\n\nMarcus Bauer, Jürgen Dierke and Roland Ewert (2011) Application of a discontinuous Galerkin method to discretize acoustic perturbation equations DOI: 10.2514/1.J050333\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations2D)\n\nShould be used together with StructuredMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations3D)\n\nShould be used together with StructuredMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::CompressibleEulerEquations2D)\n\nDetermine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:\n\nJ. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF\n\nDetails about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761\n\nShould be used together with UnstructuredMesh2D.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::CompressibleEulerEquations3D)\n\nDetermine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:\n\nJ. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF\n\nDetails about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::ShallowWaterEquations2D)\n\nCreate a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value. For details see Section 9.2.5 of the book:\n\nEleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations1D)\n\nDetermine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:\n\nJ. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations2D)\n\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations3D)\n\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation_or_normal, x, t, surface_flux_function,\n equations::ShallowWaterEquations1D)\n\nCreate a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value.\n\nFor details see Section 9.2.5 of the book:\n\nEleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::ShallowWaterEquations2D)\n\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_wall-Tuple{Any, Any, Any, Any, Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_wall","text":"boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,\n equations::AcousticPerturbationEquations2D)\n\nBoundary conditions for a solid wall.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_wall-Tuple{Any, Any, Any, Any, Any, Any, LinearizedEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_wall","text":"boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,\n equations::LinearizedEulerEquations2D)\n\nBoundary conditions for a solid wall.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_error_norms-Tuple{Any, Any, Any, Trixi.AbstractSemidiscretization, Any}","page":"Trixi.jl","title":"Trixi.calc_error_norms","text":"calc_error_norms([func=(u_node,equations)->u_node,] u_ode, t, analyzer, semi::AbstractSemidiscretization, cache_analysis)\n\nCalculate discrete L2 and L∞ error norms of func applied to each nodal variable u_node in u_ode. If no exact solution is available, \"errors\" are calculated using some reference state and can be useful for regression tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_fast_wavespeed_roe-Tuple{Any, Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.calc_fast_wavespeed_roe","text":"calc_fast_wavespeed_roe(u_ll, u_rr, direction, equations::IdealGlmMhdEquations1D)\n\nCompute the fast magnetoacoustic wave speed using Roe averages as given by\n\nCargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_fast_wavespeed_roe-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.calc_fast_wavespeed_roe","text":"calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations2D)\n\nCompute the fast magnetoacoustic wave speed using Roe averages as given by\n\nCargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_fast_wavespeed_roe-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.calc_fast_wavespeed_roe","text":"calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)\n\nCompute the fast magnetoacoustic wave speed using Roe averages as given by\n\nCargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_wavespeed_roe-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.calc_wavespeed_roe","text":"calc_wavespeed_roe(u_ll, u_rr, direction::Integer,\n equations::ShallowWaterEquations1D)\n\nCalculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} See for instance equation (62) in \n\nPaul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044\n\nOr equation (9.17) in this lecture notes.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_wavespeed_roe-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.calc_wavespeed_roe","text":"calc_wavespeed_roe(u_ll, u_rr, direction::Integer,\n equations::ShallowWaterEquations2D)\n\nCalculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} depending on direction. See for instance equation (62) in \n\nPaul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044\n\nOr this slides, slides 8 and 9.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.collision_bgk-Tuple{Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.collision_bgk","text":"collision_bgk(u, dt, equations::LatticeBoltzmannEquations2D)\n\nCollision operator for the Bhatnagar, Gross, and Krook (BGK) model.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.collision_bgk-Tuple{Any, Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.collision_bgk","text":"collision_bgk(u, dt, equations::LatticeBoltzmannEquations3D)\n\nCollision operator for the Bhatnagar, Gross, and Krook (BGK) model.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.cons2cons-Tuple{Any, Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.cons2cons","text":"cons2cons(u, equations)\n\nReturn the conserved variables u. While this function is as trivial as identity, it is also as useful.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.cons2entropy","page":"Trixi.jl","title":"Trixi.cons2entropy","text":"cons2entropy(u, equations)\n\nConvert the conserved variables u to the entropy variables for a given set of equations with chosen standard entropy.\n\nu is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by entropy2cons.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.cons2prim","page":"Trixi.jl","title":"Trixi.cons2prim","text":"cons2prim(u, equations)\n\nConvert the conserved variables u to the primitive variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by prim2cons.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.convergence_test-Tuple{Module, AbstractString, Any}","page":"Trixi.jl","title":"Trixi.convergence_test","text":"convergence_test([mod::Module=Main,] elixir::AbstractString, iterations; kwargs...)\n\nRun iterations Trixi.jl simulations using the setup given in elixir and compute the experimental order of convergence (EOC) in the L^2 and L^infty norm. In each iteration, the resolution of the respective mesh will be doubled. Additional keyword arguments kwargs... and the optional module mod are passed directly to trixi_include.\n\nThis function assumes that the spatial resolution is set via the keywords initial_refinement_level (an integer) or cells_per_dimension (a tuple of integers, one per spatial dimension).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_analysis_errors-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.default_analysis_errors","text":"default_analysis_errors(equations)\n\nDefault analysis errors (:l2_error and :linf_error) used by the AnalysisCallback.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_analysis_integrals-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.default_analysis_integrals","text":"default_analysis_integrals(equations)\n\nDefault analysis integrals used by the AnalysisCallback.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_example-Tuple{}","page":"Trixi.jl","title":"Trixi.default_example","text":"default_example()\n\nReturn the path to an example elixir that can be used to quickly see Trixi.jl in action on a TreeMesh. See also examples_dir and get_examples.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_example_unstructured-Tuple{}","page":"Trixi.jl","title":"Trixi.default_example_unstructured","text":"default_example_unstructured()\n\nReturn the path to an example elixir that can be used to quickly see Trixi.jl in action on an UnstructuredMesh2D. This simulation is run on the example curved, unstructured mesh given in the Trixi.jl documentation regarding unstructured meshes.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.density-Tuple{Real, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.density","text":"density(p::Real, equations::LatticeBoltzmannEquations2D)\ndensity(u, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic density from the pressure p or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.density-Tuple{Real, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.density","text":"density(p::Real, equations::LatticeBoltzmannEquations3D)\ndensity(u, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic density from the pressure p or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.download-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.download","text":"Trixi.download(src_url, file_path)\n\nDownload a file from given src_url to given file_path if file_path is not already a file. This function just returns file_path. This is a small wrapper of Downloads.download(src_url, file_path) that avoids race conditions when multiple MPI ranks are used.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_dof_global-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_dof_global","text":"each_dof_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the degrees of freedom (DOF) in dg. In particular, not the DOFs themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_face_node-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_face_node","text":"each_face_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the face nodes in dg. In particular, not the face_nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_face_node_global-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_face_node_global","text":"each_face_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the face nodes in mesh. In particular, not the face nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_quad_node-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_quad_node","text":"each_quad_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the quadrature nodes in dg. In particular, not the quadrature nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_quad_node_global-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_quad_node_global","text":"each_quad_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the global quadrature nodes in mesh. In particular, not the quadrature nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachboundary-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachboundary","text":"eachboundary(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the boundaries in cache. In particular, not the boundaries themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachcomponent-Tuple{Trixi.AbstractCompressibleEulerMulticomponentEquations}","page":"Trixi.jl","title":"Trixi.eachcomponent","text":"eachcomponent(equations::AbstractCompressibleEulerMulticomponentEquations)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the components in AbstractCompressibleEulerMulticomponentEquations. In particular, not the components themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachcomponent-Tuple{Trixi.AbstractIdealGlmMhdMulticomponentEquations}","page":"Trixi.jl","title":"Trixi.eachcomponent","text":"eachcomponent(equations::AbstractIdealGlmMhdMulticomponentEquations)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the components in AbstractIdealGlmMhdMulticomponentEquations. In particular, not the components themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachdim-Tuple{Any}","page":"Trixi.jl","title":"Trixi.eachdim","text":"eachdim(mesh)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the dimensions in AbstractTree. In particular, not the dimensions themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachdirection-Tuple{Trixi.AbstractTree}","page":"Trixi.jl","title":"Trixi.eachdirection","text":"eachdirection(tree::AbstractTree)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the directions in AbstractTree. In particular, not the directions themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in cache. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in mesh. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.ElementContainer1D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::ElementContainer1D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.ElementContainer2D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::ElementContainer2D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.ElementContainer3D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::ElementContainer3D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.UnstructuredElementContainer2D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::UnstructuredElementContainer2D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachinterface-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachinterface","text":"eachinterface(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the interfaces in cache. In particular, not the interfaces themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachmortar-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachmortar","text":"eachmortar(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the mortars in cache. In particular, not the mortars themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachmpiinterface-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachmpiinterface","text":"eachmpiinterface(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the MPI interfaces in cache. In particular, not the interfaces themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachmpimortar-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachmpimortar","text":"eachmpimortar(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the MPI mortars in cache. In particular, not the mortars themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachnode-Tuple{DG}","page":"Trixi.jl","title":"Trixi.eachnode","text":"eachnode(dg::DG)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the nodes in dg. In particular, not the nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachnode-Tuple{LobattoLegendreBasis}","page":"Trixi.jl","title":"Trixi.eachnode","text":"eachnode(basis::LobattoLegendreBasis)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the nodes in basis. In particular, not the nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachnode-Tuple{Trixi.LobattoLegendreAnalyzer}","page":"Trixi.jl","title":"Trixi.eachnode","text":"eachnode(analyzer::LobattoLegendreAnalyzer)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the nodes in analyzer. In particular, not the nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachvariable-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.eachvariable","text":"eachvariable(equations::AbstractEquations)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the variables in equations. In particular, not the variables themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.energy_internal","page":"Trixi.jl","title":"Trixi.energy_internal","text":"energy_internal(u, equations)\n\nReturn the internal energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.energy_kinetic","page":"Trixi.jl","title":"Trixi.energy_kinetic","text":"energy_kinetic(u, equations)\n\nReturn the kinetic energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.energy_total","page":"Trixi.jl","title":"Trixi.energy_total","text":"energy_total(u, equations)\n\nReturn the total energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.entropy","page":"Trixi.jl","title":"Trixi.entropy","text":"entropy(u, equations)\n\nReturn the chosen entropy of the conserved variables u for a given set of equations.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.entropy2cons","page":"Trixi.jl","title":"Trixi.entropy2cons","text":"entropy2cons(w, equations)\n\nConvert the entropy variables w based on a standard entropy to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2entropy.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.equilibrium_distribution-Tuple{Any, Any, Any, Any, Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.equilibrium_distribution","text":"equilibrium_distribution(alpha, rho, v1, v2, v3, equations::LatticeBoltzmannEquations3D)\n\nCalculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2, v3.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.equilibrium_distribution-Tuple{Any, Any, Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.equilibrium_distribution","text":"equilibrium_distribution(alpha, rho, v1, v2, equations::LatticeBoltzmannEquations2D)\n\nCalculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.examples_dir-Tuple{}","page":"Trixi.jl","title":"Trixi.examples_dir","text":"examples_dir()\n\nReturn the directory where the example files provided with Trixi.jl are located. If Trixi.jl is installed as a regular package (with ]add Trixi), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir:\n\nExamples\n\nreaddir(examples_dir())\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux","page":"Trixi.jl","title":"Trixi.flux","text":"flux(u, orientation_or_normal, equations)\n\nGiven the conservative variables u, calculate the (physical) flux in Cartesian direction orientation::Integer or in arbitrary direction normal::AbstractVector for the corresponding set of governing equations. orientation is 1, 2, and 3 for the x-, y-, and z-directions, respectively.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.flux-Tuple{Any, AbstractVector, Trixi.AbstractEquations{1}}","page":"Trixi.jl","title":"Trixi.flux","text":"flux(u, normal_direction::AbstractVector, equations::AbstractEquations{1})\n\nEnables calling flux with a non-integer argument normal_direction for one-dimensional equations. Returns the value of flux(u, 1, equations) scaled by normal_direction[1].\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_central-Tuple{Any, Any, Any, Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.flux_central","text":"flux_central(u_ll, u_rr, orientation_or_normal_direction, equations::AbstractEquations)\n\nThe classical central numerical flux f((u_ll) + f(u_rr)) / 2. When this flux is used as volume flux, the discretization is equivalent to the classical weak form DG method (except floating point errors).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chan_etal-Tuple{Any, Any, Integer, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_chan_etal","text":"@inline function fluxchanetal(ull, urr, orientation::Integer, equations::CompressibleEulerEquationsQuasi1D)\n\nConservative (symmetric) part of the entropy conservative flux for quasi 1D compressible Euler equations split form. This flux is a generalization of flux_ranocha for CompressibleEulerEquations1D. Further details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089 \n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chan_etal-Tuple{Any, Any, Integer, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_chan_etal","text":"flux_chan_etal(u_ll, u_rr, orientation,\n equations::ShallowWaterEquationsQuasi1D)\n\nTotal energy conservative (mathematical entropy for quasi 1D shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., FluxPlusDissipation(flux_chan_etal, DissipationLocalLaxFriedrichs()).\n\nFurther details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nEntropy conserving two-point flux by\n\nChandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)\n\nEntropy conserving two-point flux by\n\nChandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)\n\nEntropy conserving two-point flux by\n\nChandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations1D)\n\nEntropy conserving two-point flux by\n\nAyoub Gouasmi, Karthik Duraisamy (2020) \"Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations\" arXiv:1904.00972v3 [math.NA] 4 Feb 2020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations2D)\n\nAdaption of the entropy conserving two-point flux by\n\nAyoub Gouasmi, Karthik Duraisamy (2020) \"Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations\" arXiv:1904.00972v3 [math.NA] 4 Feb 2020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)\n\nEntropy conserving two-point flux by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations2D)\n\nEntropy conserving two-point flux by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations3D)\n\nEntropy conserving two-point flux by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)\n\nEntropy conserving two-point flux adapted by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdMulticomponentEquations2D)\n\nEntropy conserving two-point flux adapted by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_fjordholm_etal","text":"flux_fjordholm_etal(u_ll, u_rr, orientation,\n equations::ShallowWaterEquations1D)\n\nTotal energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.\n\nDetails are available in Eq. (4.1) in the paper:\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_fjordholm_etal","text":"flux_fjordholm_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::ShallowWaterEquations2D)\n\nTotal energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.\n\nDetails are available in Eq. (4.1) in the paper:\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_godunov-Tuple{Any, Any, Integer, LinearizedEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_godunov","text":"flux_godunov(u_ll, u_rr, orientation_or_normal_direction,\n equations::LinearizedEulerEquations2D)\n\nAn upwind flux for the linearized Euler equations based on diagonalization of the physical flux matrix. Given the physical flux Au, A=T Lambda T^-1 with Lambda being a diagonal matrix that holds the eigenvalues of A, decompose Lambda = Lambda^+ + Lambda^- where Lambda^+ and Lambda^- are diagonal matrices holding the positive and negative eigenvalues of A, respectively. Then for left and right states u_L u_R, the numerical flux calculated by this function is given by A^+ u_L + A^- u_R where A^pm = T Lambda^pm T^-1.\n\nThe diagonalization of the flux matrix can be found in\n\nR. F. Warming, Richard M. Beam and B. J. Hyett (1975) Diagonalization and simultaneous symmetrization of the gas-dynamic matrices DOI: 10.1090/S0025-5718-1975-0388967-5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdEquations1D)\n\nEntropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdEquations2D)\n\nEntropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdEquations3D)\n\nEntropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdMulticomponentEquations1D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdMulticomponentEquations2D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nComputes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations2D)\n\nComputes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations3D)\n\nComputes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)\n\nLi (2005)\n\nAn HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_kennedy_gruber-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_kennedy_gruber","text":"flux_kennedy_gruber(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nKinetic energy preserving two-point flux by\n\nKennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_kennedy_gruber-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_kennedy_gruber","text":"flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nKinetic energy preserving two-point flux by\n\nKennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_kennedy_gruber-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_kennedy_gruber","text":"flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nKinetic energy preserving two-point flux by\n\nKennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_audusse_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_audusse_etal","text":"flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nNon-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.\n\nThis hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations1D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.\n\nFurther details on the hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_audusse_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_audusse_etal","text":"flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_audusse_etal(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nNon-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.\n\nThis hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations2D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.\n\nFurther details for the hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_chan_etal-Tuple{Any, Any, Integer, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_chan_etal","text":"flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,\n equations::CompressibleEulerEquationsQuasi1D)\nflux_nonconservative_chan_etal(u_ll, u_rr, normal_direction, \n equations::CompressibleEulerEquationsQuasi1D)\nflux_nonconservative_chan_etal(u_ll, u_rr, normal_ll, normal_rr,\n equations::CompressibleEulerEquationsQuasi1D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the pressure CompressibleEulerEquationsQuasi1D and the nozzle width.\n\nFurther details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089 \n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_chan_etal-Tuple{Any, Any, Integer, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_chan_etal","text":"flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquationsQuasi1D)\nflux_nonconservative_chan_etal(u_ll, u_rr, normal_direction::AbstractVector,\n equations::ShallowWaterEquationsQuasi1D) \nflux_nonconservative_chan_etal(u_ll, u_rr, \n normal_ll::AbstractVector, normal_rr::AbstractVector,\n equations::ShallowWaterEquationsQuasi1D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquationsQuasi1D and the channel width.\n\nFurther details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_ersing_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_ersing_etal","text":"flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nwarning: Experimental code\nThis numerical flux is experimental and may change in any future release.\n\nNon-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.\n\nThis is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.\n\nFor further details see:\n\nPatrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_ersing_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_ersing_etal","text":"flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_ersing_etal(u_ll, u_rr,\n normal_direction_ll::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nwarning: Experimental code\nThis numerical flux is experimental and may change in any future release.\n\nNon-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nThis is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.\n\nFor further details see:\n\nPatrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_fjordholm_etal","text":"flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nNon-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations1D.\n\nThis contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.\n\nFurther details for the original finite volume formulation are available in\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\nand for curvilinear 2D case in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_fjordholm_etal","text":"flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_fjordholm_etal(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nNon-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nThis contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.\n\nFurther details for the original finite volume formulation are available in\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\nand for curvilinear 2D case in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell","text":"flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,\n equations::IdealGlmMhdEquations2D)\nflux_nonconservative_powell(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::IdealGlmMhdEquations2D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nReferences\n\nMarvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell","text":"flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,\n equations::IdealGlmMhdEquations3D)\nflux_nonconservative_powell(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::IdealGlmMhdEquations3D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations3D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nReferences\n\nMarvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell","text":"flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,\n equations::IdealGlmMhdMulticomponentEquations2D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdMulticomponentEquations2D.\n\nReferences\n\nMarvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell_local_symmetric-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D, Trixi.NonConservativeSymmetric, Integer}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell_local_symmetric","text":"flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,\n equations::IdealGlmMhdEquations2D,\n nonconservative_type::NonConservativeSymmetric,\n nonconservative_term::Integer)\n\nSymmetric part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered \"fluxes\" for subcell limiting. See, e.g.,\n\nRueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.\n\nThis function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell_local_symmetric-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell_local_symmetric","text":"flux_nonconservative_powell_local_symmetric(u_ll, u_rr,\n orientation::Integer,\n equations::IdealGlmMhdEquations2D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.\n\nThis implementation uses a non-conservative term that can be written as the product of local and symmetric parts. It is equivalent to the non-conservative flux of Bohm et al. (flux_nonconservative_powell) for conforming meshes but it yields different results on non-conforming meshes(!).\n\nThe two other flux functions with the same name return either the local or symmetric portion of the non-conservative flux based on the type of the nonconservativetype argument, employing multiple dispatch. They are used to compute the subcell fluxes in dg2dsubcelllimiters.jl.\n\nReferences\n\nRueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell_local_symmetric-Tuple{Any, Integer, IdealGlmMhdEquations2D, Trixi.NonConservativeLocal, Integer}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell_local_symmetric","text":"flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,\n equations::IdealGlmMhdEquations2D,\n nonconservative_type::NonConservativeLocal,\n nonconservative_term::Integer)\n\nLocal part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered \"fluxes\" for subcell limiting. See, e.g.,\n\nRueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.\n\nThis function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_wintermeyer_etal","text":"flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.\n\nFurther details are available in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_wintermeyer_etal","text":"flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_wintermeyer_etal(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nFurther details are available in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations1D)\n\nEntropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nEntropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nEntropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerMulticomponentEquations1D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerMulticomponentEquations2D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha_turbo-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.flux_ranocha_turbo","text":"flux_ranocha_turbo(u_ll, u_rr, orientation_or_normal_direction, equations)\n\nEquivalent to flux_ranocha except that it may use specialized methods, e.g., when used with VolumeIntegralFluxDifferencing. These specialized methods may enable better use of SIMD instructions to increase runtime efficiency on modern hardware.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_shima_etal","text":"flux_shima_etal(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nThis flux is is a modification of the original kinetic energy preserving two-point flux by\n\nYuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058\n\nThe modification is in the energy flux to guarantee pressure equilibrium and was developed by\n\nNao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_shima_etal","text":"flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nThis flux is is a modification of the original kinetic energy preserving two-point flux by\n\nYuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058\n\nThe modification is in the energy flux to guarantee pressure equilibrium and was developed by\n\nNao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_shima_etal","text":"flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nThis flux is is a modification of the original kinetic energy preserving two-point flux by\n\nYuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058\n\nThe modification is in the energy flux to guarantee pressure equilibrium and was developed by\n\nNao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal_turbo-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.flux_shima_etal_turbo","text":"flux_shima_etal_turbo(u_ll, u_rr, orientation_or_normal_direction, equations)\n\nEquivalent to flux_shima_etal except that it may use specialized methods, e.g., when used with VolumeIntegralFluxDifferencing. These specialized methods may enable better use of SIMD instructions to increase runtime efficiency on modern hardware.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_wintermeyer_etal","text":"flux_wintermeyer_etal(u_ll, u_rr, orientation,\n equations::ShallowWaterEquations1D)\n\nTotal energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.\n\nFurther details are available in Theorem 1 of the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_wintermeyer_etal","text":"flux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::ShallowWaterEquations2D)\n\nTotal energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.\n\nFurther details are available in Theorem 1 of the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_winters_etal-Tuple{Any, Any, AbstractVector, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_winters_etal","text":"flux_winters_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::PolytropicEulerEquations2D)\n\nEntropy conserving two-point flux for isothermal or polytropic gases. Requires a special weighted Stolarsky mean for the evaluation of the density denoted here as stolarsky_mean. Note, for isothermal gases where gamma = 1 this stolarsky_mean becomes the ln_mean.\n\nFor details see Section 3.2 of the following reference\n\nAndrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_boundary_outer_state-Tuple{BoundaryConditionDirichlet, Any, Any, Any, Any, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.get_boundary_outer_state","text":"get_boundary_outer_state(boundary_condition::BoundaryConditionDirichlet,\n cache, t, equations, dg, indices...)\n\nFor subcell limiting, the calculation of local bounds for non-periodic domains require the boundary outer state. This function returns the boundary value at time t and for node with spatial indices indices.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_examples-Tuple{}","page":"Trixi.jl","title":"Trixi.get_examples","text":"get_examples()\n\nReturn a list of all example elixirs that are provided by Trixi.jl. See also examples_dir and default_example.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_name-Tuple{Any}","page":"Trixi.jl","title":"Trixi.get_name","text":"get_name(x)\n\nReturns a name of x ready for pretty printing. By default, return string(y) if x isa Val{y} and return string(x) otherwise.\n\nExamples\n\njulia> Trixi.get_name(\"test\")\n\"test\"\n\njulia> Trixi.get_name(Val(:test))\n\"test\"\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_name-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.get_name","text":"get_name(equations::AbstractEquations)\n\nReturns the canonical, human-readable name for the given system of equations.\n\nExamples\n\njulia> Trixi.get_name(CompressibleEulerEquations1D(1.4))\n\"CompressibleEulerEquations1D\"\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.getmesh-Tuple{Trixi.AbstractPlotData}","page":"Trixi.jl","title":"Trixi.getmesh","text":"getmesh(pd::AbstractPlotData)\n\nExtract grid lines from pd for plotting with Plots.plot.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.global_mean_vars-Tuple{AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.global_mean_vars","text":"global_mean_vars(equations::AcousticPerturbationEquations2D)\n\nReturns the global mean variables stored in equations. This makes it easier to define flexible initial conditions for problems with constant mean flow.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.have_nonconservative_terms-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.have_nonconservative_terms","text":"have_nonconservative_terms(equations)\n\nTrait function determining whether equations represent a conservation law with or without nonconservative terms. Classical conservation laws such as the CompressibleEulerEquations2D do not have nonconservative terms. The ShallowWaterEquations2D with non-constant bottom topography are an example of equations with nonconservative terms. The return value will be True() or False() to allow dispatching on the return type.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.hydrostatic_reconstruction_audusse_etal-Tuple{Any, Any, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.hydrostatic_reconstruction_audusse_etal","text":"hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nA particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations1D. The reconstructed solution states u_ll_star and u_rr_star variables are then used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.\n\nFurther details on this hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.hydrostatic_reconstruction_audusse_etal-Tuple{Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.hydrostatic_reconstruction_audusse_etal","text":"hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::ShallowWaterEquations2D)\n\nA particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations2D. The reconstructed solution states u_ll_star and u_rr_star variables are used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.\n\nFurther details for the hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.init_mpi-Tuple{}","page":"Trixi.jl","title":"Trixi.init_mpi","text":"init_mpi()\n\nInitialize MPI by calling MPI.Initialized(). The function will check if MPI is already initialized and if yes, do nothing, thus it is safe to call it multiple times.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.init_p4est-Tuple{}","page":"Trixi.jl","title":"Trixi.init_p4est","text":"init_p4est()\n\nInitialize p4est by calling p4est_init and setting the log level to SC_LP_ERROR. This function will check if p4est is already initialized and if yes, do nothing, thus it is safe to call it multiple times.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.init_t8code-Tuple{}","page":"Trixi.jl","title":"Trixi.init_t8code","text":"init_t8code()\n\nInitialize t8code by calling sc_init, p4est_init, and t8_init while setting the log level to SC_LP_ERROR. This function will check if t8code is already initialized and if yes, do nothing, thus it is safe to call it multiple times.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::AcousticPerturbationEquations2D)\n\nA constant initial condition where the state variables are zero and the mean flow is constant. Uses the global mean values from equations.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::CompressibleEulerEquations1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::CompressibleEulerEquations2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::CompressibleEulerEquations3D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::IdealGlmMhdEquations1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::IdealGlmMhdEquations2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::IdealGlmMhdEquations3D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::InviscidBurgersEquation1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LatticeBoltzmannEquations2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LatticeBoltzmannEquations3D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::AcousticPerturbationEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test. Uses the global mean values from equations.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations3D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquationsQuasi1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerMulticomponentEquations1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerMulticomponentEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations1D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations2D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations3D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdMulticomponentEquations1D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdMulticomponentEquations2D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::InviscidBurgersEquation1D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA smooth initial condition used for convergence tests (in combination with BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearizedEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearizedEulerEquations2D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::PolytropicEulerEquations2D)\n\nManufactured smooth initial condition used for convergence tests in combination with source_terms_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::ShallowWaterEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::ShallowWaterEquationsQuasi1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, TrafficFlowLWREquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::TrafficFlowLWREquations1D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_density_wave-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_density_wave","text":"initial_condition_density_wave(x, t, equations::CompressibleEulerEquations1D)\n\nA sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper\n\nGregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026\n\nwith the following parameters\n\ndomain [-1, 1]\nmesh = 4x4\npolydeg = 5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_density_wave-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_density_wave","text":"initial_condition_density_wave(x, t, equations::CompressibleEulerEquations2D)\n\nA sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper\n\nGregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026\n\nwith the following parameters\n\ndomain [-1, 1]\nmesh = 4x4\npolydeg = 5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations1D)\n\nOne dimensional variant of the setup used for convergence tests of the Euler equations with self-gravity from\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nnote: Note\nThere is no additional source term necessary for the manufactured solution in one spatial dimension. Thus, source_terms_eoc_test_coupled_euler_gravity is not present there.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations1D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_harmonic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, HyperbolicDiffusionEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_harmonic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, HyperbolicDiffusionEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_harmonic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equations::AcousticPerturbationEquations2D)\n\nA Gaussian pulse in a constant mean flow. Uses the global mean values from equations.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA Gaussian pulse used together with BoundaryConditionDirichlet(initial_condition_gauss).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equation::LinearScalarAdvectionEquation2D)\n\nA Gaussian pulse used together with BoundaryConditionDirichlet(initial_condition_gauss).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA Gaussian pulse.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_x-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_x","text":"initial_condition_linear_x(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA linear function of x[1] used together with boundary_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_x-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_x","text":"initial_condition_linear_x(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA linear function of x[1] used together with boundary_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_x_y-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_x_y","text":"initial_condition_linear_x_y(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA linear function of x[1] + x[2] used together with boundary_condition_linear_x_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_y-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_y","text":"initial_condition_linear_y(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA linear function of x[1] used together with boundary_condition_linear_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_z-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_z","text":"initial_condition_linear_z(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA linear function of x[3] used together with boundary_condition_linear_z.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_poisson_nonperiodic-Tuple{Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_poisson_nonperiodic","text":"initial_condition_poisson_nonperiodic(x, t, equations::HyperbolicDiffusionEquations1D)\n\nA non-priodic smooth initial condition. Can be used for convergence tests in combination with source_terms_poisson_nonperiodic and boundary_condition_poisson_nonperiodic.\n\nnote: Note\nThe solution is periodic but the initial guess is not.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_sin-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_sin","text":"initial_condition_sin(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA sine wave in the conserved variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_sin-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_sin","text":"initial_condition_sin(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA sine wave in the conserved variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_sin_sin-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_sin_sin","text":"initial_condition_sin_sin(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA sine wave in the conserved variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations1D)\n\nA weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations2D)\n\nA weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations3D)\n\nA weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations1D)\n\nA for multicomponent adapted weak blast wave adapted to multicomponent and taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations2D)\n\nA for multicomponent adapted weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations1D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations3D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations1D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations2D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquations2D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations1D)\n\nA weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations2D)\n\nA weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.integrate_via_indices-Union{Tuple{Func}, Tuple{Func, Any, Trixi.AbstractSemidiscretization, Vararg{Any}}} where Func","page":"Trixi.jl","title":"Trixi.integrate_via_indices","text":"integrate_via_indices(func, u_ode, semi::AbstractSemidiscretization, args...; normalize=true)\n\nCall func(u, i..., element, equations, solver, args...) for all nodal indices i..., element and integrate the result using a quadrature associated with the semidiscretization semi.\n\nIf normalize is true, the result is divided by the total volume of the computational domain.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.inv_ln_mean-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.inv_ln_mean","text":"inv_ln_mean(x, y)\n\nCompute the inverse 1 / ln_mean(x, y) of the logarithmic mean ln_mean.\n\nThis function may be used to increase performance where the inverse of the logarithmic mean is needed, by replacing a (slow) division by a (fast) multiplication.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.jacobian_ad_forward-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.jacobian_ad_forward","text":"jacobian_ad_forward(semi::AbstractSemidiscretization;\n t0=zero(real(semi)),\n u0_ode=compute_coefficients(t0, semi))\n\nUses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.jacobian_fd-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.jacobian_fd","text":"jacobian_fd(semi::AbstractSemidiscretization;\n t0=zero(real(semi)),\n u0_ode=compute_coefficients(t0, semi))\n\nUses the right-hand side operator of the semidiscretization semi and simple second order finite difference to compute the Jacobian J of the semidiscretization semi at state u0_ode.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.linear_structure-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.linear_structure","text":"linear_structure(semi::AbstractSemidiscretization;\n t0=zero(real(semi)))\n\nWraps the right-hand side operator of the semidiscretization semi at time t0 as an affine-linear operator given by a linear operator A and a vector b.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ln_mean-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.ln_mean","text":"ln_mean(x, y)\n\nCompute the logarithmic mean\n\nln_mean(x, y) = (y - x) / (log(y) - log(x)) = (y - x) / log(y / x)\n\nProblem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Ismail and Roe (2009). Set ξ = y / x. Then, we have\n\n(y - x) / log(y / x) = (x + y) / log(ξ) * (ξ - 1) / (ξ + 1)\n\nSet f = (ξ - 1) / (ξ + 1) = (y - x) / (x + y). Then, we use the expansion\n\nlog(ξ) = 2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7) + O(ξ^9)\n\nInserting the first few terms of this expansion yields\n\n(y - x) / log(ξ) ≈ (x + y) * f / (2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7))\n = (x + y) / (2 + 2/3 * f^2 + 2/5 * f^4 + 2/7 * f^6)\n\nSince divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use\n\nf^2 = (y - x)^2 / (x + y)^2\n = (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)\n\nGiven ε = 1.0e-4, we use the following algorithm.\n\nif f^2 < ε\n # use the expansion above\nelse\n # use the direct formula (y - x) / log(y / x)\nend\n\nReferences\n\nIsmail, Roe (2009). Affordable, entropy-consistent Euler flux functions II: Entropy production at shocks. DOI: 10.1016/j.jcp.2009.04.021\nAgner Fog. Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD, and VIA CPUs. https://www.agner.org/optimize/instruction_tables.pdf\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_adaptive_time_integrator!-Tuple{Any, AbstractString}","page":"Trixi.jl","title":"Trixi.load_adaptive_time_integrator!","text":"load_adaptive_time_integrator!(integrator, restart_file::AbstractString)\n\nLoad the context information for time integrators with error-based step size control saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_dt-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_dt","text":"load_dt(restart_file::AbstractString)\n\nLoad the time step size (dt in OrdinaryDiffEq.jl) saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_mesh-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_mesh","text":"load_mesh(restart_file::AbstractString; n_cells_max)\n\nLoad the mesh from the restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_time-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_time","text":"load_time(restart_file::AbstractString)\n\nLoad the time saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_timestep!-Tuple{Any, AbstractString}","page":"Trixi.jl","title":"Trixi.load_timestep!","text":"load_timestep!(integrator, restart_file::AbstractString)\n\nLoad the time step number saved in a restart_file and assign it to both the time step number and and the number of accepted steps (iter and stats.naccept in OrdinaryDiffEq.jl, respectively) in integrator.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_timestep-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_timestep","text":"load_timestep(restart_file::AbstractString)\n\nLoad the time step number (iter in OrdinaryDiffEq.jl) saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.max-Tuple","page":"Trixi.jl","title":"Trixi.max","text":"max(x, y, ...)\n\nReturn the maximum of the arguments. See also the maximum function to take the maximum element from a collection.\n\nThis version in Trixi.jl is semantically equivalent to Base.max but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).\n\nExamples\n\njulia> max(2, 5, 1)\n5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.max_abs_speed_naive","page":"Trixi.jl","title":"Trixi.max_abs_speed_naive","text":"max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations)\nmax_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nSimple and fast estimate of the maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, based only on the local wave speeds associated to u_ll and u_rr.\n\nFor non-integer arguments normal_direction in one dimension, max_abs_speed_naive returns abs(normal_direction[1]) * max_abs_speed_naive(u_ll, u_rr, 1, equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.min-Tuple","page":"Trixi.jl","title":"Trixi.min","text":"min(x, y, ...)\n\nReturn the minimum of the arguments. See also the minimum function to take the minimum element from a collection.\n\nThis version in Trixi.jl is semantically equivalent to Base.min but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).\n\nExamples\n\njulia> min(2, 5, 1)\n1\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_davis","page":"Trixi.jl","title":"Trixi.min_max_speed_davis","text":"min_max_speed_davis(u_ll, u_rr, orientation::Integer, equations)\nmin_max_speed_davis(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nSimple and fast estimates of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr.\n\nS.F. Davis (1988) Simplified Second-Order Godunov-Type Methods DOI: 10.1137/0909030\n\nSee eq. (10.38) from\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761\n\nSee also FluxHLL, min_max_speed_naive, min_max_speed_einfeldt.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations)\nmin_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nMore advanced mininmal and maximal wave speed computation based on\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\noriginally developed for the compressible Euler equations. A compact representation can be found in this lecture notes, eq. (9.28).\n\nSee also FluxHLL, min_max_speed_naive, min_max_speed_davis.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, AbstractVector, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, AbstractVector, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nOriginal publication:\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\n\nCompactly summarized:\n\nSiddhartha Mishra, Ulrik Skre Fjordholm and Rémi Abgrall Numerical methods for conservation laws and related equations. Link\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations1D)\n\nCalculate minimum and maximum wave speeds for HLL-type fluxes as in\n\nLi (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations2D)\n\nCalculate minimum and maximum wave speeds for HLL-type fluxes as in\n\nLi (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)\n\nCalculate minimum and maximum wave speeds for HLL-type fluxes as in\n\nLi (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_naive","page":"Trixi.jl","title":"Trixi.min_max_speed_naive","text":"min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations)\nmin_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nSimple and fast estimate(!) of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr. Slightly more diffusive than min_max_speed_davis.\n\nAmiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002\n\nSee eq. (10.37) from\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761\n\nSee also FluxHLL, min_max_speed_davis, min_max_speed_einfeldt.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.modify_dt_for_tstops!-Tuple{Trixi.SimpleIntegratorSSP}","page":"Trixi.jl","title":"Trixi.modify_dt_for_tstops!","text":"modify_dt_for_tstops!(integrator::SimpleIntegratorSSP)\n\nModify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.multiply_dimensionwise-Tuple{AbstractMatrix, AbstractMatrix}","page":"Trixi.jl","title":"Trixi.multiply_dimensionwise","text":"multiply_dimensionwise(matrix::AbstractMatrix, data_in::AbstractArray{<:Any, NDIMS+1})\n\nMultiply the array data_in by matrix in each coordinate direction, where data_in is assumed to have the first coordinate for the number of variables and the remaining coordinates are multiplied by matrix.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.n_nonconservative_terms","page":"Trixi.jl","title":"Trixi.n_nonconservative_terms","text":"n_nonconservative_terms(equations)\n\nNumber of nonconservative terms in the form local * symmetric for a particular equation. This function needs to be specialized only if equations with nonconservative terms are combined with certain solvers (e.g., subcell limiting).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.ndofs-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.ndofs","text":"ndofs(semi::AbstractSemidiscretization)\n\nReturn the number of degrees of freedom associated with each scalar variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.negative_part-Tuple{Any}","page":"Trixi.jl","title":"Trixi.negative_part","text":"negative_part(x)\n\nReturn x if x is negative, else zero. In other words, return (x - abs(x)) / 2 for real numbers x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ode_default_options-Tuple{}","page":"Trixi.jl","title":"Trixi.ode_default_options","text":"ode_default_options()\n\nReturn the default options for OrdinaryDiffEq's solve. Pass ode_default_options()... to solve to only return the solution at the final time and enable MPI aware error-based step size control, whenever MPI is used. For example, use solve(ode, alg; ode_default_options()...).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ode_norm-Tuple{Number, Any}","page":"Trixi.jl","title":"Trixi.ode_norm","text":"ode_norm(u, t)\n\nImplementation of the weighted L2 norm of Hairer and Wanner used for error-based step size control in OrdinaryDiffEq.jl. This function is aware of MPI and uses global MPI communication when running in parallel.\n\nYou must pass this function as a keyword argument internalnorm=ode_norm to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.\n\nSee the \"Advanced Adaptive Stepsize Control\" section of the documentation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ode_unstable_check-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.ode_unstable_check","text":"ode_unstable_check(dt, u, semi, t)\n\nImplementation of the basic check for instability used in OrdinaryDiffEq.jl. Instead of checking something like any(isnan, u), this function just checks isnan(dt). This helps when using MPI parallelization, since no additional global communication is required and all ranks will return the same result.\n\nYou should pass this function as a keyword argument unstable_check=ode_unstable_check to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.\n\nSee the \"Miscellaneous\" section of the documentation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.partition!-Tuple{T8codeMesh}","page":"Trixi.jl","title":"Trixi.partition!","text":"Trixi.partition!(mesh::T8codeMesh)\n\nPartition a T8codeMesh in order to redistribute elements evenly among MPI ranks.\n\nArguments\n\nmesh::T8codeMesh: Initialized mesh object.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.partition!-Tuple{TreeMesh{NDIMS, <:Trixi.ParallelTree{NDIMS}} where NDIMS}","page":"Trixi.jl","title":"Trixi.partition!","text":"partition!(mesh::ParallelTreeMesh, allow_coarsening=true)\n\nPartition mesh using a static domain decomposition algorithm based on leaf cell count and tree structure. If allow_coarsening is true, the algorithm will keep leaf cells together on one rank when needed for local coarsening (i.e. when all children of a cell are leaves).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.positive_part-Tuple{Any}","page":"Trixi.jl","title":"Trixi.positive_part","text":"positive_part(x)\n\nReturn x if x is positive, else zero. In other words, return (x + abs(x)) / 2 for real numbers x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.pressure-Tuple{Real, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.pressure","text":"pressure(rho::Real, equations::LatticeBoltzmannEquations2D)\npressure(u, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic pressure from the density rho or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.pressure-Tuple{Real, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.pressure","text":"pressure(rho::Real, equations::LatticeBoltzmannEquations3D)\npressure(u, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic pressure from the density rho or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.prim2cons","page":"Trixi.jl","title":"Trixi.prim2cons","text":"prim2cons(u, equations)\n\nConvert the primitive variables u to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2prim.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.residual_steady_state-Tuple{Any, HyperbolicDiffusionEquations3D}","page":"Trixi.jl","title":"Trixi.residual_steady_state","text":"residual_steady_state(du, ::AbstractHyperbolicDiffusionEquations)\n\nUsed to determine the termination criterion of a SteadyStateCallback. For hyperbolic diffusion, this checks convergence of the potential phi.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.rotate_from_x","page":"Trixi.jl","title":"Trixi.rotate_from_x","text":"rotate_from_x(u, normal, equations)\n\nApply the rotation that maps the x-axis onto normal to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.\n\nSee also: rotate_to_x\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.rotate_to_x","page":"Trixi.jl","title":"Trixi.rotate_to_x","text":"rotate_to_x(u, normal, equations)\n\nApply the rotation that maps normal onto the x-axis to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.\n\nSee also: rotate_from_x\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.save_plot-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.save_plot","text":"save_plot(plot_data, variable_names;\n show_mesh=true, plot_arguments=Dict{Symbol,Any}(),\n time=nothing, timestep=nothing)\n\nVisualize the plot data object provided in plot_data and save result as a PNG file in the out directory, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.\n\nThe timestep is used in the filename. time is currently unused by this function.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nSee also: VisualizationCallback, show_plot\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.set_log_type-Tuple{Any}","page":"Trixi.jl","title":"Trixi.set_log_type","text":"Trixi.set_log_type(type; force = true)\n\nSet the type of the (natural) log function to be used in Trixi.jl. The default is \"sqrt_Trixi_NaN\" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to \"sqrt_Base\" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.set_sqrt_type-Tuple{Any}","page":"Trixi.jl","title":"Trixi.set_sqrt_type","text":"Trixi.set_sqrt_type(type; force = true)\n\nSet the type of the square root function to be used in Trixi.jl. The default is \"sqrt_Trixi_NaN\" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to \"sqrt_Base\" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.show_plot-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.show_plot","text":"show_plot(plot_data, variable_names;\n show_mesh=true, plot_arguments=Dict{Symbol,Any}(),\n time=nothing, timestep=nothing)\n\nVisualize the plot data object provided in plot_data and display result, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.\n\nThis function is the default plot_creator argument for the VisualizationCallback. time and timestep are currently unused by this function.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nSee also: VisualizationCallback, save_plot\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.solve","page":"Trixi.jl","title":"Trixi.solve","text":"solve(ode, alg; dt, callbacks, kwargs...)\n\nThe following structures and methods provide the infrastructure for SSP Runge-Kutta methods of type SimpleAlgorithmSSP.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::AcousticPerturbationEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations3D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquationsQuasi1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\nThis manufactured solution source term is specifically designed for the mozzle width 'a(x) = 1.5 - 0.5 * cos(x[1] * pi)' as defined in initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerMulticomponentEquations1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerMulticomponentEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::InviscidBurgersEquation1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::PolytropicEulerEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::ShallowWaterEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\nThis manufactured solution source term is specifically designed for the bottom topography function b(x,y) = 2 + 0.5 * sin(sqrt(2)*pi*x) + 0.5 * sin(sqrt(2)*pi*y) as defined in initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::ShallowWaterEquationsQuasi1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\nThis manufactured solution source term is specifically designed for the bottom topography function b(x) = 0.2 - 0.05 * sin(sqrt(2) * pi *x[1]) and channel width 'a(x)= 1 + 0.1 * cos(sqrt(2) * pi * x[1])' as defined in initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, TrafficFlowLWREquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::TrafficFlowLWREquations1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_coupled_euler_gravity-Tuple{Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_coupled_euler_gravity","text":"source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_coupled_euler_gravity-Tuple{Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_coupled_euler_gravity","text":"source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_euler-Tuple{Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_euler","text":"source_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_euler-Tuple{Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_euler","text":"source_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\nnote: Note\nThis method is to be used for testing pure Euler simulations with analytic self-gravity. If you intend to do coupled Euler-gravity simulations, you need to use source_terms_eoc_test_coupled_euler_gravity instead.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_harmonic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_harmonic","text":"source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations1D)\n\nSource term that only includes the forcing from the hyperbolic diffusion system.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_harmonic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_harmonic","text":"source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations2D)\n\nSource term that only includes the forcing from the hyperbolic diffusion system.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_harmonic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_harmonic","text":"source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations3D)\n\nSource term that only includes the forcing from the hyperbolic diffusion system.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_poisson_nonperiodic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_poisson_nonperiodic","text":"source_terms_poisson_nonperiodic(u, x, t,\n equations::HyperbolicDiffusionEquations1D)\n\nSource terms that include the forcing function f(x) and right hand side for the hyperbolic diffusion system that is used with initial_condition_poisson_nonperiodic and boundary_condition_poisson_nonperiodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_coirier_vanleer-Tuple{Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.splitting_coirier_vanleer","text":"splitting_coirier_vanleer(u, orientation::Integer,\n equations::CompressibleEulerEquations1D)\nsplitting_coirier_vanleer(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations1D)\n\nSplitting of the compressible Euler flux from Coirier and van Leer. The splitting has correction terms in the pressure splitting as well as the mass and energy flux components. The motivation for these corrections are to handle flows at the low Mach number limit.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nWilliam Coirier and Bram van Leer (1991) Numerical flux formulas for the Euler and Navier-Stokes equations. II - Progress in flux-vector splitting DOI: 10.2514/6.1991-1566\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_drikakis_tsangaris-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_drikakis_tsangaris","text":"splitting_drikakis_tsangaris(u, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\nsplitting_drikakis_tsangaris(u, which::Union{Val{:minus}, Val{:plus}}\n orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nImproved variant of the Steger-Warming flux vector splitting splitting_steger_warming for generalized coordinates. This splitting also reformulates the energy flux as in Hänel et al. to obtain conservation of the total temperature for inviscid flows.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nD. Drikakis and S. Tsangaris (1993) On the solution of the compressible Navier-Stokes equations using improved flux vector splitting methods DOI: 10.1016/0307-904X(93)90054-K\nD. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_lax_friedrichs-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_lax_friedrichs","text":"splitting_lax_friedrichs(u, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\nsplitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}\n orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nNaive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) similar to a flux splitting one would apply, e.g., to Burgers' equation.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_lax_friedrichs-Tuple{Any, Integer, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.splitting_lax_friedrichs","text":"splitting_lax_friedrichs(u, orientation::Integer,\n equations::InviscidBurgersEquation1D)\nsplitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::InviscidBurgersEquation1D)\n\nNaive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ = abs(u).\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_lax_friedrichs-Tuple{Any, Integer, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.splitting_lax_friedrichs","text":"splitting_lax_friedrichs(u, orientation::Integer,\n equations::LinearScalarAdvectionEquation1D)\nsplitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::LinearScalarAdvectionEquation1D)\n\nNaive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ is the absolute value of the advection velocity.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_steger_warming-Tuple{Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.splitting_steger_warming","text":"splitting_steger_warming(u, orientation::Integer,\n equations::CompressibleEulerEquations1D)\nsplitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations1D)\n\nSplitting of the compressible Euler flux of Steger and Warming.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nJoseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_steger_warming-Tuple{Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_steger_warming","text":"splitting_steger_warming(u, orientation::Integer,\n equations::CompressibleEulerEquations2D)\nsplitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations2D)\n\nSplitting of the compressible Euler flux of Steger and Warming. For curvilinear coordinates use the improved Steger-Warming-type splitting splitting_drikakis_tsangaris.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nJoseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_steger_warming-Tuple{Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.splitting_steger_warming","text":"splitting_steger_warming(u, orientation::Integer,\n equations::CompressibleEulerEquations3D)\nsplitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations3D)\n\nSplitting of the compressible Euler flux of Steger and Warming.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nJoseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_vanleer_haenel-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_vanleer_haenel","text":"splitting_vanleer_haenel(u, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\nsplitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}\n orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nSplitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice. For details on the curvilinear variant of this flux vector splitting see Anderson et al.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nBram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5\nD. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105\nMeng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum\nW. Kyle Anderson, James L. Thomas, and Bram van Leer (1986) Comparison of Finite Volume Flux Vector Splittings for the Euler Equations DOI: 10.2514/3.9465\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_vanleer_haenel-Tuple{Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.splitting_vanleer_haenel","text":"splitting_vanleer_haenel(u, orientation::Integer,\n equations::CompressibleEulerEquations1D)\nsplitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations1D)\n\nSplitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nBram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5\nD. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105\nMeng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.stolarsky_mean-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.stolarsky_mean","text":"stolarsky_mean(x, y, gamma)\n\nCompute an instance of a weighted Stolarsky mean of the form\n\nstolarsky_mean(x, y, gamma) = (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))\n\nwhere gamma > 1.\n\nProblem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Winters et al. (2020). Set f = (y - x) / (y + x) and g = gamma (for compact notation). Then, we use the expansions\n\n((1+f)^g - (1-f)^g) / g = 2*f + (g-1)(g-2)/3 * f^3 + (g-1)(g-2)(g-3)(g-4)/60 * f^5 + O(f^7)\n\nand\n\n((1+f)^(g-1) - (1-f)^(g-1)) / (g-1) = 2*f + (g-2)(g-3)/3 * f^3 + (g-2)(g-3)(g-4)(g-5)/60 * f^5 + O(f^7)\n\nInserting the first few terms of these expansions and performing polynomial long division we find that\n\nstolarsky_mean(x, y, gamma) ≈ (y + x) / 2 * (1 + (g-2)/3 * f^2 - (g+1)(g-2)(g-3)/45 * f^4 + (g+1)(g-2)(g-3)(2g(g-2)-9)/945 * f^6)\n\nSince divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use\n\nf^2 = (y - x)^2 / (x + y)^2\n = (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)\n\nGiven ε = 1.0e-4, we use the following algorithm.\n\nif f^2 < ε\n # use the expansion above\nelse\n # use the direct formula (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))\nend\n\nReferences\n\nAndrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w\nAgner Fog. Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD, and VIA CPUs. https://www.agner.org/optimize/instruction_tables.pdf\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.totalgamma-Tuple{Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.totalgamma","text":"totalgamma(u, equations::CompressibleEulerMulticomponentEquations1D)\n\nFunction that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.totalgamma-Tuple{Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.totalgamma","text":"totalgamma(u, equations::CompressibleEulerMulticomponentEquations2D)\n\nFunction that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.uses_amr-Tuple{Any}","page":"Trixi.jl","title":"Trixi.uses_amr","text":"uses_amr(callback)\n\nChecks whether the provided callback or CallbackSet is an AMRCallback or contains one.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.varnames","page":"Trixi.jl","title":"Trixi.varnames","text":"varnames(conversion_function, equations)\n\nReturn the list of variable names when applying conversion_function to the conserved variables associated to equations. This function is mainly used internally to determine output to screen and for IO, e.g., for the AnalysisCallback and the SaveSolutionCallback. Common choices of the conversion_function are cons2cons and cons2prim.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, Integer, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, orientation, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y) from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, Integer, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, orientation, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y, 3 -> z) from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic velocity vector from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic velocity vector from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.@autoinfiltrate","page":"Trixi.jl","title":"Trixi.@autoinfiltrate","text":"@autoinfiltrate\n@autoinfiltrate condition::Bool\n\nInvoke the @infiltrate macro of the package Infiltrator.jl to create a breakpoint for ad-hoc interactive debugging in the REPL. If the optional argument condition is given, the breakpoint is only enabled if condition evaluates to true.\n\nAs opposed to using Infiltrator.@infiltrate directly, this macro does not require Infiltrator.jl to be added as a dependency to Trixi.jl. As a bonus, the macro will also attempt to load the Infiltrator module if it has not yet been loaded manually.\n\nNote: For this macro to work, the Infiltrator.jl package needs to be installed in your current Julia environment stack.\n\nSee also: Infiltrator.jl\n\nwarning: Internal use only\nPlease note that this macro is intended for internal use only. It is not part of the public API of Trixi.jl, and it thus can altered (or be removed) at any time without it being considered a breaking change.\n\n\n\n\n\n","category":"macro"},{"location":"reference-trixi/#Trixi.@threaded-Tuple{Any}","page":"Trixi.jl","title":"Trixi.@threaded","text":"@threaded for ... end\n\nSemantically the same as Threads.@threads when iterating over a AbstractUnitRange but without guarantee that the underlying implementation uses Threads.@threads or works for more general for loops. In particular, there may be an additional check whether only one thread is used to reduce the overhead of serial execution or the underlying threading capabilities might be provided by other packages such as Polyester.jl.\n\nwarn: Warn\nThis macro does not necessarily work for general for loops. For example, it does not necessarily support general iterables such as eachline(filename).\n\nSome discussion can be found at https://discourse.julialang.org/t/overhead-of-threads-threads/53964 and https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435.\n\n\n\n\n\n","category":"macro"},{"location":"styleguide/#Style-guide","page":"Style guide","title":"Style guide","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"Coding style is an inherently personal - and thus hotly contested - issue. Since code is usually \"written once, read often\", it helps regular developers, new users, and reviewers if code is formatted consistently. We therefore believe in the merit of using a common coding style throughout Trixi.jl, even at the expense that not everyone can be happy with every detailed style decision. If you came here because you are furious about our code formatting rules, here is a happy little whale for you to calm you down: 🐳","category":"page"},{"location":"styleguide/#Conventions","page":"Style guide","title":"Conventions","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"The following lists a few coding conventions for Trixi.jl. Note that in addition to these conventions, we apply and enforce automated source code formatting (see below for more details):","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"Modules, types, structs with CamelCase.\nFunctions, variables with lowercase snake_case.\nIndentation with 4 spaces (never tabs!)\nMaximum line length (strictly): 92.\nFunctions that mutate their input are named with a trailing !.\nFunctions order their parameters similar to Julia Base.\nThe main modified argument comes first. For example, if the right-hand side du is modified, it should come first. If only the cache is modified, e.g., in prolong2interfaces! and its siblings, put the cache first.\nOtherwise, use the order mesh, equations, solver, cache.\nIf something needs to be specified in more detail for dispatch, put the additional argument before the general one that is specified in more detail. For example, we use have_nonconservative_terms(equations), equations and dg.mortar, dg.\nPrefer for i in ... to for i = ... for better semantic clarity and greater flexibility.\nExecutable code should only use ASCII characters.\nDocstrings and comments can and should use Unicode characters where it helps understanding.\nMultiline expressions should be explicitly grouped by parentheses and not rely on Julia's implicit line continuation syntax.\nWhen naming multiple functions of a single or similar category, prefer to put the general classification first and the specialization second. Example: Use flux_central instead of central_flux. This helps when searching for available functions on the REPL (e.g., when trying to find all flux functions).","category":"page"},{"location":"styleguide/#automated-source-code-formatting","page":"Style guide","title":"Automated source code formatting","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"We use JuliaFormatter.jl to format the source code of Trixi.jl, which will also enforce some of the Conventions listed above (e.g., line length or indentation with 4 spaces are automatically handled, while capitalization of names is not). Our format is mostly based on the SciML-style formatting rules. For more details you can have a look at the current .JuliaFormatter.toml file that holds the configuration options we use for JuliaFormatter.jl.","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"Note that we expect all contributions to Trixi.jl to be formatted with JuliaFormatter.jl before being merged to the main branch. We ensure this by running a automated check on all PRs that verify that running JuliaFormatter.jl again will not change the source code.","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"To format your contributions before created a PR (or, at least, before requesting a review of your PR), you need to install JuliaFormatter.jl first by running","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"julia -e 'using Pkg; Pkg.add(\"JuliaFormatter\")'","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"You can then recursively format the core Julia files in the Trixi.jl repo by executing","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"julia -e 'using JuliaFormatter; format([\"benchmark\", \"examples\", \"ext\", \"src\", \"test\", \"utils\"])'","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"from inside the Trixi.jl repository. For convenience, there is also a script you can directly run from your terminal shell, which will automatically install JuliaFormatter in a temporary environment and then run it:","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"utils/trixi-format.jl","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"You can get more information about using the convenience script by running it with the --help/-h flag.","category":"page"},{"location":"styleguide/#Checking-formatting-before-committing","page":"Style guide","title":"Checking formatting before committing","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"It can be convenient to check the formatting of source code automatically before each commit. We use git-hooks for it and provide a pre-commit script in the utils folder. The script uses JuliaFormatter.jl just like formatting script that runs over the whole Trixi.jl directory. You can copy the pre-commit-script into .git/hooks/pre-commit and it will check your formatting before each commit. If errors are found the commit is aborted and you can add the corrections via","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"git add -p","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"EditURL = \"../../literate/src/files/scalar_linear_advection_1d.jl\"","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#scalar_linear_advection_1d","page":"3 Introduction to DG methods","title":"3: Introduction to DG methods","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"This tutorial is about how to set up a simple way to approximate the solution of a hyperbolic partial differential equation. First, we will implement a basic and naive algorithm. Then, we will use predefined features from Trixi.jl to show how you can use Trixi.jl on your own.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We will implement the scalar linear advection equation in 1D with the advection velocity 1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u_t + u_x = 0 textfor tin mathbbR^+ xinOmega=-11","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We define the domain Omega by setting the boundaries.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"coordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We assume periodic boundaries and the following initial condition.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"initial_condition_sine_wave(x) = 1.0 + 0.5 * sin(pi * x)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#The-discontinuous-Galerkin-collocation-spectral-element-method-(DGSEM)","page":"3 Introduction to DG methods","title":"The discontinuous Galerkin collocation spectral element method (DGSEM)","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/#i.-Discretization-of-the-physical-domain","page":"3 Introduction to DG methods","title":"i. Discretization of the physical domain","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To improve precision we want to approximate the solution on small parts of the physical domain. So, we split the domain Omega=-1 1 into elements Q_l of length dx.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"n_elements = 16 # number of elements\n\ndx = (coordinates_max - coordinates_min) / n_elements # length of one element","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To make the calculation more efficient and storing less information, we transform each element Q_l with center point x_l to a reference element E=-1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Q_l=Bigx_l-fracdx2 x_l+fracdx2Big undersetx(xi)oversetxi(x)rightleftarrows -1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"So, for every element the transformation from the reference domain to the physical domain is defined by","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"x(xi) = x_l + fracdx2 xi xiin-1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Therefore,","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nu = u(x(xi) t) \nu_x = u_xi fracdxidx 3pt\nfracdxidx = (x_xi)^-1 = frac2dx = J^-1 \nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Here, J is the Jacobian determinant of the transformation.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Using this transformation, we can transform our equation for each element Q_l.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 u_t^Q_l + u_xi^Q_l = 0 text for tinmathbbR^+ xiin-1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Here, u_t^Q_l and u_xi^Q_l denote the time and spatial derivatives of the solution on the element Q_l.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#ii.-Polynomial-approach","page":"3 Introduction to DG methods","title":"ii. Polynomial approach","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"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 xiin-1 1 in every physical element Q_l. This saves a lot of resources by reducing the amount of calculations needed and storing less information.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"For DGSEM we choose Lagrange basis functions l_j_j=0^N as our polynomial basis of degree N in -1 1. The solution in element Q_l can be approximated by","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"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)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with N+1 coefficients u_j^Q_l_j=0^N. 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.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"l_j(xi_i) = delta_ij =\nbegincases\n1 textif i=j \n0 textelse\nendcases","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Because of this property, the polynomial coefficients are exact the values of u^Q_l at the nodes","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u^Q_l(xi_i t) = sum_j=0^N u_j^Q_l(t) underbracel_j(xi_i)_=delta_ij = u_i^Q_l(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Next, we want to select the nodes xi_i_i=0^N, which we use for the construction of the Lagrange polynomials. We choose the N+1 Gauss-Lobatto nodes, which are used for the Gaussian-Lobatto quadrature. These always contain the boundary points at -1 and +1 and are well suited as interpolation nodes. The corresponding weights will be referred to as w_j_j=0^N. In Trixi.jl the basis with Lagrange polynomials on Gauss-Lobatto nodes is already defined.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Trixi\npolydeg = 3 #= polynomial degree = N =#\nbasis = LobattoLegendreBasis(polydeg)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The Gauss-Lobatto nodes are","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"nodes = basis.nodes","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with the corresponding weights","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"weights = basis.weights","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To illustrate how you can integrate using numerical quadrature with this Legendre-Gauss-Lobatto nodes, we give an example for f(x)=x^3. Since f is of degree 3, a polynomial interpolation with N=3 is exact. Therefore, the integral on -1 1 can be calculated by","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nint_-1^1 f(x) dx = int_-1^1 Big( sum_j=0^3 f(xi_j)l_j(x) Big) dx\n= sum_j=0^3 f(xi_j) int_-1^1 l_j(x)dx \n= sum_j=0^3 f(xi_j) w_j\n= sum_j=0^3 xi_j^3 w_j\nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Let's use our nodes and weights for N=3 and plug in","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"integral = sum(nodes.^3 .* weights)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Using this polynomial approach leads to the equation","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 dotu^Q_l(xi t) + u^Q_l(xi t) = 0","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with dotu=fracpartialpartial tu and u=fracpartialpartial xu. To approximate the solution, we need to get the polynomial coefficients u_j^Q_l_j=0^N for every element Q_l.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"After defining all nodes, we can implement the spatial coordinate x and its initial value u0 for every node.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"x = Matrix{Float64}(undef, length(nodes), n_elements)\nfor element in 1:n_elements\n x_l = coordinates_min + (element - 1) * dx + dx/2\n for i in 1:length(nodes)\n ξ = nodes[i] # nodes in [-1, 1]\n x[i, element] = x_l + dx/2 * ξ\n end\nend\n\nu0 = initial_condition_sine_wave.(x)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To have a look at the initial sinus curve, we plot it.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Plots\nplot(vec(x), vec(u0), label=\"initial condition\", legend=:topleft)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#iii.-Variational-formulation","page":"3 Introduction to DG methods","title":"iii. Variational formulation","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"After defining the equation and initial condition, we want to implement an algorithm to approximate the solution.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"From now on, we only write u instead of u^Q_l for simplicity, but consider that all the following calculation only concern one element. Multiplying the new equation with the smooth Lagrange polynomials l_i_i=0^N (test functions) and integrating over the reference element E=-11, we get the variational formulation of our transformed partial differential equation for i=0N:","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nint_-1^1 Big( fracdx2 dotu(xi t) + u(xi t) Big) l_i(xi)dxi\n = underbracefracdx2 int_-1^1 dotu(xi t) l_i(xi)dxi_textTerm I + underbraceint_-1^1 u(xi t) l_i(xi)dxi_textTerm II = 0\nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We deal with the two terms separately. We write int_-1 N^1 cdot dxi for the approximation of the integral using numerical quadrature with N+1 basis points. We use the Gauss-Lobatto nodes again. The numerical scalar product langlecdot cdotrangle_N is defined by langle f grangle_N = int_-1 N^1 f(xi) g(xi) dxi.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Term-I:","page":"3 Introduction to DG methods","title":"Term I:","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"In the following calculation we approximate the integral numerically with quadrature on the Gauss-Lobatto nodes xi_i_i=0^N and then use the Kronecker property of the Lagrange polynomials. This approach of using the same nodes for the interpolation and quadrature is called collocation.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nfracdx2 int_-1^1 dotu(xi t) l_i(xi)dxi\napprox fracdx2 int_-1 N^1 dotu(xi t) l_i(xi)dxi \n= fracdx2 sum_k=0^N underbracedotu(xi_k t)_=dotu_k(t) underbracel_i(xi_k)_=delta_kiw_k \n= fracdx2 dotu_i(t) w_i\nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We define the Legendre-Gauss-Lobatto (LGL) mass matrix M and by the Kronecker property follows:","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"M_ij = langle l_j l_irangle_N = delta_ij w_j ij=0N","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using LinearAlgebra\nM = diagm(weights)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Now, we can write the integral with this new matrix.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 int_-1 N^1 dotu(xi t) underlinel(xi)dxi = fracdx2 M underlinedotu(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"where underlinedotu = (dotu_0 dotu_N)^T and underlinel respectively.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Note: Since the LGL quadrature with N+1 nodes is exact up to functions of degree 2N-1 and dotu(xi t) l_i(xi) is of degree 2N, in general the following holds","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"int_-1^1 dotu(xi t) l_i(xi) dxi neq int_-1 N^1 dotu(xi t) l_i(xi) dxi","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"With an exact integration the mass matrix would be dense. Choosing numerical integrating and quadrature with the exact same nodes (collocation) leads to the sparse and diagonal mass matrix M. This is called mass lumping and has the big advantage of an easy invertation of the matrix.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Term-II:","page":"3 Introduction to DG methods","title":"Term II:","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We use spatial partial integration for the second term:","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"int_-1^1 u(xi t) l_i(xi) dxi = u l_i_-1^1 - int_-1^1 u l_idxi","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The resulting integral can be solved exactly with LGL quadrature since the polynomial is now of degree 2N-1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Again, we split the calculation in two steps.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Surface-term","page":"3 Introduction to DG methods","title":"Surface term","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"As mentioned before, we approximate the solution with a polynomial in every element. Therefore, in general the value of this approximation at the interfaces between two elements is not unique. To solve this problem we introduce the idea of the numerical flux u^*, which will give an exact value at the interfaces. One of many different approaches and definitions for the calculation of the numerical flux we will deal with in 4. Numerical flux.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u l_i_-1^1 = u^*big^1 l_i(+1) - u^*big_-1 l_i(-1)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Since the Gauss-Lobatto nodes contain the element boundaries -1 and +1, we can use the Kronecker property of l_i for the calculation of l_i(-1) and l_i(+1).","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u underlinel_-1^1 = u^*big^1 left(beginarrayc 0 vdots 0 1 endarrayright)\n- u^*big_-1 left(beginarrayc 1 0 vdots 0endarrayright)\n= B underlineu^*(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with the boundary matrix","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"B = beginpmatrix\n-1 0 cdots 0\n0 0 cdots 0\nvdots vdots 0 0\n0 cdots 0 1\nendpmatrix\nqquadtextandqquad\nunderlineu^*(t) = left(beginarrayc u^*big_-1 0 vdots 0 u^*big^1endarrayright)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"B = diagm([-1; zeros(polydeg - 1); 1])","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Volume-term","page":"3 Introduction to DG methods","title":"Volume term","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"As mentioned before, the new integral can be solved exact since the function inside is of degree 2N-1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"- int_-1^1 u l_idxi = - int_-1 N^1 u l_i dxi\n= - sum_k=0^N u(xi_k t) l_i(xi_k) w_k\n= - sum_k=0^N u_k(t) D_ki w_k","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"where D is the derivative matrix defined by D_ki = l_i(xi_k) for ik=0N.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"D = basis.derivative_matrix","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To show why this matrix is called the derivative matrix, we go back to our example f(x)=x^3. We calculate the derivation of f at the Gauss-Lobatto nodes xi_k_k=0^N with N=8.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"f_x=xi_k = Big( sum_j=0^8 f(xi_j) l_j(x) Big)_x=xi_k = sum_j=0^8 f(xi_j) l_j(xi_k)\n= sum_j=0^8 f(xi_j) D_kj","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"for k=0N and therefore, underlinef = D underlinef.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"basis_N8 = LobattoLegendreBasis(8)\nplot(vec(x), x -> 3 * x^2, label=\"f'\", lw=2)\nscatter!(basis_N8.nodes, basis_N8.derivative_matrix * basis_N8.nodes.^3, label=\"Df\", lw=3)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Combining the volume term for every i=0N results in","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"int_-1^1 u underlinel dxi = - D^T M underlineu(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Putting all parts together we get the following equation for the element Q_l","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 M underlinedotu(t) = - B underlineu^*(t) + D^T M underlineu(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"or equivalent","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"underlinedotu^Q_l(t) = frac2dx Big - M^-1 B underlineu^Q_l^*(t) + M^-1 D^T M underlineu^Q_l(t)Big","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"This is called the weak form of the DGSEM.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Note: For every element Q_l we get a system of N+1 ordinary differential equations to calculate N+1 coefficients. Since the numerical flux u^* is depending on extern values at the interfaces, the equation systems of adjacent elements are weakly linked.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#numerical_flux","page":"3 Introduction to DG methods","title":"iv. Numerical flux","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"As mentioned above, we still have to handle the problem of different values at the same point at the interfaces. This happens with the ideas of the numerical flux f^*(u)=u^*. The role of f^* might seem minor in this simple example, but is important for more complicated problems. There are two values at the same spatial coordinate. Let's say we are looking at the interface between the elements Q_l and Q_l+1, while both elements got N+1 nodes as defined before. We call the first value of the right element u_R=u_0^Q_l+1 and the last one of the left element u_L=u_N^Q_l. So, for the value of the numerical flux on that interface the following holds","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u^* = u^*(u_L u_R)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"These values are interpreted as start values of a so-called Riemann problem. There are many different (approximate) Riemann solvers available and useful for different problems. We will use the local Lax-Friedrichs flux.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"surface_flux = flux_lax_friedrichs","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The only missing ingredient is the flux calculation at the boundaries -1 and +1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u^Q_first^*big_-1 = u^Q_first^*big_-1(u^bound(-1) u_R)\nquadtextandquad\nu^Q_last^*big^1 = u^Q_last^*big^1(u_L u^bound(1))","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The boundaries are periodic, which means that the last value of the last element u^Q_last_N is used as u_L at the first interface and accordingly for the other boundary.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Now, we implement a function, that calculates underlinedotu^Q_l for the given matrices, underlineu and underlineu^*.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"function rhs!(du, u, x, t)\n # Reset du and flux matrix\n du .= zero(eltype(du))\n flux_numerical = copy(du)\n\n # Calculate interface and boundary fluxes, $u^* = (u^*|_{-1}, 0, ..., 0, u^*|^1)^T$\n # Since we use the flux Lax-Friedrichs from Trixi.jl, we have to pass some extra arguments.\n # Trixi.jl needs the equation we are dealing with and an additional `1`, that indicates the\n # first coordinate direction.\n equations = LinearScalarAdvectionEquation1D(1.0)\n for element in 2:n_elements-1\n # left interface\n flux_numerical[1, element] = surface_flux(u[end, element-1], u[1, element], 1, equations)\n flux_numerical[end, element-1] = flux_numerical[1, element]\n # right interface\n flux_numerical[end, element] = surface_flux(u[end, element], u[1, element+1], 1, equations)\n flux_numerical[1, element+1] = flux_numerical[end, element]\n end\n # boundary flux\n flux_numerical[1, 1] = surface_flux(u[end, end], u[1, 1], 1, equations)\n flux_numerical[end, end] = flux_numerical[1, 1]\n\n # Calculate surface integrals, $- M^{-1} * B * u^*$\n for element in 1:n_elements\n du[:, element] -= (M \\ B) * flux_numerical[:, element]\n end\n\n # Calculate volume integral, $+ M^{-1} * D^T * M * u$\n for element in 1:n_elements\n flux = u[:, element]\n du[:, element] += (M \\ transpose(D)) * M * flux\n end\n\n # Apply Jacobian from mapping to reference element\n for element in 1:n_elements\n du[:, element] *= 2 / dx\n end\n\n return nothing\nend","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Combining all definitions and the function that calculates the right-hand side, we define the ODE and solve it until t=2 with OrdinaryDiffEq's solve function and the Runge-Kutta method RDPK3SpFSAL49(), which is optimized for discontinuous Galerkin methods and hyperbolic PDEs. We set some common error tolerances abstol=1.0e-6, reltol=1.0e-6 and pass save_everystep=false to avoid saving intermediate solution vectors in memory.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using OrdinaryDiffEq\ntspan = (0.0, 2.0)\node = ODEProblem(rhs!, u0, tspan, x)\n\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...)\n\nplot(vec(x), vec(sol.u[end]), label=\"solution at t=$(tspan[2])\", legend=:topleft, lw=3)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Alternative-Implementation-based-on-Trixi.jl","page":"3 Introduction to DG methods","title":"Alternative Implementation based on Trixi.jl","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Now, we implement the same example. But this time, we directly use the functionality that Trixi.jl provides.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Trixi, OrdinaryDiffEq, Plots","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"First, define the equation with a advection_velocity of 1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"advection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Then, create a DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux. The implementation of the basis and the numerical flux is now already done.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We will now create a mesh with 16 elements for the physical domain [-1, 1] with periodic boundaries. We use Trixi.jl's standard mesh TreeMesh. Since it's limited to hypercube domains, we choose 2^4=16 elements. The mesh type supports AMR, that' why n_cells_max has to be set, even if we don't need AMR here.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"coordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4, # number of elements = 2^4\n n_cells_max=30_000) # set maximum capacity of tree data structure (only needed for AMR)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"A semidiscretization collects data structures and functions for the spatial discretization. In Trixi.jl, an initial condition has the following parameter structure and is of the type SVector.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"initial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t)))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Again, combining all definitions and the function that calculates the right-hand side, we define the ODE and solve it until t=2 with OrdinaryDiffEq's solve function and the Runge-Kutta method RDPK3SpFSAL49().","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"tspan = (0.0, 2.0)\node_trixi = semidiscretize(semi, tspan)\n\nsol_trixi = solve(ode_trixi, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...);\nnothing #hide","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We add a plot of the new approximated solution to the one calculated before.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"plot!(sol_trixi, label=\"solution at t=$(tspan[2]) with Trixi.jl\", legend=:topleft, linestyle=:dash, lw=2)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Summary-of-the-code","page":"3 Introduction to DG methods","title":"Summary of the code","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To sum up, here is the complete code that we used.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Raw-implementation","page":"3 Introduction to DG methods","title":"Raw implementation","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"# basis: Legendre-Gauss-Lobatto\nusing Trixi, LinearAlgebra, OrdinaryDiffEq, Plots\npolydeg = 3 #= polynomial degree =#\nbasis = LobattoLegendreBasis(polydeg)\nnodes = basis.nodes # Gauss-Lobatto nodes in [-1, 1]\nD = basis.derivative_matrix\nM = diagm(basis.weights) # mass matrix\nB = diagm([-1; zeros(polydeg - 1); 1])\n\n# mesh\ncoordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nn_elements = 16 # number of elements\n\ndx = (coordinates_max - coordinates_min) / n_elements # length of one element\n\nx = Matrix{Float64}(undef, length(nodes), n_elements)\nfor element in 1:n_elements\n x_l = -1 + (element - 1) * dx + dx/2\n for i in 1:length(nodes) # basis points in [-1, 1]\n ξ = nodes[i]\n x[i, element] = x_l + dx/2 * ξ\n end\nend\n\n# initial condition\ninitial_condition_sine_wave(x) = 1.0 + 0.5 * sin(pi * x)\nu0 = initial_condition_sine_wave.(x)\n\nplot(vec(x), vec(u0), label=\"initial condition\", legend=:topleft)\n\n# flux Lax-Friedrichs\nsurface_flux = flux_lax_friedrichs\n\n# rhs! method\nfunction rhs!(du, u, x, t)\n # reset du\n du .= zero(eltype(du))\n flux_numerical = copy(du)\n\n # calculate interface and boundary fluxes\n equations = LinearScalarAdvectionEquation1D(1.0)\n for element in 2:n_elements-1\n # left interface\n flux_numerical[1, element] = surface_flux(u[end, element-1], u[1, element], 1, equations)\n flux_numerical[end, element-1] = flux_numerical[1, element]\n # right interface\n flux_numerical[end, element] = surface_flux(u[end, element], u[1, element+1], 1, equations)\n flux_numerical[1, element+1] = flux_numerical[end, element]\n end\n # boundary flux\n flux_numerical[1, 1] = surface_flux(u[end, end], u[1, 1], 1, equations)\n flux_numerical[end, end] = flux_numerical[1, 1]\n\n # calculate surface integrals\n for element in 1:n_elements\n du[:, element] -= (M \\ B) * flux_numerical[:, element]\n end\n\n # calculate volume integral\n for element in 1:n_elements\n flux = u[:, element]\n du[:, element] += (M \\ transpose(D)) * M * flux\n end\n\n # apply Jacobian from mapping to reference element\n for element in 1:n_elements\n du[:, element] *= 2 / dx\n end\n\n return nothing\nend\n\n# create ODE problem\ntspan = (0.0, 2.0)\node = ODEProblem(rhs!, u0, tspan, x)\n\n# solve\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...)\n\nplot(vec(x), vec(sol.u[end]), label=\"solution at t=$(tspan[2])\", legend=:topleft, lw=3)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Alternative-Implementation-based-on-Trixi.jl-2","page":"3 Introduction to DG methods","title":"Alternative Implementation based on Trixi.jl","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Trixi, OrdinaryDiffEq, Plots\n\n# equation with a advection_velocity of `1`.\nadvection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)\n\n# create DG solver with flux lax friedrichs and LGL basis\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\n# distretize domain with `TreeMesh`\ncoordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4, # number of elements = 2^4\n n_cells_max=30_000)\n\n# create initial condition and semidiscretization\ninitial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t)))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver)\n\n# solve\ntspan = (0.0, 2.0)\node_trixi = semidiscretize(semi, tspan)\nsol_trixi = solve(ode_trixi, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...);\n\nplot!(sol_trixi, label=\"solution at t=$(tspan[2]) with Trixi.jl\", legend=:topleft, linestyle=:dash, lw=2)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Package-versions","page":"3 Introduction to DG methods","title":"Package versions","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"This page was generated using Literate.jl.","category":"page"},{"location":"reference-trixi2vtk/#Trixi2Vtk.jl-API","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.jl API","text":"","category":"section"},{"location":"reference-trixi2vtk/","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.jl","text":"CurrentModule = Trixi2Vtk","category":"page"},{"location":"reference-trixi2vtk/","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.jl","text":"Modules = [Trixi2Vtk]","category":"page"},{"location":"reference-trixi2vtk/#Trixi2Vtk.trixi2vtk-Tuple{Vararg{AbstractString}}","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.trixi2vtk","text":"trixi2vtk(filename::AbstractString...;\n format=:vtu, verbose=false, hide_progress=false, pvd=nothing,\n output_directory=\".\", nvisnodes=nothing, save_celldata=true,\n reinterpolate=true, data_is_uniform=false)\n\nConvert Trixi-generated output files to VTK files (VTU or VTI).\n\nArguments\n\nfilename: One or more Trixi solution/restart/mesh files to convert to a VTK file. Filenames support file globbing, e.g., \"solution*\" to match all files starting with solution.\nformat: Output format for solution/restart files. Can be 'vtu' or 'vti'.\nverbose: Set to true to enable verbose output.\nhide_progress: Hide progress bar (will be hidden automatically if verbose is true).\npvd: Use this filename to store PVD file (instead of auto-detecting name). Note that only the name will be used (directory and file extension are ignored).\noutput_directory: Output directory where generated files are stored.\nnvisnodes: Number of visualization nodes per element. (default: number of DG nodes for StructuredMesh or UnstructuredMesh2D, twice the number of DG nodes for TreeMesh). A value of 0 (zero) uses the number of nodes in the DG elements.\nsave_celldata: Boolean value to determine if cell-based data should be saved. (default: true)\nreinterpolate: Boolean value to determine if data should be reinterpolated onto uniform points. When false the raw data at the compute nodes is copied into the appropriate format. (default: true)\ndata_is_uniform: Boolean to indicate if the data to be converted is from a finite difference method on a uniform grid of points. (default: false)\n\nExamples\n\njulia> trixi2vtk(\"out/solution_000*.h5\")\n[...]\n\n\n\n\n\n","category":"method"}] +[{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"EditURL = \"../../literate/src/files/adaptive_mesh_refinement.jl\"","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#adaptive_mesh_refinement","page":"14 Adaptive mesh refinement","title":"14: Adaptive mesh refinement","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Adaptive mesh refinement (AMR) is a method of adapting the resolution of the numerical method to the solution features such as turbulent regions or shocks. In those critical regions 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.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Implementation-in-Trixi.jl","page":"14 Adaptive mesh refinement","title":"Implementation in Trixi.jl","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"In Trixi.jl, AMR is possible for the mesh types TreeMesh and P4estMesh. Both meshes are organized in a tree structure 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.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The implementation of AMR is divided into different steps. The basic refinement setting contains an indicator and a controller. These are added to the simulation by using an AMR callback.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Indicators","page":"14 Adaptive mesh refinement","title":"Indicators","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"An indicator estimates the current accuracy of the numerical approximation. It indicates which regions of the domain need finer or coarser resolutions. In Trixi.jl, you can use for instance IndicatorLöhner and IndicatorHennemannGassner.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"IndicatorLöhner (also callable with IndicatorLoehner) is an interpretation and adaptation of a FEM indicator by Löhner (1987) and estimates a weighted second derivative of a specified variable locally.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorLöhner(semi, variable=variable)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"All indicators have the parameter variable which is used to specify the variable for the indicator calculation. You can use for instance density, pressure or density_pressure for the compressible Euler equations. Moreover, you have the option to use simply the first conservation variable with first for any equations. This might be a good choice for a starting example.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"IndicatorHennemannGassner, also used as a shock-capturing indicator, was developed by Hennemann et al. (2021) and is explained in detail in the tutorial about shock-capturing. It can be constructed as follows.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorHennemannGassner(semi,\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable=variable)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"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.jl.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorMax(semi, variable=variable)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Controllers","page":"14 Adaptive mesh refinement","title":"Controllers","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The spatial discretization into elements is tree-based for both AMR supporting mesh types TreeMesh and P4estMesh. Thus, the higher the level in the tree the higher the level of refinement. For instance, a mesh element of level 3 has double resolution in each direction compared to another element with level 2.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"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 in Trixi.jl.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_controller = ControllerThreeLevel(semi, amr_indicator;\n base_level=4,\n med_level=5, med_threshold=0.1,\n max_level=6, max_threshold=0.6)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"You can also set med_level=0 to use the current level as target, see the docstring of ControllerThreeLevel.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"An extension is ControllerThreeLevelCombined, which uses two different indicators. The primary indicator works the same as the single indicator for ControllerThreeLevel. The second indicator with its own maximum threshold adds the property, that the target level is set to max_level additionally if this indicator's value is greater than max_threshold_secondary. This is for instance used to assure that a shock has always the maximum refinement level.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_controller = ControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;\n base_level=2,\n med_level=6, med_threshold=0.0003,\n max_level=8, max_threshold=0.003,\n max_threshold_secondary=0.3)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"This controller is for instance used in elixir_euler_astro_jet_amr.jl.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Callback","page":"14 Adaptive mesh refinement","title":"Callback","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The AMR indicator and controller are added to the simulation through the callback AMRCallback. It contains a semidiscretization semi, the controller amr_controller and the parameters interval, adapt_initial_condition, and adapt_initial_condition_only_refine.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Adaptive mesh refinement will be performed every interval time steps. adapt_initial_condition indicates whether the initial condition already should be adapted before the first time step. And with adapt_initial_condition_only_refine=true the mesh is only refined at the beginning but not coarsened.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_callback = AMRCallback(semi, amr_controller,\n interval=5,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Exemplary-simulation","page":"14 Adaptive mesh refinement","title":"Exemplary simulation","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Here, we want to implement a simple AMR simulation of the 2D linear advection equation for a Gaussian pulse.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"using OrdinaryDiffEq\nusing Trixi\n\nadvection_velocity = (0.2, -0.7)\nequations = LinearScalarAdvectionEquation2D(advection_velocity)\n\ninitial_condition = initial_condition_gauss\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\ncoordinates_min = (-5.0, -5.0)\ncoordinates_max = ( 5.0, 5.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n n_cells_max=30_000)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n\n\ntspan = (0.0, 10.0)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"For the best understanding about indicators and controllers, we use the simple AMR indicator IndicatorMax. As described before, it returns the maximal value of the specified variable (here the only conserved variable). Therefore, regions with a high maximum are refined. This is not really useful numerical application, but a nice demonstration example.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_indicator = IndicatorMax(semi, variable=first)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"These values are transferred to a refinement level with the ControllerThreeLevel, such that every element with maximal value greater than 0.1 is refined once and elements with maximum above 0.6 are refined twice.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"amr_controller = ControllerThreeLevel(semi, amr_indicator,\n base_level=4,\n med_level=5, med_threshold=0.1,\n max_level=6, max_threshold=0.6)\n\namr_callback = AMRCallback(semi, amr_controller,\n interval=5,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true)\n\nstepsize_callback = StepsizeCallback(cfl=0.9)\n\ncallbacks = CallbackSet(amr_callback, stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Running the simulation.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"We plot the solution and add the refined mesh at the end of the simulation.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#More-examples","page":"14 Adaptive mesh refinement","title":"More examples","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Trixi.jl provides many elixirs using AMR. We want to give some examples for different mesh types:","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"elixir_euler_blast_wave_amr.jl for TreeMesh and P4estMesh\nelixir_euler_kelvin_helmholtz_instability_amr.jl for TreeMesh\nelixir_euler_double_mach_amr.jl for P4estMesh","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Animations of more interesting and complicated AMR simulations can be found below and on Trixi.jl's youtube channel \"Trixi Framework\".","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"First, we give a purely hyperbolic simulation of a Sedov blast wave with self-gravity. This simulation uses the mesh type TreeMesh as we did and the AMR indicator IndicatorHennemannGassner.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":" \n
    ","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Source: Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"The next example is a numerical simulation of an ideal MHD rotor on an unstructured AMR mesh. The used mesh type is a P4estMesh.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":" \n
    ","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"Source: Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"For more information, please have a look at the respective links.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/#Package-versions","page":"14 Adaptive mesh refinement","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"","category":"page"},{"location":"tutorials/adaptive_mesh_refinement/","page":"14 Adaptive mesh refinement","title":"14 Adaptive mesh refinement","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"EditURL = \"../../literate/src/files/structured_mesh_mapping.jl\"","category":"page"},{"location":"tutorials/structured_mesh_mapping/#structured_mesh_mapping","page":"15 Structured mesh with curvilinear mapping","title":"15: Structured mesh with curvilinear mapping","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Here, we want to introduce another mesh type of Trixi.jl. More precisely, this tutorial is about the curved mesh type StructuredMesh supporting curved meshes.","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Creating-a-curved-mesh","page":"15 Structured mesh with curvilinear mapping","title":"Creating a curved mesh","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"There are two basic options to define a curved StructuredMesh 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.","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Mesh-defined-by-domain-boundary-curves","page":"15 Structured mesh with curvilinear mapping","title":"Mesh defined by domain boundary curves","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Both examples are based on a semdiscretization of the 2D compressible Euler equations.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"using OrdinaryDiffEq\nusing Trixi\n\nequations = CompressibleEulerEquations2D(1.4)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We start with a pressure perturbation at (xs, 0.0) as initial condition.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"function initial_condition_pressure_perturbation(x, t, equations::CompressibleEulerEquations2D)\n xs = 1.5 # location of the initial disturbance on the x axis\n w = 1/8 # half width\n p = exp(-log(2) * ((x[1]-xs)^2 + x[2]^2)/w^2) + 1.0\n v1 = 0.0\n v2 = 0.0\n rho = 1.0\n\n return prim2cons(SVector(rho, v1, v2, p), equations)\nend\ninitial_condition = initial_condition_pressure_perturbation","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Initialize every boundary as a boundary_condition_slip_wall.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"boundary_conditions = boundary_condition_slip_wall","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"The approximation setup is an entropy-stable split-form DG method with polydeg=4. We are using the two fluxes flux_ranocha and flux_lax_friedrichs.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"solver = DGSEM(polydeg=4, surface_flux=flux_lax_friedrichs,\n volume_integral=VolumeIntegralFluxDifferencing(flux_ranocha))","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We want to define a circular cylinder as physical domain. It contains an inner semicircle with radius r0 and an outer semicircle of radius r1.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"(Image: )","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"The domain boundary curves with curve parameter in -11 are sorted as shown in the sketch. They always are orientated from negative to positive coordinate, such that the corners have to fit like this f_1(+1) = f_4(-1), f_3(+1) = f_2(-1), etc.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"In our case we can define the domain boundary curves as follows:","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"r0 = 0.5 # inner radius\nr1 = 5.0 # outer radius\nf1(xi) = SVector( r0 + 0.5 * (r1 - r0) * (xi + 1), 0.0) # right line\nf2(xi) = SVector(-r0 - 0.5 * (r1 - r0) * (xi + 1), 0.0) # left line\nf3(eta) = SVector(r0 * cos(0.5 * pi * (eta + 1)), r0 * sin(0.5 * pi * (eta + 1))) # inner circle\nf4(eta) = SVector(r1 * cos(0.5 * pi * (eta + 1)), r1 * sin(0.5 * pi * (eta + 1))) # outer circle","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We create a curved mesh with 16 x 16 elements. The defined domain boundary curves are passed as a tuple.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"cells_per_dimension = (16, 16)\nmesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4), periodicity=false)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Then, we define the simulation with endtime T=3 with semi, ode and callbacks.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_conditions)\n\ntspan = (0.0, 3.0)\node = semidiscretize(semi, tspan)\n\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi, interval=analysis_interval)\n\nalive_callback = AliveCallback(analysis_interval=analysis_interval)\n\nstepsize_callback = StepsizeCallback(cfl=0.9)\n\ncallbacks = CallbackSet(analysis_callback,\n alive_callback,\n stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Running the simulation","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\n\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"pd = PlotData2D(sol)\nplot(pd[\"p\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Mesh-directly-defined-by-the-transformation-mapping","page":"15 Structured mesh with curvilinear mapping","title":"Mesh directly defined by the transformation mapping","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"As mentioned before, you can also define the domain for a StructuredMesh by directly setting up a transformation mapping. Here, we want to present a nice mapping, which is often used to test free-stream preservation. Exact free-stream preservation is a crucial property of any numerical method on curvilinear grids. The mapping is a reduced 2D version of the mapping described in Rueda-Ramírez et al. (2021), p.18.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"using OrdinaryDiffEq\nusing Trixi\n\nequations = CompressibleEulerEquations2D(1.4)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"As mentioned, this mapping is used for testing free-stream preservation. So, we use a constant initial condition.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"initial_condition = initial_condition_constant\n\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We define the transformation mapping with variables in -1 1 as described in Rueda-Ramírez et al. (2021), p.18 (reduced to 2D):","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"function mapping(xi_, eta_)\n # Transform input variables between -1 and 1 onto [0,3]\n xi = 1.5 * xi_ + 1.5\n eta = 1.5 * eta_ + 1.5\n\n y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) *\n cos(0.5 * pi * (2 * eta - 3)/3))\n\n x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) *\n cos(2 * pi * (2 * y - 3)/3))\n\n return SVector(x, y)\nend","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Instead of a tuple of boundary functions, the mesh now has the mapping as its parameter.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"cells_per_dimension = (16, 16)\nmesh = StructuredMesh(cells_per_dimension, mapping)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan)\n\nanalysis_callback = AnalysisCallback(semi, interval=250)\n\nstepsize_callback = StepsizeCallback(cfl=0.8)\n\ncallbacks = CallbackSet(analysis_callback,\n stepsize_callback)\n\nsol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Now, we want to verify the free-stream preservation property and plot the mesh. For the verification, we calculate the absolute difference of the first conservation variable density u[1] and 1.0. To plot this error and the mesh, we are using the visualization feature ScalarPlotData2D, explained in visualization.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"error_density = let u = Trixi.wrap_array(sol.u[end], semi)\n abs.(u[1, :, :, :] .- 1.0) # density, x, y, elements\nend\npd = ScalarPlotData2D(error_density, semi)\n\nusing Plots\nplot(pd, title=\"Error in density\")\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"We observe that the errors in the variable density are at the level of machine accuracy. Moreover, the plot shows the mesh structure resulting from our transformation mapping.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"Of course, you can also use other mappings as for instance shifts by (x y)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"mapping(xi, eta) = SVector(xi + x, eta + y)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"or rotations with a rotation matrix T","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"mapping(xi, eta) = T * SVector(xi, eta).","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"For more curved mesh mappings, please have a look at some elixirs for StructuredMesh. For another curved mesh type, there is a tutorial about Trixi.jl's unstructured mesh type [UnstructuredMesh2D] and its use of the High-Order Hex-Quad Mesh (HOHQMesh) generator, created and developed by David Kopriva.","category":"page"},{"location":"tutorials/structured_mesh_mapping/#Package-versions","page":"15 Structured mesh with curvilinear mapping","title":"Package versions","text":"","category":"section"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"","category":"page"},{"location":"tutorials/structured_mesh_mapping/","page":"15 Structured mesh with curvilinear mapping","title":"15 Structured mesh with curvilinear mapping","text":"This page was generated using Literate.jl.","category":"page"},{"location":"github-git/#GitHub-and-Git","page":"GitHub & Git","title":"GitHub & Git","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"This page contains information on how to use GitHub and Git when developing Trixi.jl.","category":"page"},{"location":"github-git/#Development-workflow","page":"GitHub & Git","title":"Development workflow","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"For adding modifications to Trixi.jl, we generally follow these steps:","category":"page"},{"location":"github-git/#Create-an-issue-(optional)","page":"GitHub & Git","title":"Create an issue (optional)","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"In many cases it makes sense to start by creating an issue on GitHub. For example, if the implementation approach for a new feature is not yet clear or if there should be a discussion about the desired outcome, it is good practice to first get a consensus on what is the expected result of this modification. A GitHub issue is the place to lead this discussion, as it preserves it in the project and - together with the actual code changes - allows in the future to revisit the reasons for a particular choice of implementation or feature.","category":"page"},{"location":"github-git/#Create-a-branch-and-*immediately*-create-a-pull-request","page":"GitHub & Git","title":"Create a branch and immediately create a pull request","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"All feature development, bug fixes etc. should be developed in a branch and not directly on main. If you do not have write access to the main repository on GitHub, first create a fork of the Trixi.jl repository and clone the fork to your machine. Then, create a branch locally by executing git checkout -b yourbranch, push it to the repository, and create a pull request (PR).","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"If you have already cloned Trixi.jl from the main repo to your local machine, you can also work in that clone. You just need to add your fork as additional remote repository and push your new branch there.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"git remote add myfork git@github.com:YOUR_NAME/Trixi.jl.git\n# get latest main from the main repo\ngit checkout main\ngit pull\n# create a new branch for a cool new feature, bug fix, ...\ngit checkout -b YOUR_BRANCH_NAME\n# do some work and push it to your fork\ngit push -u myfork\n# go to https://github.com/trixi-framework/Trixi.jl/pull\n# and create a PR from your new branch","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"info: Why using pull requests?\nImmediately creating a PR for your branch has the benefit that all code discussions can now be held directly next to the corresponding code. Also, the PR allows to easily compare your branch to the upstream branch (usually main) to see what you have changed. Moreover, tests will run automatically.","category":"page"},{"location":"github-git/#Make-changes","page":"GitHub & Git","title":"Make changes","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"With a branch and PR in place, you can now write your code and commit it to your branch. If you request feedback from someone else, make sure to push your branch to the repository such that the others can easily review your changes or dive in and change something themselves.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"warning: Avoid committing unwanted files\nWhen you use git add . or similar catch-all versions, make sure you do not 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). However, this strategy only works if you have not yet pushed your changes. If you did push your changes, please talk to one of the core developers on how to proceed.","category":"page"},{"location":"github-git/#Keep-your-branch-in-sync-with-main","page":"GitHub & Git","title":"Keep your branch in sync with main","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"For larger features with longer-living branches, it may make sense to synchronize your branch with the current main, e.g., if there was a bug fix in main that is relevant for you. In this case, perform the following steps to merge the current main to your branch:","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Commit all your local changes to your branch and push it. This allows you to delete your clone in case you make a mistake and need to abort the merge.\nExecute git fetch to get the latest changes from the repository.\nMake sure you are in the correct branch by checking the output of git status or by running git checkout yourbranch.\nMerge main using git merge main. If there were no conflicts, hooray!, you are done. Otherwise you need to resolve your merge conflicts and commit the changes afterwards. A good guide for resolving merge conflicts can be found here.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"In general, always use git merge and not git rebase to get the latest changes from main. It is less error-prone and does not create problems on branches that are worked on collaboratively.","category":"page"},{"location":"github-git/#Prepare-for-review","page":"GitHub & Git","title":"Prepare for review","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"If you feel like your branch is ready to be merged to main, prepare it for review. That is, you should","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"merge the current main to your branch\nrun tests if available, but at least ensure that you did not accidentally change the results for one of the existing example elixirs\nproperly comment your code\ndelete old/unused code, especially commented lines (unless they contain helpful code, in which case you should add a comment on why you keep this around)\nremove debug statements\nadd a elixir_xxx.jl that uses your feature (only relevant for new features)\nmake sure your code formatting adheres to the Style guide\ndescribe changes in NEWS.md if appropriate","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"After you are confident that your branch is cleaned up properly, commit all changes and push them to the repository.","category":"page"},{"location":"github-git/#Get-reviewed","page":"GitHub & Git","title":"Get reviewed","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Ask one of the core developers to review your code. Sometimes this will be done directly, either face-to-face or via a video call. Other times a review will be conducted asynchronously, with the reviewer leaving comments and annotations. In some cases it will be necessary to do multiple rounds of reviews, especially if there are larger changes to be added. Just commit and push your changes to your branch, and the corresponding pull request will be updated automatically.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Please note that a review has nothing to do with the lack of experience of the 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 that the code is developed in a consistent fashion. Furthermore, do not take criticism of your code personally - we just try to keep Trixi.jl as accessible and easy to use for everyone.","category":"page"},{"location":"github-git/#Merge-branch","page":"GitHub & Git","title":"Merge branch","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Once your branch is reviewed and declared ready for merging by the reviewer, make sure that all the latest changes have been pushed. Then, one of the developers will merge your PR. If you are one of the developers, you can also go to the pull request page on GitHub and and click on Merge pull request. Voilà, you are done! Your branch will have been merged to main and the source branch will have been deleted in the GitHub repository (if you are not working in your own fork).","category":"page"},{"location":"github-git/#Update-your-working-copy","page":"GitHub & Git","title":"Update your working copy","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Once you have merged your branch by accepting the PR on GitHub, you should clean up your local working copy of the repository by performing the following steps:","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Update your clone by running git fetch.\nCheck out main using git checkout main.\nDelete merged branch locally with git branch -d yourbranch.\nRemove local references to deleted remote branch by executing git remote prune origin.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"You can now proceed with your next changes by starting again at the top.","category":"page"},{"location":"github-git/#Using-Git","page":"GitHub & Git","title":"Using Git","text":"","category":"section"},{"location":"github-git/#Resources-for-learning-Git","page":"GitHub & Git","title":"Resources for learning Git","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Here are a few resources for learning do use Git that at least one of us found helpful in the past (roughly ordered from novice to advanced to expert):","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Git Handbook by GitHub\nLearn Git Branching","category":"page"},{"location":"github-git/#Tips-and-tricks","page":"GitHub & Git","title":"Tips and tricks","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"This is an unordered collection of different tips and tricks that can be helpful while working with Git. As usual, your mileage might vary.","category":"page"},{"location":"github-git/#Undo-last-commit","page":"GitHub & Git","title":"Undo last commit","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"If you made a mistake in your last commit, e.g., by committing an unwanted file, you can undo the latest commit by running","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"git reset HEAD~","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"This only works if you have not yet pushed your branch to the GitHub repository. In this case, please talk to one of the core developers on how to proceed. Especially when you accidentally committed a large file (image, or video), please let us know as fast as possible, since the effort to fix the repository grows considerably over time.","category":"page"},{"location":"github-git/#Remove-large-file-from-repository","page":"GitHub & Git","title":"Remove large file from repository","text":"","category":"section"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"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.","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"danger: Large files\nYou should never try to fix this yourself, as it potentially disrupts/destroys the work of others!","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Based on the instructions found here and here, the following steps need to be taken (as documented for GitLab in issue #33):","category":"page"},{"location":"github-git/","page":"GitHub & Git","title":"GitHub & Git","text":"Tell everyone to commit and push their changes to the repository.\nFix the branch in which the file was committed by removing it and committing the removal. This is especially important on main.\nPerform the following steps to clean up the Git repository:\ncd /tmp\n\n# Download bfg-1.13.0.jar from https://rtyley.github.io/bfg-repo-cleaner/\n\n# Get fresh clone of repo (so you can throw it away in case there is a problem)\ngit clone --mirror git@github.com:trixi-framework/Trixi.jl.git\n\n# Clean up repo of all files larger than 10M\njava -jar bfg-1.13.0.jar --strip-blobs-bigger-than 10M Trixi.jl.git\n\n# Enter repo\ncd Trixi.jl.git\n\n# Clean up reflog and force aggressive garbage collection\ngit reflog expire --expire=now --all && git gc --prune=now --aggressive\n\n# Push changes\ngit push\n\n# Delete clone\nrm -rf Trixi.jl.git\nTell everyone to clean up their local working copies by performing the following steps (also do this yourself):\n# Enter repo\ncd Trixi.jl\n\n# Get current changes\ngit fetch\n\n# Check out the fixed branch\ngit checkout branchname\n\n# IMPORTANT: Do a rebase instead of a pull!\ngit rebase\n\n# Clean reflog and force garbage collection\ngit reflog expire --expire=now --all && git gc --prune=now --aggressive\nIMPORTANT: You need to do a git rebase instead of a git pull when updating the fixed branch.","category":"page"},{"location":"testing/#Testing","page":"Testing","title":"Testing","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"During the development of Trixi.jl, we rely on continuous testing to ensure that modifications or new features do not break existing functionality or add other errors. In the main Trixi.jl repository (and the repositories for the visualization tool Trixi2Vtk), this is facilitated by GitHub Actions, which allows to run tests automatically upon certain events. When, how, and what is tested by GitHub Actions is controlled by the workflow file .github/workflows/ci.yml. In Trixi.jl and its related repositories, tests are triggered by","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"each git push to main and\neach git push to any pull request.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"Besides checking functionality, we also analyse the Test coverage to ensure that we do not miss important parts during testing.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"note: Test and coverage requirements\nBefore merging a pull request (PR) to main, we require thatthe code passes all functional tests\ncode coverage does not decrease.","category":"page"},{"location":"testing/#Testing-setup","page":"Testing","title":"Testing setup","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"The entry point for all testing is the file test/runtests.jl, which is run by the automated tests and which can be triggered manually by executing","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"julia> using Pkg; Pkg.test(\"Trixi\")","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"in the REPL. Since there already exist many tests, we have split them up into multiple files in the test directory to allow for faster testing of individual parts of the code. Thus in addition to performing all tests, you can also just include one of the files named test_xxx.jl to run only a specific subset, e.g.,","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"julia> # Run all 2D tests on the P4estMesh\n include(joinpath(\"test\", \"test_p4est_2d.jl\"))\n\njulia> # Run all 1D tests for the Euler equations on the TreeMesh\n include(joinpath(\"test\", \"test_tree_1d_euler.jl\"))","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"For the automated tests with GitHub Actions, we run multiple jobs in parallel to reduce the waiting time until all tests are finished. You can see the different components that are run as jobs by looking at the TRIXI_TEST variable in test/runtests.jl.","category":"page"},{"location":"testing/#Adding-new-tests","page":"Testing","title":"Adding new tests","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"We use Julia's built-in unit testing capabilities to configure tests. In general, newly added code must be covered by at least one test, and all new elixirs added to the examples/ directory must be used at least once during testing. New tests should be added to the corresponding test/test_xxx.jl file, e.g., a test involving the 3D linear advection equation on the TreeMesh would go into test/test_tree_3d_advection.jl. Please study one of the existing tests and stay consistent to the current style when creating new tests.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"Since we want to test as much as possible, we have a lot of tests and frequently create new ones. Naturally, this increases the time to wait for all tests to pass with each novel feature added to Trixi.jl. Therefore, new tests should be as short as reasonably possible, i.e., without being too insensitive to pick up changes or errors in the code.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"When you add new tests, please check whether all CI jobs still take approximately the same time. If the job where you added new tests takes much longer than everything else, please consider moving some tests from one job to another (or report this incident and ask the main developers for help).","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"note: Test duration\nAs a general rule, tests should last no more than 10 seconds when run with a single thread and after compilation (i.e., excluding the first run).","category":"page"},{"location":"testing/#Test-coverage","page":"Testing","title":"Test coverage","text":"","category":"section"},{"location":"testing/","page":"Testing","title":"Testing","text":"In addition to ensuring that the code produces the expected results, the automated tests also record the code coverage. The resulting coverage reports, i.e., which lines of code were executed by at least one test and are thus considered \"covered\" by testing, are automatically uploaded to Coveralls for easy analysis. Typically, you see a number of Coveralls results at the bottom of each pull request: One for each parallel job (see Testing setup), which can usually be ignored since they only cover parts of the code by definition, and a cumulative coverage result named coverage/coveralls. The \"Details\" link takes you to a detailed report on which lines of code are covered by tests, which ones are missed, and especially which new lines the pull requests adds to Trixi.jl's code base that are not yet covered by testing.","category":"page"},{"location":"testing/","page":"Testing","title":"Testing","text":"note: Coverage requirements\nIn general, we require pull requests to not decrease the overall test coverage percentage in main, with a hard lower bound of 97%.","category":"page"},{"location":"authors/#Authors","page":"Authors","title":"Authors","text":"","category":"section"},{"location":"authors/","page":"Authors","title":"Authors","text":"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.jl. In addition, there are contributors who have provided substantial additions or modifications. Together, these two groups form \"The Trixi.jl Authors\" as mentioned under License.","category":"page"},{"location":"authors/#Principal-Developers","page":"Authors","title":"Principal Developers","text":"","category":"section"},{"location":"authors/","page":"Authors","title":"Authors","text":"Michael Schlottke-Lakemper, RWTH Aachen University/High-Performance Computing Center Stuttgart (HLRS), Germany\nGregor Gassner, University of Cologne, Germany\nHendrik Ranocha, Johannes Gutenberg University Mainz, Germany\nAndrew Winters, Linköping University, Sweden\nJesse Chan, Rice University, US","category":"page"},{"location":"authors/#Contributors","page":"Authors","title":"Contributors","text":"","category":"section"},{"location":"authors/","page":"Authors","title":"Authors","text":"The following people contributed major additions or modifications to Trixi.jl and are listed in alphabetical order:","category":"page"},{"location":"authors/","page":"Authors","title":"Authors","text":"Maximilian D. Bertrand\nBenjamin Bolm\nSimon Candelaresi\nJesse Chan\nLars Christmann\nChristof Czernik\nDaniel Doehring\nPatrick Ersing\nErik Faulhaber\nGregor Gassner\nLucas Gemein\nSven Goldberg\nJoshua Lampert\nJulia Odenthal\nSigrun Ortleb\nHendrik Ranocha\nAndrés M. Rueda-Ramírez\nFelipe Santillan\nMichael Schlottke-Lakemper\nToskan Theine\nAndrew Winters","category":"page"},{"location":"license/#License","page":"License","title":"License","text":"","category":"section"},{"location":"license/","page":"License","title":"License","text":"MIT LicenseCopyright (c) 2020-present The Trixi.jl Authors (see Authors)Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","category":"page"},{"location":"restart/#restart","page":"Restart simulation","title":"Restart simulation","text":"","category":"section"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"You can continue running an already finished simulation by first preparing the simulation for the restart and then performing the restart. Here we suppose that in the first run your simulation stops at time 1.0 and then you want it to run further to time 2.0.","category":"page"},{"location":"restart/#restart_preparation","page":"Restart simulation","title":"Prepare the simulation for a restart","text":"","category":"section"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"In you original elixir you need to specify to write out restart files. Those will later be read for the restart of your simulation. This is done almost the same way as writing the snapshots using the SaveSolutionCallback callback. For the restart files it is called SaveRestartCallback:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"save_restart = SaveRestartCallback(interval=100,\n save_final_restart=true)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Make this part of your CallbackSet.","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"An example is examples/examples/structured_2d_dgsem/elixir_advection_extended.jl.","category":"page"},{"location":"restart/#restart_perform","page":"Restart simulation","title":"Perform the simulation restart","text":"","category":"section"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Since all of the information about the simulation can be obtained from the last snapshot, the restart can be done with relatively few lines in an extra elixir file. However, some might prefer to keep everything in one elixir and conditionals like if restart with a boolean variable restart that is user defined.","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"First we need to define from which file we want to restart, e.g.","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"restart_file = \"restart_000021.h5\"\nrestart_filename = joinpath(\"out\", restart_file)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Then we load the mesh file:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"mesh = load_mesh(restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"This is then needed for the semidiscretization:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"We then define a new time span for the simulation that takes as starting time the one form the snapshot:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"tspan = (load_time(restart_filename), 2.0)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"We now also take the last dt, so that our solver does not need to first find one to fulfill the CFL condition:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"dt = load_dt(restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"The ODE that we will pass to the solver is now:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"ode = semidiscretize(semi, tspan, restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"You should now define a SaveSolutionCallback similar to the original simulation, but with save_initial_solution=false, otherwise our initial snapshot will be overwritten. If you are using one file for the original simulation and the restart you can reuse your SaveSolutionCallback, but need to set","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"save_solution.condition.save_initial_solution = false","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Before we compute the solution using OrdinaryDiffEq.jl we need to set the integrator and its time step number, e.g.:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"integrator = init(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=dt, save_everystep=false, callback=callbacks);\nload_timestep!(integrator, restart_filename)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"Now we can compute the solution:","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"sol = solve!(integrator)","category":"page"},{"location":"restart/","page":"Restart simulation","title":"Restart simulation","text":"An example is in examples/structured_2d_dgsem/elixir_advection_restart.jl.","category":"page"},{"location":"meshes/structured_mesh/#Structured-mesh","page":"Structured mesh","title":"Structured mesh","text":"","category":"section"},{"location":"meshes/structured_mesh/","page":"Structured mesh","title":"Structured mesh","text":"The StructuredMesh is a structured, curvilinear, conforming mesh type available for one-, two-, and three-dimensional simulations.","category":"page"},{"location":"meshes/structured_mesh/","page":"Structured mesh","title":"Structured mesh","text":"Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.","category":"page"},{"location":"development/#Development","page":"Development","title":"Development","text":"","category":"section"},{"location":"development/#interactive-use-of-julia","page":"Development","title":"Interactive use of Julia","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"When a Julia program is executed, Julia first loads and parses all code. Then, the just-in-time compiler has to compile all functions at their first use, which 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.jl should generally always be used interactively from the REPL without closing Julia during development, as it allows much faster turnaround times.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"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 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","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> add Revise","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"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.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Another recommended package for working from the REPL is OhMyREPL.jl. It can be installed by running","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> add OhMyREPL","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"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.","category":"page"},{"location":"development/#Running-Trixi.jl-interactively-in-the-global-environment","page":"Development","title":"Running Trixi.jl interactively in the global environment","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"If you've installed Trixi.jl and Revise in your default environment, begin by executing:","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"This will start the Julia REPL. Then, run","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> using Revise; using Trixi","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"You can run a simulation by executing","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> trixi_include(default_example())","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Together, all of these commands can take some time, roughly half a minute on a 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.jl runs do not need to be recompiled and thus execute much faster after the first run.","category":"page"},{"location":"development/#Manually-starting-Trixi.jl-in-the-local-environment","page":"Development","title":"Manually starting Trixi.jl in the local environment","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"If you followed the installation instructions 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.jl this way, you need to start the REPL with","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia --project=path/to/Trixi.jl/run","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"and execute","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> using Revise; using Trixi","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"to load Revise and Trixi.jl. You can then proceed with the usual commands and run Trixi.jl as in the example above. 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 manually such that you can modify their implementations.","category":"page"},{"location":"development/#Pitfalls-when-using-Revise","page":"Development","title":"Pitfalls when using Revise","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"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.jl developers and probably incomplete. Further information on limitations and possible issues with Revise can be found in the official documentation.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"tip: If in doubt, restart the REPL\nOftentimes, it is possible to recover from issues with Revise by fixing the offending code. Sometimes, however, this is not possible or you might have troubles finding out what exactly caused the problems. Therefore, in these cases, or if in doubt, restart the REPL to get a fresh start.","category":"page"},{"location":"development/#Syntax-errors-are-easy-to-miss","page":"Development","title":"Syntax errors are easy to miss","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Revise does not stop on syntax errors, e.g., when you accidentally write a[i) instead of a[i]. In this case, Revise reports an error but continues 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.jl starts writing output to the screen and you might not even have noticed that an error occurred at all.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Therefore, when you are deep in a coding/debugging session and wonder why your code modifications do not seem to have any effect, scroll up in your terminal to check if you missed earlier syntax errors, or - if in doubt - restart your REPL.","category":"page"},{"location":"development/#Files-are-not-tracked-after-changing-branches","page":"Development","title":"Files are not tracked after changing branches","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Sometimes, Revise stops tracking files when changing the Git branch. That is, 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 changing branches.","category":"page"},{"location":"development/#Changes-to-type-definitions-are-not-allowed","page":"Development","title":"Changes to type definitions are not allowed","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Revise cannot handle changes to type definitions, e.g., when modifying the fields in a struct. In this case, Revise reports an error and refuses to run your code unless you undo the modifications. Once you undo the changes, Revise will usually continue to work as expected again. However, if you want to keep your type modifications, you need to restart the REPL.","category":"page"},{"location":"development/#Using-the-Julia-REPL-effectively","page":"Development","title":"Using the Julia REPL effectively","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"The Julia manual is an excellent resource to learn Julia. Here, we list some helpful commands than can increase your productivity in the Julia REPL.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Use the REPL help mode entered by typing ?.\njulia> using Trixi\n\nhelp?> trixi_include\nsearch: trixi_include\n\n trixi_include([mod::Module=Main,] elixir::AbstractString; kwargs...)\n\n include the file elixir and evaluate its content in the global scope of module mod. You can override specific\n assignments in elixir by supplying keyword arguments. It's basic purpose is to make it easier to modify some\n parameters while running Trixi.jl from the REPL. Additionally, this is used in tests to reduce the computational\n burden for CI while still providing examples with sensible default values for users.\n\n Examples\n ≡≡≡≡≡≡≡≡≡≡\n\n julia> trixi_include(@__MODULE__, default_example(), tspan=(0.0, 0.1))\n [...]\n\n julia> sol.t[end]\n 0.1\nYou can copy and paste REPL history including julia> prompts into the REPL.\nUse tab completion in the REPL, both for names of functions/types/variables and for function arguments.\njulia> flux_ranocha( # and TAB\nflux_ranocha(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations1D) in Trixi at ~/.julia/dev/Trixi/src/equations/compressible_euler_1d.jl:390\nflux_ranocha(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) in Trixi at ~/.julia/dev/Trixi/src/equations/compressible_euler_2d.jl:839\n[...]\nUse methodswith to discover methods associated to a given type etc.\njulia> methodswith(CompressibleEulerEquations2D)\n[1] initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations2D) in Trixi at ~/.julia/dev/Trixi/src/equations/compressible_euler_2d.jl:51\n[...]\nUse @which (or @edit) for method calls.\njulia> @which trixi_include(default_example())\ntrixi_include(elixir::AbstractString; kwargs...) in Trixi at ~/.julia/dev/Trixi/src/auxiliary/special_elixirs.jl:36\nUse apropos to search through the documentation and docstrings.\njulia> apropos(\"MHD\")\nTrixi.IdealGlmMhdEquations3D\nTrixi.IdealGlmMhdMulticomponentEquations2D\nTrixi.calc_fast_wavespeed_roe\nTrixi.IdealGlmMhdEquations1D\nTrixi.initial_condition_constant\nTrixi.flux_nonconservative_powell\nTrixi.GlmSpeedCallback\nTrixi.flux_derigs_etal\nTrixi.flux_hindenlang_gassner\nTrixi.initial_condition_convergence_test\nTrixi.min_max_speed_naive\nTrixi.IdealGlmMhdEquations2D\nTrixi.IdealGlmMhdMulticomponentEquations1D\n[...]","category":"page"},{"location":"development/#Text-editors","page":"Development","title":"Text editors","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"When writing code, the choice of text editor can have a significant impact on productivity and developer satisfaction. While using the default text editor of the operating system has its own benefits (specifically the lack of an explicit installation procure), usually it makes sense to switch to a more programming-friendly tool. In the following, a few of the many options are listed and discussed:","category":"page"},{"location":"development/#VS-Code","page":"Development","title":"VS Code","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Visual Studio Code is a modern open source editor with good support for Julia. While Juno had some better support in the past, the developers of Juno and the Julia VS Code plugin are joining forces and concentrating on VS Code since support of Atom has been suspended. Basically, all comments on Juno below also apply to VS Code.","category":"page"},{"location":"development/#Juno","page":"Development","title":"Juno","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"If you are new to programming or do not have a preference for a text editor yet, Juno is a good choice for developing Julia code. It is based on Atom, a sophisticated and widely used editor for software developers, and is enhanced with several Julia-specific features. Furthermore and especially helpful for novice programmers, it has a MATLAB-like appearance with easy and interactive access to the current variables, the help system, and a debugger.","category":"page"},{"location":"development/#Vim-or-Emacs","page":"Development","title":"Vim or Emacs","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Vim and Emacs are both very popular editors that work great with Julia. One of their advantages is that they are text editors without a GUI and as such are available for almost any operating system. They also are preinstalled on virtually all Unix-like systems. However, Vim and Emacs come with their own, steep learning curve if they have never been used before. Therefore, if in doubt, it is probably easier to get started with a classic GUI-based text editor (like Juno). If you decide to use Vim or Emacs, make sure that you install the corresponding Vim plugin julia-vim or Emacs major mode julia-emacs.","category":"page"},{"location":"development/#Debugging","page":"Development","title":"Debugging","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Julia offers several options for debugging. A classical debugger is available with the Debugger.jl package or in the Julia extension for VS Code. However, it can be quite slow and, at the time of writing (January 2023), currently does not work properly with Trixi.jl. The 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.","category":"page"},{"location":"development/#Infiltrator","page":"Development","title":"Infiltrator","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"The Infiltrator package provides fast, interactive breakpoints using the @infiltrate command, which drops the user into a local REPL session. From there, it is possible to access local variables, see the call stack, and execute statements.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"The package can be installed in the Julia REPL by executing","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> add Infiltrator","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"To load the package in the Julia REPL execute","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia> using Infiltrator","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Breakpoints can be set by adding a line with the @infiltrate macro at the respective position in the code. Use Revise if you want to set and delete breakpoints in your package without having to restart Julia.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"note: Use `@autoinfiltrate` when debugging Trixi.jl\nWhen 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.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Triggering the breakpoint starts a REPL session where it is possible to interact with the current local scope. Possible commands are:","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"@locals: Print the local variables.\n@exfiltrate: Save the local variables to a global storage, which can be accessed with the safehouse variable outside the Infiltrator session.\n@trace: Print the current stack trace.\nExecute other arbitrary statements\n?: Print a help list with all options","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"To finish a debugging session, either use @continue to continue and eventually stop at the next breakpoint or @exit to skip further breakpoints. After the code has finished, local variables saved with @exfiltrate can be accessed in the REPL using the safehouse variable.","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"Limitations of using Infiltrator.jl are that local variables cannot be changed, and that it is not possible to step into further calls or access other function scopes.","category":"page"},{"location":"development/#Releasing-a-new-version-of-Trixi.jl,-Trixi2Vtk","page":"Development","title":"Releasing a new version of Trixi.jl, Trixi2Vtk","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"Check whether everything is okay, tests pass etc.\nSet the new version number in Project.toml according to the Julian version of semver. Commit and push.\nComment @JuliaRegistrator register on the commit setting the version number.\nJuliaRegistrator will create a PR with the new version in the General registry. Wait for it to be merged.\nIncrement 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.\nWhen 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.jl should be updated.\nThese 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.jl was released afterwards.","category":"page"},{"location":"development/#Preview-of-the-documentation","page":"Development","title":"Preview of the documentation","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"You can build the documentation of Trixi.jl locally by running","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'\njulia --project=docs --color=yes docs/make.jl","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"from the Trixi.jl main directory. Then, you can look at the html files generated in docs/build. 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.jl website, including malicious code).","category":"page"},{"location":"development/#trixi2vtk-dev","page":"Development","title":"Developing Trixi2Vtk","text":"","category":"section"},{"location":"development/","page":"Development","title":"Development","text":"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.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","category":"page"},{"location":"development/","page":"Development","title":"Development","text":"(@v1.9) pkg> develop path/to/Trixi.jl","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"EditURL = \"../../../literate/src/files/first_steps/create_first_setup.jl\"","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#create_first_setup","page":"1.2 Create first setup","title":"1.2: First steps in Trixi.jl: Create first setup","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"In this part of the introductory guide, we will create a first Trixi.jl setup as an extension of elixir_advection_basic.jl. Since Trixi.jl has a common basic structure for the setups, you can create your own by extending and modifying the following example.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Let's consider the linear advection equation for a state u = u(x y t) on the two-dimensional spatial domain -1 1 times -1 1 with a source term","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"fracpartialpartial tu + fracpartialpartial x (02 u) - fracpartialpartial y (07 u) = - 2 e^-t\nsinbigl(2 pi (x - t) bigr) sinbigl(2 pi (y - t) bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"with the initial condition","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"u(x y 0) = sinbigl(pi x bigr) sinbigl(pi y bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"and periodic boundary conditions.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The first step is to create and open a file with the .jl extension. You can do this with your favorite text editor (if you do not have one, we recommend VS Code). In this file you will create your setup.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To be able to use functionalities of Trixi.jl, you always need to load Trixi.jl itself and the OrdinaryDiffEq.jl package.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"using Trixi\nusing OrdinaryDiffEq","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The next thing to do is to choose an equation that is suitable for your problem. To see all the currently implemented equations, take a look at src/equations. If you are interested in adding a new physics model that has not yet been implemented in Trixi.jl, take a look at the tutorials Adding a new scalar conservation law or Adding a non-conservative equation.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The linear scalar advection equation in two spatial dimensions","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"fracpartialpartial tu + fracpartialpartial x (a_1 u) + fracpartialpartial y (a_2 u) = 0","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"is already implemented in Trixi.jl as LinearScalarAdvectionEquation2D, for which we need to define a two-dimensional parameter advection_velocity describing the parameters a_1 and a_2. Appropriate for our problem is (0.2, -0.7).","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"advection_velocity = (0.2, -0.7)\nequations = LinearScalarAdvectionEquation2D(advection_velocity)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To solve our problem numerically using Trixi.jl, we have to discretize the spatial domain, for which we set up a mesh. One of the most used meshes in Trixi.jl is the TreeMesh. The spatial domain used is -1 1 times -1 1. We set an initial number of elements in the mesh using initial_refinement_level, which describes the initial number of hierarchical refinements. In this simple case, the total number of elements is 2^initial_refinement_level throughout the simulation. The variable n_cells_max is used to limit the number of elements in the mesh, which cannot be exceeded when using adaptive mesh refinement.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"All minimum and all maximum coordinates must be combined into Tuples.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"coordinates_min = (-1.0, -1.0)\ncoordinates_max = ( 1.0, 1.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level = 4,\n n_cells_max = 30_000)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To approximate the solution of the defined model, we create a DGSEM solver. The solution in each of the recently defined mesh elements will be approximated by a polynomial of degree polydeg. For more information about discontinuous Galerkin methods, check out the Introduction to DG methods tutorial.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"solver = DGSEM(polydeg=3)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now we need to define an initial condition for our problem. All the already implemented initial conditions for LinearScalarAdvectionEquation2D can be found in src/equations/linear_scalar_advection_2d.jl. If you want to use, for example, a Gaussian pulse, it can be used as follows:","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"initial_conditions = initial_condition_gauss","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"But to show you how an arbitrary initial condition can be implemented in a way suitable for Trixi.jl, we define our own initial conditions.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"u(x y 0) = sinbigl(pi x bigr) sinbigl(pi y bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The initial conditions function must take spatial coordinates, time and equation as arguments and returns an initial condition as a statically sized vector SVector. Following the same structure, you can define your own initial conditions. The time variable t can be unused in the initial condition, but might also be used to describe an analytical solution if known. If you use the initial condition as analytical solution, you can analyze your numerical solution by computing the error, see also the section about analyzing the solution.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"function initial_condition_sinpi(x, t, equations::LinearScalarAdvectionEquation2D)\n scalar = sinpi(x[1]) * sinpi(x[2])\n return SVector(scalar)\nend\ninitial_condition = initial_condition_sinpi","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The next step is to define a function of the source term corresponding to our problem.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"f(u x y t) = - 2 e^-t sinbigl(2 pi (x - t) bigr) sinbigl(2 pi (y - t) bigr)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"This function must take the state variable, the spatial coordinates, the time and the equation itself as arguments and returns the source term as a static vector SVector.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"function source_term_exp_sinpi(u, x, t, equations::LinearScalarAdvectionEquation2D)\n scalar = - 2 * exp(-t) * sinpi(2*(x[1] - t)) * sinpi(2*(x[2] - t))\n return SVector(scalar)\nend","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now we collect all the information that is necessary to define a spatial discretization, which leaves us with an ODE problem in time with a span from 0.0 to 1.0. This approach is commonly referred to as the method of lines.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;\n source_terms = source_term_exp_sinpi)\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"At this point, our problem is defined. We will use the solve function defined in OrdinaryDiffEq.jl to get the solution. OrdinaryDiffEq.jl gives us the ability to customize the solver using callbacks without actually modifying it. Trixi.jl already has some implemented Callbacks. The most widely used callbacks in Trixi.jl are step control callbacks that are activated at the end of each time step to perform some actions, e.g. to print statistics. We will show you how to use some of the common callbacks.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To print a summary of the simulation setup at the beginning and to reset timers we use the SummaryCallback. When the returned callback is executed directly, the current timer values are shown.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"summary_callback = SummaryCallback()","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"We also want to analyze the current state of the solution in regular intervals. The AnalysisCallback outputs some useful statistical information during the solving process every interval time steps.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"analysis_callback = AnalysisCallback(semi, interval = 5)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"It is also possible to control the time step size using the StepsizeCallback if the time integration method isn't adaptive itself. To get more details, look at CFL based step size control.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"stepsize_callback = StepsizeCallback(cfl = 1.6)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To save the current solution in regular intervals we use the SaveSolutionCallback. We would like to save the initial and final solutions as well. The data will be saved as HDF5 files located in the out folder. Afterwards it is possible to visualize a solution from saved files using Trixi2Vtk.jl and ParaView, which is described below in the section Visualize the solution.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"save_solution = SaveSolutionCallback(interval = 5,\n save_initial_solution = true,\n save_final_solution = true)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Alternatively, we have the option to print solution files at fixed time intervals.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"save_solution = SaveSolutionCallback(dt = 0.1,\n save_initial_solution = true,\n save_final_solution = true)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Another useful callback is the SaveRestartCallback. It saves information for restarting in regular intervals. We are interested in saving a restart file for the final solution as well. To perform a restart, you need to configure the restart setup in a special way, which is described in the section Restart simulation.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"save_restart = SaveRestartCallback(interval = 100, save_final_restart = true)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Create a CallbackSet to collect all callbacks so that they can be passed to the solve function.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback, save_solution,\n save_restart)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The last step is to choose the time integration method. OrdinaryDiffEq.jl defines a wide range of ODE solvers, e.g. CarpenterKennedy2N54(williamson_condition = false). We will pass the ODE problem, the ODE solver and the callbacks to the solve function. Also, to use StepsizeCallback, we must explicitly specify the initial trial time step dt, the selected value is not important, because it will be overwritten by the StepsizeCallback. And there is no need to save every step of the solution, we are only interested in the final result.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0,\n save_everystep = false, callback = callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Finally, we print the timer summary.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"summary_callback()","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now you can plot the solution as shown below, analyze it and improve the stability, accuracy or efficiency of your setup.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#Visualize-the-solution","page":"1.2 Create first setup","title":"Visualize the solution","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"In the previous part of the tutorial, we calculated the final solution of the given problem, now we want to visualize it. A more detailed explanation of visualization methods can be found in the section Visualization.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#Using-Plots.jl","page":"1.2 Create first setup","title":"Using Plots.jl","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"The first option is to use the Plots.jl package directly after calculations, when the solution is saved in the sol variable. We load the package and use the plot function.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"To show the mesh on the plot, we need to extract the visualization data from the solution as a PlotData2D object. Mesh extraction is possible using the getmesh function. Plots.jl has the plot! function that allows you to modify an already built graph.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"pd = PlotData2D(sol)\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/first_steps/create_first_setup/#Using-Trixi2Vtk.jl","page":"1.2 Create first setup","title":"Using Trixi2Vtk.jl","text":"","category":"section"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Another way to visualize a solution is to extract it from a saved HDF5 file. After we used the solve function with SaveSolutionCallback there is a file with the final solution. It is located in the out folder and is named as follows: solution_index.h5. The index is the final time step of the solution that is padded to 6 digits with zeros from the beginning. With Trixi2Vtk you can convert the HDF5 output file generated by Trixi.jl into a VTK file. This can be used in visualization tools such as ParaView or VisIt to plot the solution. The important thing is that currently Trixi2Vtk.jl supports conversion only for solutions in 2D and 3D spatial domains.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"If you haven't added Trixi2Vtk.jl to your project yet, you can add it as follows.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"import Pkg\nPkg.add([\"Trixi2Vtk\"])","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now we load the Trixi2Vtk.jl package and convert the file out/solution_000018.h5 with the final solution using the trixi2vtk function saving the resulting file in the out folder.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"using Trixi2Vtk\ntrixi2vtk(joinpath(\"out\", \"solution_000018.h5\"), output_directory=\"out\")","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now two files solution_000018.vtu and solution_000018_celldata.vtu have been generated in the out folder. The first one contains all the information for visualizing the solution, the second one contains all the cell-based or discretization-based information.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now let's visualize the solution from the generated files in ParaView. Follow this short instruction to get the visualization.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Download, install and open ParaView.\nPress Ctrl+O and select the generated files solution_000018.vtu and solution_000018_celldata.vtu from the out folder.\nIn the upper-left corner in the Pipeline Browser window, left-click on the eye-icon near solution_000018.vtu.\nIn the lower-left corner in the Properties window, change the Coloring from Solid Color to scalar. This already generates the visualization of the final solution.\nNow let's add the mesh to the visualization. In the upper-left corner in the Pipeline Browser window, left-click on the eye-icon near solution_000018_celldata.vtu.\nIn the lower-left corner in the Properties window, change the Representation from Surface to Wireframe. Then a white grid should appear on the visualization.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Now, if you followed the instructions exactly, you should get a similar image as shown in the section Using Plots.jl:","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"(Image: paraview_trixi2vtk_example)","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"After completing this tutorial you are able to set up your own simulations with Trixi.jl. If you have an interest in contributing to Trixi.jl as a developer, refer to the third part of the introduction titled Changing Trixi.jl itself.","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"Sys.rm(\"out\"; recursive=true, force=true) #hide","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"","category":"page"},{"location":"tutorials/first_steps/create_first_setup/","page":"1.2 Create first setup","title":"1.2 Create first setup","text":"This page was generated using Literate.jl.","category":"page"},{"location":"visualization/#visualization","page":"Visualization","title":"Visualization","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"There are two possible approaches to visualize results from Trixi.jl: either directly from the REPL using Plots.jl or with ParaView/VisIt by postprocessing Trixi.jl's output files with Trixi2Vtk.","category":"page"},{"location":"visualization/#Plots.jl","page":"Visualization","title":"Plots.jl [experimental]","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By far the easiest and most convenient plotting approach is to use the powerful Plots.jl package to directly visualize Trixi.jl's results from the REPL. In the following, you will find more information on a number of topics for how to use Plots.jl together with Trixi.jl:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Getting started\nCustomizing plot results via a PlotData2D object\nPlotting a 3D solution as a 2D plot\nCreating a 1D plot\nPlotting a 2D or 3D solutions as a 1D plot\nVisualizing results during a simulation","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nPlotting via Plots.jl is still considered an experimental feature and might change in any future releases.","category":"page"},{"location":"visualization/#getting-started-plots-jl","page":"Visualization","title":"Getting started","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"After running a simulation with Trixi.jl in the REPL, load the Plots package with","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Plots","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To visualize the solution, execute","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Here we assume that sol holds the return value of the solve(...) method (with type SciMLBase.ODESolution), which is the default variable name when you use one of the example elixirs. This will generate a grid layout with one subplot for each solution variable, convenient for getting an overview of the current solution:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"You can save the resulting file as a PNG image file by calling savefig(...) with an output file name that ends in .png, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> savefig(\"solution-overview.png\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In Trixi.jl, two plot types are available: 2D heatmap plots and 1D line plots. If you use plot(sol), Trixi.jl will automatically choose the plot type that fits the dimensions of the sol input: 2D/3D data will be visualized as a heatmap, 1D data as a line plot. For more fine-grained control over what to plot, you can create such an object yourself, which can either be a PlotData2D or a PlotData1D object. For further details on both of these see below:","category":"page"},{"location":"visualization/#Customizing-plot-results-via-a-PlotData2D-object","page":"Visualization","title":"Customizing plot results via a PlotData2D object","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"For more fine-grained control over what to plot, first create a PlotData2D object by executing","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(sol)\njulia> pd = PlotData2D(u, semi)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"where u is an array containing the solution and semi is the semidiscretization. For example, if PlotData2D(sol.u[2], semi) is specified, this will create a PlotData2D instance from the 2nd saved time-step. If PlotData2D(sol(0.5), semi) is specified, it will construct a PlotData2D instance using OrdinaryDiffEq.jl's interpolation to evaluate the solution at time t=0.5.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This takes the results generated by Trixi.jl and stores them in a data format that can be understood by the Plots package, and pd holds all data relevant for plotting sol. You can pass variable names as strings to pd using a dictionary-like syntax, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(pd[\"rho\"])","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This will create a single 2D heatmap plot of the variable rho:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The default plot type and style can be overridden by passing any additional arguments that are understood by the Plots package. For example, to change the color scheme and add names to the axes, modify the previous command to","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(pd[\"rho\"], seriescolor = :heat, xguide=\"x\", yguide=\"y\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"to yield","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho-modified)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"For more details on the various format options for plot, please consult the Plots documentation.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In addition, you can plot the mesh lines on top of the solution variables by calling the getmesh(...) function on the PlotData2D object","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot!(getmesh(pd)) # here we use `plot!` with an `!` to add to the previous plot","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"which modifies the previous plot to","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho-modified-mesh)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By default, PlotData2D will convert the conserved variables to primitive variables, but this can be changed by passing an appropriate conversion function in the solution_variables keyword argument, similar to the behavior of the SaveSolutionCallback:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(sol; solution_variables=cons2cons) # Plot conservative variables","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"There are several other keyword arguments that influence how the solution data is processed for visualization with the Plots package. A detailed explanation can be found in the docstring of the PlotData2D constructor.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Another way to change the appearance of a plot is to convert the solution to a uniformly refined mesh before plotting. This can be helpful, e.g., when trying different settings for a simulation with adaptive mesh refinement, where one would like to ignore the mesh changes when comparing solutions. This is achieved with adapt_to_mesh_level, which uses the mesh adaptation routines to adapt the solution to a uniform grid. For example, the AMR solution from above could be preprocessed with","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(adapt_to_mesh_level(sol, 4)...)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"When plotted together with the mesh, this will yield the following visualization:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-rho-uniform-mesh)","category":"page"},{"location":"visualization/#Plotting-a-user-defined-scalar-field","page":"Visualization","title":"Plotting a user-defined scalar field","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To plot a scalar quantity, one can call plot(ScalarPlotData2D(u, semi)), where u is an array of nodal values of the scalar field to plot. The layout of u should match the layout of the x and y nodal coordinates of the respective solver. For example, after running trixi_include(joinpath(\"examples\", \"unstructured_2d_dgsem\", \"elixir_euler_wall_bc.jl\")), the following can be used to plot the function f(x, y) = x * y:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"x = view(semi.cache.elements.node_coordinates, 1, :, :, :)\ny = view(semi.cache.elements.node_coordinates, 2, :, :, :)\nplot(ScalarPlotData2D(x .* y, semi))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This produces the following plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: scalar-plotting-example)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This routine can be used to visualize scalar quantities which depend on the solution, such as the norm of a velocity vector or two-dimensional vorticity. For example, we can visualize vorticity for a compressible version of the Brown-Minion vortex problem:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Trixi, Plots\n\njulia> redirect_stdout(devnull) do\n # runs the elixir without any output from callbacks etc.\n trixi_include(@__MODULE__,\n joinpath(examples_dir(), \"dgmulti_2d\", \"elixir_euler_brown_minion_vortex.jl\"))\n end\n[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n\njulia> function compute_vorticity(velocity, mesh, equations::CompressibleEulerEquations2D,\n dg::DGMulti, cache)\n rd = dg.basis\n md = mesh.md\n @unpack Dr, Ds = rd\n @unpack rxJ, sxJ, ryJ, syJ, J = md\n v1, v2 = velocity\n dv1dy = ryJ .* (Dr * v1) + syJ .* (Ds * v1)\n dv2dx = rxJ .* (Dr * v2) + sxJ .* (Ds * v2)\n return dv2dx - dv1dy\n end;\n\njulia> compute_vorticity(velocity, semi) =\n compute_vorticity(velocity, Trixi.mesh_equations_solver_cache(semi)...);\n\njulia> function get_velocity(sol)\n rho, rhou, rhov, E = StructArrays.components(sol.u[end])\n v1 = rhou ./ rho\n v2 = rhov ./ rho\n return v1, v2\n end;\n\njulia> vorticity = compute_vorticity(get_velocity(sol), semi);\n\njulia> plot(ScalarPlotData2D(vorticity, semi;\n variable_name = \"Vorticity at t = $(sol.prob.tspan[end])\"))\nPlot{Plots.GRBackend() n=1}","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This produces the following plot of vorticity.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: vorticity-example)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Since the mesh is fairly coarse, we observe numerical artifacts due to the low resolution. These errors vanish under mesh refinement; for example, doubling the mesh resolution by running","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi_include(joinpath(examples_dir(), \"dgmulti_2d\", \"elixir_euler_BM_vortex.jl\"), cells_per_dimension = 32)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"yields the following plot of vorticity:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: vorticity-example-refined)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nWhen visualizing a scalar field, the plotted solution is reinterpolated using a high order polynomial approximation. Thus, small discrepancies may be observed when the underlying data is highly non-smooth or under-resolved.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"ScalarPlotData2D objects can also be used with Makie through iplot. For example, the following code plots two surfaces:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Trixi, CairoMakie\n\njulia> redirect_stdout(devnull) do\n # runs the elixir without any output from callbacks etc.\n trixi_include(@__MODULE__,\n joinpath(examples_dir(), \"unstructured_2d_dgsem\", \"elixir_euler_wall_bc.jl\"))\n end\n[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n\njulia> x = view(semi.cache.elements.node_coordinates, 1, :, :, :); # extracts the node x coordinates\n\njulia> y = view(semi.cache.elements.node_coordinates, 2, :, :, :); # extracts the node y coordinates\n\njulia> fig_ax_plt = iplot(ScalarPlotData2D((@. 1 - .25*(x^2 + y^2)), semi), plot_mesh=true, colormap=:viridis);\n\njulia> fig_ax_plt2 = iplot!(fig_ax_plt, ScalarPlotData2D((@. .125*(x+y)), semi), plot_mesh=true, colormap=:blues)\nFigureAxisPlot()","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This creates the following plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: ScalarPlotData2D_example)","category":"page"},{"location":"visualization/#Plotting-a-3D-solution-as-a-2D-plot","page":"Visualization","title":"Plotting a 3D solution as a 2D plot","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"It is possible to plot 2D slices from 3D simulation data using the TreeMesh with the same commands as above:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol) # `sol` is from a 3D simulation","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By default, plotting sol or creating a PlotData2D object from a 3D simulation will create a 2D slice of the solution in the xy-plane. You can customize this behavior by explicitly creating a PlotData2D object and passing appropriate keyword arguments:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"slice specifies the plane which is being sliced and can be :xy, :xz, or :yz (default: :xy)\npoint specifies a three-dimensional point. The sliced plane is then created such that it lies on the point (default: (0.0, 0.0, 0.0)).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"All other attributes for PlotData2D objects apply here as well.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"For example, to plot the velocity field orthogonal to the yz-plane at different x-axis locations, you can execute","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi_include(joinpath(examples_dir(), \"tree_3d_dgsem\", \"elixir_euler_taylor_green_vortex.jl\"), tspan=(0.0, 1.0))\n[...]\n\njulia> plots = []\nAny[]\n\njulia> for x in range(0, stop=pi/2, length=6)\n pd = PlotData2D(sol, slice=:yz, point=(x, 0.0, 0.0))\n push!(plots, plot(pd[\"v1\"], clims=(-1,1), title=\"x = \"*string(round(x, digits=2))))\n end\n\njulia> plot(plots..., layout=(2, 3), size=(750,350))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"which results in a 2x3 grid of slices of the yz-plane:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: plot-v1-0.0-to-0.5pi)","category":"page"},{"location":"visualization/#Creating-a-1D-plot","page":"Visualization","title":"Creating a 1D plot","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"When plotting a 1D solution with","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol) # `sol` is from a 1D simulation","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Trixi.jl automatically creates a PlotData1D object and visualizes it as a line plot: (Image: 1d-plot)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To customize your 1D plot, you can create a PlotData1D object manually as follows:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData1D(sol)\njulia> pd = PlotData1D(u, semi)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The behavior is analogous to the PlotData2D behavior.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In a very similar fashion to PlotData2D, you can customize your plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"plot(pd) creates the same plot as in plot(sol).\nplot(pd[\"rho\", \"p\"]) only plots specific variables. In this case rho and p.\nplot!(getmesh(pd)) adds mesh lines after creating a plot.\nAny attributes from Plots can be used, e.g., plot(pd, yguide=:temperature).\npd = PlotData1D(adapt_to_mesh_level(sol, 4)...) adapts the mesh before plotting (in this example to a mesh with refinement level 4).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"You can also customize the PlotData1D object itself by passing attributes to the PlotData1D constructor:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"solution_variables specifies the variables to be plotted.\nnvisnodes sets the amount of nodes per element which the solution then is interpolated on.","category":"page"},{"location":"visualization/#Plotting-a-2D-or-3D-solutions-as-a-1D-plot","page":"Visualization","title":"Plotting a 2D or 3D solutions as a 1D plot","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"It is possible to extract a straight, axis-parallel line from a 2D or 3D solution and visualize it as a 1D plot. This is done by creating a PlotData1D object with a 2D/3D solution sol as input:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData1D(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The plot is then created with:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(pd)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"By default the x-axis is extracted, which can be changed with following attributes:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"slice specifies the axis which is being extracted and can be :x, :y or :z (:z is only for 3D input and default is :x)\npoint specifies a two or three dimensional point. The sliced axis is then created in such a way, that it lies on the point. (default: (0.0, 0.0) or (0.0, 0.0, 0.0))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"All other attributes for PlotData1D objects apply here as well.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In the following, is an example for a 2D simulation of the linear scalar advection equation. First, we have the regular 2D heatmap plot:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: 2d-plot-for-slice)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"From this, we can extract a line plot parallel to the y-axis going through the point (1.0, 0.0) with the following commands:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData1D(sol, slice=:y, point=(1.0, 0.0))\njulia> plot(pd)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: 1d-plot-for-slice)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This convenient method of slicing is limited to axis-parallel slices, but for 2D/3D solutions it is also possible to create a plot along any curve you want. To do so, you first need to create a list of 2D/3D points that define your curve. Then you can create a PlotData1D with the keyword argument curve set to your list.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Let's give an example of this with the basic advection equation from above by creating a plot along the circle marked in green:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: 2d-plot-along-circle)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"We can write a function like this, that outputs a list of points on a circle:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"function circle(radius, center, n_points)\n coordinates = zeros(2, n_points)\n for i in 1:n_points\n coordinates[:,i] = radius*[cospi(2*i/n_points), sinpi(2*i/n_points)] .+ center\n end\n return coordinates\nend","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Then create and plot a PlotData1D object along a circle with radius one, center at (1,1), and 100 points:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"pd = PlotData1D(sol, curve=circle(1.0, (1.0, 1.0), 100))\nplot(pd)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This gives you the following plot: (Image: 1d-plot-along-circle)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Creating a plot like this has its downsides. For one, it is unclear what to put on the abscissa of the plot. By default, the arc length of the given curve is used. Also, with this way of plotting you lose the ability to use a mesh plot from getmesh.","category":"page"},{"location":"visualization/#Visualizing-results-during-a-simulation","page":"Visualization","title":"Visualizing results during a simulation","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To visualize solutions while a simulation is still running (also known as in-situ visualization), you can use the VisualizationCallback. It is created as a regular callback and accepts upon creation a number of keyword arguments that allow, e.g., to control the visualization interval, to specify the variables to plot, or to customize the plotting style.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"During the simulation, the visualization callback creates and displays visualizations of the current solution in regular intervals. This can be useful to, e.g., monitor the validity of a long-running simulation or for illustrative purposes. An example for how to create a VisualizationCallback can be found in examples/tree_2d_dgsem/elixir_advection_amr_visualization.jl:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"[...]\n\n# Enable in-situ visualization with a new plot generated every 20 time steps\n# and additional plotting options passed as keyword arguments\nvisualization = VisualizationCallback(interval=20; clims=(0,1))\n\n[...]","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The resulting output of the referenced elixir can be seen in the embedded video below:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":" \n
    ","category":"page"},{"location":"visualization/#Trixi2Vtk","page":"Visualization","title":"Trixi2Vtk","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Trixi2Vtk converts Trixi.jl's .h5 output files to VTK files, which can be read by ParaView, VisIt, and other visualization tools. It automatically interpolates solution data from the original quadrature node locations to equidistant visualization nodes at a higher resolution, to make up for the loss of accuracy from going from a high-order polynomial representation to a piecewise constant representation in VTK.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In the Julia REPL, first load the package Trixi2Vtk","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using Trixi2Vtk","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To process an HDF5 file generated by Trixi.jl, execute","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(joinpath(\"out\", \"solution_000000.h5\"), output_directory=\"out\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This will create two unstructured VTK files in the out subdirectory that can be opened with ParaView or VisIt: solution_000000.vtu contains the discontinuous Galerkin solution data while solution_000000_celldata.vtu holds any cell-based values such as the current AMR indicator or the cell refinement level.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: \"solution_000000_scalar_mesh\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This allows you to generate VTK files for solution, restart and mesh files. By default, Trixi2Vtk generates .vtu (unstructured VTK) files for both cell/element data (e.g., cell ids, element ids) and node data (e.g., solution variables). This format visualizes each cell with the same number of nodes, independent of its size. Alternatively, you can provide format=:vti as a keyword argument to trixi2vtk, which causes Trixi2Vtk to generate .vti (image data VTK) files for the solution files, while still using .vtu files for cell-/element-based data. In .vti files, a uniform resolution is used throughout the entire domain, resulting in different number of visualization nodes for each element. This can be advantageous to create publication-quality images, but increases the file size.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"If you want to convert multiple solution/restart files at once, you can just supply multiple input files as the positional arguments to trixi2vtk, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(\"out/solution_000000.h5\", \"out/solution_000040.h5\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"You may also use file globbing to select a range of files based on filename patterns, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(\"out/solution_*.h5\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"to convert all solution files in the out/ directory or","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi2vtk(\"out/restart_00[0-9]000.h5\")","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"to convert every one-thousandth restart file (out/restart_000000.h5, out/restart_001000.h5 etc.).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"When multiple solution/restart files are provided, Trixi2Vtk will also generate a .pvd file, which allows ParaView to read all .vtu/.vti files at once and which uses the time attribute in solution/restart files to inform ParaView about the solution time. A comprehensive list of all possible arguments for trixi2vtk can be found in the Trixi2Vtk.jl API.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Further information regarding the development of Trixi2Vtk can be found in the development section.","category":"page"},{"location":"visualization/#Makie.jl","page":"Visualization","title":"Makie.jl [experimental]","text":"","category":"section"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"In addition to Plots.jl support, Trixi.jl includes visualization utilities through Makie.jl. Trixi.jl provides Makie-based visualization options both for heatmap-type plots (similar to the Plots.jl recipes) as well as for interactive surface plots. Support is currently limited to the UnstructuredMesh2D type.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nPlotting via Makie.jl is still considered an experimental feature and might change in any future releases.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"A Makie plot can be created as follows: after running a simulation with Trixi.jl in the REPL, load a Makie backend (for example, GLMakie or CairoMakie).","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> using GLMakie","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"To visualize the solution and mesh with a heatmap-type plot, simply run","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"note: Note\nBoth Makie.jl and Plots.jl export plot, so if you load both libraries, you will have to specify which plot function to call via Plots.plot or Makie.plot.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"As with Plots.jl recipes, one can view individual solution components by creating a PlotData2D object and indexing into it with the desired variable name","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> pd = PlotData2D(sol)\njulia> plot(pd[\"rho\"])","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Unlike the Plots.jl recipe, mesh plotting is controlled using the keyword argument plot_mesh = false, e.g.,","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> plot(sol; plot_mesh=false)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The plot command also returns figure and axis handles, which can be used to edit plot titles or labels:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> fig, axes = plot(sol)\njulia> axes[1,1].title = \"New title for subplot (1,1)\"","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Trixi.jl also supports interactive surface plots using iplot. After executing","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> trixi_include(joinpath(\"examples\", \"unstructured_2d_dgsem\", \"elixir_euler_wall_bc.jl\"))","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"we can run","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"julia> iplot(sol)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"This will open up an interactive visualization window:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: makie-example)","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"The plot can be rotated (click and hold), zoomed in and out (scroll up and down), and panned (hold right click and drag). Two toggle buttons control whether mesh lines are visible on top of and below the solution.","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"Both plot and iplot use colormap = :inferno by default. A different colormap can be selected by providing an appropriate keyword argument. For example, plot(sol, colormap=:blues) and iplot(sol, colormap=:blues) produce the following figures:","category":"page"},{"location":"visualization/","page":"Visualization","title":"Visualization","text":"(Image: makie-plot-example) (Image: makie-iplot-example)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"EditURL = \"../../literate/src/files/adding_new_parabolic_terms.jl\"","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#adding_new_parabolic_terms","page":"13 Adding new parabolic terms","title":"13: Adding new parabolic terms","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"This demo illustrates the steps involved in adding new parabolic terms for the scalar advection equation. In particular, we will add an anisotropic diffusion. We begin by defining the hyperbolic (advection) part of the advection-diffusion equation.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"using OrdinaryDiffEq\nusing Trixi\n\n\nadvection_velocity = (1.0, 1.0)\nequations_hyperbolic = LinearScalarAdvectionEquation2D(advection_velocity);\nnothing #hide","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Define-a-new-parabolic-equation-type","page":"13 Adding new parabolic terms","title":"Define a new parabolic equation type","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Next, we define a 2D parabolic diffusion term type. This is similar to LaplaceDiffusion2D except that the diffusivity field refers to a spatially constant diffusivity matrix now. Note that ConstantAnisotropicDiffusion2D has a field for equations_hyperbolic. It is useful to have information about the hyperbolic system available to the parabolic part so that we can reuse functions defined for hyperbolic equations (such as varnames).","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"The abstract type Trixi.AbstractEquationsParabolic has three parameters: NDIMS (the spatial dimension, e.g., 1D, 2D, or 3D), NVARS (the number of variables), and GradientVariable, which we set as GradientVariablesConservative. This indicates that the gradient should be taken with respect to the conservative variables (e.g., the same variables used in equations_hyperbolic). Users can also take the gradient with respect to a different set of variables; see, for example, the implementation of CompressibleNavierStokesDiffusion2D, which can utilize either \"primitive\" or \"entropy\" variables.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"struct ConstantAnisotropicDiffusion2D{E, T} <: Trixi.AbstractEquationsParabolic{2, 1, GradientVariablesConservative}\n diffusivity::T\n equations_hyperbolic::E\nend\n\nvarnames(variable_mapping, equations_parabolic::ConstantAnisotropicDiffusion2D) =\n varnames(variable_mapping, equations_parabolic.equations_hyperbolic)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Next, we define the viscous flux function. We assume that the mixed hyperbolic-parabolic system is of the form","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"partial_t u(tx) + partial_x (f_1(u) - g_1(u nabla u))\n + partial_y (f_2(u) - g_2(u nabla u)) = 0","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"where f_1(u), f_2(u) are the hyperbolic fluxes and g_1(u nabla u), g_2(u nabla u) denote the viscous fluxes. For anisotropic diffusion, the viscous fluxes are the first and second components of the matrix-vector product involving diffusivity and the gradient vector.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Here, we specialize the flux to our new parabolic equation type ConstantAnisotropicDiffusion2D.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"function Trixi.flux(u, gradients, orientation::Integer, equations_parabolic::ConstantAnisotropicDiffusion2D)\n @unpack diffusivity = equations_parabolic\n dudx, dudy = gradients\n if orientation == 1\n return SVector(diffusivity[1, 1] * dudx + diffusivity[1, 2] * dudy)\n else # if orientation == 2\n return SVector(diffusivity[2, 1] * dudx + diffusivity[2, 2] * dudy)\n end\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Defining-boundary-conditions","page":"13 Adding new parabolic terms","title":"Defining boundary conditions","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Trixi.jl's implementation of parabolic terms discretizes both the gradient and divergence using weak formulation. In other words, we discretize the system","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"beginaligned\nbmq = nabla u \nbmsigma = beginpmatrix g_1(u bmq) g_2(u bmq) endpmatrix \ntextviscous contribution = nabla cdot bmsigma\nendaligned","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Boundary data must be specified for all spatial derivatives, e.g., for both the gradient equation bmq = nabla u and the divergence of the viscous flux nabla cdot bmsigma. We account for this by introducing internal Gradient and Divergence types which are used to dispatch on each type of boundary condition.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"As an example, let us introduce a Dirichlet boundary condition with constant boundary data.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"struct BoundaryConditionConstantDirichlet{T <: Real}\n boundary_value::T\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"This boundary condition contains only the field boundary_value, which we assume to be some real-valued constant which we will impose as the Dirichlet data on the boundary.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Boundary conditions have generally been defined as \"callable structs\" (also known as \"functors\"). For each boundary condition, we need to specify the appropriate boundary data to return for both the Gradient and Divergence. Since the gradient is operating on the solution u, the boundary data should be the value of u, and we can directly impose Dirichlet data.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"@inline function (boundary_condition::BoundaryConditionConstantDirichlet)(flux_inner, u_inner, normal::AbstractVector,\n x, t, operator_type::Trixi.Gradient,\n equations_parabolic::ConstantAnisotropicDiffusion2D)\n return boundary_condition.boundary_value\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"While the gradient acts on the solution u, the divergence acts on the viscous flux bmsigma. Thus, we have to supply boundary data for the Divergence operator that corresponds to bmsigma. However, we've already imposed boundary data on u for a Dirichlet boundary condition, and imposing boundary data for bmsigma might overconstrain our problem.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Thus, for the Divergence boundary data under a Dirichlet boundary condition, we simply return flux_inner, which is boundary data for bmsigma computed using the \"inner\" or interior solution. This way, we supply boundary data for the divergence operation without imposing any additional conditions.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"@inline function (boundary_condition::BoundaryConditionConstantDirichlet)(flux_inner, u_inner, normal::AbstractVector,\n x, t, operator_type::Trixi.Divergence,\n equations_parabolic::ConstantAnisotropicDiffusion2D)\n return flux_inner\nend","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#A-note-on-the-choice-of-gradient-variables","page":"13 Adding new parabolic terms","title":"A note on the choice of gradient variables","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"It is often simpler to transform the solution variables (and solution gradients) to another set of variables prior to computing the viscous fluxes (see CompressibleNavierStokesDiffusion2D for an example of this). If this is done, then the boundary condition for the Gradient operator should be modified accordingly as well.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Putting-things-together","page":"13 Adding new parabolic terms","title":"Putting things together","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"Finally, we can instantiate our new parabolic equation type, define boundary conditions, and run a simulation. The specific anisotropic diffusion matrix we use produces more dissipation in the direction (1 -1) as an isotropic diffusion.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"For boundary conditions, we impose that u=1 on the left wall, u=2 on the bottom wall, and u = 0 on the outflow walls. The initial condition is taken to be u = 0. Note that we use BoundaryConditionConstantDirichlet only for the parabolic boundary conditions, since we have not defined its behavior for the hyperbolic part.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"using Trixi: SMatrix\ndiffusivity = 5.0e-2 * SMatrix{2, 2}([2 -1; -1 2])\nequations_parabolic = ConstantAnisotropicDiffusion2D(diffusivity, equations_hyperbolic);\n\nboundary_conditions_hyperbolic = (; x_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(1.0)),\n y_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(2.0)),\n y_pos = boundary_condition_do_nothing,\n x_pos = boundary_condition_do_nothing)\n\nboundary_conditions_parabolic = (; x_neg = BoundaryConditionConstantDirichlet(1.0),\n y_neg = BoundaryConditionConstantDirichlet(2.0),\n y_pos = BoundaryConditionConstantDirichlet(0.0),\n x_pos = BoundaryConditionConstantDirichlet(0.0));\n\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\ncoordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))\ncoordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n periodicity=false, n_cells_max=30_000) # set maximum capacity of tree data structure\n\ninitial_condition = (x, t, equations) -> SVector(0.0)\n\nsemi = SemidiscretizationHyperbolicParabolic(mesh,\n (equations_hyperbolic, equations_parabolic),\n initial_condition, solver;\n boundary_conditions=(boundary_conditions_hyperbolic,\n boundary_conditions_parabolic))\n\ntspan = (0.0, 2.0)\node = semidiscretize(semi, tspan)\ncallbacks = CallbackSet(SummaryCallback())\ntime_int_tol = 1.0e-6\nsol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,\n ode_default_options()..., callback=callbacks);\n\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/#Package-versions","page":"13 Adding new parabolic terms","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"","category":"page"},{"location":"tutorials/adding_new_parabolic_terms/","page":"13 Adding new parabolic terms","title":"13 Adding new parabolic terms","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"EditURL = \"../../literate/src/files/p4est_from_gmsh.jl\"","category":"page"},{"location":"tutorials/p4est_from_gmsh/#p4est_from_gmsh","page":"17 P4est mesh from gmsh","title":"17: P4est mesh from gmsh","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Trixi.jl supports numerical approximations from structured and unstructured quadrilateral meshes with the P4estMesh mesh type.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The purpose of this tutorial is to demonstrate how to use the P4estMesh functionality of Trixi.jl for existing meshes with straight-sided (bilinear) elements/cells. This begins by running and visualizing an available unstructured quadrilateral mesh example. Then, the tutorial will cover how to use existing meshes generated by gmsh or any other meshing software that can export to the Abaqus input .inp format.","category":"page"},{"location":"tutorials/p4est_from_gmsh/#Running-the-simulation-of-a-near-field-flow-around-an-airfoil","page":"17 P4est mesh from gmsh","title":"Running the simulation of a near-field flow around an airfoil","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Trixi.jl supports solving hyperbolic-parabolic problems on several mesh types. A somewhat complex example that employs the P4estMesh is the near-field simulation of a Mach 2 flow around the NACA6412 airfoil.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"using Trixi\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi_include(joinpath(examples_dir(), \"p4est_2d_dgsem\", \"elixir_euler_NACA6412airfoil_mach2.jl\"), tspan=(0.0, 0.5))\nend #hide","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Conveniently, we use the Plots package to have a first look at the results:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"using Plots\npd = PlotData2D(sol)\nplot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/p4est_from_gmsh/#Creating-a-mesh-using-gmsh","page":"17 P4est mesh from gmsh","title":"Creating a mesh using gmsh","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The creation of an unstructured quadrilateral mesh using gmsh is driven by a geometry file. There are plenty of possibilities for the user, see the documentation and tutorials.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"To begin, we provide a complete geometry file for the NACA6412 airfoil bounded by a rectangular box. After this we give a breakdown of the most important parts required for successful mesh generation that can later be used by the p4est library and Trixi.jl. We emphasize that this near-field mesh should only be used for instructive purposes and not for actual production runs.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The associated NACA6412.geo file is given below:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":" // GMSH geometry script for a NACA 6412 airfoil with 11 degree angle of attack\n // in a box (near-field mesh).\n // see https://github.com/cfsengineering/GMSH-Airfoil-2D\n // for software to generate gmsh `.geo` geometry files for NACA airfoils.\n\n // outer bounding box\n Point(1) = {-1.25, -0.5, 0, 1.0};\n Point(2) = {1.25, -0.5, 0, 1.0};\n Point(3) = {1.25, 0.5, 0, 1.0};\n Point(4) = {-1.25, 0.5, 0, 1.0};\n\n // lines of the bounding box\n Line(1) = {1, 2};\n Line(2) = {2, 3};\n Line(3) = {3, 4};\n Line(4) = {4, 1};\n // outer box\n Line Loop(8) = {1, 2, 3, 4};\n\n // Settings\n // This value gives the global element size factor (lower -> finer mesh)\n Mesh.CharacteristicLengthFactor = 1.0 * 2^(-3);\n // Insist on quads instead of default triangles\n Mesh.RecombineAll = 1;\n // Violet instead of green base color for better visibility\n Mesh.ColorCarousel = 0;\n\n // points of the airfoil contour\n // Format: {x, y, z, DesiredCellSize}. See the documentation: https://gmsh.info/doc/texinfo/gmsh.html#Points\n // These concrete points are generated using the tool from https://github.com/cfsengineering/GMSH-Airfoil-2D\n Point(5) = {-0.4900332889206208, 0.09933466539753061, 0, 0.125};\n Point(6) = {-0.4900274857651495, 0.1021542752054094, 0, 0.125};\n Point(7) = {-0.4894921489729144, 0.1049830248247787, 0, 0.125};\n Point(8) = {-0.4884253336670712, 0.1078191282319664, 0, 0.125};\n Point(9) = {-0.4868257975566199, 0.1106599068424483, 0, 0.125};\n Point(10) = {-0.4846930063965668, 0.1135018003016681, 0, 0.125};\n Point(11) = {-0.4820271400142729, 0.1163403835785654, 0, 0.125};\n Point(12) = {-0.4788290988083472, 0.1191703902233889, 0, 0.125};\n Point(13) = {-0.4751005105908123, 0.1219857416089041, 0, 0.125};\n Point(14) = {-0.4708437376101668, 0.1247795819332056, 0, 0.125};\n Point(15) = {-0.4660618835629463, 0.1275443187232316, 0, 0.125};\n Point(16) = {-0.4607588003749649, 0.1302716685409717, 0, 0.125};\n Point(17) = {-0.4549390945110529, 0.132952707559475, 0, 0.125};\n Point(18) = {-0.448608132554204, 0.1355779266432996, 0, 0.125};\n Point(19) = {-0.4417720457819508, 0.138137290538182, 0, 0.125};\n Point(20) = {-0.4344377334597768, 0.140620300747629, 0, 0.125};\n Point(21) = {-0.4266128645686593, 0.1430160616500159, 0, 0.125};\n Point(22) = {-0.4183058776865576, 0.1453133493887722, 0, 0.125};\n Point(23) = {-0.4095259787518715, 0.147500683050503, 0, 0.125};\n Point(24) = {-0.4002831364505879, 0.1495663976315875, 0, 0.125};\n Point(25) = {-0.3905880749878933, 0.1514987182830453, 0, 0.125};\n Point(26) = {-0.3804522640292948, 0.1532858353164163, 0, 0.125};\n Point(27) = {-0.3698879056254708, 0.1549159794501833, 0, 0.125};\n Point(28) = {-0.3589079179688306, 0.1563774967770029, 0, 0.125};\n Point(29) = {-0.3475259158676376, 0.1576589229368209, 0, 0.125};\n Point(30) = {-0.3357561878650377, 0.158749055989923, 0, 0.125};\n Point(31) = {-0.3236136699747923, 0.1596370274972017, 0, 0.125};\n Point(32) = {-0.3111139160522804, 0.1603123713324616, 0, 0.125};\n Point(33) = {-0.298273064867608, 0.160765089773461, 0, 0.125};\n Point(34) = {-0.2851078039966239, 0.1609857164445887, 0, 0.125};\n Point(35) = {-0.2716353306943914, 0.160965375714529, 0, 0.125};\n Point(36) = {-0.2578733099632437, 0.1606958381868515, 0, 0.125};\n Point(37) = {-0.2438398300730194, 0.1601695719599709, 0, 0.125};\n Point(38) = {-0.2295533558334121, 0.1593797893750759, 0, 0.125};\n Point(39) = {-0.2150326799566391, 0.1583204890160489, 0, 0.125};\n Point(40) = {-0.2002968728818922, 0.1569864927736143, 0, 0.125};\n Point(41) = {-0.18536523146042, 0.1553734778363979, 0, 0.125};\n Point(42) = {-0.1702572269208345, 0.1534780035235666, 0, 0.125};\n Point(43) = {-0.1549924525477129, 0.1512975329264932, 0, 0.125};\n Point(44) = {-0.1395905715122586, 0.1488304493795921, 0, 0.125};\n Point(45) = {-0.1240712652914332, 0.1460760678321895, 0, 0.125};\n Point(46) = {-0.1084541831014299, 0.1430346412430583, 0, 0.125};\n Point(47) = {-0.09275889275279087, 0.1397073621660917, 0, 0.125};\n Point(48) = {-0.07700483330818747, 0.1360963597385416, 0, 0.125};\n Point(49) = {-0.06151286635366404, 0.1323050298149023, 0, 0.125};\n Point(50) = {-0.04602933219022032, 0.1283521764905442, 0, 0.125};\n Point(51) = {-0.03051345534800332, 0.1242331665904082, 0, 0.125};\n Point(52) = {-0.01498163190522334, 0.1199540932779839, 0, 0.125};\n Point(53) = {0.0005498526140696458, 0.1155214539466913, 0, 0.125};\n Point(54) = {0.01606484191716884, 0.1109421303284033, 0, 0.125};\n Point(55) = {0.03154732664394777, 0.106223368423828, 0, 0.125};\n Point(56) = {0.0469814611314705, 0.1013727584299359, 0, 0.125};\n Point(57) = {0.06235157928986135, 0.09639821481480275, 0, 0.125};\n Point(58) = {0.07764220964363855, 0.09130795666388933, 0, 0.125};\n Point(59) = {0.09283808959671735, 0.08611048839446452, 0, 0.125};\n Point(60) = {0.1079241789809607, 0.08081458090718853, 0, 0.125};\n Point(61) = {0.1228856729475325, 0.07542925321638272, 0, 0.125};\n Point(62) = {0.1377080142575372, 0.06996375457378261, 0, 0.125};\n Point(63) = {0.1523769050236616, 0.06442754707512513, 0, 0.125};\n Point(64) = {0.1668783179480157, 0.05883028871526293, 0, 0.125};\n Point(65) = {0.1811985070933818, 0.05318181683604975, 0, 0.125};\n Point(66) = {0.1953240182159306, 0.04749213189240609, 0, 0.125};\n Point(67) = {0.2092416986775084, 0.04177138144606024, 0, 0.125};\n Point(68) = {0.2229387069452062, 0.03602984428372727, 0, 0.125};\n Point(69) = {0.2364025216754475, 0.03027791454712048, 0, 0.125};\n Point(70) = {0.2496209503696738, 0.02452608575629232, 0, 0.125};\n Point(71) = {0.2625821375791982, 0.01878493460541621, 0, 0.125};\n Point(72) = {0.2752745726282818, 0.01306510441121807, 0, 0.125};\n Point(73) = {0.28768709681727, 0.007377288098728577, 0, 0.125};\n Point(74) = {0.2998089100619555, 0.001732210616722449, 0, 0.125};\n Point(75) = {0.3116295769214332, -0.003859389314124759, 0, 0.125};\n Point(76) = {0.3231390319647309, -0.009386778203927332, 0, 0.125};\n Point(77) = {0.3343275844265582, -0.01483924761490708, 0, 0.125};\n Point(78) = {0.3451859221046181, -0.02020613485126957, 0, 0.125};\n Point(79) = {0.3557051144551212, -0.02547684454806881, 0, 0.125};\n Point(80) = {0.3658766148492779, -0.03064087116872238, 0, 0.125};\n Point(81) = {0.3756922619615632, -0.0356878223992288, 0, 0.125};\n Point(82) = {0.3851442802702071, -0.0406074434050937, 0, 0.125};\n Point(83) = {0.394225279661484, -0.04538964189492445, 0, 0.125};\n Point(84) = {0.4029282541416501, -0.05002451391298904, 0, 0.125};\n Point(85) = {0.4112465796735204, -0.05450237026215737, 0, 0.125};\n Point(86) = {0.4191740111683733, -0.05881376343890812, 0, 0.125};\n Point(87) = {0.4267046786777481, -0.06294951494382847, 0, 0.125};\n Point(88) = {0.4338330828434404, -0.06690074281456823, 0, 0.125};\n Point(89) = {0.4405540896772232, -0.07065888921378868, 0, 0.125};\n Point(90) = {0.4468629247542237, -0.07421574789251445, 0, 0.125};\n Point(91) = {0.4527551669150955, -0.0775634913396257, 0, 0.125};\n Point(92) = {0.4582267415819197, -0.08069469742118066, 0, 0.125};\n Point(93) = {0.4632739138007936, -0.08360237530891265, 0, 0.125};\n Point(94) = {0.4678932811302005, -0.08627999049569551, 0, 0.125};\n Point(95) = {0.4720817664982195, -0.08872148869699745, 0, 0.125};\n Point(96) = {0.4758366111533843, -0.09092131844134463, 0, 0.125};\n Point(97) = {0.4791553678333992, -0.09287445215953141, 0, 0.125};\n Point(98) = {0.4820358942729613, -0.09457640559161551, 0, 0.125};\n Point(99) = {0.4844763471666588, -0.09602325534252773, 0, 0.125};\n Point(100) = {0.4864751766953637, -0.09721165443119822, 0, 0.125};\n Point(101) = {0.4880311217148797, -0.09813884569428721, 0, 0.125};\n Point(102) = {0.4891432056939881, -0.09880267292366274, 0, 0.125};\n Point(103) = {0.4898107334756874, -0.09920158963645126, 0, 0.125};\n Point(104) = {0.4900332889206208, -0.09933466539753058, 0, 0.125};\n Point(105) = {0.4897824225031319, -0.09926905587549506, 0, 0.125};\n Point(106) = {0.4890301110661922, -0.09907236506934192, 0, 0.125};\n Point(107) = {0.4877772173496635, -0.09874500608402761, 0, 0.125};\n Point(108) = {0.48602517690576, -0.09828766683852558, 0, 0.125};\n Point(109) = {0.4837759946062035, -0.09770130916007558, 0, 0.125};\n Point(110) = {0.4810322398085871, -0.09698716747297723, 0, 0.125};\n Point(111) = {0.4777970402368822, -0.09614674703990023, 0, 0.125};\n Point(112) = {0.4740740746447117, -0.09518182170326678, 0, 0.125};\n Point(113) = {0.4698675643422793, -0.09409443106501386, 0, 0.125};\n Point(114) = {0.4651822636784212, -0.09288687703518478, 0, 0.125};\n Point(115) = {0.460023449577924, -0.09156171967354482, 0, 0.125};\n Point(116) = {0.4543969102408585, -0.09012177224394632, 0, 0.125};\n Point(117) = {0.4483089331151018, -0.08857009539864649, 0, 0.125};\n Point(118) = {0.4417662922553667, -0.08690999040934186, 0, 0.125};\n Point(119) = {0.4347762351819332, -0.0851449913634191, 0, 0.125};\n Point(120) = {0.4273464693498908, -0.08327885624791403, 0, 0.125};\n Point(121) = {0.419485148335155, -0.08131555684993674, 0, 0.125};\n Point(122) = {0.411200857836944, -0.07925926741086739, 0, 0.125};\n Point(123) = {0.4025026015879757, -0.07711435198240155, 0, 0.125};\n Point(124) = {0.3933997872536054, -0.07488535044544484, 0, 0.125};\n Point(125) = {0.3839022123897198, -0.07257696316779733, 0, 0.125};\n Point(126) = {0.3740200505167618, -0.07019403429336624, 0, 0.125};\n Point(127) = {0.3637638373540689, -0.06774153367408606, 0, 0.125};\n Point(128) = {0.3531444572451353, -0.06522453747557577, 0, 0.125};\n Point(129) = {0.3421731297908021, -0.06264820750853495, 0, 0.125};\n Point(130) = {0.3308613966940724, -0.06001776935966011, 0, 0.125};\n Point(131) = {0.3192211088076166, -0.05733848941811218, 0, 0.125};\n Point(132) = {0.3072644133633567, -0.05461565091590426, 0, 0.125};\n Point(133) = {0.2950037413531683, -0.05185452912263369, 0, 0.125};\n Point(134) = {0.2824517950208982, -0.04906036585632723, 0, 0.125};\n Point(135) = {0.2696215354188702, -0.04623834349241404, 0, 0.125};\n Point(136) = {0.2565261699769623, -0.04339355867155523, 0, 0.125};\n Point(137) = {0.2431791400293651, -0.04053099592384862, 0, 0.125};\n Point(138) = {0.2295941082432855, -0.03765550144139543, 0, 0.125};\n Point(139) = {0.2157849458952252, -0.03477175724299444, 0, 0.125};\n Point(140) = {0.2017657199439165, -0.03188425598348005, 0, 0.125};\n Point(141) = {0.187550679854507, -0.02899727666564914, 0, 0.125};\n Point(142) = {0.1731542441359161, -0.02611486151457043, 0, 0.125};\n Point(143) = {0.1585909865622793, -0.02324079427214604, 0, 0.125};\n Point(144) = {0.1438756220597465, -0.02037858016395433, 0, 0.125};\n Point(145) = {0.129022992251319, -0.0175314277805827, 0, 0.125};\n Point(146) = {0.1140480506645569, -0.01470223310184333, 0, 0.125};\n Point(147) = {0.09896584761949168, -0.01189356587453844, 0, 0.125};\n Point(148) = {0.08379151482656089, -0.009107658532933174, 0, 0.125};\n Point(149) = {0.06854024973648176, -0.006346397826038436, 0, 0.125};\n Point(150) = {0.05322729969528361, -0.003611319287478529, 0, 0.125};\n Point(151) = {0.03786794596792287, -0.00090360465249055, 0, 0.125};\n Point(152) = {0.0224774877026287, 0.00177591770710904, 0, 0.125};\n Point(153) = {0.007071225915134205, 0.004426769294862437, 0, 0.125};\n Point(154) = {-0.00833555242305456, 0.007048814950562587, 0, 0.125};\n Point(155) = {-0.02372759010533726, 0.009642253300220296, 0, 0.125};\n Point(156) = {-0.03908967513210498, 0.01220760427359278, 0, 0.125};\n Point(157) = {-0.05440665578848514, 0.01474569380579989, 0, 0.125};\n Point(158) = {-0.06966345527617318, 0.01725763587663899, 0, 0.125};\n Point(159) = {-0.08484508582421563, 0.01974481207672138, 0, 0.125};\n Point(160) = {-0.09987987792382108, 0.02219618763023203, 0, 0.125};\n Point(161) = {-0.1145078729404739, 0.02450371976411331, 0, 0.125};\n Point(162) = {-0.1290321771824579, 0.0267015185742735, 0, 0.125};\n Point(163) = {-0.143440065923266, 0.02879471001709845, 0, 0.125};\n Point(164) = {-0.1577189448447794, 0.03078883518202784, 0, 0.125};\n Point(165) = {-0.1718563428491159, 0.03268980457290044, 0, 0.125};\n Point(166) = {-0.1858399037768357, 0.03450385196323842, 0, 0.125};\n Point(167) = {-0.1996573773370766, 0.03623748825421298, 0, 0.125};\n Point(168) = {-0.2132966095779342, 0.03789745574015834, 0, 0.125};\n Point(169) = {-0.2267455332406906, 0.0394906831577609, 0, 0.125};\n Point(170) = {-0.2399921583489679, 0.04102424186233269, 0, 0.125};\n Point(171) = {-0.2530245633834605, 0.04250530343879837, 0, 0.125};\n Point(172) = {-0.2658308873846617, 0.04394109901707172, 0, 0.125};\n Point(173) = {-0.2783993233102972, 0.04533888052223981, 0, 0.125};\n Point(174) = {-0.2907181129514687, 0.04670588405019788, 0, 0.125};\n Point(175) = {-0.3027755436824813, 0.0480492955198111, 0, 0.125};\n Point(176) = {-0.3145599472847223, 0.04937621871394801, 0, 0.125};\n Point(177) = {-0.3260597010456697, 0.05069364578437131, 0, 0.125};\n Point(178) = {-0.337263231291058, 0.05200843025992359, 0, 0.125};\n Point(179) = {-0.3481590194623916, 0.05332726256406103, 0, 0.125};\n Point(180) = {-0.3587356108043638, 0.05465664801682354, 0, 0.125};\n Point(181) = {-0.3689816256782782, 0.0560028872679817, 0, 0.125};\n Point(182) = {-0.3788857734692287, 0.05737205908247899, 0, 0.125};\n Point(183) = {-0.3884368690074614, 0.05877000537646382, 0, 0.125};\n Point(184) = {-0.3976238513788748, 0.06020231838219783, 0, 0.125};\n Point(185) = {-0.40643580495675, 0.06167432980291591, 0, 0.125};\n Point(186) = {-0.4148619824472646, 0.06319110180426264, 0, 0.125};\n Point(187) = {-0.4228918297057104, 0.06475741967717524, 0, 0.125};\n Point(188) = {-0.43051501204915, 0.06637778599795482, 0, 0.125};\n Point(189) = {-0.4377214417649294, 0.06805641610468524, 0, 0.125};\n Point(190) = {-0.4445013064933708, 0.06979723470503821, 0, 0.125};\n Point(191) = {-0.4508450981473512, 0.07160387342876083, 0, 0.125};\n Point(192) = {-0.4567436420215075, 0.073479669138689, 0, 0.125};\n Point(193) = {-0.4621881257395756, 0.07542766281688272, 0, 0.125};\n Point(194) = {-0.4671701276898881, 0.07745059884734995, 0, 0.125};\n Point(195) = {-0.471681644606229, 0.07955092452372269, 0, 0.125};\n Point(196) = {-0.4757151179639407, 0.0817307896190848, 0, 0.125};\n Point(197) = {-0.4792634588791559, 0.0839920458658267, 0, 0.125};\n Point(198) = {-0.4823200712220043, 0.08633624620581726, 0, 0.125};\n Point(199) = {-0.4848788726822436, 0.08876464368523246, 0, 0.125};\n Point(200) = {-0.4869343135575803, 0.09127818988394577, 0, 0.125};\n Point(201) = {-0.4884813930704814, 0.09387753278635144, 0, 0.125};\n Point(202) = {-0.4895156730580155, 0.09656301401871749, 0, 0.125};\n\n // splines of the airfoil\n Spline(5) = {5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104};\n Spline(6) = {104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,5};\n\n // airfoil\n Line Loop(9) = {5, 6};\n // complete domain\n Plane Surface(1) = {8, 9};\n\n // labeling of the boundary parts\n Physical Line(1) = {4}; // inflow\n Physical Line(2) = {2}; // outflow\n Physical Line(3) = {1, 3}; // airfoil\n Physical Line(4) = {5, 6}; // upper/lower wall\n Physical Surface(1) = {10};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"From which we can construct a mesh like this: (Image: mesh_screenshot)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The first four points define the bounding box = (near-field) domain:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":" // outer bounding box\nPoint(1) = {-1.25, -0.5, 0, 1.0};\nPoint(2) = {1.25, -0.5, 0, 1.0};\nPoint(3) = {1.25, 0.5, 0, 1.0};\nPoint(4) = {-1.25, 0.5, 0, 1.0};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which is constructed from connecting the points in lines:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// outer box\nLine(1) = {1, 2};\nLine(2) = {2, 3};\nLine(3) = {3, 4};\nLine(4) = {4, 1};\n// outer box\nLine Loop(8) = {1, 2, 3, 4};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"This is followed by a couple (in principle optional) settings where the most important one is","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// Insist on quads instead of default triangles\nMesh.RecombineAll = 1;","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which forces gmsh to generate quadrilateral elements instead of the default triangles. This is strictly required to be able to use the mesh later with p4est, which supports only straight-sided quads, i.e., C2D4, CPS4, S4 in 2D and C3D in 3D. See for more details the (short) documentation on the interaction of p4est with .inp files. In principle, it should also be possible to use the recombine function of gmsh to convert the triangles to quads, but this is observed to be less robust than enforcing quads from the beginning.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Then the airfoil is defined by a set of points:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// points of the airfoil contour\n Point(5) = {-0.4900332889206208, 0.09933466539753061, 0, 0.125};\n Point(6) = {-0.4900274857651495, 0.1021542752054094, 0, 0.125};\n ...","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which are connected by splines for the upper and lower part of the airfoil:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// splines of the airfoil\n Spline(5) = {5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,\n ...\n 96,97,98,99,100,101,102,103,104};\n Spline(6) = {104,105,106,107,108,109,110,111,112,113,114,115,\n ...\n 200,201,202,5};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which are then connected to form a single line loop for easy physical group assignment:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// airfoil\n Line Loop(9) = {5, 6};","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"At the end of the file the physical groups are defined:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"// labeling of the boundary parts\n Physical Line(1) = {4}; // Inflow. Label in Abaqus .inp file: PhysicalLine1\n Physical Line(2) = {2}; // Outflow. Label in Abaqus .inp file: PhysicalLine2\n Physical Line(3) = {1, 3}; // Upper and lower wall/farfield/... Label in Abaqus .inp file: PhysicalLine3\n Physical Line(4) = {5, 6}; // Airfoil. Label in Abaqus .inp file: PhysicalLine4","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"which are crucial for the correct assignment of boundary conditions in Trixi.jl. In particular, it is the responsibility of a user to keep track on the physical boundary names between the mesh generation and assignment of boundary condition functions in an elixir.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"After opening this file in gmsh, meshing the geometry and exporting to Abaqus .inp format, we can have a look at the input file:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"*Heading\n \n*NODE\n1, -1.25, -0.5, 0\n2, 1.25, -0.5, 0\n3, 1.25, 0.5, 0\n4, -1.25, 0.5, 0\n...\n******* E L E M E N T S *************\n*ELEMENT, type=T3D2, ELSET=Line1\n1, 1, 7\n...\n*ELEMENT, type=CPS4, ELSET=Surface1\n191, 272, 46, 263, 807\n...\n*NSET,NSET=PhysicalLine1\n1, 4, 52, 53, 54, 55, 56, 57, 58,\n*NSET,NSET=PhysicalLine2\n2, 3, 26, 27, 28, 29, 30, 31, 32,\n*NSET,NSET=PhysicalLine3\n1, 2, 3, 4, 7, 8, 9, 10, 11, 12,\n13, 14, 15, 16, 17, 18, 19, 20, 21, 22,\n23, 24, 25, 33, 34, 35, 36, 37, 38, 39,\n40, 41, 42, 43, 44, 45, 46, 47, 48, 49,\n50, 51,\n*NSET,NSET=PhysicalLine4\n5, 6, 59, 60, 61, 62, 63, 64, 65, 66,\n67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\n77, 78, 79, 80, 81, 82, 83, 84, 85, 86,\n87, 88, 89, 90, 91, 92, 93, 94, 95, 96,\n97, 98, 99, 100, 101, 102, 103, 104, 105, 106,\n107, 108, 109, 110, 111, 112, 113, 114, 115, 116,\n117, 118, 119, 120, 121, 122, 123, 124, 125, 126,\n127, 128, 129, 130, 131, 132, 133, 134, 135, 136,\n137, 138, 139, 140, 141, 142, 143, 144, 145, 146,\n147, 148, 149, 150, 151, 152, 153, 154, 155, 156,\n157, 158, 159, 160, 161, 162, 163, 164, 165, 166,\n167, 168, 169, 170, 171, 172, 173, 174, 175, 176,\n177, 178, 179, 180, 181, 182, 183, 184, 185, 186,\n187, 188, 189, 190,","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"First, the coordinates of the nodes are listed, followed by the elements. Note that gmsh exports also line elements of type T3D2 which are ignored by p4est. The relevant elements in 2D which form the gridcells are of type CPS4 which are defined by their four corner nodes. This is followed by the nodesets encoded via *NSET which are used to assign boundary conditions in Trixi.jl. Trixi.jl parses the .inp file and assigns the edges (in 2D, surfaces in 3D) of elements to the corresponding boundary condition based on the supplied boundary_symbols that have to be supplied to the P4estMesh constructor:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"# boundary symbols\nboundary_symbols = [:PhysicalLine1, :PhysicalLine2, :PhysicalLine3, :PhysicalLine4]\nmesh = P4estMesh{2}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"The same boundary symbols have then also be supplied to the semidiscretization alongside the corresponding physical boundary conditions:","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"# Supersonic inflow boundary condition.\n# Calculate the boundary flux entirely from the external solution state, i.e., set\n# external solution state values for everything entering the domain.\n@inline function boundary_condition_supersonic_inflow(u_inner,\n normal_direction::AbstractVector,\n x, t, surface_flux_function,\n equations::CompressibleEulerEquations2D)\n u_boundary = initial_condition_mach2_flow(x, t, equations)\n flux = Trixi.flux(u_boundary, normal_direction, equations)\n\n return flux\nend\n\n# Supersonic outflow boundary condition.\n# Calculate the boundary flux entirely from the internal solution state. Analogous to supersonic inflow\n# except all the solution state values are set from the internal solution as everything leaves the domain\n@inline function boundary_condition_supersonic_outflow(u_inner,\n normal_direction::AbstractVector, x,\n t,\n surface_flux_function,\n equations::CompressibleEulerEquations2D)\nflux = Trixi.flux(u_inner, normal_direction, equations)\n\nboundary_conditions = Dict(:PhysicalLine1 => boundary_condition_supersonic_inflow, # Left boundary\n :PhysicalLine2 => boundary_condition_supersonic_outflow, # Right boundary\n :PhysicalLine3 => boundary_condition_supersonic_outflow, # Top and bottom boundary\n :PhysicalLine4 => boundary_condition_slip_wall) # Airfoil\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions = boundary_conditions)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"Note that you have to supply the boundary_symbols keyword to the P4estMesh constructor to select the boundaries from the available nodesets in the .inp file. If the boundary_symbols keyword is not supplied, all boundaries will be assigned to the default set :all.","category":"page"},{"location":"tutorials/p4est_from_gmsh/#Package-versions","page":"17 P4est mesh from gmsh","title":"Package versions","text":"","category":"section"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\", \"Download\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"","category":"page"},{"location":"tutorials/p4est_from_gmsh/","page":"17 P4est mesh from gmsh","title":"17 P4est mesh from gmsh","text":"This page was generated using Literate.jl.","category":"page"},{"location":"code_of_conduct/","page":"Code of Conduct","title":"Code of Conduct","text":"EditURL = \"https://github.com/trixi-framework/Trixi.jl/blob/main/CODE_OF_CONDUCT.md\"","category":"page"},{"location":"code_of_conduct/#code-of-conduct","page":"Code of Conduct","title":"Code of Conduct","text":"","category":"section"},{"location":"code_of_conduct/","page":"Code of Conduct","title":"Code of Conduct","text":"Contributor Covenant Code of ConductOur PledgeWe as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.Our StandardsExamples of behavior that contributes to a positive environment for our community include:Demonstrating empathy and kindness toward other people\nBeing respectful of differing opinions, viewpoints, and experiences\nGiving and gracefully accepting constructive feedback\nAccepting responsibility and apologizing to those affected by our mistakes, and learning from the experience\nFocusing on what is best not just for us as individuals, but for the overall communityExamples of unacceptable behavior include:The use of sexualized language or imagery, and sexual attention or advances of any kind\nTrolling, insulting or derogatory comments, and personal or political attacks\nPublic or private harassment\nPublishing others' private information, such as a physical or email address, without their explicit permission\nOther conduct which could reasonably be considered inappropriate in a professional settingEnforcement ResponsibilitiesCommunity leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.ScopeThis Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.EnforcementInstances of abusive, harassing, or otherwise unacceptable behavior may be reported to Michael Schlottke-Lakemper, Hendrik Ranocha, or any other of the principal developers responsible for enforcement listed in Authors. All complaints will be reviewed and investigated promptly and fairly.All community leaders are obligated to respect the privacy and security of the reporter of any incident.Enforcement GuidelinesCommunity leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:1. CorrectionCommunity Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.2. WarningCommunity Impact: A violation through a single incident or series of actions.Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.3. Temporary BanCommunity Impact: A serious violation of community standards, including sustained inappropriate behavior.Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.4. Permanent BanCommunity Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.Consequence: A permanent ban from any sort of public interaction within the community.AttributionThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/codeofconduct.html.Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.[homepage]: https://www.contributor-covenant.orgFor answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.","category":"page"},{"location":"conventions/#conventions","page":"Conventions","title":"Conventions","text":"","category":"section"},{"location":"conventions/#Spatial-dimensions-and-directions","page":"Conventions","title":"Spatial dimensions and directions","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"We use the following numbering schemes on Cartesian or curved structured meshes.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"The orientations are numbered as 1 => x, 2 => y, 3 => z. For example, numerical fluxes such as flux_central(u_ll, u_rr, orientation, equations::AbstractEquations) use the orientation in this way.\nThe directions are numbered as 1 => -x, 2 => +x, 3 => -y, 4 => +y, 5 => -z, 6 => +z. For example, the boundary_conditions are ordered in this way when a Tuple of boundary conditions per direction is passed to the constructor of a SemidiscretizationHyperbolic.\nFor structured and unstructured curved meshes the concept of direction is generalized via the variable normal_direction. This variable points in the normal direction at a given, curved surface. For the computation of boundary fluxes the normal_direction is normalized to be a normal_vector used, for example, in FluxRotated.","category":"page"},{"location":"conventions/#Cells-vs.-elements-vs.-nodes","page":"Conventions","title":"Cells vs. elements vs. nodes","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"To uniquely distinguish between different components of the discretization, we use the following naming conventions:","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"The computational domain is discretized by a mesh, which is made up of individual cells. In general, neither the mesh nor the cells should be aware of any solver-specific knowledge, i.e., they should not store anything that goes beyond the geometrical information and the connectivity.\nThe numerical solvers do not directly store their information inside the mesh, but use own data structures. Specifically, for each cell on which a solver wants to operate, the solver creates an element to store solver-specific data.\nFor discretization schemes such as the discontinuous Galerkin or the finite element method, inside each element multiple nodes may be defined, which hold nodal information. The nodes are again a solver-specific component, just like the elements.\nWe often identify elements, nodes, etc. with their (local or global) integer index. Convenience iterators such as eachelement, eachnode use these indices.","category":"page"},{"location":"conventions/#Keywords-in-elixirs","page":"Conventions","title":"Keywords in elixirs","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Trixi.jl is distributed with several examples in the form of elixirs, small Julia scripts containing everything to set up and run a simulation. Working interactively from the Julia REPL with these scripts can be quite convenient while for exploratory research and development of Trixi.jl. For example, you can use the convenience function trixi_include to include an elixir with some modified arguments. To enable this, it is helpful to use a consistent naming scheme in elixirs, since trixi_include can only perform simple replacements. Some standard variables names are","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"polydeg for the polynomial degree of a solver\nsurface_flux for the numerical flux at surfaces\nvolume_flux for the numerical flux used in flux differencing volume terms","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Moreover, convergence_test requires that the spatial resolution is set via the keywords","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"initial_refinement_level (an integer, e.g. for the TreeMesh and the P4estMesh) or\ncells_per_dimension (a tuple of integers, one per spatial dimension, e.g. for the StructuredMesh and the DGMultiMesh).","category":"page"},{"location":"conventions/#Variable-names","page":"Conventions","title":"Variable names","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Use descriptive names (using snake_case for variables/functions and CamelCase for types)\nUse a suffix _ as in name_ for local variables that would otherwise hide existing symbols.\nUse a prefix _ as in _name to indicate internal methods/data that are \"fragile\" in the sense that there's no guarantee that they might get changed without notice. These are also not documented with a docstring (but maybe with comments using #).","category":"page"},{"location":"conventions/#Array-types-and-wrapping","page":"Conventions","title":"Array types and wrapping","text":"","category":"section"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"To allow adaptive mesh refinement efficiently when using time integrators from OrdinaryDiffEq, Trixi.jl allows to represent numerical solutions in two different ways. Some discussion can be found online and in form of comments describing Trixi.wrap_array and Trixi.wrap_array_native in the source code of Trixi.jl. The flexibility introduced by this possible wrapping enables additional performance optimizations. 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.jl). Thus, we use the following conventions to distinguish between arrays visible to the time integrator and wrapped arrays mainly used internally.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Arrays visible to the time integrator have a suffix _ode, e.g., du_ode, u_ode.\nWrapped arrays do not have a suffix, e.g., du, u.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"Methods either accept arrays visible to the time integrator or wrapped arrays based on the following rules.","category":"page"},{"location":"conventions/","page":"Conventions","title":"Conventions","text":"When some solution is passed together with a semidiscretization semi, the solution must be a u_ode that needs to be wrapped via wrap_array(u_ode, semi) (or wrap_array_native(u_ode, semi)) for further processing.\nWhen some solution is passed together with the mesh, equations, solver, cache, ..., it is already wrapped via wrap_array (or wrap_array_native).\nExceptions of this rule are possible, e.g. for AMR, but must be documented in the code.\nwrap_array should be used as default option. wrap_array_native should only be used when necessary, e.g., to avoid additional overhead when interfacing with external C libraries such as HDF5, MPI, or visualization.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"EditURL = \"../../literate/src/files/non_periodic_boundaries.jl\"","category":"page"},{"location":"tutorials/non_periodic_boundaries/#non_periodic_boundaries","page":"6 Non-periodic boundaries","title":"6: Non-periodic boundaries","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/non_periodic_boundaries/#Dirichlet-boundary-condition","page":"6 Non-periodic boundaries","title":"Dirichlet boundary condition","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"First, let's look at the Dirichlet boundary condition BoundaryConditionDirichlet.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"BoundaryConditionDirichlet(boundary_value_function)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"In Trixi.jl, this creates a Dirichlet boundary condition where the function boundary_value_function is used to set the values at the boundary. It can be used to create a boundary condition that sets exact boundary values by passing the exact solution of the equation.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"It is important to note that standard Dirichlet boundary conditions for hyperbolic PDEs do not make sense in most cases. However, we are using a special weak form of the Dirichlet boundary condition, based on the application of the numerical surface flux. The numerical surface flux takes the solution value from inside the domain and the prescribed value of the outer boundary state as arguments, and solves an approximate Riemann problem to introduce dissipation (and hence stabilization) at the boundary. Hence, the performance of the Dirichlet BC depends on the fidelity of the numerical surface flux. An easy-to read introductory reference on this topic is the paper by Mengaldo et al..","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"The passed boundary value function is called with the same arguments as an initial condition function, i.e.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"boundary_value_function(x, t, equations)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"where x specifies the spatial coordinates, t is the current time, and equations is the corresponding system of equations.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"We want to give a short example for a simulation with such a Dirichlet BC.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Consider the one-dimensional linear advection equation with domain Omega=0 2 and a constant zero initial condition.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"using OrdinaryDiffEq, Trixi\n\nadvection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)\n\ninitial_condition_zero(x, t, equation::LinearScalarAdvectionEquation1D) = SVector(0.0)\ninitial_condition = initial_condition_zero\n\nusing Plots\nplot(x -> sum(initial_condition(x, 0.0, equations)), label=\"initial condition\", ylim=(-1.5, 1.5))","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Using an advection velocity of 1.0 and the (local) Lax-Friedrichs/Rusanov flux FluxLaxFriedrichs as a numerical surface flux, we are able to create an inflow boundary on the left and an outflow boundary on the right, as the Lax-Friedrichs flux is in this case an exact characteristics Riemann solver. We note that for more complex PDEs different strategies for inflow/outflow boundaries are necessary. To define the inflow values, we initialize a boundary_value_function.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"function boundary_condition_sine_sector(x, t, equation::LinearScalarAdvectionEquation1D)\n if 1 <= t <= 3\n scalar = sin(2 * pi * sum(t - 1))\n else\n scalar = zero(t)\n end\n return SVector(scalar)\nend\nboundary_condition = boundary_condition_sine_sector","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"We set the BC in negative and positive x-direction.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"boundary_conditions = (x_neg=BoundaryConditionDirichlet(boundary_condition),\n x_pos=BoundaryConditionDirichlet(boundary_condition))","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\ncoordinates_min = (0.0,)\ncoordinates_max = (2.0,)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"For the mesh type TreeMesh the parameter periodicity must be set to false in the corresponding direction.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"mesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n n_cells_max=10_000,\n periodicity=false)\n\n\nsemi = SemidiscretizationHyperbolic(mesh, equations,\n initial_condition,\n solver,\n boundary_conditions=boundary_conditions)\n\ntspan = (0.0, 6.0)\node = semidiscretize(semi, tspan)\n\nanalysis_callback = AnalysisCallback(semi, interval=100,)\n\nstepsize_callback = StepsizeCallback(cfl=0.9)\n\ncallbacks = CallbackSet(analysis_callback,\n stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"We define some equidistant nodes for the visualization","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"visnodes = range(tspan[1], tspan[2], length=300)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"and run the simulation.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, saveat=visnodes, callback=callbacks);\n\nusing Plots\n@gif for step in 1:length(sol.u)\n plot(sol.u[step], semi, ylim=(-1.5, 1.5), legend=true, label=\"approximation\", title=\"time t=$(round(sol.t[step], digits=5))\")\n scatter!([0.0], [sum(boundary_condition(SVector(0.0), sol.t[step], equations))], label=\"boundary condition\")\nend","category":"page"},{"location":"tutorials/non_periodic_boundaries/#Other-available-example-elixirs-with-non-trivial-BC","page":"6 Non-periodic boundaries","title":"Other available example elixirs with non-trivial BC","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Moreover, there are other boundary conditions in Trixi.jl. For instance, you can use the slip wall boundary condition boundary_condition_slip_wall.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Trixi.jl provides some interesting examples with different combinations of boundary conditions, e.g. using boundary_condition_slip_wall and other self-defined boundary conditions using BoundaryConditionDirichlet.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"For instance, there is a 2D compressible Euler setup for a Mach 3 wind tunnel flow with a forward facing step in the elixir elixir_euler_forward_step_amr.jl discretized with a P4estMesh using adaptive mesh refinement (AMR).","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":" \n
    ","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Source: Video on Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"A double Mach reflection problem for the 2D compressible Euler equations elixir_euler_double_mach_amr.jl exercises a special boundary conditions along the bottom of the domain that is a mixture of Dirichlet and slip wall.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":" \n
    ","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Source: Video on Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"A channel flow around a cylinder at Mach 3 elixir_euler_supersonic_cylinder.jl contains supersonic Mach 3 inflow at the left portion of the domain and supersonic outflow at the right portion of the domain. The top and bottom of the channel as well as the cylinder are treated as Euler slip wall boundaries.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":" \n
    ","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"Source: Video on Trixi.jl's YouTube channel Trixi Framework","category":"page"},{"location":"tutorials/non_periodic_boundaries/#Package-versions","page":"6 Non-periodic boundaries","title":"Package versions","text":"","category":"section"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"","category":"page"},{"location":"tutorials/non_periodic_boundaries/","page":"6 Non-periodic boundaries","title":"6 Non-periodic boundaries","text":"This page was generated using Literate.jl.","category":"page"},{"location":"parallelization/#Parallelization","page":"Parallelization","title":"Parallelization","text":"","category":"section"},{"location":"parallelization/#Shared-memory-parallelization-with-threads","page":"Parallelization","title":"Shared-memory parallelization with threads","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Many compute-intensive loops in Trixi.jl are parallelized using the multi-threading support provided by Julia. You can recognize those loops by the @threaded macro prefixed to them, e.g.,","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"@threaded for element in eachelement(dg, cache)\n ...\nend","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"This will statically assign an equal iteration count to each available thread.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"To use multi-threading, you need to tell Julia at startup how many threads you want to use by either setting the environment variable JULIA_NUM_THREADS or by providing the -t/--threads command line argument. For example, to start Julia with four threads, start Julia with","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia --threads=4","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If both the environment variable and the command line argument are specified at the same time, the latter takes precedence.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If you use time integration methods from OrdinaryDiffEq.jl and want to use multiple threads therein, you need to set the keyword argument thread=OrdinaryDiffEq.True() of the algorithms, as described in the section on time integration methods.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"warning: Warning\nNot everything is parallelized yet and there are likely opportunities to improve scalability. Multi-threading isn't considered part of the public API of Trixi.jl yet.","category":"page"},{"location":"parallelization/#Distributed-computing-with-MPI","page":"Parallelization","title":"Distributed computing with MPI","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"In addition to the shared memory parallelization with multi-threading, Trixi.jl supports distributed parallelism via MPI.jl, which leverages the Message Passing Interface (MPI). MPI.jl comes with its own MPI library binaries such that there is no need to install MPI yourself. However, it is also possible to instead use an existing MPI installation, which is recommended if you are running MPI programs on a cluster or supercomputer (see the MPI.jl docs to find out how to select the employed MPI library). Additional notes on how to use a system-provided MPI installation with Trixi.jl can be found in the following subsection.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"warning: Work in progress\nMPI-based parallelization is work in progress and not finished yet. Nothing related to MPI is part of the official API of Trixi.jl yet.","category":"page"},{"location":"parallelization/#parallel_system_MPI","page":"Parallelization","title":"Using a system-provided MPI installation","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"When using Trixi.jl with a system-provided MPI backend, the underlying p4est, t8code and HDF5 libraries need to be compiled with the same MPI installation. If you want to use p4est (via the P4estMesh) or t8code (via the T8codeMesh) from Trixi.jl, you also need to use system-provided p4est or t8code installations (for notes on how to install p4est and t8code see, e.g., here and here, use the configure option --enable-mpi). Otherwise, there will be warnings that no preference is set for P4est.jl and T8code.jl that can be ignored if you do not use these libraries from Trixi.jl. Note that t8code already comes with a p4est installation, so it suffices to install t8code. In order to use system-provided p4est and t8code installations, P4est.jl and T8code.jl need to be configured to use the custom installations. Follow the steps described here and here for the configuration. The paths that point to libp4est.so (and potentially to libsc.so) need to be the same for P4est.jl and T8code.jl. This could, e.g., be libp4est.so that usually can be found in lib/ or local/lib/ in the installation directory of t8code. The preferences for HDF5.jl always need to be set, even if you do not want to use HDF5 from Trixi.jl, see also issue #1079 in HDF5.jl. To set the preferences for HDF5.jl, follow the instructions described here.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"In total, in your active Julia project you should have a LocalPreferences.toml file with sections [MPIPreferences], [T8code] (only needed if T8codeMesh is used), [P4est] (only needed if P4estMesh is used), and [HDF5] as well as an entry MPIPreferences in your Project.toml to use a custom MPI installation. A LocalPreferences.toml file created as described above might look something like the following:","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"[HDF5]\nlibhdf5 = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so\"\nlibhdf5_hl = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so\"\n\n[HDF5_jll]\nlibhdf5_hl_path = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so\"\nlibhdf5_path = \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so\"\n\n[MPIPreferences]\n__clear__ = [\"preloads_env_switch\"]\n_format = \"1.0\"\nabi = \"OpenMPI\"\nbinary = \"system\"\ncclibs = []\nlibmpi = \"/lib/x86_64-linux-gnu/libmpi.so\"\nmpiexec = \"mpiexec\"\npreloads = []\n\n[P4est]\nlibp4est = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libp4est.so\"\nlibsc = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libsc.so\"\n\n[T8code]\nlibp4est = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libp4est.so\"\nlibsc = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libsc.so\"\nlibt8 = \"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libt8.so\"","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"This file is created with the following sequence of commands:","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using MPIPreferences\njulia> MPIPreferences.use_system_binary()","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Restart the Julia REPL","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using P4est\njulia> P4est.set_library_p4est!(\"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libp4est.so\")\njulia> P4est.set_library_sc!(\"/home/mschlott/hackathon/libtrixi/t8code/install/lib/libsc.so\")\njulia> using T8code\njulia> T8code.set_libraries_path!(\"/home/mschlott/hackathon/libtrixi/t8code/install/lib/\")\njulia> using HDF5\njulia> HDF5.API.set_libraries!(\"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so\", \"/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so\")","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"After the preferences are set, restart the Julia REPL again.","category":"page"},{"location":"parallelization/#parallel_usage","page":"Parallelization","title":"Usage","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"To start Trixi.jl in parallel with MPI, there are three options:","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Run from the REPL with mpiexec(): You can start a parallel execution directly from the REPL by executing\njulia> using MPI\n\njulia> mpiexec() do cmd\n run(`$cmd -n 3 $(Base.julia_cmd()) --threads=1 --project=@. -e 'using Trixi; trixi_include(default_example())'`)\n end\nThe parameter -n 3 specifies that Trixi.jl should run with three processes (or ranks in MPI parlance) and should be adapted to your available computing resources and problem size. The $(Base.julia_cmd()) argument ensures that Julia is executed in parallel with the same optimization level etc. as you used for the REPL; if this is unnecessary or undesired, you can also just use julia. Further, if you are not running Trixi.jl from a local clone but have installed it as a package, you need to omit the --project=@..\nRun from the command line with mpiexecjl: Alternatively, you can use the mpiexecjl script provided by MPI.jl, which allows you to start Trixi.jl in parallel directly from the command line. As a preparation, you need to install the script once by running\njulia> using MPI\n\njulia> MPI.install_mpiexecjl(destdir=\"/somewhere/in/your/PATH\")\nThen, to execute Trixi.jl in parallel, execute the following command from your command line:\nmpiexecjl -n 3 julia --threads=1 --project=@. -e 'using Trixi; trixi_include(default_example())'\nRun interactively with tmpi (Linux/MacOS only): If you are on a Linux/macOS system, you have a third option which lets you run Julia in parallel interactively from the REPL. This comes in handy especially during development, as in contrast to the first two options, it allows to reuse the compilation cache and thus facilitates much faster startup times after the first execution. It requires tmux and the OpenMPI library to be installed before, both of which are usually available through a package manager. Once you have installed both tools, you need to configure MPI.jl to use the OpenMPI for your system, which is explained here. Then, you can download and install the tmpi script by executing\ncurl https://raw.githubusercontent.com/Azrael3000/tmpi/master/tmpi -o /somewhere/in/your/PATH/tmpi\nFinally, you can start and control multiple Julia REPLs simultaneously by running\ntmpi 3 julia --threads=1 --project=@.\nThis will start Julia inside tmux three times and multiplexes all commands you enter in one REPL to all other REPLs (try for yourself to understand what it means). If you have no prior experience with tmux, handling the REPL this way feels slightly weird in the beginning. However, there is a lot of documentation for tmux available and once you get the hang of it, developing Trixi.jl in parallel becomes much smoother this way. Some helpful commands are the following. To close a single pane you can press Ctrl+b and then x followed by y to confirm. To quit the whole session you press Ctrl+b followed by :kill-session. Often you would like to scroll up. You can do that by pressing Ctrl+b and then [, which allows you to use the arrow keys to scroll up and down. To leave the scroll mode you press q. Switching between panes can be done by Ctrl+b followed by o. As of March 2022, newer versions of tmpi also support mpich, which is the default backend of MPI.jl (via MPICH_Jll.jl). To use this setup, you need to install mpiexecjl as described in the documentation of MPI.jl and make it available as mpirun, e.g., via a symlink of the form\nln -s ~/.julia/bin/mpiexecjl /somewhere/in/your/path/mpirun\n(assuming default installations).","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"note: Hybrid parallelism\nIt is possible to combine MPI with shared memory parallelism via threads by starting Julia with more than one thread, e.g. by passing the command line argument julia --threads=2 instead of julia --threads=1 used in the examples above. In that case, you should make sure that your system supports the number of processes/threads that you try to start.","category":"page"},{"location":"parallelization/#parallel_performance","page":"Parallelization","title":"Performance","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"For information on how to evaluate the parallel performance of Trixi.jl, please have a look at the Performance metrics of the AnalysisCallback section, specifically at the descriptions of the performance index (PID).","category":"page"},{"location":"parallelization/#Using-error-based-step-size-control-with-MPI","page":"Parallelization","title":"Using error-based step size control with MPI","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If you use error-based step size control (see also the section on error-based adaptive step sizes) together with MPI you need to pass internalnorm=ode_norm and you should pass unstable_check=ode_unstable_check to OrdinaryDiffEq's solve, which are both included in ode_default_options.","category":"page"},{"location":"parallelization/#Using-parallel-input-and-output","page":"Parallelization","title":"Using parallel input and output","text":"","category":"section"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Trixi.jl allows parallel I/O using MPI by leveraging parallel HDF5.jl. On most systems, this is enabled by default. Additionally, you can also use a local installation of the HDF5 library (with MPI support). For this, you first need to use a system-provided MPI library, see also here and you need to tell HDF5.jl to use this library. To do so with HDF5.jl v0.17 and newer, set the preferences libhdf5 and libhdf5_hl to the local paths of the libraries libhdf5 and libhdf5_hl, which can be done by","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using Preferences, UUIDs\njulia> set_preferences!(\n UUID(\"f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f\"), # UUID of HDF5.jl\n \"libhdf5\" => \"/path/to/your/libhdf5.so\",\n \"libhdf5_hl\" => \"/path/to/your/libhdf5_hl.so\", force = true)","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"Alternatively, with HDF5.jl v0.17.1 or higher you can use","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"julia> using HDF5\njulia> HDF5.API.set_libraries!(\"/path/to/your/libhdf5.so\", \"/path/to/your/libhdf5_hl.so\")","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"For more information see also the documentation of HDF5.jl. In total, you should have a file called LocalPreferences.toml in the project directory that contains a section [MPIPreferences], a section [HDF5] with entries libhdf5 and libhdf5_hl, a section [P4est] with the entry libp4est as well as a section [T8code] with the entries libt8, libp4est and libsc. If you use HDF5.jl v0.16 or older, instead of setting the preferences for HDF5.jl, you need to set the environment variable JULIA_HDF5_PATH to the path, where the HDF5 binaries are located and then call ]build HDF5 from Julia.","category":"page"},{"location":"parallelization/","page":"Parallelization","title":"Parallelization","text":"If HDF5 is not MPI-enabled, Trixi.jl will fall back on a less efficient I/O mechanism. In that case, all disk I/O is performed only on rank zero and data is distributed to/gathered from the other ranks using regular MPI communication.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"EditURL = \"../../literate/src/files/behind_the_scenes_simulation_setup.jl\"","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#behind_the_scenes_simulation_setup","page":"2 Behind the scenes of a simulation setup","title":"2: Behind the scenes of a simulation setup","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"This tutorial will guide you through a simple Trixi.jl setup (\"elixir\"), giving an overview of what happens in the background during the initialization of a simulation. While the setup described herein does not cover all details, it involves relatively stable parts of Trixi.jl that are unlikely to undergo significant changes in the near future. The goal is to clarify some of the more fundamental, technical concepts that are applicable to a variety of (also more complex) configurations.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Trixi.jl follows the method of lines concept for solving partial differential equations (PDEs). Firstly, the PDEs are reduced to a (potentially huge) system of ordinary differential equations (ODEs) by discretizing the spatial derivatives. Subsequently, these generated ODEs may be solved with methods available in OrdinaryDiffEq.jl or those specifically implemented in Trixi.jl. The following steps elucidate the process of transitioning from PDEs to ODEs within the framework of Trixi.jl.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Basic-setup","page":"2 Behind the scenes of a simulation setup","title":"Basic setup","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Import essential libraries and specify an equation.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"using Trixi, OrdinaryDiffEq\nequations = LinearScalarAdvectionEquation2D((-0.2, 0.7))","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Generate a spatial discretization using a TreeMesh with a pre-coarsened set of cells.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"coordinates_min = (-2.0, -2.0)\ncoordinates_max = (2.0, 2.0)\n\ncoarsening_patches = ((type = \"box\", coordinates_min = [0.0, -2.0],\n coordinates_max = [2.0, 0.0]),)\n\nmesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2,\n n_cells_max = 30_000,\n coarsening_patches = coarsening_patches)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The created TreeMesh looks like the following:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: TreeMesh_example)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Instantiate a DGSEM solver with a user-specified polynomial degree. The solver will define polydeg + 1 Gauss-Lobatto nodes and their associated weights within the reference interval -1 1 in each spatial direction. These nodes will be subsequently used to approximate solutions on each leaf cell of the TreeMesh.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"solver = DGSEM(polydeg = 3)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Gauss-Lobatto nodes with polydeg = 3:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: Gauss-Lobatto_nodes_example)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Overview-of-the-[SemidiscretizationHyperbolic](@ref)-type","page":"2 Behind the scenes of a simulation setup","title":"Overview of the SemidiscretizationHyperbolic type","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"At this stage, all necessary components for configuring the spatial discretization are in place. The remaining task is to combine these components into a single structure that will be used throughout the entire simulation process. This is where SemidiscretizationHyperbolic comes into play.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,\n solver)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The constructor for the SemidiscretizationHyperbolic object calls numerous sub-functions to perform the necessary initialization steps. A brief description of the key sub-functions is provided below.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"init_elements(leaf_cell_ids, mesh, equations, dg.basis, RealT, uEltype)\nThe fundamental elements for approximating the solution are the leaf cells. The solution is constructed as a polynomial of the degree specified in the DGSEM solver in each spatial direction on each leaf cell. This polynomial approximation is evaluated at the Gauss-Lobatto nodes mentioned earlier. The init_elements function extracts these leaf cells from the TreeMesh, assigns them the label \"elements\", records their coordinates, and maps the Gauss-Lobatto nodes from the 1D interval -1 1 onto each coordinate axis of every element.\n(Image: elements_example)\nThe visualization of elements with nodes shown here includes spaces between elements, which do not exist in reality. This spacing is included only for illustrative purposes to underscore the separation of elements and the independent projection of nodes onto each element.\ninit_interfaces(leaf_cell_ids, mesh, elements)\nAt this point, the elements with nodes have been defined; however, they lack the necessary communication functionality. This is crucial because the local solution polynomials on the elements are not independent of each other. Furthermore, nodes on the boundary of adjacent elements share the same spatial location, which requires a method to combine this into a meaningful solution. Here Riemann solvers come into play which can handle the principal ambiguity of a multi-valued solution at the same spatial location.\nAs demonstrated earlier, the elements can have varying sizes. Let us initially consider neighbors with equal size. For these elements, the init_interfaces function generates interfaces that store information about adjacent elements, their relative positions, and allocate containers for sharing solution data between neighbors during the solution process.\nIn our visualization, these interfaces would conceptually resemble tubes connecting the corresponding elements.\n(Image: interfaces_example)\ninit_mortars(leaf_cell_ids, mesh, elements, dg.mortar)\nReturning to the consideration of different sizes among adjacent elements, within the TreeMesh, adjacent leaf cells can vary in side length by a maximum factor of two. This implies that a large element has one neighbor of equal size with a connection through an interface, or two neighbors at half the size, requiring a connection through so called \"mortars\". In 3D, a large element would have four small neighbor elements.\nMortars store information about the connected elements, their relative positions, and allocate containers for storing the solutions along the boundaries between these elements.\nDue to the differing sizes of adjacent elements, it is not feasible to directly map boundary nodes of adjacent elements. Therefore, the concept of mortars employs a mass-conserving interpolation function to map boundary nodes from a larger element to a smaller one.\nIn our visualization, mortars are represented as branched tubes.\n(Image: mortars_example)\ninit_boundaries(leaf_cell_ids, mesh, elements)\nIn order to apply boundary conditions, it is necessary to identify the locations of the boundaries. Therefore, we initialize a \"boundaries\" object, which records the elements that contain boundaries, specifies which side of an element is a boundary, stores the coordinates of boundary nodes, and allocates containers for managing solutions at these boundaries.\nIn our visualization, boundaries and their corresponding nodes are highlighted with green, semi-transparent lines.\n(Image: boundaries_example)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"All the structures mentioned earlier are collected as a cache of type NamedTuple. Subsequently, an object of type SemidiscretizationHyperbolic is initialized using this cache, initial and boundary conditions, equations, mesh and solver.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"In conclusion, the primary purpose of a SemidiscretizationHyperbolic is to collect equations, the geometric representation of the domain, and approximation instructions, creating specialized structures to interconnect these components in a manner that enables their utilization for the numerical solution of partial differential equations (PDEs).","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"As evident from the earlier description of SemidiscretizationHyperbolic, it comprises numerous functions called subsequently. Without delving into details, the structure of the primary calls are illustrated as follows:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: SemidiscretizationHyperbolic_structure)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Overview-of-the-[semidiscretize](@ref)-function","page":"2 Behind the scenes of a simulation setup","title":"Overview of the semidiscretize function","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"At this stage, we have defined the equations and configured the domain's discretization. The final step before solving is to select a suitable time span and apply the corresponding initial conditions, which are already stored in the initialized SemidiscretizationHyperbolic object.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The purpose of the semidiscretize function is to wrap the semidiscretization as an ODEProblem within the specified time interval. During this procedure the approximate solution is created at the given initial time via the specified initial_condition function from the SemidiscretizationHyperbolic object. This ODEProblem can be subsequently passed to the solve function from the OrdinaryDiffEq.jl package or to Trixi.solve.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"ode = semidiscretize(semi, (0.0, 1.0));\nnothing #hide","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"The semidiscretize function involves a deep tree of subsequent calls, with the primary ones explained below.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"allocate_coefficients(mesh, equations, solver, cache)\nTo apply initial conditions, a data structure (\"container\") needs to be generated to store the initial values of the target variables for each node within each element.\nSince only one-dimensional Arrays are resize!able in Julia, we use Vectors as an internal storage for the target variables and resize! them whenever needed, e.g. to change the number of elements. Then, during the solving process the same memory is reused by unsafe_wrapping multi-dimensional Arrays around the internal storage.\nwrap_array(u_ode, semi)\nAs previously noted, u_ode is constructed as a 1D vector to ensure compatibility with OrdinaryDiffEq.jl. However, for internal use within Trixi.jl, identifying which part of the vector relates to specific variables, elements, or nodes can be challenging.\nThis is why the u_ode vector is wrapped by the wrap_array function using unsafe_wrap to form a multidimensional array u. In this array, the first dimension corresponds to variables, followed by N dimensions corresponding to nodes for each of N space dimensions. The last dimension corresponds to the elements. Consequently, navigation within this multidimensional array becomes noticeably easier.\n\"Wrapping\" in this context involves the creation of a reference to the same storage location but with an alternative structural representation. This approach enables the use of both instances u and u_ode as needed, so that changes are simultaneously reflected in both. This is possible because, from a storage perspective, they share the same stored data, while access to this data is provided in different ways.\ncompute_coefficients!(u, initial_conditions, t, mesh::DG, equations, solver, cache)\nNow the variable u, intended to store solutions, has been allocated and wrapped, it is time to apply the initial conditions. The compute_coefficients! function calculates the initial conditions for each variable at every node within each element and properly stores them in the u array.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"At this stage, the semidiscretize function has all the necessary components to initialize and return an ODEProblem object, which will be used by the solve function to compute the solution.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"In summary, the internal workings of semidiscretize with brief descriptions can be presented as follows.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: semidiscretize_structure)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/#Functions-solve-and-rhs!","page":"2 Behind the scenes of a simulation setup","title":"Functions solve and rhs!","text":"","category":"section"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Once the ODEProblem object is initialized, the solve function and one of the ODE solvers from the OrdinaryDiffEq.jl package can be utilized to compute an approximated solution using the instructions contained in the ODEProblem object.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 0.01,\n save_everystep = false);\nnothing #hide","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Since the solve function and the ODE solver have no knowledge of a particular spatial discretization, it is necessary to define a \"right-hand-side function\", rhs!, within Trixi.jl.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Trixi.jl includes a set of rhs! functions designed to compute du, i.e., fracpartial upartial t according to the structure of the setup. These rhs! functions calculate interface, mortars, and boundary fluxes, in addition to surface and volume integrals, in order to construct the du vector. This du vector is then used by the time integration method to obtain the solution at the subsequent time step. The rhs! function is called by time integration methods in each iteration of the solve loop within OrdinaryDiffEq.jl, with arguments du, u, semidiscretization, and the current time.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Trixi.jl uses a two-levels approach for rhs! functions. The first level is limited to a single function for each semidiscretization type, and its role is to redirect data to the target rhs! for specific solver and mesh types. This target rhs! function is responsible for calculating du.","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Path from the solve function call to the appropriate rhs! function call:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"(Image: rhs_structure)","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"Computed solution:","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"using Plots\nplot(sol)\npd = PlotData2D(sol)\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"","category":"page"},{"location":"tutorials/behind_the_scenes_simulation_setup/","page":"2 Behind the scenes of a simulation setup","title":"2 Behind the scenes of a simulation setup","text":"This page was generated using Literate.jl.","category":"page"},{"location":"overview/#Overview-of-the-structure-of-Trixi.jl","page":"Overview","title":"Overview of the structure of Trixi.jl","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"Trixi.jl is designed as a library of components for discretizations of hyperbolic conservation laws. Thus, it is not a monolithic PDE solver that is configured at runtime via parameter files, as it is often found in classical numerical simulation codes. Instead, each simulation is configured by pure Julia code. Many examples of such simulation setups, called elixirs in Trixi.jl, are provided in the examples/ folder.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"Trixi.jl uses the method of lines, i.e., the full space-time discretization is separated into two steps; the spatial semidiscretization is performed at first and the resulting ODE system is solved numerically using a suitable time integration method. Thus, the main ingredients of an elixir designed to solve a PDE numerically are the spatial semidiscretization and the time integration scheme.","category":"page"},{"location":"overview/#overview-semidiscretizations","page":"Overview","title":"Semidiscretizations","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"Semidiscretizations are high-level descriptions of spatial discretizations specialized for certain PDEs. Trixi.jl's main focus is on hyperbolic conservation laws represented in a SemidiscretizationHyperbolic. Such semidiscretizations are usually named semi in Trixi.jl","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"(Image: semidiscretization_overview)","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"The basic building blocks of a semidiscretization are","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"a mesh describing the geometry of the domain\na set of equations describing the physical model\na solver describing the numerical approach","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"In addition, a semidiscretization bundles initial and boundary conditions, and possible source terms. These different ingredients of a semidiscretization can be configured individually and combined together. When a semidiscretization is constructed, it will create an internal cache, i.e., a collection of setup-specific data structures, that is usually passed to all lower level functions.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"Due to Trixi.jl's modular nature using Julia's multiple dispatch features, new ingredients can be created specifically for a certain combination of other ingredients. For example, a new mesh type can be created and implemented at first only for a specific solver. Thus, there is no need to consider all possible combinations of meshes, equations, and solvers when implementing new features. This allows rapid prototyping of new ideas and is one of the main design goals behind Trixi.jl. Below is a brief overview of the availability of different features on different mesh types.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"Feature TreeMesh StructuredMesh UnstructuredMesh2D P4estMesh DGMultiMesh Further reading\nSpatial dimension 1D, 2D, 3D 1D, 2D, 3D 2D 2D, 3D 1D, 2D, 3D \nCoordinates Cartesian curvilinear curvilinear curvilinear curvilinear \nConnectivity h-nonconforming conforming conforming h-nonconforming conforming \nElement type line, square, cube line, quadᵃ, hexᵃ quadᵃ quadᵃ, hexᵃ simplex, quadᵃ, hexᵃ \nAdaptive mesh refinement ✅ ❌ ❌ ✅ ❌ AMRCallback\nSolver type DGSEM DGSEM DGSEM DGSEM DGMulti \nDomain hypercube mapped hypercube arbitrary arbitrary arbitrary \nWeak form ✅ ✅ ✅ ✅ ✅ VolumeIntegralWeakForm\nFlux differencing ✅ ✅ ✅ ✅ ✅ VolumeIntegralFluxDifferencing\nShock capturing ✅ ✅ ✅ ✅ ❌ VolumeIntegralShockCapturingHG\nNonconservative equations ✅ ✅ ✅ ✅ ✅ e.g., GLM MHD or shallow water equations\nParabolic terms ✅ ✅ ❌ ✅ ✅ e.g., CompressibleNavierStokesDiffusion2D","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"ᵃ: quad = quadrilateral, hex = hexahedron","category":"page"},{"location":"overview/#Time-integration-methods","page":"Overview","title":"Time integration methods","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, a spatial semidiscretization can be wrapped in an ODE problem using semidiscretize, which returns an ODEProblem. This ODEProblem is a wrapper of Trixi.rhs!(du_ode, u_ode, semi, t), which gets called in ODE solvers. Further information can be found in the section on time integration methods.","category":"page"},{"location":"overview/#Next-steps","page":"Overview","title":"Next steps","text":"","category":"section"},{"location":"overview/","page":"Overview","title":"Overview","text":"We explicitly encourage people interested in Trixi.jl to have a look at the examples/ bundled with Trixi.jl to get an impression of what is possible and the general look and feel of Trixi.jl. Before doing that, it is usually good to get an idea of how to visualize numerical results.","category":"page"},{"location":"overview/","page":"Overview","title":"Overview","text":"If you like learning by doing, looking at the tutorials and trying to mix your own elixirs based thereon is probably a good next step. Otherwise, you can further dig into the documentation by looking at Trixi.jl's basic building blocks.","category":"page"},{"location":"callbacks/#callbacks-id","page":"Callbacks","title":"Callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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.jl are either called after each time step (step callbacks) or after each stage of the ODE solver (stage callbacks).","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"(Image: callbacks_illustration)","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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.","category":"page"},{"location":"callbacks/#Step-callbacks","page":"Callbacks","title":"Step callbacks","text":"","category":"section"},{"location":"callbacks/#CFL-based-time-step-control","page":"Callbacks","title":"CFL-based time step control","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Time step control can be performed with a StepsizeCallback. An example making use of this can be found at examples/tree_2d_dgsem/elixir_advection_basic.jl","category":"page"},{"location":"callbacks/#Adaptive-mesh-refinement","page":"Callbacks","title":"Adaptive mesh refinement","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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 to the ODE solver. The AMRCallback requires a controller such as ControllerThreeLevel or ControllerThreeLevelCombined to tell the AMR algorithm which cells to refine/coarsen.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"An example elixir using AMR can be found at examples/tree_2d_dgsem/elixir_advection_amr.jl.","category":"page"},{"location":"callbacks/#Analyzing-the-numerical-solution","page":"Callbacks","title":"Analyzing the numerical solution","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"The AnalysisCallback can be used to analyze the numerical solution, e.g. calculate errors or user-specified integrals, and print the results to the screen. The results can also be saved in a file. An example can be found at examples/tree_2d_dgsem/elixir_euler_vortex.jl. Note that the errors (e.g. L2 error or Linf error) are computed with respect to the initial condition. The percentage of the simulation time refers to the ratio of the current time and the final time, i.e. it does not consider the maximal number of iterations. So the simulation could finish before 100% are reached. Note that, e.g., due to AMR or smaller time step sizes, the simulation can actually take longer than the percentage indicates. In Performance metrics of the AnalysisCallback you can find a detailed description of the different performance metrics the AnalysisCallback computes.","category":"page"},{"location":"callbacks/#I/O","page":"Callbacks","title":"I/O","text":"","category":"section"},{"location":"callbacks/#Solution-and-restart-files","page":"Callbacks","title":"Solution and restart files","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"To save the solution in regular intervals you can use a SaveSolutionCallback. It is also possible to create restart files using the SaveRestartCallback. An example making use of these can be found at examples/tree_2d_dgsem/elixir_advection_extended.jl. An example showing how to restart a simulation from a restart file can be found at examples/tree_2d_dgsem/elixir_advection_restart.jl.","category":"page"},{"location":"callbacks/#Time-series","page":"Callbacks","title":"Time series","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"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, which is used, e.g., in examples/tree_2d_dgsem/elixir_acoustics_gaussian_source.jl. The TimeSeriesCallback constructor expects a semidiscretization and a list of points at which the solution should be recorded in regular time step intervals. After the last time step, the entire record is stored in an HDF5 file.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"For the points, two different input formats are supported: You can either provide them as a list of tuples, which is handy if you specify them by hand on the REPL. Alternatively, you can provide them as a two-dimensional array, where the first dimension is the point number and the second dimension is the coordinate dimension. This is especially useful when reading them from a file.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"For example, to record the primitive variables at the points (0.0, 0.0) and (-1.0, 0.5) every five timesteps and storing the collected data in the file tseries.h5, you can create the TimeSeriesCallback as","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"time_series = TimeSeriesCallback(semi, [(0.0, 0.0), (-1.0, 0.5)];\n interval=5,\n solution_variables=cons2prim,\n filename=\"tseries.h5\")","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"For a full list of possible arguments, please check the documentation for the TimeSeriesCallback. As an alternative to specifying the point coordinates directly in the elixir or on the REPL, you can read them from a file. For instance, with a text file points.dat with content","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":" 0.0 0.0\n-1.0 0.5","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"you can create a time series callback with","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"using DelimitedFiles: readdlm\ntime_series = TimeSeriesCallback(semi, readdlm(\"points.dat\"))","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"To plot the individual point data series over time, you can create a PlotData1D from the TimeSeriesCallback and a given point ID. For example, executing","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"julia> using Trixi, Plots\n\njulia> trixi_include(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_acoustics_gaussian_source.jl\"))\n\njulia> pd1 = PlotData1D(time_series, 1)\n\njulia> pd2 = PlotData1D(time_series, 2)\n\njulia> plot(pd1[\"p_prime\"]); plot!(pd2[\"p_prime\"], xguide=\"t\")","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"will yield the following plot:","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"(Image: image)","category":"page"},{"location":"callbacks/#Miscellaneous","page":"Callbacks","title":"Miscellaneous","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"The AliveCallback prints some information to the screen to show that a simulation is still running.\nThe SummaryCallback prints a human-readable summary of the simulation setup and controls the automated performance measurements, including an output of the recorded timers after a simulation.\nThe VisualizationCallback can be used for in-situ visualization. See Visualizing results during a simulation.\nThe TrivialCallback does nothing and can be used to easily disable some callbacks via trixi_include.","category":"page"},{"location":"callbacks/#Equation-specific-callbacks","page":"Callbacks","title":"Equation-specific callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Some callbacks provided by Trixi.jl implement specific features for certain equations:","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"The LBMCollisionCallback 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\nThe SteadyStateCallback terminates the time integration when the residual steady state falls below a certain threshold. This checks the convergence of the potential phi for hyperbolic diffusion. See e.g. examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl.\nThe GlmSpeedCallback updates the divergence cleaning wave speed c_h for the ideal GLM-MHD equations. See e.g. examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl.","category":"page"},{"location":"callbacks/#Usage-of-step-callbacks","page":"Callbacks","title":"Usage of step callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Step callbacks are passed to the solve method from the ODE solver via the keyword argument callback. If you want to use a single callback cb, pass it as callback=cb. When using two or more callbacks, you need to turn them into a CallbackSet first by calling callbacks = CallbackSet(cb1, cb2) and passing it as callback=callbacks.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"note: Note\nThere are some restrictions regarding the order of callbacks in a CallbackSet.The callbacks are called after each time step but some callbacks actually belong to the next time step. Therefore, the callbacks should be ordered in the following way:Callbacks that belong to the current time step:\nSummaryCallback controls, among other things, timers and should thus be first\nSteadyStateCallback may mark a time step as the last one\nAnalysisCallback may do some checks that mark a time step as the last one\nAliveCallback should be nearby AnalysisCallback\nSaveSolutionCallback/SaveRestartCallback should save the current solution before it is degraded by AMR\nVisualizationCallback should be called before the mesh is adapted\nCallbacks that belong to the next time step:\nAMRCallback\nStepsizeCallback must be called after AMRCallback to accommodate potential changes to the mesh\nGlmSpeedCallback must be called after StepsizeCallback because the step size affects the value of c_h\nLBMCollisionCallback is already part of the calculations of the next time step and should therefore be called after StepsizeCallback","category":"page"},{"location":"callbacks/#Stage-callbacks","page":"Callbacks","title":"Stage callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"PositivityPreservingLimiterZhangShu is a positivity-preserving limiter, used to enforce physical constraints. An example elixir using this feature can be found at examples/tree_2d_dgsem/elixir_euler_positivity.jl.","category":"page"},{"location":"callbacks/#Implementing-new-callbacks","page":"Callbacks","title":"Implementing new callbacks","text":"","category":"section"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"Since Trixi.jl is compatible with OrdinaryDiffEq.jl, both packages share the same callback interface. A detailed description of it can be found in the OrdinaryDiffEq.jl documentation. Step callbacks are just called callbacks. Stage callbacks are called stage_limiter!.","category":"page"},{"location":"callbacks/","page":"Callbacks","title":"Callbacks","text":"An example elixir showing how to implement a new simple stage callback and a new simple step callback can be found at examples/tree_2d_dgsem/elixir_advection_callbacks.jl.","category":"page"},{"location":"#Trixi.jl","page":"Home","title":"Trixi.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Docs-stable) (Image: Docs-dev) (Image: Slack) (Image: Youtube) (Image: Build Status) (Image: Codecov) (Image: Coveralls) (Image: Aqua QA) (Image: License: MIT) (Image: DOI)","category":"page"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl is a numerical simulation framework for conservation laws written in Julia. 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.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures. Its features include:","category":"page"},{"location":"","page":"Home","title":"Home","text":"1D, 2D, and 3D simulations on line/quad/hex/simplex meshes\nCartesian and curvilinear meshes\nConforming and non-conforming meshes\nStructured and unstructured meshes\nHierarchical quadtree/octree grid with adaptive mesh refinement\nForests of quadtrees/octrees with p4est via P4est.jl\nHigh-order accuracy in space and time\nDiscontinuous Galerkin methods\nKinetic energy-preserving and entropy-stable methods based on flux differencing\nEntropy-stable shock capturing\nPositivity-preserving limiting\nFinite difference summation by parts (SBP) methods\nCompatible with the SciML ecosystem for ordinary differential equations\nExplicit low-storage Runge-Kutta time integration\nStrong stability preserving methods\nCFL-based and error-based time step control\nNative support for differentiable programming\nForward mode automatic differentiation via ForwardDiff.jl\nPeriodic and weakly-enforced boundary conditions\nMultiple governing equations:\nCompressible Euler equations\nCompressible Navier-Stokes equations\nMagnetohydrodynamics (MHD) equations\nMulti-component compressible Euler and MHD equations\nLinearized Euler and acoustic perturbation equations\nHyperbolic diffusion equations for elliptic problems\nLattice-Boltzmann equations (D2Q9 and D3Q27 schemes)\nShallow water equations\nScalar advection\nMulti-physics simulations\nSelf-gravitating gas dynamics\nShared-memory parallelization via multithreading\nMulti-node parallelization via MPI\nVisualization and postprocessing of the results\nIn-situ and a posteriori visualization with Plots.jl\nInteractive visualization with Makie.jl\nPostprocessing with ParaView/VisIt via Trixi2Vtk","category":"page"},{"location":"#Installation","page":"Home","title":"Installation","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"If you have not yet installed Julia, please follow the instructions for your operating system. Trixi.jl works with Julia v1.8 and newer. We recommend using the latest stable release of Julia.","category":"page"},{"location":"#For-users","page":"Home","title":"For users","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl and its related tools are registered Julia packages. Hence, you can install Trixi.jl, the visualization tool Trixi2Vtk, OrdinaryDiffEq.jl, and Plots.jl by executing the following commands in the Julia REPL:","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg\n\njulia> Pkg.add([\"Trixi\", \"Trixi2Vtk\", \"OrdinaryDiffEq\", \"Plots\"])","category":"page"},{"location":"","page":"Home","title":"Home","text":"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 provides time integration schemes used by Trixi.jl, while Plots.jl can be used to directly visualize Trixi.jl's results from the REPL.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg; Pkg.update(\"Trixi\"); Pkg.status(\"Trixi\")","category":"page"},{"location":"","page":"Home","title":"Home","text":"to the latest release. If the installed version does not match the current release, please check the Troubleshooting section.","category":"page"},{"location":"","page":"Home","title":"Home","text":"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.","category":"page"},{"location":"#for-developers","page":"Home","title":"For developers","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"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:","category":"page"},{"location":"","page":"Home","title":"Home","text":"git clone git@github.com:trixi-framework/Trixi.jl.git\ncd Trixi.jl\nmkdir run\ncd run\njulia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=\"..\"))'","category":"page"},{"location":"","page":"Home","title":"Home","text":"If you installed Trixi.jl this way, you always have to start Julia with the --project flag set to your run directory, e.g.,","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia --project=.","category":"page"},{"location":"","page":"Home","title":"Home","text":"if already inside the run directory.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The advantage of using a separate run directory is that you can also add other related packages (see below, e.g., for time integration or visualization) to the project in the run folder and always have a reproducible environment at hand to share with others.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Since the postprocessing tool Trixi2Vtk.jl typically does not need to be modified, it is recommended to install it as a normal package. Likewise, you can install OrdinaryDiffEq.jl and Plots.jl as ordinary packages. To achieve this, use the following REPL commands:","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg\n\njulia> Pkg.add([\"OrdinaryDiffEq\", \"Trixi2Vtk\", \"Plots\"])","category":"page"},{"location":"","page":"Home","title":"Home","text":"Note that the postprocessing tools Trixi2Vtk.jl and Plots.jl are optional and can be omitted.","category":"page"},{"location":"#Example:-Installing-Trixi.jl-as-a-package","page":"Home","title":"Example: Installing Trixi.jl as a package","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":" ","category":"page"},{"location":"","page":"Home","title":"Home","text":"Please note that the playback speed is set to 3x, thus the entire installation procedure lasts around 45 seconds in real time (depending on the performance of your computer and on how many dependencies had already been installed before).","category":"page"},{"location":"#Usage","page":"Home","title":"Usage","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"In the Julia REPL, first load the package Trixi.jl","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Trixi","category":"page"},{"location":"","page":"Home","title":"Home","text":"Then start a simulation by executing","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> trixi_include(default_example())","category":"page"},{"location":"","page":"Home","title":"Home","text":"Please be patient since Julia will compile the code just before running it. To visualize the results, load the package Plots","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> using Plots","category":"page"},{"location":"","page":"Home","title":"Home","text":"and generate a heatmap plot of the results with","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> plot(sol) # No trailing semicolon, otherwise no plot is shown","category":"page"},{"location":"","page":"Home","title":"Home","text":"This will open a new window with a 2D visualization of the final solution:","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: image)","category":"page"},{"location":"","page":"Home","title":"Home","text":"The method trixi_include(...) expects a single string argument with the path to a Trixi.jl elixir, i.e., a text file containing Julia code necessary to set up and run a simulation. To quickly see Trixi.jl in action, default_example() returns the path to an example elixir with a short, two-dimensional problem setup. A list of all example elixirs packaged with Trixi.jl can be obtained by running get_examples(). Alternatively, you can also browse the examples/ subdirectory. If you want to modify one of the elixirs to set up your own simulation, download it to your machine, edit the configuration, and pass the file path to trixi_include(...).","category":"page"},{"location":"#Example:-Running-a-simulation-with-Trixi.jl","page":"Home","title":"Example: Running a simulation with Trixi.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":" ","category":"page"},{"location":"","page":"Home","title":"Home","text":"If this produces weird symbols or question marks in the terminal on your system, you are probably using Mac OS with problematic fonts. In that case, please check the Troubleshooting section.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Note on performance: Julia uses just-in-time compilation to transform its source code to native, optimized machine code at the time of execution and caches the compiled methods for further use. That means that the first execution of a Julia method is typically slow, with subsequent runs being much faster. For instance, in the example above the first execution of trixi_include takes about 20 seconds, while subsequent runs require less than 60 milliseconds.","category":"page"},{"location":"#Performing-a-convergence-analysis","page":"Home","title":"Performing a convergence analysis","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"To automatically determine the experimental order of convergence (EOC) for a given setup, execute","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> convergence_test(default_example(), 4)","category":"page"},{"location":"","page":"Home","title":"Home","text":"This will run a convergence test with the elixir default_example(), using four iterations with different initial refinement levels. The initial iteration will use the elixir unchanged, while for each subsequent iteration the initial_refinement_level parameter is incremented by one. Finally, the measured l^2 and l^infty errors and the determined EOCs will be displayed like this:","category":"page"},{"location":"","page":"Home","title":"Home","text":"[...]\nl2\nscalar\nerror EOC\n9.14e-06 -\n5.69e-07 4.01\n3.55e-08 4.00\n2.22e-09 4.00\n\nmean 4.00\n--------------------------------------------------------------------------------\nlinf\nscalar\nerror EOC\n6.44e-05 -\n4.11e-06 3.97\n2.58e-07 3.99\n1.62e-08 4.00\n\nmean 3.99\n--------------------------------------------------------------------------------","category":"page"},{"location":"","page":"Home","title":"Home","text":"An example with multiple variables looks like this:","category":"page"},{"location":"","page":"Home","title":"Home","text":"julia> convergence_test(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_source_terms.jl\"), 3)","category":"page"},{"location":"","page":"Home","title":"Home","text":"[...]\nl2\nrho rho_v1 rho_v2 rho_e\nerror EOC error EOC error EOC error EOC\n9.32e-07 - 1.42e-06 - 1.42e-06 - 4.82e-06 -\n7.03e-08 3.73 9.53e-08 3.90 9.53e-08 3.90 3.30e-07 3.87\n4.65e-09 3.92 6.09e-09 3.97 6.09e-09 3.97 2.12e-08 3.96\n\nmean 3.82 mean 3.93 mean 3.93 mean 3.91\n--------------------------------------------------------------------------------\nlinf\nrho rho_v1 rho_v2 rho_e\nerror EOC error EOC error EOC error EOC\n9.58e-06 - 1.17e-05 - 1.17e-05 - 4.89e-05 -\n6.23e-07 3.94 7.48e-07 3.97 7.48e-07 3.97 3.22e-06 3.92\n4.05e-08 3.94 4.97e-08 3.91 4.97e-08 3.91 2.10e-07 3.94\n\nmean 3.94 mean 3.94 mean 3.94 mean 3.93\n--------------------------------------------------------------------------------","category":"page"},{"location":"#Showcase-of-advanced-features","page":"Home","title":"Showcase of advanced features","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The presentation From Mesh Generation to Adaptive Simulation: A Journey in Julia, originally given as part of JuliaCon 2022, outlines how to use Trixi.jl for an adaptive simulation of the compressible Euler equations in two spatial dimensions on a complex domain. More details as well as code to run the simulation presented can be found at the reproducibility repository for the presentation.","category":"page"},{"location":"#Referencing","page":"Home","title":"Referencing","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"If you use Trixi.jl in your own research or write a paper using results obtained with the help of Trixi.jl, please cite the following articles:","category":"page"},{"location":"","page":"Home","title":"Home","text":"@article{ranocha2022adaptive,\n title={Adaptive numerical simulations with {T}rixi.jl:\n {A} case study of {J}ulia for scientific computing},\n author={Ranocha, Hendrik and Schlottke-Lakemper, Michael and Winters, Andrew Ross\n and Faulhaber, Erik and Chan, Jesse and Gassner, Gregor},\n journal={Proceedings of the JuliaCon Conferences},\n volume={1},\n number={1},\n pages={77},\n year={2022},\n doi={10.21105/jcon.00077},\n eprint={2108.06476},\n eprinttype={arXiv},\n eprintclass={cs.MS}\n}\n\n@article{schlottkelakemper2021purely,\n title={A purely hyperbolic discontinuous {G}alerkin approach for\n self-gravitating gas dynamics},\n author={Schlottke-Lakemper, Michael and Winters, Andrew R and\n Ranocha, Hendrik and Gassner, Gregor J},\n journal={Journal of Computational Physics},\n pages={110467},\n year={2021},\n month={06},\n volume={442},\n publisher={Elsevier},\n doi={10.1016/j.jcp.2021.110467},\n eprint={2008.10593},\n eprinttype={arXiv},\n eprintclass={math.NA}\n}","category":"page"},{"location":"","page":"Home","title":"Home","text":"In addition, you can also refer to Trixi.jl directly as","category":"page"},{"location":"","page":"Home","title":"Home","text":"@misc{schlottkelakemper2020trixi,\n title={{T}rixi.jl: {A}daptive high-order numerical simulations\n of hyperbolic {PDE}s in {J}ulia},\n author={Schlottke-Lakemper, Michael and Gassner, Gregor J and\n Ranocha, Hendrik and Winters, Andrew R and Chan, Jesse},\n year={2021},\n month={09},\n howpublished={\\url{https://github.com/trixi-framework/Trixi.jl}},\n doi={10.5281/zenodo.3996439}\n}","category":"page"},{"location":"#authors-index-md","page":"Home","title":"Authors","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl was initiated by Michael Schlottke-Lakemper (RWTH Aachen University/High-Performance Computing Center Stuttgart (HLRS), Germany) and Gregor Gassner (University of Cologne, Germany). Together with Hendrik Ranocha (Johannes Gutenberg University Mainz, Germany) and Andrew Winters (Linköping University, Sweden), and Jesse Chan (Rice University, US), they are the principal developers of Trixi.jl. The full list of contributors can be found under Authors.","category":"page"},{"location":"#License-and-contributing","page":"Home","title":"License and contributing","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl is licensed under the MIT license (see License). Since Trixi.jl is an open-source project, we are very happy to accept contributions from the community. Please refer to Contributing for more details. Note that we strive to be a friendly, inclusive open-source community and ask all members of our community to adhere to our Code of Conduct. To get in touch with the developers, join us on Slack or create an issue.","category":"page"},{"location":"#Acknowledgments","page":"Home","title":"Acknowledgments","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    ","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) through the following grants:","category":"page"},{"location":"","page":"Home","title":"Home","text":"Excellence Strategy EXC 2044-390685587, Mathematics Münster: Dynamics-Geometry-Structure.\nResearch unit FOR 5409 \"Structure-Preserving Numerical Methods for Bulk- and Interface Coupling of Heterogeneous Models (SNuBIC)\" (project number 463312734).\nIndividual grant no. 528753982.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from the European Research Council through the ERC Starting Grant \"An Exascale aware and Un-crashable Space-Time-Adaptive Discontinuous Spectral Element Solver for Non-Linear Conservation Laws\" (Extreme), ERC grant agreement no. 714487.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from Vetenskapsrådet (VR, Swedish Research Council), Sweden through the VR Starting Grant \"Shallow water flows including sediment transport and morphodynamics\", VR grant agreement 2020-03642 VR.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from the United States National Science Foundation (NSF) under awards DMS-1719818 and DMS-1943186.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding from the German Federal Ministry of Education and Research (BMBF) through the project grant \"Adaptive earth system modeling with significantly reduced computation time for exascale supercomputers (ADAPTEX)\" (funding id: 16ME0668K).","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project has benefited from funding by the Daimler und Benz Stiftung (Daimler and Benz Foundation) through grant no. 32-10/22.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Trixi.jl is supported by NumFOCUS as an Affiliated Project.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"EditURL = \"../../literate/src/files/adding_nonconservative_equation.jl\"","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#adding_nonconservative_equation","page":"11 Adding a non-conservative equation","title":"11: Adding a non-conservative equation","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"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","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"left\nbeginalignedpartial_t u(tx) + a(x) partial_x u(tx) = 0 \nu(0x)=sin(x) \nu(t-pi)=u(tpi)\nendaligned\nright","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"where a(x) = 2 + cos(x). The analytic solution is","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"u(tx)=-sin left(2 tan ^-1left(sqrt3 tan left(fracsqrt3 t2-tan ^-1left(frac1sqrt3tan left(fracx2right)right)right)right)right)","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"In Trixi.jl, such a mathematical model is encoded as a subtype of Trixi.AbstractEquations.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#Basic-setup","page":"11 Adding a non-conservative equation","title":"Basic setup","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Since there is no native support for variable coefficients, we need to transform the PDE to the following system:","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"left\nbeginalignedpartial_t beginpmatrixu(tx)a(tx) endpmatrix +beginpmatrix a(tx) partial_x u(tx) 0 endpmatrix = 0 \nu(0x)=sin(x) \na(0x)=2+cos(x) \nu(t-pi)=u(tpi)\nendaligned\nright","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"# Define new physics\nusing Trixi\nusing Trixi: AbstractEquations, get_node_vars\nimport Trixi: varnames, default_analysis_integrals, flux, max_abs_speed_naive,\n have_nonconservative_terms\n\n# Since there is no native support for variable coefficients, we use two\n# variables: one for the basic unknown `u` and another one for the coefficient `a`\nstruct NonconservativeLinearAdvectionEquation <: AbstractEquations{1 #= spatial dimension =#,\n 2 #= two variables (u,a) =#}\nend\n\nvarnames(::typeof(cons2cons), ::NonconservativeLinearAdvectionEquation) = (\"scalar\", \"advection_velocity\")\n\ndefault_analysis_integrals(::NonconservativeLinearAdvectionEquation) = ()\n\n\n# The conservative part of the flux is zero\nflux(u, orientation, equation::NonconservativeLinearAdvectionEquation) = zero(u)\n\n# Calculate maximum wave speed for local Lax-Friedrichs-type dissipation\nfunction max_abs_speed_naive(u_ll, u_rr, orientation::Integer, ::NonconservativeLinearAdvectionEquation)\n _, advection_velocity_ll = u_ll\n _, advection_velocity_rr = u_rr\n\n return max(abs(advection_velocity_ll), abs(advection_velocity_rr))\nend\n\n\n# We use nonconservative terms\nhave_nonconservative_terms(::NonconservativeLinearAdvectionEquation) = Trixi.True()\n\n# This \"nonconservative numerical flux\" implements the nonconservative terms.\n# In general, nonconservative terms can be written in the form\n# g(u) ∂ₓ h(u)\n# Thus, a discrete difference approximation of this nonconservative term needs\n# - `u mine`: the value of `u` at the current position (for g(u))\n# - `u_other`: the values of `u` in a neighborhood of the current position (for ∂ₓ h(u))\nfunction flux_nonconservative(u_mine, u_other, orientation,\n equations::NonconservativeLinearAdvectionEquation)\n _, advection_velocity = u_mine\n scalar, _ = u_other\n\n return SVector(advection_velocity * scalar, zero(scalar))\nend","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"The implementation of nonconservative terms uses a single \"nonconservative flux\" function flux_nonconservative. It will basically be applied in a loop of the form","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"du_m(D, u) = sum(D[m, l] * flux_nonconservative(u[m], u[l], 1, equations)) # orientation 1: x","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"where D is the derivative matrix and u contains the nodal solution values.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Now, we can run a simple simulation using a DGSEM discretization.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"# Create a simulation setup\nusing Trixi\nusing OrdinaryDiffEq\n\nequation = NonconservativeLinearAdvectionEquation()\n\n# You can derive the exact solution for this setup using the method of\n# characteristics\nfunction initial_condition_sine(x, t, equation::NonconservativeLinearAdvectionEquation)\n x0 = -2 * atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3))))\n scalar = sin(x0)\n advection_velocity = 2 + cos(x[1])\n SVector(scalar, advection_velocity)\nend\n\n# Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries\nmesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates\n initial_refinement_level=4, n_cells_max=10^4)\n\n# Create a DGSEM solver with polynomials of degree `polydeg`\n# Remember to pass a tuple of the form `(conservative_flux, nonconservative_flux)`\n# as `surface_flux` and `volume_flux` when working with nonconservative terms\nvolume_flux = (flux_central, flux_nonconservative)\nsurface_flux = (flux_lax_friedrichs, flux_nonconservative)\nsolver = DGSEM(polydeg=3, surface_flux=surface_flux,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\n# Setup the spatial semidiscretization containing all ingredients\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\n# Create an ODE problem with given time span\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan)\n\n# Set up some standard callbacks summarizing the simulation setup and computing\n# errors of the numerical solution\nsummary_callback = SummaryCallback()\nanalysis_callback = AnalysisCallback(semi, interval=50)\ncallbacks = CallbackSet(summary_callback, analysis_callback)\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes\n# the passed callbacks\nsol = solve(ode, Tsit5(), abstol=1.0e-6, reltol=1.0e-6,\n save_everystep=false, callback=callbacks)\n\n# Print the timer summary\nsummary_callback()\n\n# Plot the numerical solution at the final time\nusing Plots: plot\nplot(sol)","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"You see a plot of the final solution.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"We can check whether everything fits together by refining the grid and comparing the numerical errors. First, we look at the error using the grid resolution above.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"error_1 = analysis_callback(sol).l2 |> first","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Next, we increase the grid resolution by one refinement level and run the simulation again.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"mesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates\n initial_refinement_level=5, n_cells_max=10^4)\n\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\n\nsummary_callback = SummaryCallback()\nanalysis_callback = AnalysisCallback(semi, interval=50)\ncallbacks = CallbackSet(summary_callback, analysis_callback);\n\nsol = solve(ode, Tsit5(), abstol=1.0e-6, reltol=1.0e-6,\n save_everystep=false, callback=callbacks);\nsummary_callback()\n\nerror_2 = analysis_callback(sol).l2 |> first","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"error_1 / error_2","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"As expected, the new error is roughly reduced by a factor of 16, corresponding to an experimental order of convergence of 4 (for polynomials of degree 3).","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#Summary-of-the-code","page":"11 Adding a non-conservative equation","title":"Summary of the code","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Here is the complete code that we used (without the callbacks since these create a lot of unnecessary output in the doctests of this tutorial). In addition, we create the struct inside the new module NonconservativeLinearAdvection. That ensures that we can re-create structs defined therein without having to restart Julia.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"Define new physics","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"module NonconservativeLinearAdvection\n\nusing Trixi\nusing Trixi: AbstractEquations, get_node_vars\nimport Trixi: varnames, default_analysis_integrals, flux, max_abs_speed_naive,\n have_nonconservative_terms\n\n# Since there is not yet native support for variable coefficients, we use two\n# variables: one for the basic unknown `u` and another one for the coefficient `a`\nstruct NonconservativeLinearAdvectionEquation <: AbstractEquations{1 #= spatial dimension =#,\n 2 #= two variables (u,a) =#}\nend\n\nvarnames(::typeof(cons2cons), ::NonconservativeLinearAdvectionEquation) = (\"scalar\", \"advection_velocity\")\n\ndefault_analysis_integrals(::NonconservativeLinearAdvectionEquation) = ()\n\n\n# The conservative part of the flux is zero\nflux(u, orientation, equation::NonconservativeLinearAdvectionEquation) = zero(u)\n\n# Calculate maximum wave speed for local Lax-Friedrichs-type dissipation\nfunction max_abs_speed_naive(u_ll, u_rr, orientation::Integer, ::NonconservativeLinearAdvectionEquation)\n _, advection_velocity_ll = u_ll\n _, advection_velocity_rr = u_rr\n\n return max(abs(advection_velocity_ll), abs(advection_velocity_rr))\nend\n\n\n# We use nonconservative terms\nhave_nonconservative_terms(::NonconservativeLinearAdvectionEquation) = Trixi.True()\n\n# This \"nonconservative numerical flux\" implements the nonconservative terms.\n# In general, nonconservative terms can be written in the form\n# g(u) ∂ₓ h(u)\n# Thus, a discrete difference approximation of this nonconservative term needs\n# - `u mine`: the value of `u` at the current position (for g(u))\n# - `u_other`: the values of `u` in a neighborhood of the current position (for ∂ₓ h(u))\nfunction flux_nonconservative(u_mine, u_other, orientation,\n equations::NonconservativeLinearAdvectionEquation)\n _, advection_velocity = u_mine\n scalar, _ = u_other\n\n return SVector(advection_velocity * scalar, zero(scalar))\nend\n\nend # module\n\n\n\n# Create a simulation setup\nimport .NonconservativeLinearAdvection\nusing Trixi\nusing OrdinaryDiffEq\n\nequation = NonconservativeLinearAdvection.NonconservativeLinearAdvectionEquation()\n\n# You can derive the exact solution for this setup using the method of\n# characteristics\nfunction initial_condition_sine(x, t, equation::NonconservativeLinearAdvection.NonconservativeLinearAdvectionEquation)\n x0 = -2 * atan(sqrt(3) * tan(sqrt(3) / 2 * t - atan(tan(x[1] / 2) / sqrt(3))))\n scalar = sin(x0)\n advection_velocity = 2 + cos(x[1])\n SVector(scalar, advection_velocity)\nend\n\n# Create a uniform mesh in 1D in the interval [-π, π] with periodic boundaries\nmesh = TreeMesh(-Float64(π), Float64(π), # min/max coordinates\n initial_refinement_level=4, n_cells_max=10^4)\n\n# Create a DGSEM solver with polynomials of degree `polydeg`\n# Remember to pass a tuple of the form `(conservative_flux, nonconservative_flux)`\n# as `surface_flux` and `volume_flux` when working with nonconservative terms\nvolume_flux = (flux_central, NonconservativeLinearAdvection.flux_nonconservative)\nsurface_flux = (flux_lax_friedrichs, NonconservativeLinearAdvection.flux_nonconservative)\nsolver = DGSEM(polydeg=3, surface_flux=surface_flux,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\n# Setup the spatial semidiscretization containing all ingredients\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\n# Create an ODE problem with given time span\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\n\n# Set up some standard callbacks summarizing the simulation setup and computing\n# errors of the numerical solution\nsummary_callback = SummaryCallback()\nanalysis_callback = AnalysisCallback(semi, interval=50)\ncallbacks = CallbackSet(summary_callback, analysis_callback);\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes\n# the passed callbacks\nsol = solve(ode, Tsit5(), abstol=1.0e-6, reltol=1.0e-6,\n save_everystep=false);\n\n# Plot the numerical solution at the final time\nusing Plots: plot\nplot(sol);\nnothing #hide","category":"page"},{"location":"tutorials/adding_nonconservative_equation/#Package-versions","page":"11 Adding a non-conservative equation","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"","category":"page"},{"location":"tutorials/adding_nonconservative_equation/","page":"11 Adding a non-conservative equation","title":"11 Adding a non-conservative equation","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"EditURL = \"../../literate/src/files/differentiable_programming.jl\"","category":"page"},{"location":"tutorials/differentiable_programming/#differentiable_programming","page":"19 Differentiable programming","title":"19: Differentiable programming","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Julia and its ecosystem provide some tools for differentiable programming. Trixi.jl is designed to be flexible, extendable, and composable with Julia's growing ecosystem for scientific computing and machine learning. Thus, the ultimate goal is to have fast implementations that allow automatic differentiation (AD) without too much hassle for users. If some parts do not meet these requirements, please feel free to open an issue or propose a fix in a PR.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"In the following, we will walk through some examples demonstrating how to differentiate through Trixi.jl.","category":"page"},{"location":"tutorials/differentiable_programming/#Forward-mode-automatic-differentiation","page":"19 Differentiable programming","title":"Forward mode automatic differentiation","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Trixi.jl integrates well with ForwardDiff.jl for forward mode AD.","category":"page"},{"location":"tutorials/differentiable_programming/#Computing-the-Jacobian","page":"19 Differentiable programming","title":"Computing the Jacobian","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"The high-level interface to compute the Jacobian this way is jacobian_ad_forward. First, we load the required packages and compute the Jacobian of a semidiscretization of the compressible Euler equations, a system of nonlinear conservation laws.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra, Plots\n\nequations = CompressibleEulerEquations2D(1.4)\n\nsolver = DGSEM(3, flux_central)\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi);\nsize(J)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we compute the eigenvalues of the Jacobian.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ = eigvals(J)\nscatter(real.(λ), imag.(λ), label=\"central flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"As you can see here, the maximal real part is close to zero.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Interestingly, if we add dissipation by switching to the flux_lax_friedrichs at the interfaces, the maximal real part of the eigenvalues increases.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"solver = DGSEM(3, flux_lax_friedrichs)\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi)\nλ = eigvals(J)\n\nscatter!(real.(λ), imag.(λ), label=\"Lax-Friedrichs flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Although the maximal real part is still somewhat small, it's larger than for the purely central discretization.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"However, we should be careful when using this analysis, since the eigenvectors are not necessarily well-conditioned.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ, V = eigen(J)\ncondition_number = cond(V)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"In one space dimension, the situation is a bit different.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"equations = CompressibleEulerEquations1D(1.4)\n\nsolver = DGSEM(3, flux_central)\nmesh = TreeMesh((-1.0,), (1.0,), initial_refinement_level=6, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi)\n\nλ = eigvals(J)\n\nscatter(real.(λ), imag.(λ), label=\"central flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Here, the maximal real part is basically zero to machine accuracy.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Moreover, the eigenvectors are not as ill-conditioned as in 2D.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ, V = eigen(J)\ncondition_number = cond(V)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"If we add dissipation, the maximal real part is still approximately zero.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"solver = DGSEM(3, flux_lax_friedrichs)\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ = jacobian_ad_forward(semi)\nλ = eigvals(J)\n\nscatter!(real.(λ), imag.(λ), label=\"Lax-Friedrichs flux\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"As you can see from the plot generated above, the maximal real part is still basically zero to machine precision.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"relative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Let's check the condition number of the eigenvectors.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ, V = eigen(J)\n\ncondition_number = cond(V)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Note that the condition number of the eigenvector matrix increases but is still smaller than for the example in 2D.","category":"page"},{"location":"tutorials/differentiable_programming/#Computing-other-derivatives","page":"19 Differentiable programming","title":"Computing other derivatives","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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 examples/special_elixirs/elixir_euler_ad.jl","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"First, we create a semidiscretization of the compressible Euler equations.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra, ForwardDiff\n\nequations = CompressibleEulerEquations2D(1.4)\n\n\"\"\"\n initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)\n\nThe classical isentropic vortex test case of\n- Chi-Wang Shu (1997)\n Essentially Non-Oscillatory and Weighted Essentially Non-Oscillatory\n Schemes for Hyperbolic Conservation Laws\n [NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)\n\"\"\"\nfunction initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)\n inicenter = SVector(0.0, 0.0) # initial center of the vortex\n iniamplitude = 5.0 # size and strength of the vortex\n\n rho = 1.0 # base flow\n v1 = 1.0\n v2 = 1.0\n vel = SVector(v1, v2)\n p = 25.0\n\n rt = p / rho # ideal gas equation\n t_loc = 0.0\n\n cent = inicenter + vel*t_loc # shift advection of center to handle periodic BC, but only for v1 = v2 = 1.0\n cent = x - cent # distance to center point\n cent = SVector(-cent[2], cent[1])\n\n r2 = cent[1]^2 + cent[2]^2\n du = iniamplitude / (2*π) * exp(0.5 * (1 - r2)) # vel. perturbation\n dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic\n\n rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))\n vel = vel + du * cent\n v1, v2 = vel\n p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))\n\n prim = SVector(rho, v1, v2, p)\n return prim2cons(prim, equations)\nend\n\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsolver = DGSEM(3, flux_lax_friedrichs, VolumeIntegralFluxDifferencing(flux_ranocha))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_isentropic_vortex, solver)\n\nu0_ode = Trixi.compute_coefficients(0.0, semi)\nsize(u0_ode)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we compute the Jacobian using ForwardDiff.jacobian.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"J = ForwardDiff.jacobian((du_ode, γ) -> begin\n equations_inner = CompressibleEulerEquations2D(first(γ))\n semi_inner = Trixi.remake(semi, equations=equations_inner, uEltype=eltype(γ))\n Trixi.rhs!(du_ode, u0_ode, semi_inner, 0.0)\nend, similar(u0_ode), [1.4]); # γ needs to be an `AbstractArray`\n\nround.(extrema(J), sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Note that we create a semidiscretization semi at first to determine the state u0_ode around which we want to perform the linearization. Next, we wrap the RHS evaluation inside a closure and pass that to ForwardDiff.jacobian. There, we need to make sure that the internal caches are able to store dual numbers from ForwardDiff.jl by setting uEltype appropriately. A similar approach is used by jacobian_ad_forward.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Note that the ideal gas constant does not influence the semidiscrete rate of change of the density, as demonstrated by","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"norm(J[1:4:end])","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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.","category":"page"},{"location":"tutorials/differentiable_programming/#Differentiating-through-a-complete-simulation","page":"19 Differentiable programming","title":"Differentiating through a complete simulation","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"It is also possible to differentiate through a complete simulation. As an example, let's differentiate the total energy of a simulation using the linear scalar advection equation with respect to the wave number (frequency) of the initial data.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, OrdinaryDiffEq, ForwardDiff, Plots\n\nfunction energy_at_final_time(k) # k is the wave number of the initial condition\n equations = LinearScalarAdvectionEquation2D(1.0, -0.3)\n mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=3, n_cells_max=10^4)\n solver = DGSEM(3, flux_lax_friedrichs)\n initial_condition = (x, t, equation) -> begin\n x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t)\n return SVector(sinpi(k * sum(x_trans)))\n end\n semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n uEltype=typeof(k))\n ode = semidiscretize(semi, (0.0, 1.0))\n sol = solve(ode, BS3(), save_everystep=false)\n Trixi.integrate(energy_total, sol.u[end], semi)\nend\n\nk_values = range(0.9, 1.1, length=101)\n\nplot(k_values, energy_at_final_time.(k_values), label=\"Energy\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"You see a plot of a curve that resembles a parabola with local maximum around k = 1.0. Why's that? Well, the domain is fixed but the wave number changes. Thus, if the wave number is not chosen as an integer, the initial condition will not be a smooth periodic function in the given domain. Hence, the dissipative surface flux (flux_lax_friedrichs in this example) will introduce more dissipation. In particular, it will introduce more dissipation for \"less smooth\" initial data, corresponding to wave numbers k further away from integers.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"We can compute the discrete derivative of the energy at the final time with respect to the wave number k as follows.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"round(ForwardDiff.derivative(energy_at_final_time, 1.0), sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"This is rather small and we can treat it as zero in comparison to the value of this derivative at other wave numbers k.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"dk_values = ForwardDiff.derivative.((energy_at_final_time,), k_values);\n\nplot(k_values, dk_values, label=\"Derivative\")","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"If you remember basic calculus, a sufficient condition for a local maximum is that the first derivative vanishes and the second derivative is negative. We can also check this discretely.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"second_derivative = round(ForwardDiff.derivative(\n k -> Trixi.ForwardDiff.derivative(energy_at_final_time, k), 1.0),\n sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Having seen this application, let's break down what happens step by step.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"function energy_at_final_time(k) # k is the wave number of the initial condition\n equations = LinearScalarAdvectionEquation2D(1.0, -0.3)\n mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=3, n_cells_max=10^4)\n solver = DGSEM(3, flux_lax_friedrichs)\n initial_condition = (x, t, equation) -> begin\n x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t)\n return SVector(sinpi(k * sum(x_trans)))\n end\n semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n uEltype=typeof(k))\n ode = semidiscretize(semi, (0.0, 1.0))\n sol = solve(ode, BS3(), save_everystep=false)\n Trixi.integrate(energy_total, sol.u[end], semi)\nend\n\nk = 1.0\nround(ForwardDiff.derivative(energy_at_final_time, k), sigdigits=2)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"When calling ForwardDiff.derivative(energy_at_final_time, k) with k=1.0, ForwardDiff.jl will basically use the chain rule and known derivatives of existing basic functions to calculate the derivative of the energy at the final time with respect to the wave number k at k0 = 1.0. To do this, ForwardDiff.jl uses dual numbers, which basically store the result and its derivative w.r.t. a specified parameter at the same time. Thus, we need to make sure that we can treat these ForwardDiff.Dual numbers everywhere during the computation. Fortunately, generic Julia code usually supports these operations. The most basic problem for a developer is to ensure that all types are generic enough, in particular the ones of internal caches.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"The first step in this example creates some basic ingredients of our simulation.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"equations = LinearScalarAdvectionEquation2D(1.0, -0.3)\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=3, n_cells_max=10^4)\nsolver = DGSEM(3, flux_lax_friedrichs);\nnothing #hide","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"These do not have internal caches storing intermediate values of the numerical solution, so we do not need to adapt them. In fact, we could also define them outside of energy_at_final_time (but would need to take care of globals or wrap everything in another function).","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we define the initial condition","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"initial_condition = (x, t, equation) -> begin\n x_trans = Trixi.x_trans_periodic_2d(x - equation.advection_velocity * t)\n return SVector(sinpi(k * sum(x_trans)))\nend;\nnothing #hide","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"as a closure capturing the wave number k passed to energy_at_final_time. If you call energy_at_final_time(1.0), k will be a Float64. Thus, the return values of initial_condition will be SVectors of Float64s. When calculating the ForwardDiff.derivative, k will be a ForwardDiff.Dual number. Hence, the initial_condition will return SVectors of ForwardDiff.Dual numbers.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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.jl to allow ForwardDiff.Dual numbers in these caches. That's what the keyword argument uEltype=typeof(k) in","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n uEltype=typeof(k));\nnothing #hide","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"ode = semidiscretize(semi, (0.0, 1.0))\nsol = solve(ode, BS3(), save_everystep=false)\nround(Trixi.integrate(energy_total, sol.u[end], semi), sigdigits=5)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"do not need any modifications since they are sufficiently generic (and enough effort has been spend to allow general types inside these calls).","category":"page"},{"location":"tutorials/differentiable_programming/#Propagating-errors-using-Measurements.jl","page":"19 Differentiable programming","title":"Propagating errors using Measurements.jl","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"(Image: Error bars by Randall Munroe) \"Error bars\" by Randall Munroe, linked from https://xkcd.com/2110","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Similar to AD, Trixi.jl also allows propagating uncertainties using linear error propagation theory via 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 sine wave as initial condition, solve the ODE, and plot the resulting uncertainties in the primitive variables.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, OrdinaryDiffEq, Measurements, Plots, LaTeXStrings\n\nequations = LinearScalarAdvectionEquation1D(1.0 ± 0.1)\n\nmesh = TreeMesh((-1.0,), (1.0,), n_cells_max=10^5, initial_refinement_level=5)\n\nsolver = DGSEM(3)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,\n solver, uEltype=Measurement{Float64})\n\node = semidiscretize(semi, (0.0, 1.5))\n\nsol = solve(ode, BS3(), save_everystep=false);\n\nplot(sol)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"You should see a plot where small error bars are shown around the extrema and larger error bars are shown in the remaining parts. This result is in accordance with expectations. Indeed, the uncertain propagation speed will affect the extrema less since the local variation of the solution is relatively small there. In contrast, the local variation of the solution is large around the turning points of the sine wave, so the uncertainties will be relatively large there.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"All this is possible due to allowing generic types and having good abstractions in Julia that allow packages to work together seamlessly.","category":"page"},{"location":"tutorials/differentiable_programming/#Finite-difference-approximations","page":"19 Differentiable programming","title":"Finite difference approximations","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Trixi.jl provides the convenience function jacobian_fd to approximate the Jacobian via central finite differences.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra\n\nequations = CompressibleEulerEquations2D(1.4)\n\nsolver = DGSEM(3, flux_central)\n\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_density_wave, solver)\n\nJ_fd = jacobian_fd(semi)\n\nJ_ad = jacobian_ad_forward(semi)\n\nrelative_difference = norm(J_fd - J_ad) / size(J_fd, 1)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"This discrepancy is of the expected order of magnitude for central finite difference approximations.","category":"page"},{"location":"tutorials/differentiable_programming/#Linear-systems","page":"19 Differentiable programming","title":"Linear systems","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"When a linear PDE is discretized using a linear scheme such as a standard DG method, the resulting semidiscretization yields an affine ODE of the form","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"partial_t u(t) = A u(t) + b","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"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. The resulting operator A can be used in multiplication, e.g. mul! from LinearAlgebra, converted to a sparse matrix using sparse from SparseArrays, or converted to a dense matrix using Matrix for detailed eigenvalue analyses. For example,","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using Trixi, LinearAlgebra, Plots\n\nequations = LinearScalarAdvectionEquation2D(1.0, -0.3)\n\nsolver = DGSEM(3, flux_lax_friedrichs)\n\nmesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), initial_refinement_level=2, n_cells_max=10^5)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)\n\nA, b = linear_structure(semi)\n\nsize(A), size(b)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"Next, we compute the eigenvalues of the linear operator.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ = eigvals(Matrix(A))\n\nscatter(real.(λ), imag.(λ))","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"As you can see here, the maximal real part is close to machine precision.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"λ = eigvals(Matrix(A))\nrelative_maximum = maximum(real, λ) / maximum(abs, λ)","category":"page"},{"location":"tutorials/differentiable_programming/#Package-versions","page":"19 Differentiable programming","title":"Package versions","text":"","category":"section"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\", \"ForwardDiff\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"","category":"page"},{"location":"tutorials/differentiable_programming/","page":"19 Differentiable programming","title":"19 Differentiable programming","text":"This page was generated using Literate.jl.","category":"page"},{"location":"meshes/tree_mesh/#Tree-mesh","page":"Tree mesh","title":"Tree mesh","text":"","category":"section"},{"location":"meshes/tree_mesh/","page":"Tree mesh","title":"Tree mesh","text":"The TreeMesh is a Cartesian, h-non-conforming mesh type used in many parts of Trixi.jl. Often, the support for this mesh type is developed best since it was the first mesh type in Trixi.jl, and it is available in one, two, and three space dimensions.","category":"page"},{"location":"meshes/tree_mesh/","page":"Tree mesh","title":"Tree mesh","text":"It is limited to hypercube domains but supports AMR via the AMRCallback. Due to its Cartesian nature, (numerical) fluxes need to implement methods dispatching on the orientation::Integer as described in the conventions.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Unstructured-quadrilateral-mesh","page":"Unstructured mesh","title":"Unstructured quadrilateral mesh","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The UnstructuredMesh2D is an unstructured, curvilinear, conforming mesh type in two space dimensions.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Next, we describe the conventions taken in the implementation for two-dimensional unstructured quadrilateral meshes. Principally, this relates to how a file with the extension .mesh encodes information about the numbering and orientation of elements in an unstructured quadrilateral mesh with possibly curved boundaries.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We use the following unstructured mesh with three elements for this discussion:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"(Image: example-mesh)","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Further, a simulation using Trixi.jl on this example unstructured mesh is provided in examples/unstructured_2d_dgsem/elixir_euler_basic.jl.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Mesh-file-header","page":"Unstructured mesh","title":"Mesh file header","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The first two lines of the mesh file lists the mesh file type as well as the total number of corners, surfaces, elements, and the polynomial degree that the mesh will use to represent any curved sides. For the example mesh these quantities are","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"ISM-V2\n 7 9 3 8","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"corresponding to seven corners, nine surfaces, and three elements. The mesh polynomial degree of eight is taken only for illustrative purposes. In practice, this mesh polynomial degree depends on the particular application for which the curved, unstructured mesh is required.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#List-of-corner-nodes","page":"Unstructured mesh","title":"List of corner nodes","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"After these global counts that prescribe information about the mesh skeleton, the mesh file give a list of the physical (x,y) coordinates of all the corners. The corner nodes are listed in the order prescribed by mesh generator. Thus, for the example mesh this node list would be","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 1.0 -1.0\n 3.0 0.0\n 1.0 1.0\n 2.0 0.0\n 0.0 0.0\n 3.0 1.0\n 3.0 -1.0","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The corner nodes are internally referenced by their position in the list above. For example, here the node at (1.0, -1.0) would have node id 1, node id 2 would be at (3.0, 0.0) etc.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#List-of-neighbor-connectivity","page":"Unstructured mesh","title":"List of neighbor connectivity","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"After the corner list comes the neighbor connectivity along each surface in the mesh. This includes local indexing and orientation information necessary to compute the coupling between elements in the mesh. In 2D each surface is defined by connecting two nodes indexed as with the numbering above. We adopt the convention that node id 1 < node id 2.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Each surface will have two neighbors where the element on the left locally as one \"walks\" from node id 1 to node id 2 is taken to be the primary element and the element locally on the right is taken to be the secondary element. If, however, there is no secondary element index, then the surface lies along a physical boundary. In this case the only available element index is considered to be primary and the secondary index is set to zero.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The final two index numbers within the neighbor information list are used to identify the local surface within each element. The first local surface index (on the primary element) will always be positive whereas the second local surface index (on the primary element) can be positive or negative. If the second local surface index is positive, then the local coordinate systems in the primary element and secondary element match, i.e., the indexing on either side runs from 1:polydeg+1. However, if the local surface index of the secondary element is negative in the mesh file, then the coordinate system in the secondary element is flipped with respect to the primary element. Therefore, care must be taken in the implementation to ensure that the primary element indexing runs from 1:polydeg+1 whereas the secondary element indexing must run in reverse from polydeg+1:-1:1. Finally, if the secondary element index is zero, then so will be the local surface index because the surface is on a physical boundary. Also, there is no flipping of coordinate indexing required at the physical boundary because only the primary element's coordinate system exists.","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Three-examples:-One-along-a-physical-boundary-and-two-along-interior-surfaces.","page":"Unstructured mesh","title":"Three examples: One along a physical boundary and two along interior surfaces.","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Along edge {8} we connect node (2) to node (7) and are along a physical boundary in element 3 with the local surface index 1 and the neighbor information:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 2 7 3 0 1 0","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Along edge {1} we connect node (2) to node (4) such that the primary element is 3 with local surface index 2 and the secondary element is 2 with local surface index 1. Furthermore, we see that coordinate system in the secondary element 2 is flipped with respect to the primary element's coordinate system such that the sign of the local surface index in the secondary element flips. This gives the following neighbor information:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 2 4 3 2 2 -1","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Along edge {4} we connect node (1) to node (4) such that the primary element is 1 with local surface index 2 and the secondary element is 3 with local surface index 3. The coordinate systems in both elements match and no sign change is required on the local surface index in the secondary element:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 1 4 1 3 2 3","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We collect the complete neighbor information for the example mesh above:","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 2 4 3 2 2 -1\n 3 5 1 0 4 0\n 1 5 1 0 1 0\n 1 4 1 3 2 3\n 2 6 2 0 2 0\n 1 7 3 0 4 0\n 3 6 2 0 3 0\n 2 7 3 0 1 0\n 3 4 2 1 4 -3","category":"page"},{"location":"meshes/unstructured_quad_mesh/#List-of-elements","page":"Unstructured mesh","title":"List of elements","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Each quadrilateral element in the unstructured mesh is dictated by four corner points with indexing taken from the numbering given by the corner list above. We connect a set of four corner points (starting from the bottom left) in an anti-clockwise fashion thus making the element right-handed indicated using the circular arrow in the figure above. In turn, this right-handedness defines the local surface indexing (i.e. the four local sides) and the local (xi eta) coordinate system. For example, the four corners for element 1 would be listed as","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 5 1 4 3","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The mesh file also encodes information for curved surfaces either interior to the domain (as surface {9} above) or along the physical boundaries. A set of check digits are included directly below the four corner indexes to indicate whether the local surface index (1, 2, 3, or 4) within the element is straight sided, 0, or is curved, 1. If the local surface is straight sided no additional information is necessary during the mesh file read in. But for any curved surfaces the mesh file provides (x,y) coordinate values in order to construct an interpolant of this surface with the mesh polynomial order at the Chebyshev-Gauss-Lobatto nodes. This list of (x,y) data will be given in the direction of the local coordinate system.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"The last piece of information provided by the mesh file are labels for the different surfaces of an element. These labels are useful to set boundary conditions along physical surfaces. The labels can be short descriptive words. The label --- indicates an internal surface where no boundary condition is required.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"As an example, the complete information for element 1 in the example mesh would be","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 5 1 4 3\n 0 0 1 1\n 1.000000000000000 1.000000000000000\n 1.024948365654583 0.934461926834452\n 1.116583018200151 0.777350964621867\n 1.295753434047077 0.606254343587194\n 1.537500000000000 0.462500000000000\n 1.768263070247418 0.329729152118310\n 1.920916981799849 0.185149035378133\n 1.986035130050921 0.054554577460044\n 2.000000000000000 0.0\n 0.0 0.0\n 0.035513826946206 0.105291711848750\n 0.148591270347399 0.317731556850611\n 0.340010713990041 0.452219430075470\n 0.575000000000000 0.462500000000000\n 0.788022294598950 0.483764065630034\n 0.926408729652601 0.644768443149389\n 0.986453164464803 0.883724792445746\n 1.000000000000000 1.000000000000000\n Slant --- --- Bezier","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"where the curved boundary information is encoded \"back to back\". That is, the first nine (x,y) nodes in the list above correspond to the interior boundary curve along local side 3 in element 1 and the next nine (x,y) nodes denote the curved physical boundary named Bezier along local side 4.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We collect the complete set of element information for the example mesh","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" 5 1 4 3\n 0 0 1 1\n 1.000000000000000 1.000000000000000\n 1.024948365654583 0.934461926834452\n 1.116583018200151 0.777350964621867\n 1.295753434047077 0.606254343587194\n 1.537500000000000 0.462500000000000\n 1.768263070247418 0.329729152118310\n 1.920916981799849 0.185149035378133\n 1.986035130050921 0.054554577460044\n 2.000000000000000 0.0\n 0.0 0.0\n 0.035513826946206 0.105291711848750\n 0.148591270347399 0.317731556850611\n 0.340010713990041 0.452219430075470\n 0.575000000000000 0.462500000000000\n 0.788022294598950 0.483764065630034\n 0.926408729652601 0.644768443149389\n 0.986453164464803 0.883724792445746\n 1.000000000000000 1.000000000000000\n Slant --- --- Bezier\n 4 2 6 3\n 0 0 0 1\n 2.000000000000000 0.0\n 1.986035130050921 0.054554577460044\n 1.920916981799849 0.185149035378133\n 1.768263070247418 0.329729152118310\n 1.537500000000000 0.462500000000000\n 1.295753434047077 0.606254343587194\n 1.116583018200151 0.777350964621867\n 1.024948365654583 0.934461926834452\n 1.000000000000000 1.000000000000000\n --- Right Top ---\n 7 2 4 1\n 0 0 0 0\n Right --- --- Bottom","category":"page"},{"location":"meshes/unstructured_quad_mesh/#Trixi.jl-on-an-unstructured-quadrilateral-mesh","page":"Unstructured mesh","title":"Trixi.jl on an unstructured quadrilateral mesh","text":"","category":"section"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"We provide an example simulation on an unstructured quadrilateral mesh by executing","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"julia> trixi_include(default_example_unstructured())","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":"Note this may download a copy of the mesh file described above for the three element unstructured mesh. This elixir provides the solution for the compressible Euler equations in two spatial dimensions for a smooth propagating wave solution. Below we provide the time evolution of the pressure wave for this example created with the Trixi2Vtk tool and visualized using ParaView.","category":"page"},{"location":"meshes/unstructured_quad_mesh/","page":"Unstructured mesh","title":"Unstructured mesh","text":" \n
    ","category":"page"},{"location":"reference-trixibase/#TrixiBase.jl-API","page":"TrixiBase.jl","title":"TrixiBase.jl API","text":"","category":"section"},{"location":"reference-trixibase/","page":"TrixiBase.jl","title":"TrixiBase.jl","text":"CurrentModule = TrixiBase","category":"page"},{"location":"reference-trixibase/","page":"TrixiBase.jl","title":"TrixiBase.jl","text":"Modules = [TrixiBase]","category":"page"},{"location":"reference-trixibase/#TrixiBase.trixi_include-Tuple{Module, AbstractString}","page":"TrixiBase.jl","title":"TrixiBase.trixi_include","text":"trixi_include([mod::Module=Main,] elixir::AbstractString; kwargs...)\n\ninclude 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. Its basic purpose is to make it easier to modify some parameters while running simulations 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.\n\nBefore replacing assignments in elixir, the keyword argument maxiters is inserted into calls to solve with it's default value used in the SciML ecosystem for ODEs, see the \"Miscellaneous\" section of the documentation.\n\nExamples\n\njulia> using TrixiBase, Trixi\n\njulia> redirect_stdout(devnull) do\n trixi_include(@__MODULE__, joinpath(examples_dir(), \"tree_1d_dgsem\", \"elixir_advection_extended.jl\"),\n tspan=(0.0, 0.1))\n sol.t[end]\n end\n[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n0.1\n\n\n\n\n\n","category":"method"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"EditURL = \"../../literate/src/files/time_stepping.jl\"","category":"page"},{"location":"tutorials/time_stepping/#time_stepping","page":"18 Explicit time stepping","title":"18: Explicit time stepping","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"For the time integration, Trixi.jl uses the package OrdinaryDiffEq.jl from the SciML ecosystem. The interface to this package is the solve(...) function. It always requires an ODE problem and a time integration algorithm as input parameters.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"solve(ode, alg; kwargs...)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"In Trixi.jl, the ODE problem is created by semidiscretize(semi, tspan) for a semidiscretization semi and the time span tspan. In particular, semidiscretize returns an ODEProblem used by OrdinaryDiffEq.jl.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"OrdinaryDiffEq.jl provides many integration algorithms, which are summarized in the documentation. Particularly interesting for Trixi.jl are their strong stability preserving (SSP) methods and low-storage methods. There are some differences regarding the choice of the used time step.","category":"page"},{"location":"tutorials/time_stepping/#adaptive_step_sizes","page":"18 Explicit time stepping","title":"Error-based adaptive step sizes","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"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 or elixir_euler_astro_jet_amr.jl.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"Other error-based adaptive integration algorithms are for instance RDPK3SpFSAL35, RDPK3Sp35, RDPK3SpFSAL49, RDPK3Sp49, RDPK3SpFSAL510, RDPK3Sp510.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"They already contain an error-based adaptive step size control and heuristics to guess 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.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"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.","category":"page"},{"location":"tutorials/time_stepping/#CFL-based-step-size-control","page":"18 Explicit time stepping","title":"CFL-based step size control","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"The SciML ecosystem also provides time integration algorithms without adaptive time stepping on their own, such as CarpenterKennedy2N54. Moreover, you also can deactivate the automatic adaptivity of adaptive integration algorithms by passing adaptive=false in the solve function.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"These algorithms require another way of setting the step size. You have to pass dt=... in the solve function. Without other settings, the simulation uses this fixed time step.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"For hyperbolic PDEs, it is natural to use an adaptive CFL-based step size control. Here, the time step is proportional to a ratio of the local measure of mesh spacing Delta x_i for an element i and the maximum (local) wave speed lambda_max related to the largest-magnitude eigenvalue of the flux Jacobian of the hyperbolic system.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"Delta t_n = textCFL * min_i fracDelta x_ilambda_max(u_i^n)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"We compute Delta x_i by scaling the element size by a factor of 1(N+1), cf. Gassner and Kopriva (2011), Section 5.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"Trixi.jl provides such a CFL-based step size control. It is implemented as the callback StepsizeCallback.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"stepsize_callback = StepsizeCallback(; cfl=1.0)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"A suitable CFL number depends on many parameters such as the chosen grid, the integration algorithm and the polynomial degree of the spatial DG discretization. So, the optimal number for an example is mostly determined experimentally.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"You can add this CFL-based step size control to your simulation like any other callback.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"callbacks = CallbackSet(stepsize_callback)\nalg = CarpenterKennedy2N54(williamson_condition=false)\nsolve(ode, alg;\n dt=1.0 # solve needs some value here but it will be overwritten by the stepsize_callback\n callback=callbacks)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"You can find simple examples with a CFL-based step size control for instance in the elixirs elixir_advection_basic.jl or elixir_euler_source_terms.jl.","category":"page"},{"location":"tutorials/time_stepping/#Package-versions","page":"18 Explicit time stepping","title":"Package versions","text":"","category":"section"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"","category":"page"},{"location":"tutorials/time_stepping/","page":"18 Explicit time stepping","title":"18 Explicit time stepping","text":"This page was generated using Literate.jl.","category":"page"},{"location":"contributing/#Contributing","page":"Contributing","title":"Contributing","text":"","category":"section"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"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).","category":"page"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"Trixi.jl and its contributions are licensed under the MIT license (see License). 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.","category":"page"},{"location":"contributing/#Developer-Certificate-of-Origin-(Version-1.1)","page":"Contributing","title":"Developer Certificate of Origin (Version 1.1)","text":"","category":"section"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"The following text was taken from https://developercertificate.org:","category":"page"},{"location":"contributing/","page":"Contributing","title":"Contributing","text":"Developer Certificate of Origin\nVersion 1.1\n\nCopyright (C) 2004, 2006 The Linux Foundation and its contributors.\n1 Letterman Drive\nSuite D4700\nSan Francisco, CA, 94129\n\nEveryone is permitted to copy and distribute verbatim copies of this\nlicense document, but changing it is not allowed.\n\n\nDeveloper's Certificate of Origin 1.1\n\nBy making a contribution to this project, I certify that:\n\n(a) The contribution was created in whole or in part by me and I\n have the right to submit it under the open source license\n indicated in the file; or\n\n(b) The contribution is based upon previous work that, to the best\n of my knowledge, is covered under an appropriate open source\n license and I have the right under that license to submit that\n work with modifications, whether created in whole or in part\n by me, under the same open source license (unless I am\n permitted to submit under a different license), as indicated\n in the file; or\n\n(c) The contribution was provided directly to me by some other\n person who certified (a), (b) or (c) and I have not modified\n it.\n\n(d) I understand and agree that this project and the contribution\n are public and that a record of the contribution (including all\n personal information I submit with it, including my sign-off) is\n maintained indefinitely and may be redistributed consistent with\n this project or the open source license(s) involved.","category":"page"},{"location":"performance/#Performance","page":"Performance","title":"Performance","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"Trixi.jl is designed to balance performance and readability. Since Julia provides a lot of zero-cost abstractions, it is often possible to optimize both goals simultaneously.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"The usual development workflow in Julia is","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Make it work.\nMake it nice.\nMake it fast.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"To achieve the third step, you should be familiar with (at least) the section on performance tips in the Julia manual. Here, we just list some important aspects you should consider when developing Trixi.jl.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Consider using @views/view(...) when using array slices, except on the left-side of an assignment (further details).\nFunctions are essentially for free, since they are usually automatically inlined where it makes sense (using @inline can be used as an additional hint to the compiler) (further details).\nFunction barriers can improve performance due to type stability (further details).\nLook for type instabilities using @code_warntype. Consider using @descend from Cthulhu.jl to investigate deeper call chains.","category":"page"},{"location":"performance/#Manual-benchmarking","page":"Performance","title":"Manual benchmarking","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"If you modify some internal parts of Trixi.jl, you should check the impact on performance. Hence, you should at least investigate the performance roughly by comparing the reported timings of several elixirs. Deeper investigations and micro-benchmarks should usually use BenchmarkTools.jl. For example, the following steps were used to benchmark the changes introduced in PR #256.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"git checkout e7ebf3846b3fd62ee1d0042e130afb50d7fe8e48 (new version)\nStart julia --threads=1 --check-bounds=no.\nExecute the following code in the REPL to benchmark the rhs! call at the final state.\njulia> using BenchmarkTools, Revise; using Trixi\n\njulia> trixi_include(\"examples/2d/elixir_euler_sedov_blast_wave.jl\")\n\njulia> du_test = copy(sol.u[end]); u_test = copy(sol.u[end]);\n\njulia> @benchmark Trixi.rhs!(\n $(du_test),\n $(u_test),\n $(semi),\n $(sol.t[end]))\nBenchmarkTools.Trial:\n memory estimate: 10.48 KiB\n allocs estimate: 67\n --------------\n minimum time: 4.510 ms (0.00% GC)\n median time: 4.646 ms (0.00% GC)\n mean time: 4.699 ms (0.00% GC)\n maximum time: 7.183 ms (0.00% GC)\n --------------\n samples: 1065\n evals/sample: 1\n\nshell> git checkout 222241ff54f8a4ca9876cc1fc25ae262416a4ea0\n\njulia> trixi_include(\"examples/2d/elixir_euler_sedov_blast_wave.jl\")\n\njulia> @benchmark Trixi.rhs!(\n $(du_test),\n $(u_test),\n $(semi),\n $(sol.t[end]))\nBenchmarkTools.Trial:\n memory estimate: 10.36 KiB\n allocs estimate: 67\n --------------\n minimum time: 4.500 ms (0.00% GC)\n median time: 4.635 ms (0.00% GC)\n mean time: 4.676 ms (0.00% GC)\n maximum time: 5.880 ms (0.00% GC)\n --------------\n samples: 1070\n evals/sample: 1\nRun the @benchmark ... commands multiple times to see whether there are any significant fluctuations.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Follow these steps for both commits you want to compare. The relevant benchmark results you should typically be looking at are the median and mean values of the runtime and the memory/allocs estimate. In this example, the differences of the runtimes are of the order of the fluctuations one gets when running the benchmarks multiple times. Since the memory/allocs are (roughly) the same, there doesn't seem to be a significant performance regression here.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"You can also make it more detailed by benchmarking only, e.g., the calculation of the volume terms, but whether that's necessary depends on the modifications you made and their (potential) impact.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Some more detailed description of manual profiling and benchmarking as well as resulting performance improvements of Trixi.jl are given in the following blog posts.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Improving performance of AMR with p4est, cf. #638\nImproving performance of EC methods, cf. #643","category":"page"},{"location":"performance/#Automated-benchmarking","page":"Performance","title":"Automated benchmarking","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"We use PkgBenchmark.jl to provide a standard set of benchmarks for Trixi.jl. The relevant benchmark script is benchmark/benchmarks.jl. To benchmark the changes made in a PR, please proceed as follows:","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Check out the latest main branch of your Trixi.jl development repository.\nCheck out the latest development branch of your PR.\nChange your working directory to the benchmark directory of Trixi.jl.\nExecute julia run_benchmarks.jl.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"This will take some hours to complete and requires at least 8 GiB of RAM. When everything is finished, some output files will be created in the benchmark directory of Trixi.jl.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"warning: Warning\nPlease note that the benchmark scripts use --check-bounds=no at the moment. Thus, they will not work in any useful way for Julia v1.10 (and newer?), see Julia issue #50985.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"You can also run a standard set of benchmarks manually via","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"julia> using PkgBenchmark, Trixi\n\njulia> results = benchmarkpkg(Trixi, BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`))\n\njulia> export_markdown(pkgdir(Trixi, \"benchmark\", \"single_benchmark.md\"), results)","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"This will save a markdown file with a summary of the benchmark results similar to this example. Note that this will take quite some time. Additional options are described in the docs of PkgBenchmark.jl. A particularly useful option is to specify a BenchmarkConfig including Julia command line options affecting the performance such as disabling bounds-checking and setting the number of threads.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"A useful feature when developing Trixi.jl is to compare the performance of Trixi.jl's current state vs. the main branch. This can be achieved by executing","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"julia> using PkgBenchmark, Trixi\n\njulia> results = judge(Trixi,\n BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`), # target\n BenchmarkConfig(juliacmd=`$(Base.julia_cmd()) --check-bounds=no --threads=1`, id=\"main\") # baseline\n )\n\njulia> export_markdown(pkgdir(Trixi, \"benchmark\", \"results.md\"), results)","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"By default, the target is the current state of the repository. Remember that you need to be in a clean state (commit or stash your changes) to run this successfully. You can also run this comparison and an additional one using two threads via","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"julia> include(\"benchmark/run_benchmarks.jl\")","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Then, markdown files including the results are saved in benchmark/. This example result was obtained using a GitHub action for the PR #535. Note that GitHub actions run on in the cloud in a virtual machine. Hence, we do not really have control over it and performance results must be taken with a grain of salt. Nevertheless, significant runtime differences and differences of memory allocations should be robust indicators of performance changes.","category":"page"},{"location":"performance/#Runtime-performance-vs.-latency-aka-using-@nospecialize-selectively","page":"Performance","title":"Runtime performance vs. latency aka using @nospecialize selectively","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"Usually, Julia will compile specialized versions of each method, using as much information from the types of function arguments as possible (based on some heuristics). The compiler will generate code that is as efficient as comparable code written in a low-level language such as C or Fortran. However, there are cases where the runtime performance does not really matter but the time needed to compile specializations becomes significant. This is related to latency or the time-to-first-plot problem, well-known in the Julia community. In such a case, it can be useful to remove some burden from the compiler by avoiding specialization on every possible argument types using the macro @nospecialize. A prime example of such a case is pretty printing of structs in the Julia REPL, see the associated PR for further discussions.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"As a rule of thumb:","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Do not use @nospecialize in performance-critical parts, in particular not for methods involved in computing Trixi.rhs!.\nConsider using @nospecialize for methods like custom implementations of Base.show.","category":"page"},{"location":"performance/#performance-metrics","page":"Performance","title":"Performance metrics of the AnalysisCallback","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"The AnalysisCallback computes two performance indicators that you can use to evaluate the serial and parallel performance of Trixi.jl. They represent measured run times that are normalized by the number of rhs! evaluations and the number of degrees of freedom of the problem setup. The normalization ensures that we can compare different measurements for each type of indicator independent of the number of time steps or mesh size. All indicators have in common that they are still in units of time, thus lower is better for each of them.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"Here, the term \"degrees of freedom\" (DOFs) refers to the number of independent state vectors that are used to represent the numerical solution. For example, if you use a DGSEM-type scheme in 2D on a mesh with 8 elements and with 5-by-5 Gauss-Lobatto nodes in each element (i.e., a polynomial degree of 4), the total number of DOFs would be","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"n_textDOFsDGSEM = textnumber of elements cdot textnumber of nodes per element = 8 cdot (5 cdot 5) = 200","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"In contrast, for a finite volume-type scheme on a mesh with 8 elements, the total number of DOFs would be (independent of the number of spatial dimensions)","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"n_textDOFsFV = textnumber of elements = 8","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"since for standard finite volume methods you store a single state vector in each element. Note that we specifically count the number of state vectors and not the number of state variables for the DOFs. That is, in the previous example n_textDOFsFV is equal to 8 independent of whether this is a compressible Euler setup with 5 state variables or a linear scalar advection setup with one state variable.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"For each indicator, the measurements are always since the last invocation of the AnalysisCallback. That is, if the analysis callback is called multiple times, the indicators are repeatedly computed and can thus also be used to track the performance over the course of a longer simulation, e.g., to analyze setups with varying performance characteristics. Note that the time spent in the AnalysisCallback itself is always excluded, i.e., the performance measurements are not distorted by potentially expensive solution analysis computations. All other parts of a Trixi.jl simulation are included, however, thus make sure that you disable everything you do not want to be measured (such as I/O callbacks, visualization etc.).","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"note: Performance indicators and adaptive mesh refinement\nCurrently it is not possible to compute meaningful performance indicators for a simulation with arbitrary adaptive mesh refinement, since this would require to explicitly keep track of the number of DOF updates due to the mesh size changing repeatedly. The only way to do this at the moment is by setting the analysis interval to the same value as the AMR interval.","category":"page"},{"location":"performance/#Local,-rhs!-only-indicator","page":"Performance","title":"Local, rhs!-only indicator","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"The local, rhs!-only indicator is computed as","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"texttimeDOFrhs = fract_texttextttrhsn_textDOFslocal cdot n_textcallstextttrhs","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"where t_texttextttrhs is the accumulated time spent in rhs!, n_textDOFslocal is the local number of DOFs (i.e., on the current MPI rank; if doing a serial run, you can just think of this as the number of DOFs), and n_textcallstextttrhs is the number of times the rhs! function has been evaluated. Note that for this indicator, we measure only the time spent in rhs!, i.e., by definition all computations outside of rhs! - specifically all other callbacks and the time integration method - are not taken into account.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"The local, rhs!-only indicator is usually most useful if you do serial measurements and are interested in the performance of the implementation of your core numerical methods (e.g., when doing performance tuning).","category":"page"},{"location":"performance/#Performance-index-(PID)","page":"Performance","title":"Performance index (PID)","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"The performance index (PID) is computed as","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"textPID = fract_textwall cdot n_textranksMPIn_textDOFsglobal cdot n_textcallstextttrhs","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"where t_textwall is the walltime since the last call to the AnalysisCallback, n_textranksMPI is the number of MPI ranks used, n_textDOFsglobal is the global number of DOFs (i.e., the sum of DOFs over all MPI ranks; if doing a serial run, you can just think of this as the number of DOFs), and n_textcallstextttrhs is the number of times the rhs! function has been evaluated since the last call to the AnalysisCallback. The PID measures everything except the time spent in the AnalysisCallback itself - specifically, all other callbacks and the time integration method itself are included.","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"The PID is usually most useful if you would like to compare the parallel performance of your code to its serial performance. Specifically, it allows you to evaluate the parallelization overhead of your code by giving you a measure of the resources that are necessary to solve a given simulation setup. In a sense, it mimics the \"core hours\" metric that is often used by supercomputer centers to measure how many resources a particular compute job requires. It can thus be seen as a proxy for \"energy used\" and, as an extension, \"monetary cost\".","category":"page"},{"location":"performance/","page":"Performance","title":"Performance","text":"note: Initialization overhead in measurements\nWhen using one of the integration schemes from OrdinaryDiffEq.jl, their implementation will initialize some OrdinaryDiffEq.jl-specific information during the first time step. Among other things, one additional call to rhs! is performed. Therefore, make sure that for performance measurements using the PID either the number of timesteps or the workload per rhs! call is large enough to make the initialization overhead negligible. Note that the extra call to rhs! is properly accounted for in both the number of calls and the measured time, so you do not need to worry about it being expensive. If you want a perfect timing result, you need to set the analysis interval such that the AnalysisCallback is invoked at least once during the course of the simulation and discard the first PID value.","category":"page"},{"location":"performance/#Performance-issues-with-multi-threaded-reductions","page":"Performance","title":"Performance issues with multi-threaded reductions","text":"","category":"section"},{"location":"performance/","page":"Performance","title":"Performance","text":"False sharing is a known performance issue for systems with distributed caches. It also occurred for the implementation of a thread parallel bounds checking routine for the subcell IDP limiting in PR #1736. After some testing and discussion, it turned out that initializing a vector of length n * Threads.nthreads() and only using every n-th entry instead of a vector of length Threads.nthreads() fixes the problem. Since there are no processors with caches over 128B, we use n = 128B / size(uEltype). Now, the bounds checking routine of the IDP limiting scales as hoped.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"EditURL = \"../../literate/src/files/custom_semidiscretization.jl\"","category":"page"},{"location":"tutorials/custom_semidiscretization/#custom_semidiscretization","page":"20 Custom semidiscretizations","title":"20: Custom semidiscretizations","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"As described in the overview section, semidiscretizations are high-level descriptions of spatial discretizations in Trixi.jl. Trixi.jl's main focus is on hyperbolic conservation laws represented in a SemidiscretizationHyperbolic. Hyperbolic-parabolic problems based on the advection-diffusion equation or the compressible Navier-Stokes equations can be represented in a SemidiscretizationHyperbolicParabolic. This is described in the basic tutorial on parabolic terms and its extension to custom parabolic terms. In this tutorial, we will describe how these semidiscretizations work and how they can be used to create custom semidiscretizations involving also other tasks.","category":"page"},{"location":"tutorials/custom_semidiscretization/#Overview-of-the-right-hand-side-evaluation","page":"20 Custom semidiscretizations","title":"Overview of the right-hand side evaluation","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"The semidiscretizations provided by Trixi.jl are set up to create ODEProblems from the SciML ecosystem for ordinary differential equations. In particular, a spatial semidiscretization can be wrapped in an ODE problem using semidiscretize, which returns an ODEProblem. This ODEProblem bundles an initial condition, a right-hand side (RHS) function, the time span, and possible parameters. The ODEProblems created by Trixi.jl use the semidiscretization passed to semidiscretize as a parameter. For a SemidiscretizationHyperbolic, the ODEProblem wraps Trixi.rhs! as ODE RHS. For a SemidiscretizationHyperbolicParabolic, Trixi.jl uses a SplitODEProblem combining Trixi.rhs_parabolic! for the (potentially) stiff part and Trixi.rhs! for the other part.","category":"page"},{"location":"tutorials/custom_semidiscretization/#Standard-Trixi.jl-setup","page":"20 Custom semidiscretizations","title":"Standard Trixi.jl setup","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"In this tutorial, we will consider the linear advection equation with source term","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"partial_t u(tx) + partial_x u(tx) = -exp(-t) sinbigl(pi (x - t) bigr)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"with periodic boundary conditions in the domain [-1, 1] as a model problem. The initial condition is","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"u(0x) = sin(pi x)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"The source term results in some damping and the analytical solution","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"u(tx) = exp(-t) sinbigl(pi (x - t) bigr)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"First, we discretize this equation using the standard functionality of Trixi.jl.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"using Trixi, OrdinaryDiffEq, Plots","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"The linear scalar advection equation is already implemented in Trixi.jl as LinearScalarAdvectionEquation1D. We construct it with an advection velocity 1.0.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"equations = LinearScalarAdvectionEquation1D(1.0)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we use a standard DGSEM solver.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"solver = DGSEM(polydeg = 3)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We create a simple TreeMesh in 1D.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"coordinates_min = (-1.0,)\ncoordinates_max = (+1.0,)\nmesh = TreeMesh(coordinates_min, coordinates_max;\n initial_refinement_level = 4,\n n_cells_max = 10^4,\n periodicity = true)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We wrap everything in in a semidiscretization and pass the source terms as a standard Julia function. Please note that Trixi.jl uses SVectors from StaticArrays.jl to store the conserved variables u. Thus, the return value of the source terms must be wrapped in an SVector - even if we consider just a scalar problem.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function initial_condition(x, t, equations)\n return SVector(exp(-t) * sinpi(x[1] - t))\nend\n\nfunction source_terms_standard(u, x, t, equations)\n return -initial_condition(x, t, equations)\nend\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition,\n solver;\n source_terms = source_terms_standard)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Now, we can create the ODEProblem, solve the resulting ODE using a time integration method from OrdinaryDiffEq.jl, and visualize the numerical solution at the final time using Plots.jl.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"tspan = (0.0, 3.0)\node = semidiscretize(semi, tspan)\n\nsol = solve(ode, RDPK3SpFSAL49(); ode_default_options()...)\n\nplot(sol; label = \"numerical sol.\", legend = :topright)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We can also plot the analytical solution for comparison. Since Trixi.jl uses SVectors for the variables, we take their first (and only) component to get the scalar value for manual plotting.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"let\n x = range(-1.0, 1.0; length = 200)\n plot!(x, first.(initial_condition.(x, sol.t[end], equations)),\n label = \"analytical sol.\", linestyle = :dash, legend = :topright)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We can also add the initial condition to the plot.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"plot!(sol.u[1], semi, label = \"u0\", linestyle = :dot, legend = :topleft)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"You can of course also use some callbacks provided by Trixi.jl as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"summary_callback = SummaryCallback()\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi; interval = analysis_interval)\nalive_callback = AliveCallback(; analysis_interval)\ncallbacks = CallbackSet(summary_callback,\n analysis_callback,\n alive_callback)\n\nsol = solve(ode, RDPK3SpFSAL49();\n ode_default_options()..., callback = callbacks)\nsummary_callback()","category":"page"},{"location":"tutorials/custom_semidiscretization/#Using-a-custom-ODE-right-hand-side-function","page":"20 Custom semidiscretizations","title":"Using a custom ODE right-hand side function","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we will solve the same problem but use our own ODE RHS function. To demonstrate this, we will artificially create a global variable containing the current time of the simulation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"const GLOBAL_TIME = Ref(0.0)\n\nfunction source_terms_custom(u, x, t, equations)\n t = GLOBAL_TIME[]\n return -initial_condition(x, t, equations)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we create our own RHS function to update the global time of the simulation before calling the RHS function from Trixi.jl.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function rhs_source_custom!(du_ode, u_ode, semi, t)\n GLOBAL_TIME[] = t\n Trixi.rhs!(du_ode, u_ode, semi, t)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we create an ODEProblem manually copying over the data from the one we got from semidiscretize earlier.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"ode_source_custom = ODEProblem(rhs_source_custom!,\n ode.u0,\n ode.tspan,\n ode.p #= semi =#)\nsol_source_custom = solve(ode_source_custom, RDPK3SpFSAL49();\n ode_default_options()...)\n\nplot(sol_source_custom; label = \"numerical sol.\")\nlet\n x = range(-1.0, 1.0; length = 200)\n plot!(x, first.(initial_condition.(x, sol_source_custom.t[end], equations)),\n label = \"analytical sol.\", linestyle = :dash, legend = :topleft)\nend\nplot!(sol_source_custom.u[1], semi, label = \"u0\", linestyle = :dot, legend = :topleft)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"This also works with callbacks as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"summary_callback = SummaryCallback()\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi; interval = analysis_interval)\nalive_callback = AliveCallback(; analysis_interval)\ncallbacks = CallbackSet(summary_callback,\n analysis_callback,\n alive_callback)\n\nsol = solve(ode_source_custom, RDPK3SpFSAL49();\n ode_default_options()..., callback = callbacks)\nsummary_callback()","category":"page"},{"location":"tutorials/custom_semidiscretization/#Setting-up-a-custom-semidiscretization","page":"20 Custom semidiscretizations","title":"Setting up a custom semidiscretization","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Using a global constant is of course not really nice from a software engineering point of view. Thus, it can often be useful to collect additional data in the parameters of the ODEProblem. Thus, it is time to create our own semidiscretization. Here, we create a small wrapper of a standard semidiscretization of Trixi.jl and the current global time of the simulation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"struct CustomSemidiscretization{Semi, T} <: Trixi.AbstractSemidiscretization\n semi::Semi\n t::T\nend\n\nsemi_custom = CustomSemidiscretization(semi, Ref(0.0))","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"To get pretty printing in the REPL, you can consider specializing","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Base.show(io::IO, parameters::CustomSemidiscretization)\nBase.show(io::IO, ::MIME\"text/plain\", parameters::CustomSemidiscretization)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"for your custom semidiscretiation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Next, we create our own source terms that use the global time stored in the custom semidiscretiation.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"source_terms_custom_semi = let semi_custom = semi_custom\n function source_terms_custom_semi(u, x, t, equations)\n t = semi_custom.t[]\n return -initial_condition(x, t, equations)\n end\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"We also create a custom ODE RHS to update the current global time stored in the custom semidiscretization. We unpack the standard semidiscretization created by Trixi.jl and pass it to Trixi.rhs!.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function rhs_semi_custom!(du_ode, u_ode, semi_custom, t)\n semi_custom.t[] = t\n Trixi.rhs!(du_ode, u_ode, semi_custom.semi, t)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Finally, we set up an ODEProblem and solve it numerically.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"ode_semi_custom = ODEProblem(rhs_semi_custom!,\n ode.u0,\n ode.tspan,\n semi_custom)\nsol_semi_custom = solve(ode_semi_custom, RDPK3SpFSAL49();\n ode_default_options()...)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"If we want to make use of additional functionality provided by Trixi.jl, e.g., for plotting, we need to implement a few additional specializations. In this case, we forward everything to the standard semidiscretization provided by Trixi.jl wrapped in our custom semidiscretization.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Base.ndims(semi::CustomSemidiscretization) = ndims(semi.semi)\nfunction Trixi.mesh_equations_solver_cache(semi::CustomSemidiscretization)\n Trixi.mesh_equations_solver_cache(semi.semi)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Now, we can plot the numerical solution as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"plot(sol_semi_custom; label = \"numerical sol.\")\nlet\n x = range(-1.0, 1.0; length = 200)\n plot!(x, first.(initial_condition.(x, sol_semi_custom.t[end], equations)),\n label = \"analytical sol.\", linestyle = :dash, legend = :topleft)\nend\nplot!(sol_semi_custom.u[1], semi, label = \"u0\", linestyle = :dot, legend = :topleft)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"This also works with many callbacks as usual. However, the AnalysisCallback requires some special handling since it makes use of a performance counter contained in the standard semidiscretizations of Trixi.jl to report some performance metrics. Here, we forward all accesses to the performance counter to the wrapped semidiscretization.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function Base.getproperty(semi::CustomSemidiscretization, s::Symbol)\n if s === :performance_counter\n wrapped_semi = getfield(semi, :semi)\n wrapped_semi.performance_counter\n else\n getfield(semi, s)\n end\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Moreover, the AnalysisCallback also performs some error calculations. We also need to forward them to the wrapped semidiscretization.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"function Trixi.calc_error_norms(func, u, t, analyzer,\n semi::CustomSemidiscretization,\n cache_analysis)\n Trixi.calc_error_norms(func, u, t, analyzer,\n semi.semi,\n cache_analysis)\nend","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"Now, we can work with the callbacks used before as usual.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"summary_callback = SummaryCallback()\nanalysis_interval = 100\nanalysis_callback = AnalysisCallback(semi_custom;\n interval = analysis_interval)\nalive_callback = AliveCallback(; analysis_interval)\ncallbacks = CallbackSet(summary_callback,\n analysis_callback,\n alive_callback)\n\nsol = solve(ode_semi_custom, RDPK3SpFSAL49();\n ode_default_options()..., callback = callbacks)\nsummary_callback()","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"For even more advanced usage of custom semidiscretizations, you may look at the source code of the ones contained in Trixi.jl, e.g.,","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"SemidiscretizationHyperbolicParabolic\nSemidiscretizationEulerGravity\nSemidiscretizationEulerAcoustics\nSemidiscretizationCoupled","category":"page"},{"location":"tutorials/custom_semidiscretization/#Package-versions","page":"20 Custom semidiscretizations","title":"Package versions","text":"","category":"section"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"","category":"page"},{"location":"tutorials/custom_semidiscretization/","page":"20 Custom semidiscretizations","title":"20 Custom semidiscretizations","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"EditURL = \"../../literate/src/files/DGSEM_FluxDiff.jl\"","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#DGSEM_FluxDiff","page":"4 DGSEM with flux differencing","title":"4: DGSEM with flux differencing","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This tutorial starts with a presentation of the weak formulation of the discontinuous Galerkin spectral element method (DGSEM) in order to fix the notation of the used operators. Then, the DGSEM formulation with flux differencing (split form DGSEM) and its implementation in Trixi.jl is shown.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We start with the one-dimensional conservation law","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"u_t + f(u)_x = 0 qquad tin mathbbR^+ xinOmega","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"with the physical flux f.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We split the domain Omega into elements K with center x_K and size Delta x. With the transformation mapping x(xi)=x_K + fracDelta x2 xi we can transform the reference element -11 to every physical element. So, the equation can be restricted to the reference element using the determinant of the Jacobian matrix of the transformation mapping J=fracpartial xpartial xi=fracDelta x2.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"J u_t + f(u)_xi = 0 qquad tin mathbbR^+ xiin -11","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#The-weak-form-of-the-DGSEM","page":"4 DGSEM with flux differencing","title":"The weak form of the DGSEM","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We consider the so-called discontinuous Galerkin spectral element method (DGSEM) with collocation. It results from choosing a nodal DG ansatz using N+1 Gauss-Lobatto nodes xi_i in -11 with matching interpolation weights w_i, which are used for numerical integration and interpolation with the Lagrange polynomial basis l_i of degree N. The Lagrange functions are created with those nodes and hence fulfil a Kronecker property at the GL nodes. The weak formulation of the DGSEM for one element is","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"J underlinedotu(t) = - M^-1 B underlinef^* + M^-1 D^T M underlinef","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"where underlineu=(u_0 u_1 dots u_N)^TinmathbbR^N+1 is the collected pointwise evaluation of u at the discretization nodes and dotu = partial u partial t = u_t is the temporal derivative. The nodal values of the flux function f results with collocation in underlinef, since underlinef_j=f(underlineu_j). Moreover, we got the numerical flux f^*=f^*(u^- u^+).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We will now have a short overview over the operators we used.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The derivative matrix DinmathbbR^(N+1)times (N+1) mimics a spatial derivation on a discrete level with underlinef_x approx D underlinef. It is defined by D_ij = l_j(xi_i).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The diagonal mass matrix M is defined by M_ij=langle l_j l_irangle_N with the numerical scalar product langle cdot cdotrangle_N defined for functions f and g by","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"langle f grangle_N = int_-1 N^1 f(xi) g(xi) dxi = sum_k=0^N f(xi_k) g(xi_k) w_k","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The multiplication by M matches a discrete integration","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":" int_-1^1 f(xi) underlinel(xi) dxi approx M underlinef","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The boundary matrix B=textdiag(-1 0 0 1) represents an evaluation of a function at the boundaries xi_0=-1 and xi_N=1.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"For these operators the following property holds:","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":" M D + (M D)^T = B","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This is called the summation-by-parts (SBP) property since it mimics integration by parts on a discrete level (Gassner (2013)).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"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 or in more detail in Kopriva (2009).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This property shows the equivalence between the weak form and the following strong formulation of the DGSEM.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"beginalign*\nJ underlinedotu(t)\n= - M^-1 B underlinef^* + M^-1 D^T M underlinef5pt\n= - M^-1 B underlinef^* + M^-1 (B - MD) underlinef5pt\n= - M^-1 B (underlinef^* - underlinef) - D underlinef\nendalign*","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"More information about the equivalence you can find in Kopriva, Gassner (2010).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#DGSEM-with-flux-differencing","page":"4 DGSEM with flux differencing","title":"DGSEM with flux differencing","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"When using the diagonal SBP property it is possible to rewrite the application of the derivative operator D in the calculation of the volume integral into a subcell based finite volume type differencing formulation (Fisher, Carpenter (2013)). Generalizing","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"(D underlinef)_i = sum_j D_ij underlinef_j\n= 2sum_j frac12 D_ij (underlinef_j + underlinef_i)\neqqcolon 2sum_j D_ij f_textcentral(u_i u_j)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"we replace D underlinef in the strong form by 2D underlinef_vol(u^- u^+) with the consistent two-point volume flux f_vol and receive the DGSEM formulation with flux differencing (split form DGSEM) (Gassner, Winters, Kopriva (2016)).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"beginalign*\nJ underlinedotu(t) = - M^-1 B (underlinef^* - underlinef) - 2D underlinef_vol(u^- u^+)5pt\n= - M^-1 B (underlinef^* - underlinef_vol(underlineu underlineu)) - 2D underlinef_vol(u^- u^+)5pt\n= - M^-1 B underlinef_surface^* - (2D - M^-1 B) underlinef_vol5pt\n= - M^-1 B underlinef_surface^* - D_split underlinef_vol\nendalign*","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This formulation is in a weak form type formulation and can be implemented by using the derivative split matrix D_split=(2D-M^-1B) and two different fluxes. We divide between the surface flux f=f_surface used for the numerical flux f_surface^* and the already mentioned volume flux f_vol especially for this formulation.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This formulation creates a more stable version of DGSEM, because it fulfils entropy stability. Moreover it allows the construction of entropy conserving discretizations without relying on exact integration. This is achieved when using a two-point entropy conserving flux function as volume flux in the volume flux differencing formulation. Then, the numerical surface flux can be used to control the dissipation of the discretization and to guarantee decreasing entropy, i.e. entropy stability.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#fluxDiffExample","page":"4 DGSEM with flux differencing","title":"Implementation in Trixi.jl","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"Now, we have a look at the implementation of DGSEM with flux differencing with Trixi.jl.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using OrdinaryDiffEq, Trixi","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We implement a simulation for the compressible Euler equations in 2D","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"partial_t beginpmatrix rho rho v_1 rho v_2 rho e endpmatrix\n+ partial_x beginpmatrix rho v_1 rho v_1^2 + p rho v_1 v_2 (rho e +p) v_1 endpmatrix\n+ partial_y beginpmatrix rho v_2 rho v_1 v_2 rho v_2^2 + p (rho e +p) v_2 endpmatrix\n= beginpmatrix 0 0 0 0 endpmatrix","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"for an ideal gas with ratio of specific heats gamma=14. Here, rho is the density, v_1, v_2 the velocities, e the specific total energy and","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"p = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2) right)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"the pressure.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"gamma = 1.4\nequations = CompressibleEulerEquations2D(gamma)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"As our initial condition we will use a weak blast wave from Hennemann, Gassner (2020). The primitive variables are defined by","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"beginpmatrix rho v_1 v_2 p endpmatrix\n= beginpmatrix 10 00 00 10 endpmatrix textif x_2 05\ntextand beginpmatrix rho v_1 v_2 p endpmatrix\n= beginpmatrix 11691 01882 * cos(phi) 01882 * sin(phi) 1245 endpmatrix textelse","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"with phi = tan^-1(fracx_2x_1).","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This initial condition is implemented in Trixi.jl under the name initial_condition_weak_blast_wave.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"initial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"In Trixi.jl, flux differencing for the volume integral can be implemented with VolumeIntegralFluxDifferencing using symmetric two-point volume fluxes. First, we set up a simulation with the entropy conserving and kinetic energy preserving flux flux_ranocha by Hendrik Ranocha (2018) as surface and volume flux.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We will confirm the entropy conservation property numerically.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"volume_flux = flux_ranocha # = f_vol\nsolver = DGSEM(polydeg=3, surface_flux=volume_flux,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"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 or some basic elixirs.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"coordinates_min = (-2.0, -2.0)\ncoordinates_max = ( 2.0, 2.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=5,\n n_cells_max=10_000,\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_condition_periodic)\n\n# ODE solvers\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"To analyse the entropy conservation of the approximation, we will use the analysis calllback implemented in Trixi. It provides some information about the approximation including the entropy change.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"analysis_callback = AnalysisCallback(semi, interval=100);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We now run the simulation using flux_ranocha for both surface and volume flux.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=analysis_callback);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"A look at the change in entropy sum partial Spartial U cdot U_t in the analysis callback confirms that the flux is entropy conserving since the change is about machine precision.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We can plot the approximated solution at the time t=0.4.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"Now, we can use for instance the dissipative flux flux_lax_friedrichs as surface flux to get an entropy stable method.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using OrdinaryDiffEq, Trixi\n\ngamma = 1.4\nequations = CompressibleEulerEquations2D(gamma)\n\ninitial_condition = initial_condition_weak_blast_wave\n\nvolume_flux = flux_ranocha # = f_vol\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\ncoordinates_min = (-2.0, -2.0)\ncoordinates_max = ( 2.0, 2.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=5,\n n_cells_max=10_000,\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_condition_periodic)\n\n# ODE solvers\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan);\n\nanalysis_callback = AnalysisCallback(semi, interval=100);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"We now run the simulation using the volume flux flux_ranocha and surface flux flux_lax_friedrichs.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=analysis_callback);\nnothing #hide","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"The change in entropy confirms the expected entropy stability.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"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.jl provides for example flux_ranocha, flux_shima_etal, flux_chandrashekar, flux_kennedy_gruber. As surface flux you can use all volume fluxes and additionally for instance flux_lax_friedrichs, flux_hll, flux_hllc.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/#Package-versions","page":"4 DGSEM with flux differencing","title":"Package versions","text":"","category":"section"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"","category":"page"},{"location":"tutorials/DGSEM_FluxDiff/","page":"4 DGSEM with flux differencing","title":"4 DGSEM with flux differencing","text":"This page was generated using Literate.jl.","category":"page"},{"location":"multi-physics_coupling/#multi-physics-coupling","page":"Coupling","title":"Multi-physics coupling","text":"","category":"section"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"A complex simulation can consist of different spatial domains in which different equations are being solved, different numerical methods being used or the grid structure is different. One example would be a fluid in a tank and an extended hot plate attached to it. We would then like to solve the Navier-Stokes equations in the fluid domain and the heat conduction equations in the plate. The coupling would happen at the interface through the exchange of thermal energy.","category":"page"},{"location":"multi-physics_coupling/#Converter-coupling","page":"Coupling","title":"Converter coupling","text":"","category":"section"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"It may happen that the two systems to be coupled do not share any variables, but share some of the physics. In such a situation, the same physics is just represented in a different form and with a different set of variables. This is the case, for instance assuming two domains, if there is a fluid system in one domain and a Vlasov system in the other domain. In that case we would have variables representing distribution functions of the Vlasov system on one side and variables representing the mechanical quantities, like density, of the fluid system. To translate the fields from one description to the other one needs to use converter functions. These functions need to be hand tailored by the user in the elixir file where each pair of coupled systems requires two coupling functions, one for each direction.","category":"page"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"In the general case, we have a system A with m variables u_Ai i = 1 dots m and another system B with n variables u_Bj j = 1 dots n. We then define two coupling functions, one that transforms u_A into u_B and one that goes the other way.","category":"page"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"In their minimal form they take the position vector x, state vector u and the equations of the two coupled systems and return the transformed variables. By passing the equations we can make use of their parameters, if they are required. Examples can be seen in examples/structured_2d_dgsem/elixir_advection_coupled.jl.","category":"page"},{"location":"multi-physics_coupling/#Warning-about-binary-compatibility","page":"Coupling","title":"Warning about binary compatibility","text":"","category":"section"},{"location":"multi-physics_coupling/","page":"Coupling","title":"Coupling","text":"Currently the coordinate values on the nodes can differ by machine precision when simulating the mesh and when splitting the mesh in multiple domains. This is an issue coming from the coordinate interpolation on the nodes. As a result, running a simulation in a single system and in two coupled domains may result in a difference of the order of the machine precision. While this is not an issue for most practical problems, it is best to keep this in mind when comparing test runs.","category":"page"},{"location":"meshes/dgmulti_mesh/#DGMulti","page":"DGMulti mesh","title":"Unstructured meshes and the DGMulti solver","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Trixi.jl includes support for simplicial and tensor product meshes via the DGMulti solver type, which is based on the StartUpDG.jl package. DGMulti solvers also provide support for quadrilateral and hexahedral meshes, though this feature is currently restricted to Cartesian grids. On these line/quad/hex meshes, the DGMulti solver also allows to use all (finite domain) SBP derivative operators provided by SummationByPartsOperators.jl, including several finite difference SBP methods.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"We make a few simplifying assumptions about supported meshes:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"meshes consist of a single type of element\nmeshes are conforming (e.g., each face of an element is shared with at most one other element).\nthe geometric mapping from reference to physical elements is polynomial (currently, only affine mappings are supported).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"StartUpDG.jl includes both simple uniform meshes via uniform_mesh, as well as support for triangular meshes constructed using Triangulate.jl, a wrapper around Jonathan Shewchuk's Triangle package.","category":"page"},{"location":"meshes/dgmulti_mesh/#The-DGMulti-solver-type","page":"DGMulti mesh","title":"The DGMulti solver type","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Trixi.jl solvers on simplicial meshes use the DGMulti solver type, which allows users to specify element_type and approximation_type in addition to polydeg, surface_flux, surface_integral, and volume_integral.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"DGMulti(; polydeg::Integer,\n element_type::AbstractElemShape,\n approximation_type=Polynomial(),\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n RefElemData_kwargs...)","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Here, element_type can be Tri(), Quad(), Tet(), or Hex(), and approximation_type can be","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Polynomial(), which specifies a DG discretization using a polynomial basis using quadrature rules which are exact for degree 2 * polydeg integrands, or\nSBP(), which specifies a DG discretization using multi-dimensional SBP operators. Types of SBP discretizations available include: SBP{Kubatko{LobattoFaceNodes}}() (the default choice), SBP{Kubatko{LegendreFaceNodes}}(), and SBP{Hicken}(). For polydeg = 1, ..., 4, the SBP{Kubatko{LegendreFaceNodes}}() SBP nodes are identical to the SBP nodes of Chen and Shu. More detailed descriptions of each SBP node set can be found in the StartUpDG.jl docs. Trixi.jl will also specialize certain parts of the solver based on the SBP approximation type.\na (periodic or non-periodic) derivative operator from SummationByPartsOperators.jl, usually constructed as D = derivative_operator(...). In this case, you do not need to pass a polydeg. Periodic derivative operators will only work with single-element meshes constructed using DGMultiMesh.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Additional options can also be specified through RefElemData_kwargs:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"quad_rule_vol = quad_nodes(Tri(), Nq) will substitute in a volume quadrature rule of degree Nq instead of the default (which is a quadrature rule of degree polydeg). Here, a degree Nq rule will be exact for at least degree 2*Nq integrands (such that the mass matrix is integrated exactly). Quadrature rules of which exactly integrate degree Nq integrands may also be specified (for example, quad_rule_vol = StartUpDG.quad_nodes_tri(Nq) on triangles).\nquad_rule_face = quad_nodes(Line(), Nq)) will use a face quadrature rule of degree Nq rather than the default. This rule is also exact for at least degree 2*Nq integrands.","category":"page"},{"location":"meshes/dgmulti_mesh/#The-GaussSBP()-approximation-type-on-Quad()-and-Hex()-meshes","page":"DGMulti mesh","title":"The GaussSBP() approximation type on Quad() and Hex() meshes","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"When using VolumeIntegralFluxDifferencing on Quad() and Hex() meshes, one can also specify approximation_type = GaussSBP() to use an entropy stable Gauss collocation scheme. Here, GaussSBP() refers to \"generalized\" summation-by-parts operators (see for example Ranocha 2018 or Fernandez and Zingg 2015).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Unlike traditional SBP operators, generalized SBP operators are constructed from nodes which do not include boundary nodes (i.e., Gauss quadrature nodes as opposed to Gauss-Lobatto quadrature nodes). This makes the computation of interface fluxes slightly more expensive, but also usually results in a more accurate solution. Roughly speaking, an entropy stable Gauss collocation scheme will yield results similar to a modal entropy stable scheme using a Polynomial() approximation type, but will be more efficient at high orders of approximation.","category":"page"},{"location":"meshes/dgmulti_mesh/#Trixi.jl-elixirs-on-simplicial-and-tensor-product-element-meshes","page":"DGMulti mesh","title":"Trixi.jl elixirs on simplicial and tensor product element meshes","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Example elixirs with triangular, quadrilateral, and tetrahedral meshes can be found in the examples/dgmulti_2d/ and examples/dgmulti_3d/ folders. Some key elixirs to look at:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"examples/dgmulti_2d/elixir_euler_weakform.jl: basic weak form DG discretization on a uniform triangular mesh. Changing element_type = Quad() or approximation_type = SBP() will switch to a quadrilateral mesh or an SBP-type discretization. Changing surface_integral = SurfaceIntegralWeakForm(flux_ec) and volume_integral = VolumeIntegralFluxDifferencing(flux_ec) for some entropy conservative flux (e.g., flux_chandrashekar or flux_ranocha) will switch to an entropy conservative formulation.\nexamples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl: uses an unstructured mesh generated by Triangulate.jl.\nexamples/dgmulti_3d/elixir_euler_weakform.jl: ´basic weak form DG discretization on a uniform tetrahedral mesh. Changing element_type = Hex() will switch to a hexahedral mesh. Changing surface_integral = SurfaceIntegralWeakForm(flux_ec) and volume_integral = VolumeIntegralFluxDifferencing(flux_ec) for some entropy conservative flux (e.g., flux_chandrashekar or flux_ranocha) will switch to an entropy conservative formulation.","category":"page"},{"location":"meshes/dgmulti_mesh/#For-developers","page":"DGMulti mesh","title":"For developers","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/#DGMultiMesh-wrapper-type","page":"DGMulti mesh","title":"DGMultiMesh wrapper type","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"DGMulti meshes in Trixi.jl are represented using a DGMultiMesh{NDIMS, ...} type. This mesh type is assumed to have fields md::MeshData, which contains geometric terms derived from the mapping between the reference and physical elements, and boundary_faces, which contains a Dict of boundary segment names (symbols) and list of faces which lie on that boundary segment.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"A DGMultiMesh can be constructed in several ways. For example, DGMultiMesh(dg::DGMulti) will return a Cartesian mesh on -1 1^d with element types specified by dg. DGMulti meshes can also be constructed by specifying a list of vertex coordinates vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z and a connectivity matrix EToV where EToV[e,:] gives the vertices which correspond to element e. These quantities are available from most unstructured mesh generators.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Initial support for curved DGMultiMeshes is available for flux differencing solvers using SBP and GaussSBP approximation types on quadrilateral and hexahedral meshes. These can be called by specifying mesh = DGMultiMesh(dg, cells_per_dimension, mapping), where mapping is a function which specifies the warping of the mesh (e.g., mapping(xi, eta) = SVector{2}(xi, eta) is the identity mapping) similar to the mapping argument used by StructuredMesh.","category":"page"},{"location":"meshes/dgmulti_mesh/#Variable-naming-conventions","page":"DGMulti mesh","title":"Variable naming conventions","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"We use the convention that coordinates on the reference element are r in 1D, r s in 2D, or r s t in 3D. Physical coordinates use the standard conventions x (1D), x y (2D), and x y z (3D).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"(Image: \"Ref-to-physical mapping\")","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Derivatives of reference coordinates with respect to physical coordinates are abbreviated, e.g., fracpartial rpartial x = r_x. Additionally, J is used to denote the determinant of the Jacobian of the reference-to-physical mapping.","category":"page"},{"location":"meshes/dgmulti_mesh/#Variable-meanings-and-conventions-in-StartUpDG.jl","page":"DGMulti mesh","title":"Variable meanings and conventions in StartUpDG.jl","text":"","category":"section"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"StartUpDG.jl exports structs RefElemData{NDIMS, ElemShape, ...} (which contains data associated with the reference element, such as interpolation points, quadrature rules, face nodes, normals, and differentiation/interpolation/projection matrices) and MeshData{NDIMS} (which contains geometric data associated with a mesh). These are currently used for evaluating DG formulations in a matrix-free fashion. These structs contain fields similar (but not identical) to those in Globals1D, Globals2D, Globals3D in the Matlab codes from \"Nodal Discontinuous Galerkin Methods\" by Hesthaven and Warburton (2007).","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"In general, we use the following code conventions:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"variables such as r, s,... and x, y,... correspond to values at nodal interpolation points.\nvariables ending in q (e.g., rq, sq,... and xq, yq,...) correspond to values at volume quadrature points.\nvariables ending in f (e.g., rf, sf,... and xf, yf,...) correspond to values at face quadrature points.\nvariables ending in p (e.g., rp, sp,...) correspond to \"plotting\" points, which are usually a fine grid of equispaced points.\nV matrices correspond to interpolation matrices from nodal interpolation points, e.g., Vq interpolates to volume quadrature points, Vf interpolates to face quadrature points.\ngeometric quantities in MeshData are stored as matrices of dimension textnumber of points per element times textnumber of elements.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Quantities in rd::RefElemData:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"rd.Np, rd.Nq, rd.Nf: the number of nodal interpolation points, volume quadrature points, and face quadrature points on the reference element, respectively.\nrd.Vq: interpolation matrices from values at nodal interpolation points to volume quadrature points\nrd.wq: volume quadrature weights on the reference element\nrd.Vf: interpolation matrices from values at nodal interpolation points to face quadrature points\nrd.wf: a vector containing face quadrature weights on the reference element\nrd.M: the quadrature-based mass matrix, computed via rd.Vq' * diagm(rd.wq) * rd.Vq.\nrd.Pq: a quadrature-based L^2 projection matrix rd.Pq = rd.M \\ rd.Vq' * diagm(rd.wq) which maps between values at quadrature points and values at nodal points.\nDr, Ds, Dt matrices are nodal differentiation matrices with respect to the rst coordinates, e.g., Dr*f.(r,s) approximates the derivative of f(rs) at nodal points.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"Quantities in md::MeshData:","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"md.xyz is a tuple of matrices md.x, md.y, md.z, where column e contains coordinates of physical interpolation points.\nmd.xyzq is a tuple of matrices md.xq, md.yq, md.zq, where column e contains coordinates of physical quadrature points.\nmd.rxJ, md.sxJ, ... are matrices where column e contains values of Jfracpartial rpartial x, Jfracpartial spartial x, etc. at nodal interpolation points on the element e.\nmd.J is a matrix where column e contains values of the Jacobian J at nodal interpolation points.\nmd.Jf is a matrix where column e contains values of the face Jacobian (e.g., determinant of the geometric mapping between a physical face and a reference face) at face quadrature points.\nmd.nxJ, md.nyJ, ... are matrices where column e contains values of components of the unit normal scaled by the face Jacobian md.Jf at face quadrature points.","category":"page"},{"location":"meshes/dgmulti_mesh/","page":"DGMulti mesh","title":"DGMulti mesh","text":"For more details, please see the StartUpDG.jl docs.","category":"page"},{"location":"meshes/p4est_mesh/#P4est-based-mesh","page":"P4est-based mesh","title":"P4est-based mesh","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The P4estMesh is an unstructured, curvilinear, nonconforming mesh type for quadrilateral (2D) and hexahedral (3D) cells. It supports quadtree/octree-based adaptive mesh refinement (AMR) via the C library p4est. See AMRCallback for further information.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Due to its curvilinear nature, (numerical) fluxes need to implement methods dispatching on the normal::AbstractVector. Rotationally invariant equations such as the compressible Euler equations can use FluxRotated to wrap numerical fluxes implemented only for Cartesian meshes. This simplifies the re-use of existing functionality for the TreeMesh but is usually less efficient, cf. PR #550.","category":"page"},{"location":"meshes/p4est_mesh/#Construction-of-a-P4estMesh-from-an-Abaqus-file","page":"P4est-based mesh","title":"Construction of a P4estMesh from an Abaqus file","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"One available option to construct a P4estMesh is to read in an Abaqus (.inp) mesh file. We briefly describe the structure of this file, the conventions it uses, and how the mesh file is parsed to create an initial unstructured, curvilinear, and conforming mesh.","category":"page"},{"location":"meshes/p4est_mesh/#Mesh-in-two-spatial-dimensions","page":"P4est-based mesh","title":"Mesh in two spatial dimensions","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For this discussion we use the following two-dimensional unstructured curved mesh with three elements:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"(Image: abaqus-2dmesh-docs)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"We note that the corner and element connectivity information parsed from the Abaqus file creates a straight sided (linear) mesh. From this linear mesh there are two strategies available to make the mesh curvilinear:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Apply a mapping function to describe a transformation of the linear mesh to another physical domain. The mapping is approximated using interpolation polynomial of a user specified polynomial degree. The default value of this polynomial degree is 1 that corresponds to an uncurved geometry.\nHigh-order boundary information is available in the .inp mesh file because it was created with the HOHQMesh mesh generator, which is available via the Julia package HOHQMesh.jl. This information is used to create appropriate transfinite mappings during the mesh construction.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"We divide our discussion into two parts. The first part discusses the standard corner and element information contained in the .inp mesh file. The second part specifically deals with the mesh file parsing of an Abaqus file created by HOHQMesh.jl.","category":"page"},{"location":"meshes/p4est_mesh/#Mesh-file-header","page":"P4est-based mesh","title":"Mesh file header","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"An Abaqus .inp mesh file typically begins with a *Heading. Though optional, the *Heading is helpful to give users some information about the mesh described by the mesh file. In particular, a .inp mesh file created with HOHQMesh will contain the header","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*Heading\n File created by HOHQMesh","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"This heading is used to indicate to the mesh constructor which of the above mapping strategies to apply in order to create a curvilinear mesh. If the Abaqus file header is not present then the P4estMesh is created with the first strategy above.","category":"page"},{"location":"meshes/p4est_mesh/#corner-node-list","page":"P4est-based mesh","title":"List of corner nodes","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Next, prefaced with *NODE, comes a list of the physical (x,y,z) coordinates of all the corners. The first integer in the list of the corners provides its id number. Thus, for the two-dimensional example mesh this block of corner information is","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*NODE\n1, 1.0, -1.0, 0.0\n2, 3.0, 0.0, 0.0\n3, 1.0, 1.0, 0.0\n4, 2.0, 0.0, 0.0\n5, 0.0, 0.0, 0.0\n6, 3.0, 1.0, 0.0\n7, 3.0, -1.0, 0.0","category":"page"},{"location":"meshes/p4est_mesh/#element-list","page":"P4est-based mesh","title":"List of elements","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The element connectivity is given after the list of corners. The header for this information block is","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*ELEMENT, type=CPS4, ELSET=Surface1","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The Abaqus element type CPS4 corresponds to a quadrilateral element. Each quadrilateral element in the unstructured mesh is dictated by four corner points with indexing taken from the numbering given by the corner list above. The elements connect a set of four corner points (starting from the bottom left) in an anti-clockwise fashion; making the element right-handed. This element handedness is indicated using the circular arrow in the figure above. Just as with the corner list, the first integer in the element connectivity list indicates the element id number. Thus, the element connectivity list for the three element example mesh is","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*ELEMENT, type=CPS4, ELSET=Surface1\n1, 5, 1, 4, 3\n2, 4, 2, 6, 3\n3, 7, 2, 4, 1","category":"page"},{"location":"meshes/p4est_mesh/#Element-neighbor-connectivity","page":"P4est-based mesh","title":"Element neighbor connectivity","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The construction of the element neighbor ids and identifying physical boundary surfaces is done using functionality directly from the p4est library. For example, the neighbor connectivity is created in the mesh constructor using the wrapper read_inp_p4est function.","category":"page"},{"location":"meshes/p4est_mesh/#Encoding-of-boundaries","page":"P4est-based mesh","title":"Encoding of boundaries","text":"","category":"section"},{"location":"meshes/p4est_mesh/#HOHQMesh-boundary-information","page":"P4est-based mesh","title":"HOHQMesh boundary information","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"If present, any additional information in the mesh file that was created by HOHQMesh is prefaced with ** to make it an Abaqus comment. This ensures that the read in of the file by a standard Abaqus file parser, as done in the read_inp_p4est function, is done correctly.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The high-order, curved boundary information and labels of the physical boundary created by HOHQMesh is found below the comment line","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** ***** HOHQMesh boundary information ***** **","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Next comes the polynomial degree that the mesh will use to represent any curved sides","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** mesh polynomial degree = 8","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The mesh file then, again, provides the element connectivity as well as information for curved surfaces either interior to the domain or along the physical boundaries. A set of check digits are included directly below the four corner indexes to indicate whether the local surface index (-y, +x, +y, or -x) within the element is straight sided, 0, or is curved, 1. If the local surface is straight sided no additional information is necessary during the mesh file read in. But for any curved surfaces the mesh file provides (x,y,z) coordinate values in order to construct an interpolant of this surface with the mesh polynomial order at the Chebyshev-Gauss-Lobatto nodes. This list of (x,y,z) data will be given in the direction of the local coordinate system. Given below is the element curvature information for the example mesh:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** 5 1 4 3\n** 0 0 1 1\n** 1.000000000000000 1.000000000000000 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 2.000000000000000 0.0 0.0\n** 0.0 0.0 0.0\n** 0.035513826946206 0.105291711848750 0.0\n** 0.148591270347399 0.317731556850611 0.0\n** 0.340010713990041 0.452219430075470 0.0\n** 0.575000000000000 0.462500000000000 0.0\n** 0.788022294598950 0.483764065630034 0.0\n** 0.926408729652601 0.644768443149389 0.0\n** 0.986453164464803 0.883724792445746 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 4 2 6 3\n** 0 0 0 1\n** 2.000000000000000 0.0 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 7 2 4 1\n** 0 0 0 0","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The last piece of information provided by HOHQMesh are labels for the different surfaces of an element. These labels are useful to set boundary conditions along physical surfaces. The labels can be short descriptive words up to 32 characters in length. The label --- indicates an internal surface where no boundary condition is required.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"It is important to note that these labels are given in the following order according to the local surface index -x +x -y +y as required by the p4est library.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"** Bezier --- Slant ---\n** --- Right --- Top\n** Bottom --- Right ---","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For completeness, we provide the entire Abaqus mesh file for the example mesh in the figure above:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*Heading\n File created by HOHQMesh\n*NODE\n1, 1.0, -1.0, 0.0\n2, 3.0, 0.0, 0.0\n3, 1.0, 1.0, 0.0\n4, 2.0, 0.0, 0.0\n5, 0.0, 0.0, 0.0\n6, 3.0, 1.0, 0.0\n7, 3.0, -1.0, 0.0\n*ELEMENT, type=CPS4, ELSET=Surface1\n1, 5, 1, 4, 3\n2, 4, 2, 6, 3\n3, 7, 2, 4, 1\n** ***** HOHQMesh boundary information ***** **\n** mesh polynomial degree = 8\n** 5 1 4 3\n** 0 0 1 1\n** 1.000000000000000 1.000000000000000 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 2.000000000000000 0.0 0.0\n** 0.0 0.0 0.0\n** 0.035513826946206 0.105291711848750 0.0\n** 0.148591270347399 0.317731556850611 0.0\n** 0.340010713990041 0.452219430075470 0.0\n** 0.575000000000000 0.462500000000000 0.0\n** 0.788022294598950 0.483764065630034 0.0\n** 0.926408729652601 0.644768443149389 0.0\n** 0.986453164464803 0.883724792445746 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 4 2 6 3\n** 0 0 0 1\n** 2.000000000000000 0.0 0.0\n** 1.986035130050921 0.054554577460044 0.0\n** 1.920916981799849 0.185149035378133 0.0\n** 1.768263070247418 0.329729152118310 0.0\n** 1.537500000000000 0.462500000000000 0.0\n** 1.295753434047077 0.606254343587194 0.0\n** 1.116583018200151 0.777350964621867 0.0\n** 1.024948365654583 0.934461926834452 0.0\n** 1.000000000000000 1.000000000000000 0.0\n** 7 2 4 1\n** 0 0 0 0\n** Bezier --- Slant ---\n** --- Right --- Top\n** Bottom --- Right ---","category":"page"},{"location":"meshes/p4est_mesh/#Standard-Abaqus-format-boundary-information","page":"P4est-based mesh","title":"Standard Abaqus format boundary information","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"As an alternative to an Abaqus mesh generated by HOHQMesh, .inp files with boundary information encoded as nodesets *NSET,NSET= can be used to construct a p4est mesh. This is especially useful for usage of existing meshes (consisting of bilinear elements) which could stem from the popular gmsh meshing software.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"In addition to the list of nodes and elements given above, there are nodesets of the form ","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*NSET,NSET=PhysicalLine1\n1, 4, 52, 53, 54, 55, 56, 57, 58, ","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"present which are used to associate the edges defined through their corner nodes with a label. In this case it is called PhysicalLine1. By looping over every element and its associated edges, consisting of two nodes, we query the read in NSETs if the current node pair is present.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"To prevent that every nodeset following *NSET,NSET= is treated as a boundary, the user must supply a boundary_symbols keyword to the P4estMesh constructor:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"boundary_symbols = [:PhysicalLine1]\n\nmesh = P4estMesh{2}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"By doing so, only nodesets with a label present in boundary_symbols are treated as physical boundaries. Other nodesets that could be used for diagnostics are not treated as external boundaries. Note that there is a leading colon : compared to the label in the .inp mesh file. This is required to turn the label into a Symbol. Important: In Julia, a symbol cannot contain a hyphen/dash -, i.e., :BC-1 is not a valid symbol. Keep this in mind when importing boundaries, you might have to convert hyphens/dashes - to underscores _ in the .inp mesh file, i.e., BC_1 instead of BC-1.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"A 2D example for this mesh, which is read-in for an unstructured mesh file created with gmsh, is presented in examples/p4est_2d_dgsem/elixir_euler_NACA6412airfoil_mach2.jl.","category":"page"},{"location":"meshes/p4est_mesh/#Mesh-in-three-spatial-dimensions","page":"P4est-based mesh","title":"Mesh in three spatial dimensions","text":"","category":"section"},{"location":"meshes/p4est_mesh/#HOHQMesh-Extended-Abaqus-format","page":"P4est-based mesh","title":"HOHQMesh-Extended Abaqus format","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The 3D Abaqus file format with high-order boundary information from HOHQMesh is very similar to the 2D version discussed above. There are only three changes:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"The element connectivity would be given in terms of the eight corners that define a hexahedron. The corners are numbered as shown in the figure below. The header of the element list changes to be\n*ELEMENT, type=C3D8, ELSET=Volume1\nwhere C3D8 corresponds to a Abaqus hexahedral element.\nThere are six check digits included directly below the eight corner indexes to indicate whether the local face within the element is straight sided, 0, or is curved, 1. For curved faces (x,y,z) coordinate values are available in order to construct an face interpolant with the mesh polynomial order at the Chebyshev-Gauss-Lobatto nodes.\nThe boundary labels are given in the following order according to the local surface index -x +x -y +y -z +z as required by the p4est library.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For completeness, we also give a short description and derivation of the three-dimensional transfinite mapping formulas used to compute the physical coordinates mathbfx=(xyz) of a (possibly curved) hexahedral element give the reference coordinates boldsymbolxi = (xi eta zeta) which lie in -11^3. That is, we will create an expression mathbfx= mathbfX(boldsymbolxi).","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Below we provide a sketch of a single hexahedral element with curved faces. This is done to introduce the numbering conventions for corners, edges, and faces of the element.","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"(Image: abaqus-3dmesh-docs)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"When the hexahedron is a straight sided (linear) element we compute the transfinite mapping directly from the element corner points according to","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"beginaligned\nmathbfX_linear(boldsymbolxi) = frac18quad mathbfx_1(1-xi)(1-eta)(1-zeta)\n + mathbfx_2(1+xi)(1-eta)(1-zeta)-015cm\n qquad + mathbfx_3(1+xi)(1+eta)(1-zeta)\n + mathbfx_4(1-xi)(1+eta)(1-zeta) \n qquad + mathbfx_5(1-xi)(1-eta)(1+zeta)\n + mathbfx_6(1+xi)(1-eta)(1+zeta) \n qquad + mathbfx_7(1+xi)(1+eta)(1+zeta)\n + mathbfx_8(1-xi)(1+eta)(1+zeta)quad\nendaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Next, we create a transfinite mapping function, mathbfX(boldsymbolxi), for a hexahedron that has one or more curved faces. For this we assume that have a set of six interpolating polynomials Gamma_i_i=1^6 that approximate the faces. The interpolating polynomial for any curved faces is provided by the information in a HOHQMesh Abaqus mesh file or is constructed on the fly via a bi-linear interpolation routine for any linear faces. Explicitly, these six face interpolation polynomials depend on the computational coordinates boldsymbolxi as follows","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":" beginaligned\n Gamma_1(xi zeta) quad quad Gamma_3(xi eta) quad quad Gamma_4(eta zeta)01cm\n Gamma_2(xi zeta) quad quad Gamma_5(xi eta) quad quad Gamma_6(eta zeta)\n endaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"To determine the form of the mapping we first create linear interpolations between two opposing faces, e.g., Gamma_3 and Gamma_5 and sum them together to have","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"beginaligned\n boldsymbolSigma(boldsymbolxi) = frac12quad(1-xi)Gamma_6(etazeta) + (1+xi)Gamma_4(etazeta) -015cm\n qquad+ (1-eta)Gamma_1(xizeta) + (1+eta)Gamma_2(xizeta) -015cm\n qquad +(1-zeta)Gamma_3(xieta) + (1+zeta)Gamma_5(xieta)quad\nendaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Unfortunately, the linear interpolations boldsymbolSigma(boldsymbolxi) no longer match at the faces, e.g., evaluating at eta = -1 we have","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"boldsymbolSigma(xi-1zeta) = Gamma_1(xizeta) + frac12(1-xi)Gamma_6(-1zeta) + (1+xi)Gamma_4(-1zeta)\n +(1-zeta)Gamma_3(xi-1) + (1+zeta)Gamma_5(xi-1)","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"which is the desired face Gamma_1(xizeta) plus four edge error terms. Analogous edge error terms occur at the other faces evaluating boldsymbolSigma(boldsymbolxi) at eta=1, xi=pm 1, and zeta=pm 1. In order to match the faces, we subtract a linear interpolant in the xi, eta, and zeta directions of the edge error terms, e.g., the terms in braces in the above equation. So, continuing the example above, the correction term to be subtracted for face Gamma_1 to match would be","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"left(frac1-eta2right) bigg frac12 (1-xi)Gamma_6(-1zeta) + (1+xi)Gamma_4(-1zeta)+(1-zeta)Gamma_3(xi-1)\n + (1+zeta)Gamma_5(xi-1) bigg","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"For clarity, and to allow an easier comparison to the implementation, we introduce auxiliary notation for the 12 edge values present in the complete correction term. That is, for given values of xi, eta, and zeta we have","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":" beginaligned\n textttedge_1 = Gamma_1(xi -1) quad quad textttedge_5 = Gamma_2(xi -1) quad quad textttedge_9 = Gamma_6(eta -1)01cm\n textttedge_2 = Gamma_1(1 zeta) quad quadtextttedge_6 = Gamma_2(1 zeta) quad quad textttedge_10 = Gamma_4(eta -1)01cm\n textttedge_3 = Gamma_1(xi 1) quad quad textttedge_7 = Gamma_2(xi 1) quad quad textttedge_11 = Gamma_4(eta 1)01cm\n textttedge_4 = Gamma_1(-1 zeta) quad quad textttedge_8 = Gamma_2(-1 zeta) quad quad textttedge_12 = Gamma_6(eta 1)\n endaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"With this notation for the edge terms (and after some algebraic manipulation) we write the complete edge correction term, mathcalC_textttedge(boldsymbolxi), as","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"beginaligned\nmathcalC_textttedge(boldsymbolxi) = frac14quad (1-eta)(1-zeta)textttedge_1-015cm\n qquad + (1+xi)(1-eta)textttedge_2 \n qquad + (1-eta)(1+zeta)textttedge_3 \n qquad + (1-xi)(1-eta)textttedge_4 \n qquad + (1+eta)(1-zeta)textttedge_5 \n qquad + (1+xi)(1+eta)textttedge_6 \n qquad + (1+eta)(1+zeta)textttedge_7 \n qquad + (1-xi)(1+eta)textttedge_8 \n qquad + (1-xi)(1-zeta)textttedge_9 \n qquad + (1+xi)(1-zeta)textttedge_10 \n qquad + (1+xi)(1+zeta)textttedge_11 \n qquad + (1-xi)(1+zeta)textttedge_12quad\nendaligned","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"However, subtracting the edge correction terms mathcalC_textttedge(boldsymbolxi) from boldsymbolSigma(boldsymbolxi) removes the interior element contributions twice. Thus, to complete the construction of the transfinite mapping mathbfX(boldsymbolxi) we add the transfinite map of the straight sided hexahedral element to find","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"mathbfX(boldsymbolxi) = boldsymbolSigma(boldsymbolxi)\n - mathcalC_textttedge(boldsymbolxi)\n + mathbfX_linear(boldsymbolxi)","category":"page"},{"location":"meshes/p4est_mesh/#Construction-from-standard-Abaqus","page":"P4est-based mesh","title":"Construction from standard Abaqus","text":"","category":"section"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"Also for a mesh in standard Abaqus format there are no qualitative changes when going from 2D to 3D. The most notable difference is that boundaries are formed in 3D by faces defined by four nodes while in 2D boundaries are edges consisting of two elements. A simple mesh file, which is used also in examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl, is given below:","category":"page"},{"location":"meshes/p4est_mesh/","page":"P4est-based mesh","title":"P4est-based mesh","text":"*Heading\n\n*NODE\n1, -2, 0, 0\n2, -1, 0, 0\n3, -1, 1, 0\n4, -2, 1, 0\n5, -2, 0, 1\n6, -1, 0, 1\n7, -1, 1, 1\n8, -2, 1, 1\n9, -1.75, 1, 0\n10, -1.5, 1, 0\n11, -1.25, 1, 0\n12, -1, 0.75000000000035, 0\n13, -1, 0.50000000000206, 0\n14, -1, 0.25000000000104, 0\n15, -1.25, 0, 0\n16, -1.5, 0, 0\n17, -1.75, 0, 0\n18, -2, 0.24999999999941, 0\n19, -2, 0.49999999999869, 0\n20, -2, 0.74999999999934, 0\n21, -1.75, 0, 1\n22, -1.5, 0, 1\n23, -1.25, 0, 1\n24, -1, 0.24999999999941, 1\n25, -1, 0.49999999999869, 1\n26, -1, 0.74999999999934, 1\n27, -1.25, 1, 1\n28, -1.5, 1, 1\n29, -1.75, 1, 1\n30, -2, 0.75000000000035, 1\n31, -2, 0.50000000000206, 1\n32, -2, 0.25000000000104, 1\n33, -2, 0, 0.24999999999941\n34, -2, 0, 0.49999999999869\n35, -2, 0, 0.74999999999934\n36, -2, 1, 0.24999999999941\n37, -2, 1, 0.49999999999869\n38, -2, 1, 0.74999999999934\n39, -1, 0, 0.24999999999941\n40, -1, 0, 0.49999999999869\n41, -1, 0, 0.74999999999934\n42, -1, 1, 0.24999999999941\n43, -1, 1, 0.49999999999869\n44, -1, 1, 0.74999999999934\n45, -1.25, 0.25000000000063, 0\n46, -1.25, 0.50000000000122, 0\n47, -1.25, 0.7500000000001, 0\n48, -1.5, 0.25000000000023, 0\n49, -1.5, 0.50000000000038, 0\n50, -1.5, 0.74999999999984, 0\n51, -1.75, 0.24999999999982, 0\n52, -1.75, 0.49999999999953, 0\n53, -1.75, 0.74999999999959, 0\n54, -1.75, 0.25000000000063, 1\n55, -1.75, 0.50000000000122, 1\n56, -1.75, 0.7500000000001, 1\n57, -1.5, 0.25000000000023, 1\n58, -1.5, 0.50000000000038, 1\n59, -1.5, 0.74999999999984, 1\n60, -1.25, 0.24999999999982, 1\n61, -1.25, 0.49999999999953, 1\n62, -1.25, 0.74999999999959, 1\n63, -2, 0.24999999999982, 0.24999999999941\n64, -2, 0.49999999999953, 0.24999999999941\n65, -2, 0.74999999999959, 0.24999999999941\n66, -2, 0.25000000000023, 0.49999999999869\n67, -2, 0.50000000000038, 0.49999999999869\n68, -2, 0.74999999999984, 0.49999999999869\n69, -2, 0.25000000000063, 0.74999999999934\n70, -2, 0.50000000000122, 0.74999999999934\n71, -2, 0.7500000000001, 0.74999999999934\n72, -1.25, 1, 0.74999999999934\n73, -1.25, 1, 0.49999999999869\n74, -1.25, 1, 0.24999999999941\n75, -1.5, 1, 0.74999999999934\n76, -1.5, 1, 0.49999999999869\n77, -1.5, 1, 0.24999999999941\n78, -1.75, 1, 0.74999999999934\n79, -1.75, 1, 0.49999999999869\n80, -1.75, 1, 0.24999999999941\n81, -1, 0.25000000000063, 0.24999999999941\n82, -1, 0.50000000000122, 0.24999999999941\n83, -1, 0.7500000000001, 0.24999999999941\n84, -1, 0.25000000000023, 0.49999999999869\n85, -1, 0.50000000000038, 0.49999999999869\n86, -1, 0.74999999999984, 0.49999999999869\n87, -1, 0.24999999999982, 0.74999999999934\n88, -1, 0.49999999999953, 0.74999999999934\n89, -1, 0.74999999999959, 0.74999999999934\n90, -1.75, 0, 0.74999999999934\n91, -1.75, 0, 0.49999999999869\n92, -1.75, 0, 0.24999999999941\n93, -1.5, 0, 0.74999999999934\n94, -1.5, 0, 0.49999999999869\n95, -1.5, 0, 0.24999999999941\n96, -1.25, 0, 0.74999999999934\n97, -1.25, 0, 0.49999999999869\n98, -1.25, 0, 0.24999999999941\n99, -1.75, 0.25000000000043, 0.74999999999934\n100, -1.75, 0.25000000000023, 0.49999999999869\n101, -1.75, 0.25000000000002, 0.24999999999941\n102, -1.75, 0.5000000000008, 0.74999999999934\n103, -1.75, 0.50000000000038, 0.49999999999869\n104, -1.75, 0.49999999999995, 0.24999999999941\n105, -1.75, 0.74999999999997, 0.74999999999934\n106, -1.75, 0.74999999999984, 0.49999999999869\n107, -1.75, 0.74999999999972, 0.24999999999941\n108, -1.5, 0.25000000000023, 0.74999999999934\n109, -1.5, 0.25000000000023, 0.49999999999869\n110, -1.5, 0.25000000000023, 0.24999999999941\n111, -1.5, 0.50000000000038, 0.74999999999934\n112, -1.5, 0.50000000000038, 0.49999999999869\n113, -1.5, 0.50000000000038, 0.24999999999941\n114, -1.5, 0.74999999999984, 0.74999999999934\n115, -1.5, 0.74999999999984, 0.49999999999869\n116, -1.5, 0.74999999999984, 0.24999999999941\n117, -1.25, 0.25000000000002, 0.74999999999934\n118, -1.25, 0.25000000000023, 0.49999999999869\n119, -1.25, 0.25000000000043, 0.24999999999941\n120, -1.25, 0.49999999999995, 0.74999999999934\n121, -1.25, 0.50000000000038, 0.49999999999869\n122, -1.25, 0.5000000000008, 0.24999999999941\n123, -1.25, 0.74999999999972, 0.74999999999934\n124, -1.25, 0.74999999999984, 0.49999999999869\n125, -1.25, 0.74999999999997, 0.24999999999941\n******* E L E M E N T S *************\n*ELEMENT, type=C3D8, ELSET=Volume1\n153, 54, 21, 5, 32, 99, 90, 35, 69\n154, 99, 90, 35, 69, 100, 91, 34, 66\n155, 100, 91, 34, 66, 101, 92, 33, 63\n156, 101, 92, 33, 63, 51, 17, 1, 18\n157, 55, 54, 32, 31, 102, 99, 69, 70\n158, 102, 99, 69, 70, 103, 100, 66, 67\n159, 103, 100, 66, 67, 104, 101, 63, 64\n160, 104, 101, 63, 64, 52, 51, 18, 19\n161, 56, 55, 31, 30, 105, 102, 70, 71\n162, 105, 102, 70, 71, 106, 103, 67, 68\n163, 106, 103, 67, 68, 107, 104, 64, 65\n164, 107, 104, 64, 65, 53, 52, 19, 20\n165, 29, 56, 30, 8, 78, 105, 71, 38\n166, 78, 105, 71, 38, 79, 106, 68, 37\n167, 79, 106, 68, 37, 80, 107, 65, 36\n168, 80, 107, 65, 36, 9, 53, 20, 4\n169, 57, 22, 21, 54, 108, 93, 90, 99\n170, 108, 93, 90, 99, 109, 94, 91, 100\n171, 109, 94, 91, 100, 110, 95, 92, 101\n172, 110, 95, 92, 101, 48, 16, 17, 51\n173, 58, 57, 54, 55, 111, 108, 99, 102\n174, 111, 108, 99, 102, 112, 109, 100, 103\n175, 112, 109, 100, 103, 113, 110, 101, 104\n176, 113, 110, 101, 104, 49, 48, 51, 52\n177, 59, 58, 55, 56, 114, 111, 102, 105\n178, 114, 111, 102, 105, 115, 112, 103, 106\n179, 115, 112, 103, 106, 116, 113, 104, 107\n180, 116, 113, 104, 107, 50, 49, 52, 53\n181, 28, 59, 56, 29, 75, 114, 105, 78\n182, 75, 114, 105, 78, 76, 115, 106, 79\n183, 76, 115, 106, 79, 77, 116, 107, 80\n184, 77, 116, 107, 80, 10, 50, 53, 9\n185, 60, 23, 22, 57, 117, 96, 93, 108\n186, 117, 96, 93, 108, 118, 97, 94, 109\n187, 118, 97, 94, 109, 119, 98, 95, 110\n188, 119, 98, 95, 110, 45, 15, 16, 48\n189, 61, 60, 57, 58, 120, 117, 108, 111\n190, 120, 117, 108, 111, 121, 118, 109, 112\n191, 121, 118, 109, 112, 122, 119, 110, 113\n192, 122, 119, 110, 113, 46, 45, 48, 49\n193, 62, 61, 58, 59, 123, 120, 111, 114\n194, 123, 120, 111, 114, 124, 121, 112, 115\n195, 124, 121, 112, 115, 125, 122, 113, 116\n196, 125, 122, 113, 116, 47, 46, 49, 50\n197, 27, 62, 59, 28, 72, 123, 114, 75\n198, 72, 123, 114, 75, 73, 124, 115, 76\n199, 73, 124, 115, 76, 74, 125, 116, 77\n200, 74, 125, 116, 77, 11, 47, 50, 10\n201, 24, 6, 23, 60, 87, 41, 96, 117\n202, 87, 41, 96, 117, 84, 40, 97, 118\n203, 84, 40, 97, 118, 81, 39, 98, 119\n204, 81, 39, 98, 119, 14, 2, 15, 45\n205, 25, 24, 60, 61, 88, 87, 117, 120\n206, 88, 87, 117, 120, 85, 84, 118, 121\n207, 85, 84, 118, 121, 82, 81, 119, 122\n208, 82, 81, 119, 122, 13, 14, 45, 46\n209, 26, 25, 61, 62, 89, 88, 120, 123\n210, 89, 88, 120, 123, 86, 85, 121, 124\n211, 86, 85, 121, 124, 83, 82, 122, 125\n212, 83, 82, 122, 125, 12, 13, 46, 47\n213, 7, 26, 62, 27, 44, 89, 123, 72\n214, 44, 89, 123, 72, 43, 86, 124, 73\n215, 43, 86, 124, 73, 42, 83, 125, 74\n216, 42, 83, 125, 74, 3, 12, 47, 11\n*NSET,NSET=PhysicalSurface1\n1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \n11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \n21, 22, 23, 24, 25, 26, 27, 28, 29, 30, \n31, 32, 33, 34, 35, 36, 37, 38, 45, 46, \n47, 48, 49, 50, 51, 52, 53, 54, 55, 56, \n57, 58, 59, 60, 61, 62, 63, 64, 65, 66, \n67, 68, 69, 70, 71, \n*NSET,NSET=PhysicalSurface2\n1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \n11, 12, 13, 14, 15, 16, 17, 21, 22, 23, \n24, 25, 26, 27, 28, 29, 33, 34, 35, 36, \n37, 38, 39, 40, 41, 42, 43, 44, 72, 73, \n74, 75, 76, 77, 78, 79, 80, 81, 82, 83, \n84, 85, 86, 87, 88, 89, 90, 91, 92, 93, \n94, 95, 96, 97, 98, ","category":"page"},{"location":"troubleshooting/#Troubleshooting-and-FAQ","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"In general, Trixi.jl works best with the newest Julia release and up-to-date dependencies. If something does not work as expected, try updating your installed Julia packages via the package manager, e.g., by running","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"julia> import Pkg; Pkg.update()","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"If you do not use the latest stable release of Julia from the official website, consider updating your Julia installation.","category":"page"},{"location":"troubleshooting/#old-release","page":"Troubleshooting and FAQ","title":"Installing Trixi.jl as a package only provides an older release","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Trixi.jl requires fairly recent versions of several of its dependencies, which sometimes causes issues when other installed packages have conflicting version requirements. In this case, Julia's package manager Pkg will try to handle this gracefully by going back in history until it finds a Trixi.jl release whose version requirements can be met, resulting in an older - and usually outdated - version of Trixi.jl being installed.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"The following example illustrates this issue:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"The current Trixi.jl release v0.3.6 requires package Foo with a minimum version of v0.2.\nAn older Trixi.jl release v0.2.1 requires package Foo only with a minimum version of v0.1.\nA user has already installed package Bar, which itself requires Foo with a maximum version of v0.1.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"In this case, installing Trixi.jl via Pkg will result in version v0.2.1 to be installed instead of the current release v0.3.6. That is, a specific release of Trixi.jl may not be installable if it has a dependency with a higher minimum version that at the same time is restricted to a lower maximum version by another installed package.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"You can check whether an outdated version of Trixi.jl is installed by executing","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"julia> import Pkg; Pkg.update(\"Trixi\"); Pkg.status(\"Trixi\")","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"in the REPL and comparing the reported Trixi.jl version with the version of the latest release. If the versions differ, you can confirm that it is due to a version conflict by forcing Pkg to install the latest Trixi.jl release, where version is the current release:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"julia> Pkg.add(name=\"Trixi\", version=\"0.3.6\")","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"In case of a conflict, the command above will produce an error that informs you about the offending packages, similar to the following:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":" Updating registry at `~/.julia/registries/General`\n Resolving package versions...\nERROR: Unsatisfiable requirements detected for package DataStructures [864edb3b]:\n DataStructures [864edb3b] log:\n ├─possible versions are: [0.9.0, 0.10.0, 0.11.0-0.11.1, 0.12.0, 0.13.0, 0.14.0-0.14.1, 0.15.0, 0.16.1, 0.17.0-0.17.20, 0.18.0-0.18.8] or uninstalled\n ├─restricted by compatibility requirements with DiffEqCallbacks [459566f4] to versions: 0.18.0-0.18.8\n │ └─DiffEqCallbacks [459566f4] log:\n │ ├─possible versions are: [2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0-2.5.2, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.12.0-2.12.1, 2.13.0-2.13.5, 2.14.0-2.14.1, 2.15.0] or uninstalled\n │ ├─restricted by compatibility requirements with Trixi [a7f1ee26] to versions: [2.14.0-2.14.1, 2.15.0]\n │ │ └─Trixi [a7f1ee26] log:\n │ │ ├─possible versions are: [0.1.0-0.1.2, 0.2.0-0.2.6, 0.3.0-0.3.6] or uninstalled\n │ │ └─restricted to versions 0.3.6 by an explicit requirement, leaving only versions 0.3.6\n │ └─restricted by compatibility requirements with StaticArrays [90137ffa] to versions: 2.15.0 or uninstalled, leaving only versions: 2.15.0\n │ └─StaticArrays [90137ffa] log:\n │ ├─possible versions are: [0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0, 0.10.2-0.10.3, 0.11.0-0.11.1, 0.12.0-0.12.5, 1.0.0-1.0.1] or uninstalled\n │ └─restricted by compatibility requirements with Trixi [a7f1ee26] to versions: 1.0.0-1.0.1\n │ └─Trixi [a7f1ee26] log: see above\n └─restricted by compatibility requirements with JLD2 [033835bb] to versions: [0.9.0, 0.10.0, 0.11.0-0.11.1, 0.12.0, 0.13.0, 0.14.0-0.14.1, 0.15.0, 0.16.1, 0.17.0-0.17.20] — no versions left\n └─JLD2 [033835bb] log:\n ├─possible versions are: [0.1.0-0.1.14, 0.2.0-0.2.4, 0.3.0-0.3.1] or uninstalled\n └─restricted by compatibility requirements with BinaryBuilder [12aac903] to versions: 0.1.0-0.1.14\n └─BinaryBuilder [12aac903] log:\n ├─possible versions are: [0.1.0-0.1.2, 0.1.4, 0.2.0-0.2.6] or uninstalled\n └─restricted to versions * by an explicit requirement, leaving only versions [0.1.0-0.1.2, 0.1.4, 0.2.0-0.2.6]","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"From the error message, we can see that ultimately BinaryBuilder is the problem here: It restricts the package DataStructures to version v0.17 (via its dependency JLD2), while Trixi.jl requires at least v0.18 (via its dependency DiffEqCallbacks). Following the official Pkg documentation, there are a number of things you can try to fix such errors:","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Try updating all packages with julia -e 'using Pkg; Pkg.update()'. A newer version of the problematic package may exist that has updated version requirements.\nRemove the offending package. Running\njulia> import Pkg; Pkg.rm(\"BinaryBuilder\"); Pkg.update(); Pkg.status()\nin the REPL will remove BinaryBuilder and (hopefully) update Trixi.jl to the latest version.\nReport the versioning issue to us and/or the development repository of the conflicting package. Maybe it is possible to lift the version restrictions such that both packages can live side by side.\nInstead of installing Trixi.jl and conflicting packages in the same (default) environment, consider creating new environments/projects and install only packages required for the specific tasks, as explained in the official Pkg documentation. For example, if you use Trixi.jl for a research project (Bachelor/Master thesis or a paper), you should create a new Julia project/environment for that research and add Trixi.jl as a dependency. If you track all your code and the Project.toml, Manifest.toml files (generated by Pkg) in a version control system such as git, you can make your research easily reproducible (if you also record the version of Julia you are using and leave some comments for others who do not know what you are trying to do, including your future self 😉).","category":"page"},{"location":"troubleshooting/#font-issues","page":"Troubleshooting and FAQ","title":"There are many questions marks and weird symbols in the output of Trixi.jl","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"This probably means that the default font used by your operating system does not support enough Unicode symbols. Try installing a modern font with decent unicode support, e.g. JuliaMono. Detailed installation instructions are available there.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"This problems affects users of Mac OS particularly often. At the time of writing, installing JuliaMono is as simple as","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"$ brew tap homebrew/cask-fonts\n$ brew install --cask font-juliamono","category":"page"},{"location":"troubleshooting/#There-are-no-timing-results-of-the-initial-mesh-creation","page":"Troubleshooting and FAQ","title":"There are no timing results of the initial mesh creation","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"By default, the SummaryCallback resets the timer used internally by Trixi.jl when it is initialized (when solve is called). If this step needs to be timed, e.g. to debug performance problems, explicit timings can be used as follows.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"using Trixi\n\nbegin\n Trixi.reset_timer!(Trixi.timer())\n\n equations = LinearScalarAdvectionEquation2D(0.2, -0.7)\n mesh = TreeMesh((-1.0, -1.0), (1.0, 1.0), n_cells_max=10^5, initial_refinement_level=5)\n solver = DGSEM(3)\n semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, solver)\n\n Trixi.print_timer(Trixi.timer())\nend","category":"page"},{"location":"troubleshooting/#MPI-ranks-are-assigned-zero-cells-in-[P4estMesh](@ref)-even-though-there-are-enough-cells","page":"Troubleshooting and FAQ","title":"MPI ranks are assigned zero cells in P4estMesh even though there are enough cells","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"The P4estMesh allows one to coarsen the mesh by default. When Trixi.jl is parallelized with multiple MPI ranks, this has the consequence that sibling cells (i.e., child cells with the same parent cell) are kept on the same MPI rank to be able to coarsen them easily. This might cause an unbalanced distribution of cells on different ranks. For 2D meshes, this also means that initially each rank will at least own 4 cells, and for 3D meshes, initially each rank will at least own 8 cells. See issue #1329.","category":"page"},{"location":"troubleshooting/#Installing-and-updating-everything-takes-a-lot-of-time","page":"Troubleshooting and FAQ","title":"Installing and updating everything takes a lot of time","text":"","category":"section"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Julia compiles code to get good (C/Fortran-like) performance. At the same time, Julia provides a dynamic environment and usually compiles code just before using it. Over time, Julia has improved its caching infrastructure, allowing to store and reuse more results from (pre-)compilation. This often results in an increased time to install/update packages, in particular when updating to Julia v1.8 or v1.9 from older versions.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"Some packages used together with Trixi.jl provide options to configure the amount of precompilation. For example, OrdinaryDiffEq.jl precompiles many ODE solvers for a good runtime experience of average users. Currently, Trixi.jl does not use all of the available solvers. Thus, you can save some time at every update by setting their precompilation options.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"At the time of writing, this could look as follows. First, you need to activate the environment where you have installed OrdinaryDiffEq.jl. Then, you need to execute the following Julia code.","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"using Preferences, UUIDs\nlet uuid = UUID(\"1dea7af3-3e70-54e6-95c3-0bf5283fa5ed\")\n set_preferences!(uuid, \"PrecompileAutoSpecialize\" => false)\n set_preferences!(uuid, \"PrecompileAutoSwitch\" => false)\n set_preferences!(uuid, \"PrecompileDefaultSpecialize\" => true)\n set_preferences!(uuid, \"PrecompileFunctionWrapperSpecialize\" => false)\n set_preferences!(uuid, \"PrecompileLowStorage\" => true)\n set_preferences!(uuid, \"PrecompileNoSpecialize\" => false)\n set_preferences!(uuid, \"PrecompileNonStiff\" => true)\n set_preferences!(uuid, \"PrecompileStiff\" => false)\nend","category":"page"},{"location":"troubleshooting/","page":"Troubleshooting and FAQ","title":"Troubleshooting and FAQ","text":"This disables precompilation of all implicit methods. This should usually not affect the runtime latency with Trixi.jl since most setups use explicit time integration methods.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"EditURL = \"../../literate/src/files/shock_capturing.jl\"","category":"page"},{"location":"tutorials/shock_capturing/#shock_capturing","page":"5 Shock capturing with flux differencing and stage limiter","title":"5: Shock capturing with flux differencing and stage limiter","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This tutorial contains a short summary of the idea of shock capturing for DGSEM with flux differencing and its implementation in Trixi.jl. In the second part, an implementation of a positivity preserving limiter is added to the simulation.","category":"page"},{"location":"tutorials/shock_capturing/#Shock-capturing-with-flux-differencing","page":"5 Shock capturing with flux differencing and stage limiter","title":"Shock capturing with flux differencing","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The following rough explanation is on a very basic level. More information about an entropy stable shock-capturing strategy for DGSEM discretizations of advection dominated problems, such as the compressible Euler equations or the compressible Navier-Stokes equations, can be found in Hennemann et al. (2021). In Rueda-Ramírez et al. (2021) you find the extension to the systems with non-conservative terms, such as the compressible magnetohydrodynamics (MHD) equations.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The strategy for a shock-capturing method presented by Hennemann et al. is based on a hybrid blending of a high-order DG method with a low-order variant. The low-order subcell finite volume (FV) method is created directly with the Legendre-Gauss-Lobatto (LGL) nodes already used for the high-order DGSEM. Then, the final method is a convex combination with regulating indicator alpha of these two methods.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Since the surface integral is equal for both the DG and the subcell FV method, only the volume integral divides between the two methods.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This strategy for the volume integral is implemented in Trixi.jl under the name of VolumeIntegralShockCapturingHG with the three parameters of the indicator and the volume fluxes for the DG and the subcell FV method.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Note, that the DG method is based on the flux differencing formulation. Hence, you have to use a two-point flux, such as flux_ranocha, flux_shima_etal, flux_chandrashekar or flux_kennedy_gruber, for the DG volume flux. We would recommend to use the entropy conserving flux flux_ranocha by Ranocha (2018) for the compressible Euler equations.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;\n volume_flux_dg=volume_flux_dg,\n volume_flux_fv=volume_flux_fv)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We now focus on a choice of the shock capturing indicator indicator_sc. A possible indicator is alpha_HG presented by Hennemann et al. (p.10), which depends on the current approximation with modal coefficients m_j_j=0^N of a given variable.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The indicator is calculated for every DG element by itself. First, we calculate a smooth alpha by","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"alpha = frac11+exp(-frac-smathbbT(mathbbE-mathbbT))","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"with the total energy mathbbE=maxbig(fracm_N^2sum_j=0^N m_j^2 fracm_N-1^2sum_j=0^N-1 m_j^2big), threshold mathbbT= 05 * 10^-18*(N+1)^14 and parameter s=lnbig(frac1-0000100001big)approx 921024.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"For computational efficiency, alpha_min is introduced and used for","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"tildealpha = begincases\n0 textif alphaalpha_min\nalpha textif alpha_minleq alpha leq 1- alpha_min\n1 textif 1-alpha_minalpha\nendcases","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Moreover, the parameter alpha_max sets a maximal value for alpha by","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"alpha = mintildealpha alpha_max","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This allows to control the maximal dissipation.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"To remove numerical artifact the final indicator is smoothed with all the neighboring elements' indicators. This is activated with alpha_smooth=true.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"alpha_HG = max_E alpha 05 * alpha_E","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"where E are all elements sharing a face with the current element.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Furthermore, you can specify the variable used for the calculation. For instance you can choose 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.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This indicator is implemented in Trixi.jl and called IndicatorHennemannGassner with the parameters equations, basis, alpha_max, alpha_min, alpha_smooth and variable.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"indicator_sc = IndicatorHennemannGassner(equations, basis,\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable=variable)","category":"page"},{"location":"tutorials/shock_capturing/#Positivity-preserving-limiter","page":"5 Shock capturing with flux differencing and stage limiter","title":"Positivity preserving limiter","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Some numerical solutions are physically meaningless, for instance negative values of pressure 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.jl provides the fully-discrete positivity-preserving limiter of Zhang, Shu (2011).","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"It works the following way. For every passed (scalar) variable and for every DG element we calculate the minimal value value_min. If this value falls below the given threshold varepsilon, the approximation is slightly adapted such that the minimal value of the relevant variable lies now above the threshold.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"underlineu^new = theta * underlineu + (1-theta) * u_mean","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"where underlineu are the collected pointwise evaluation coefficients in element e and u_mean the integral mean of the quantity in e. The new coefficients are a convex combination of these two values with factor","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"theta = fracvalue_mean - varepsilonvalue_mean - value_min","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"where value_mean is the relevant variable evaluated for the mean value u_mean.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"The adapted approximation keeps the exact same mean value, but the relevant variable is now greater or equal the threshold varepsilon at every node in every element.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We specify the variables the way we did before for the shock capturing variables. For the compressible Euler equations density, pressure or the combined variable density_pressure are a reasonable choice.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"You can implement the limiter in Trixi.jl using PositivityPreservingLimiterZhangShu with parameters threshold and variables.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=thresholds,\n variables=variables)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Then, the limiter is added to the time integration method in the solve function. For instance, like","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"CarpenterKennedy2N54(stage_limiter!, williamson_condition=false)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"or","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"SSPRK43(stage_limiter!).","category":"page"},{"location":"tutorials/shock_capturing/#Simulation-with-shock-capturing-and-positivity-preserving","page":"5 Shock capturing with flux differencing and stage limiter","title":"Simulation with shock capturing and positivity preserving","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Now, we can run a simulation using the described methods of shock capturing and positivity preserving limiters. We want to give an example for the 2D compressible Euler equations.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"using OrdinaryDiffEq, Trixi\n\nequations = CompressibleEulerEquations2D(1.4)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"As our initial condition we use the Sedov blast wave setup.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)\n # Set up polar coordinates\n inicenter = SVector(0.0, 0.0)\n x_norm = x[1] - inicenter[1]\n y_norm = x[2] - inicenter[2]\n r = sqrt(x_norm^2 + y_norm^2)\n\n r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)\n # r0 = 0.5 # = more reasonable setup\n E = 1.0\n p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)\n p0_outer = 1.0e-5 # = true Sedov setup\n # p0_outer = 1.0e-3 # = more reasonable setup\n\n # Calculate primitive variables\n rho = 1.0\n v1 = 0.0\n v2 = 0.0\n p = r > r0 ? p0_outer : p0_inner\n\n return prim2cons(SVector(rho, v1, v2, p), equations)\nend\ninitial_condition = initial_condition_sedov_blast_wave","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"basis = LobattoLegendreBasis(3)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We set the numerical fluxes and divide between the surface flux and the two volume fluxes for the DG and FV method. Here, we are using flux_lax_friedrichs and flux_ranocha.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"surface_flux = flux_lax_friedrichs\nvolume_flux = flux_ranocha","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Now, we specify the shock capturing indicator alpha.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We implement the described indicator of Hennemann, Gassner as explained above with parameters equations, basis, alpha_max, alpha_min, alpha_smooth and variable. Since density and pressure are the critical variables in this example, we use density_pressure = density * pressure = rho * p as indicator variable.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"indicator_sc = IndicatorHennemannGassner(equations, basis,\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable=density_pressure)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"Now, we can use the defined fluxes and the indicator to implement the volume integral using shock capturing.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;\n volume_flux_dg=volume_flux,\n volume_flux_fv=surface_flux)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We finalize the discretization by implementing Trixi.jl's solver, mesh, semi and ode, while solver now has the extra parameter volume_integral.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"solver = DGSEM(basis, surface_flux, volume_integral)\n\ncoordinates_min = (-2.0, -2.0)\ncoordinates_max = ( 2.0, 2.0)\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=6,\n n_cells_max=10_000)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)\n\ntspan = (0.0, 1.0)\node = semidiscretize(semi, tspan);\nnothing #hide","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We add some callbacks to get an solution analysis and use a CFL-based time step size calculation.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"analysis_callback = AnalysisCallback(semi, interval=100)\n\nstepsize_callback = StepsizeCallback(cfl=0.8)\n\ncallbacks = CallbackSet(analysis_callback, stepsize_callback);\nnothing #hide","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"We now run the simulation using the positivity preserving limiter of Zhang and Shu for the variables density and pressure.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(5.0e-6, 5.0e-6),\n variables=(Trixi.density, pressure))\n\nsol = solve(ode, CarpenterKennedy2N54(stage_limiter!, williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\n\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/shock_capturing/#Package-versions","page":"5 Shock capturing with flux differencing and stage limiter","title":"Package versions","text":"","category":"section"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"","category":"page"},{"location":"tutorials/shock_capturing/","page":"5 Shock capturing with flux differencing and stage limiter","title":"5 Shock capturing with flux differencing and stage limiter","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"EditURL = \"../../literate/src/files/DGMulti_1.jl\"","category":"page"},{"location":"tutorials/DGMulti_1/#DGMulti_1","page":"7 DG schemes via DGMulti solver","title":"7: DG schemes via DGMulti solver","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"DGMulti is a DG solver that allows meshes with simplex elements. The basic idea and implementation of this solver is explained in section \"Meshes\". Here, we want to give some examples and a quick overview about the options with DGMulti.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We start with a simple example we already used in the tutorial about flux differencing. There, we implemented a simulation with initial_condition_weak_blast_wave for the 2D compressible Euler equations CompressibleEulerEquations2D and used the DG formulation with flux differencing using volume flux flux_ranocha and surface flux flux_lax_friedrichs.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Here, we want to implement the equivalent example, only now using the DGMulti solver instead of DGSEM.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq\n\nequations = CompressibleEulerEquations2D(1.4)\n\ninitial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"To use the Gauss-Lobatto nodes again, we choose approximation_type=SBP() in the solver. Since we want to start with a Cartesian domain discretized with squares, we use the element type Quad().","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3,\n element_type = Quad(),\n approximation_type = SBP(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))\n\ncells_per_dimension = (32, 32)\nmesh = DGMultiMesh(dg,\n cells_per_dimension, # initial_refinement_level = 5\n coordinates_min=(-2.0, -2.0),\n coordinates_max=( 2.0, 2.0),\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n boundary_conditions=boundary_condition_periodic)\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=10)\nanalysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))\ncallbacks = CallbackSet(analysis_callback, alive_callback);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Run the simulation with the same time integration algorithm as before.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6,\n callback=callbacks, save_everystep=false);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"plot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"This simulation is not as fast as the equivalent with TreeMesh since no special optimizations for quads (for instance tensor product structure) have been implemented. Figure 4 in \"Efficient implementation of modern entropy stable and kinetic energy preserving discontinuous Galerkin methods for conservation laws\" (2021) provides a nice runtime comparison between the different mesh types. On the other hand, the functions are more general and thus we have more option we can choose from.","category":"page"},{"location":"tutorials/DGMulti_1/#Simulation-with-Gauss-nodes","page":"7 DG schemes via DGMulti solver","title":"Simulation with Gauss nodes","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"For instance, we can change the approximation type of our simulation.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq\nequations = CompressibleEulerEquations2D(1.4)\ninitial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We now use Gauss nodes instead of Gauss-Lobatto nodes which can be done for the element types Quad() and Hex(). Therefore, we set approximation_type=GaussSBP(). Alternatively, we can use a modal approach using the approximation type Polynomial().","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3,\n element_type = Quad(),\n approximation_type = GaussSBP(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))\n\ncells_per_dimension = (32, 32)\nmesh = DGMultiMesh(dg,\n cells_per_dimension, # initial_refinement_level = 5\n coordinates_min=(-2.0, -2.0),\n coordinates_max=( 2.0, 2.0),\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n boundary_conditions=boundary_condition_periodic)\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=10)\nanalysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))\ncallbacks = CallbackSet(analysis_callback, alive_callback);\n\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)","category":"page"},{"location":"tutorials/DGMulti_1/#Simulation-with-triangular-elements","page":"7 DG schemes via DGMulti solver","title":"Simulation with triangular elements","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Also, we can set another element type. We want to use triangles now.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq\nequations = CompressibleEulerEquations2D(1.4)\ninitial_condition = initial_condition_weak_blast_wave","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"Since there is no direct equivalent to Gauss-Lobatto nodes on triangles, the approximation type SBP() now uses Gauss-Lobatto nodes on faces and special nodes in the interior of the triangular. More details can be found in the documentation of StartUpDG.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3,\n element_type = Tri(),\n approximation_type = SBP(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))\n\ncells_per_dimension = (32, 32)\nmesh = DGMultiMesh(dg,\n cells_per_dimension, # initial_refinement_level = 5\n coordinates_min=(-2.0, -2.0),\n coordinates_max=( 2.0, 2.0),\n periodicity=true)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n boundary_conditions=boundary_condition_periodic)\ntspan = (0.0, 0.4)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=10)\nanalysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))\ncallbacks = CallbackSet(analysis_callback, alive_callback);\n\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd)","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"plot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/DGMulti_1/#Triangular-meshes-on-non-Cartesian-domains","page":"7 DG schemes via DGMulti solver","title":"Triangular meshes on non-Cartesian domains","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"To use triangular meshes on a non-Cartesian domain, Trixi.jl uses the package StartUpDG.jl. The following example is based on elixir_euler_triangulate_pkg_mesh.jl and uses a pre-defined mesh from StartUpDG.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Trixi, OrdinaryDiffEq","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We want to simulate the smooth initial condition initial_condition_convergence_test with source terms source_terms_convergence_test for the 2D compressible Euler equations.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"equations = CompressibleEulerEquations2D(1.4)\ninitial_condition = initial_condition_convergence_test\nsource_terms = source_terms_convergence_test","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"We create the solver DGMulti with triangular elements (Tri()) as before.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"dg = DGMulti(polydeg = 3, element_type = Tri(),\n approximation_type=Polynomial(),\n surface_flux = flux_lax_friedrichs,\n volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"StartUpDG.jl provides for instance a pre-defined Triangulate geometry for a rectangular domain with hole RectangularDomainWithHole. Other pre-defined Triangulate geometries are e.g., SquareDomain, Scramjet, and CircularDomain.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole());\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"The pre-defined Triangulate geometry in StartUpDG has integer boundary tags. With DGMultiMesh we assign boundary faces based on these integer boundary tags and create a mesh compatible with Trixi.jl.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary=>1, :inner_boundary=>2))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)\nboundary_conditions = (; :outer_boundary => boundary_condition_convergence_test,\n :inner_boundary => boundary_condition_convergence_test)\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,\n source_terms = source_terms,\n boundary_conditions = boundary_conditions)\n\ntspan = (0.0, 0.2)\node = semidiscretize(semi, tspan)\n\nalive_callback = AliveCallback(alive_interval=20)\nanalysis_callback = AnalysisCallback(semi, interval=200, uEltype=real(dg))\ncallbacks = CallbackSet(alive_callback, analysis_callback);\n\nsol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using Plots\npd = PlotData2D(sol)\nplot(pd[\"rho\"])\nplot!(getmesh(pd))","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"For more information, please have a look in the StartUpDG.jl documentation.","category":"page"},{"location":"tutorials/DGMulti_1/#Package-versions","page":"7 DG schemes via DGMulti solver","title":"Package versions","text":"","category":"section"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"StartUpDG\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"","category":"page"},{"location":"tutorials/DGMulti_1/","page":"7 DG schemes via DGMulti solver","title":"7 DG schemes via DGMulti solver","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"EditURL = \"../../literate/src/files/adding_new_scalar_equations.jl\"","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#adding_new_scalar_equations","page":"10 Adding a new scalar conservation law","title":"10: Adding a new scalar conservation law","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"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","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"partial_t u(tx) + partial_x u(tx)^3 = 0","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"in a periodic domain in one space dimension. In Trixi.jl, such a mathematical model is encoded as a subtype of Trixi.AbstractEquations.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Basic-setup","page":"10 Adding a new scalar conservation law","title":"Basic setup","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using Trixi\n\nstruct CubicEquation <: Trixi.AbstractEquations{1 #= number of spatial dimensions =#,\n 1 #= number of primary variables, i.e. scalar =#};\nend","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"We create CubicEquation as an empty struct since we do not use any parameters for this equation. Other models could bundle arbitrary parameters, e.g., the ideal gas constant for the compressible Euler equations.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Next, we define the physical flux f(u) = u^3 using the calling structure used in Trixi.jl.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Trixi.flux(u, orientation, equation::CubicEquation) = u.^3\nTrixi.varnames(_, ::CubicEquation) = (\"scalar\",)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"In Trixi.jl, the conserved variables u are usually passed as SVectors of variables at a single physical location. Hence, we must use u.^3 instead of the scalar operation u^3.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"That's already enough to run a simple simulation with a standard DGSEM discretization using the non-dissipative central flux at interfaces.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using OrdinaryDiffEq\n\n# Create a simulation setup\nequation = CubicEquation()\n\ninitial_condition_sine(x, t, equation::CubicEquation) = SVector(sinpi(x[1]))\n\nmesh = TreeMesh(-1.0, 1.0, # min/max coordinates\n initial_refinement_level=4,\n n_cells_max=10^4)\n\nsolver = DGSEM(3 #= polynomial degree =#, flux_central)\n\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"We wrap the return value of the initial_condition_sine inside an SVector since that's the approach used in Trixi.jl also for systems of equations. We need to index the spatial coordinate x[1], since it is an SVector with one component. In multiple space dimensions, all spatial coordinates are passed together.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Next, we create an ODEProblem from the SciML/DifferentialEquations ecosystem. We can solve this ODE numerically using any time integration method, e.g., SSPRK43 from OrdinaryDiffEq.jl. Before, we set up a callback to summarize the simulation setup.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# Create ODE problem with given time span\ntspan = (0.0, 0.09)\node = semidiscretize(semi, tspan)\n\nsummary_callback = SummaryCallback()\ncallbacks = CallbackSet(summary_callback)\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks\nsol = solve(ode, SSPRK43();\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"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.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"You can already see that discontinuities will develop and oscillations start to occur around steep parts of the wave. That's expected from our central discretization. To avoid these issues, we need to use dissipative numerical fluxes (approximate Riemann solvers) at interfaces.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Advanced-setup","page":"10 Adding a new scalar conservation law","title":"Advanced setup","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Thus, we add a Godunov's flux for our cubic equation. That is easy for this equation since the wave speed f'(u) = 3u^2 is always non-negative.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"@inline Trixi.flux_godunov(u_ll, u_rr, orientation, equation::CubicEquation) = flux(u_ll, orientation, equation)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Let's run the example again but with a dissipative numerical flux at interfaces. remake will recreate the semidiscretization we used before and only change selected parameters, in this case the solver.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# A new setup with dissipation\nsemi = remake(semi, solver=DGSEM(3, flux_godunov))\node = semidiscretize(semi, tspan)\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot!(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"You can see that there are fewer oscillations, in particular around steep edges. Now let's increase the final time (and also the spatial resolution).","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12)\nsemi = remake(semi, mesh=TreeMesh(-1.0, 1.0, initial_refinement_level=8, n_cells_max=10^5))\node = semidiscretize(semi, (0.0, 0.5) #= tspan =#)\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"You can observe that nonclassical shocks develop and are stable under grid refinement, e.g. for initial_refinement_level=12. In this case, these nonclassical shocks can be avoided by using an entropy-dissipative semidiscretization. Thus, we need to define an entropy-conservative numerical flux","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"@inline function Trixi.flux_ec(u_ll, u_rr, orientation, equation::CubicEquation)\n return SVector(0.25 * (u_ll[1]^3 + u_ll[1]^2 * u_rr[1] + u_ll[1] * u_rr[1]^2 + u_rr[1]^3))\nend","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"and use a VolumeIntegralFluxDifferencing instead of the standard VolumeIntegralWeakForm in the DGSEM.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# Let's use a provably entropy-dissipative semidiscretization\nsemi = remake(semi, solver=DGSEM(3, flux_godunov, VolumeIntegralFluxDifferencing(flux_ec)))\node = semidiscretize(semi, (0.0, 0.5))\nsol = solve(ode, SSPRK43(); ode_default_options()...);\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"Possible next steps could be","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"to define Trixi.max_abs_speeds(u, equations::CubicEquation) = 3 * u[1]^2 to use CFL-based time step control via a StepsizeCallback\nto define quantities of interest like Trixi.entropy(u, equations::CubicEquation) = u[1]^2 and integrate them in a simulation using the AnalysisCallback\nto experiment with shock-capturing volume integrals VolumeIntegralShockCapturingHG and adaptive mesh refinement AMRCallback","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"For further reading, Trixi.jl provides another example on adding a scalar equation. In the elixir about the KPP problem, the 2D scalar \"KPP equation\" from Kurganov, Petrova, Popov (2007) is implemented.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Summary-of-the-code","page":"10 Adding a new scalar conservation law","title":"Summary of the code","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"To sum up, here is the complete code that we used (without the callbacks since these create a lot of unnecessary output in the doctests of this tutorial). In addition, we create the struct inside the new module CubicConservationLaw. That ensures that we can re-create structs defined therein without having to restart Julia.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"# Define new physics\nmodule CubicConservationLaw\n\nusing Trixi\n\nstruct CubicEquation <: Trixi.AbstractEquations{1 #= number of spatial dimensions =#,\n 1 #= number of primary variables, i.e. scalar =#}\nend\n\n@inline Trixi.flux(u, orientation, equation::CubicEquation) = u.^3\nTrixi.varnames(_, ::CubicEquation) = (\"scalar\",)\n\n@inline Trixi.flux_godunov(u_ll, u_rr, orientation, equation::CubicEquation) = flux(u_ll, orientation, equation)\n@inline function Trixi.flux_ec(u_ll, u_rr, orientation, equation::CubicEquation)\n return SVector(0.25 * (u_ll[1]^3 + u_ll[1]^2 * u_rr[1] + u_ll[1] * u_rr[1]^2 + u_rr[1]^3))\nend\n\nend # module\n\n\n# Create a simulation setup\nimport .CubicConservationLaw\nusing Trixi\nusing OrdinaryDiffEq\nusing Plots\n\nequation = CubicConservationLaw.CubicEquation()\n\ninitial_condition_sine(x, t, equation::CubicConservationLaw.CubicEquation) = SVector(sinpi(x[1]))\n\nmesh = TreeMesh(-1.0, 1.0, # min/max coordinates\n initial_refinement_level=4,\n n_cells_max=10^4)\n\nsolver = DGSEM(3 #= polynomial degree =#, flux_central)\n\nsemi = SemidiscretizationHyperbolic(mesh, equation, initial_condition_sine, solver)\n\n# Create ODE problem with given time span\ntspan = (0.0, 0.1)\node = semidiscretize(semi, tspan)\n\n# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)\n\n\n# A new setup with dissipation\nsemi = remake(semi, solver=DGSEM(3, flux_godunov))\node = semidiscretize(semi, tspan)\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot!(sol)\n\n\n# A larger final time: Nonclassical shocks develop (you can even increase the refinement to 12)\nsemi = remake(semi, mesh=TreeMesh(-1.0, 1.0, initial_refinement_level=8, n_cells_max=10^5))\node = semidiscretize(semi, (0.0, 0.5))\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)\n\n\n# Let's use a provably entropy-dissipative semidiscretization\nsemi = remake(semi, solver=DGSEM(3, flux_godunov, VolumeIntegralFluxDifferencing(flux_ec)))\node = semidiscretize(semi, (0.0, 0.5))\nsol = solve(ode, SSPRK43(); ode_default_options()...)\nplot(sol)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/#Package-versions","page":"10 Adding a new scalar conservation law","title":"Package versions","text":"","category":"section"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"","category":"page"},{"location":"tutorials/adding_new_scalar_equations/","page":"10 Adding a new scalar conservation law","title":"10 Adding a new scalar conservation law","text":"This page was generated using Literate.jl.","category":"page"},{"location":"time_integration/#time-integration","page":"Time integration","title":"Time integration methods","text":"","category":"section"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, explicit Runge-Kutta methods from OrdinaryDiffEq.jl are tested extensively. Interesting classes of time integration schemes are","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"Explicit low-storage Runge-Kutta methods\nStrong stability preserving methods","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"Some common options for solve from OrdinaryDiffEq.jl are the following. Further documentation can be found in the SciML docs.","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"If you use a fixed time step method like CarpenterKennedy2N54, you need to pass a time step as dt=.... If you use a StepsizeCallback, the value passed as dt=... is irrelevant since it will be overwritten by the StepsizeCallback. If you want to use an adaptive time step method such as SSPRK43 or RDPK3SpFSAL49 and still want to use CFL-based step size control via the StepsizeCallback, you need to pass the keyword argument adaptive=false to solve.\nYou should usually set save_everystep=false. Otherwise, OrdinaryDiffEq.jl will (try to) save the numerical solution after every time step in RAM (until you run out of memory or start to swap).\nYou can set the maximal number of time steps via maxiters=....\nSSP methods and many low-storage methods from OrdinaryDiffEq.jl support stage_limiter!s and step_limiter!s, e.g., PositivityPreservingLimiterZhangShu from Trixi.jl.\nIf you start Julia with multiple threads and want to use them also in the time integration method from OrdinaryDiffEq.jl, you need to pass the keyword argument thread=OrdinaryDiffEq.True() to the algorithm, e.g., RDPK3SpFSAL49(thread=OrdinaryDiffEq.True()) or CarpenterKennedy2N54(thread=OrdinaryDiffEq.True(), williamson_condition=false). For more information on using thread-based parallelism in Trixi.jl, please refer to Shared-memory parallelization with threads.\nIf you use error-based step size control (see also the section on error-based adaptive step sizes together with MPI, you need to pass internalnorm=ode_norm and you should pass unstable_check=ode_unstable_check to OrdinaryDiffEq's solve, which are both included in ode_default_options.","category":"page"},{"location":"time_integration/","page":"Time integration","title":"Time integration","text":"note: Number of `rhs!` calls\nIf you use explicit Runge-Kutta methods from OrdinaryDiffEq.jl, the total number of rhs! calls can be (slightly) bigger than the number of steps times the number of stages, e.g. to allow for interpolation (dense output), root-finding for continuous callbacks, and error-based time step control. In general, you often should not need to worry about this if you use Trixi.jl.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"EditURL = \"../../../literate/src/files/first_steps/getting_started.jl\"","category":"page"},{"location":"tutorials/first_steps/getting_started/#getting_started","page":"1.1 Getting started","title":"1.1: First steps in Trixi.jl: Getting started","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Trixi.jl is a numerical simulation framework for conservation laws and is written in the Julia programming language. This tutorial is intended for beginners in Julia and Trixi.jl. After reading it, you will know how to install Julia and Trixi.jl on your computer, and you will be able to download setup files from our GitHub repository, modify them, and run simulations.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"The contents of this tutorial:","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Julia installation\nTrixi.jl installation\nRunning a simulation\nGetting an existing setup file\nModifying an existing setup","category":"page"},{"location":"tutorials/first_steps/getting_started/#Julia-installation","page":"1.1 Getting started","title":"Julia installation","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Trixi.jl is compatible with the latest stable release of Julia. Additional details regarding Julia support can be found in the README.md file. The current default Julia installation is managed through juliaup. You may follow our concise installation guidelines for Windows, Linux, and MacOS provided below. In the event of any issues during the installation process, please consult the official Julia installation instruction.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Windows","page":"1.1 Getting started","title":"Windows","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Open a terminal by pressing Win+r and entering cmd in the opened window.\nTo install Julia, execute the following command in the terminal:\nwinget install julia -s msstore\nVerify the successful installation of Julia by executing the following command in the terminal:\njulia\nTo exit Julia, execute exit() or press Ctrl+d.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Linux-and-MacOS","page":"1.1 Getting started","title":"Linux and MacOS","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To install Julia, run the following command in a terminal:\ncurl -fsSL https://install.julialang.org | sh\nFollow the instructions displayed in the terminal during the installation process.\nIf an error occurs during the execution of the previous command, you may need to install curl. On Ubuntu-type systems, you can use the following command:\nsudo apt install curl\nAfter installing curl, repeat the first step once more to proceed with Julia installation.\nVerify the successful installation of Julia by executing the following command in the terminal:\njulia\nTo exit Julia, execute exit() or press Ctrl+d.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Trixi.jl-installation","page":"1.1 Getting started","title":"Trixi.jl installation","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Trixi.jl and its related tools are registered Julia packages, thus their installation happens inside Julia. For a smooth workflow experience with Trixi.jl, you need to install Trixi.jl, OrdinaryDiffEq.jl, and Plots.jl.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Open a terminal and start Julia.\nExecute following commands:\nimport Pkg\nPkg.add([\"OrdinaryDiffEq\", \"Plots\", \"Trixi\"])","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Now you have installed all these packages. OrdinaryDiffEq.jl provides time integration schemes used by Trixi.jl and Plots.jl can be used to directly visualize Trixi.jl results from the Julia REPL.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Usage","page":"1.1 Getting started","title":"Usage","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/#Running-a-simulation","page":"1.1 Getting started","title":"Running a simulation","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To get you started, Trixi.jl has a large set of example setups, that can be taken as a basis for your future investigations. In Trixi.jl, we call these setup files \"elixirs\", since they contain Julia code that takes parts of Trixi.jl and combines them into something new.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Any of the examples can be executed using the trixi_include function. trixi_include(...) expects a single string argument with a path to a file containing Julia code. For convenience, the examples_dir function returns a path to the examples folder, which has been locally downloaded while installing Trixi.jl. joinpath(...) can be used to join path components into a full path.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Let's execute a short two-dimensional problem setup. It approximates the solution of the compressible Euler equations in 2D for an ideal gas (CompressibleEulerEquations2D) with a weak blast wave as the initial condition.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Start Julia in a terminal and execute the following code:","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"using Trixi, OrdinaryDiffEq\ntrixi_include(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_ec.jl\"))","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"using Trixi, OrdinaryDiffEq #hide\ntrixi_include(@__MODULE__,joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_ec.jl\")) #hide","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To analyze the result of the computation, we can use the Plots.jl package and the function plot(...), which creates a graphical representation of the solution. sol is a variable defined in the executed example and it contains the solution at the final moment of the simulation.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To obtain a list of all Trixi.jl elixirs execute get_examples. It returns the paths to all example setups.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"get_examples()","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Editing an existing elixir is the best way to start your first own investigation using Trixi.jl.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Getting-an-existing-setup-file","page":"1.1 Getting started","title":"Getting an existing setup file","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To edit an existing elixir, you first have to find a suitable one and then copy it to a local folder. Let's have a look at how to download the elixir_euler_ec.jl elixir used in the previous section from the Trixi.jl GitHub repository.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"All examples are located inside the examples folder.\nNavigate to the file elixir_euler_ec.jl.\nRight-click the Raw button on the right side of the webpage and choose Save as... (or Save Link As...).\nChoose a folder and save the file.","category":"page"},{"location":"tutorials/first_steps/getting_started/#Modifying-an-existing-setup","page":"1.1 Getting started","title":"Modifying an existing setup","text":"","category":"section"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"As an example, we will change the initial condition for calculations that occur in elixir_euler_ec.jl. In this example we consider the compressible Euler equations in two spatial dimensions,","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"fracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1 rho v_1^2 + p rho v_1 v_2 (rho e + p) v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + p (rho e + p) v_2\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0\nendpmatrix","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"for an ideal gas with the specific heat ratio gamma. Here, rho is the density, v_1 and v_2 are the velocities, e is the specific total energy, and","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"p = (gamma - 1) left( rho e - frac12 rho (v_1^2 + v_2^2) right)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"is the pressure. Initial conditions consist of initial values for rho, rho v_1, rho v_2 and rho e. One of the common initial conditions for the compressible Euler equations is a simple density wave. Let's implement it.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Open the downloaded file elixir_euler_ec.jl with a text editor.\nGo to the line with the following code:\ninitial_condition = initial_condition_weak_blast_wave\nHere, initial_condition_weak_blast_wave is used as the initial condition.\nComment out the line using the # symbol:\n# initial_condition = initial_condition_weak_blast_wave\nNow you can create your own initial conditions. Add the following code after the commented line:","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"function initial_condition_density_waves(x, t, equations::CompressibleEulerEquations2D)\n v1 = 0.1 # velocity along x-axis\n v2 = 0.2 # velocity along y-axis\n rho = 1.0 + 0.98 * sinpi(sum(x) - t * (v1 + v2)) # density wave profile\n p = 20 # pressure\n rho_e = p / (equations.gamma - 1) + 1/2 * rho * (v1^2 + v2^2)\n return SVector(rho, rho*v1, rho*v2, rho_e)\nend\ninitial_condition = initial_condition_density_waves","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Execute the following code one more time, but instead of path/to/file paste the path to the elixir_euler_ec.jl file that you just edited.\nusing Trixi\ntrixi_include(path/to/file)\nusing Plots\nplot(sol)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Then you will obtain a new solution from running the simulation with a different initial condition.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"trixi_include(@__MODULE__,joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_euler_ec.jl\"), #hide\n initial_condition=initial_condition) #hide\npd = PlotData2D(sol) #hide\np1 = plot(pd[\"rho\"]) #hide\np2 = plot(pd[\"v1\"], clim=(0.05, 0.15)) #hide\np3 = plot(pd[\"v2\"], clim=(0.15, 0.25)) #hide\np4 = plot(pd[\"p\"], clim=(10, 30)) #hide\nplot(p1, p2, p3, p4) #hide","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"To get exactly the same picture execute the following.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"pd = PlotData2D(sol)\np1 = plot(pd[\"rho\"])\np2 = plot(pd[\"v1\"], clim=(0.05, 0.15))\np3 = plot(pd[\"v2\"], clim=(0.15, 0.25))\np4 = plot(pd[\"p\"], clim=(10, 30))\nplot(p1, p2, p3, p4)","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Feel free to make further changes to the initial condition to observe different solutions.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Now you are able to download, modify and execute simulation setups for Trixi.jl. To explore further details on setting up a new simulation with Trixi.jl, refer to the second part of the introduction titled Create first setup.","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"Sys.rm(\"out\"; recursive=true, force=true) #hide","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"","category":"page"},{"location":"tutorials/first_steps/getting_started/","page":"1.1 Getting started","title":"1.1 Getting started","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"EditURL = \"../../literate/src/files/upwind_fdsbp.jl\"","category":"page"},{"location":"tutorials/upwind_fdsbp/#upwind_fdsbp","page":"9 Upwind FD SBP schemes","title":"9: Upwind FD SBP schemes","text":"","category":"section"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"General tensor product SBP methods are supported via the DGMulti solver in a reasonably complete way, see the previous tutorial. Nevertheless, there is also experimental support for SBP methods with other solver and mesh types.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"The first step is to set up an SBP operator. A classical (central) SBP operator can be created as follows.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"using Trixi\nD_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),\n derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Instead of prefixing the source of coefficients MattssonNordström2004(), you can also load the package SummationByPartsOperators.jl. Either way, this yields an object representing the operator efficiently. If you want to compare it to coefficients presented in the literature, you can convert it to a matrix.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Matrix(D_SBP)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Upwind SBP operators are a concept introduced in 2017 by Ken Mattsson. You can create them as follows.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,\n derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Upwind operators are derivative operators biased towards one direction. The \"minus\" variants has a bias towards the left side, i.e., it uses values from more nodes to the left than from the right to compute the discrete derivative approximation at a given node (in the interior of the domain). In matrix form, this means more non-zero entries are left from the diagonal.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Matrix(D_upw.minus)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Analogously, the \"plus\" variant has a bias towards the right side.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Matrix(D_upw.plus)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"For more information on upwind SBP operators, please refer to the documentation of SummationByPartsOperators.jl and references cited there.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"The basic idea of upwind SBP schemes is to apply a flux vector splitting and use appropriate upwind operators for both parts of the flux. In 1D, this means to split the flux","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"f(u) = f^-(u) + f^+(u)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"such that f^-(u) is associated with left-going waves and f^+(u) with right-going waves. Then, we apply upwind SBP operators D^- D^+ with an appropriate upwind bias, resulting in","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"partial_x f(u) approx D^+ f^-(u) + D^- f^+(u)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Note that the established notations of upwind operators D^pm and flux splittings f^pm clash. The right-going waves from f^+ need an operator biased towards their upwind side, i.e., the left side. This upwind bias is provided by the operator D^-.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Many classical flux vector splittings have been developed for finite volume methods and are described in the book \"Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction\" of Eleuterio F. Toro (2009), DOI: 10.1007/b79761. One such a well-known splitting provided by Trixi.jl is splitting_steger_warming.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"Trixi.jl comes with several example setups using upwind SBP methods with flux vector splitting, e.g.,","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"elixir_euler_vortex.jl\nelixir_euler_taylor_green_vortex.jl","category":"page"},{"location":"tutorials/upwind_fdsbp/#Package-versions","page":"9 Upwind FD SBP schemes","title":"Package versions","text":"","category":"section"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"SummationByPartsOperators\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"","category":"page"},{"location":"tutorials/upwind_fdsbp/","page":"9 Upwind FD SBP schemes","title":"9 Upwind FD SBP schemes","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"EditURL = \"../../literate/src/files/hohqmesh_tutorial.jl\"","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#hohqmesh_tutorial","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16: Unstructured meshes with HOHQMesh.jl","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Trixi.jl supports numerical approximations on unstructured quadrilateral meshes with the UnstructuredMesh2D mesh type.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The purpose of this tutorial is to demonstrate how to use the UnstructuredMesh2D functionality of Trixi.jl. This begins by running and visualizing an available unstructured quadrilateral mesh example. Then, the tutorial will demonstrate how to conceptualize a problem with curved boundaries, generate a curvilinear mesh using the available software in the Trixi.jl ecosystem, and then run a simulation using Trixi.jl on said mesh.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Unstructured quadrilateral meshes can be made with the High-Order Hex-Quad Mesh (HOHQMesh) generator created and developed by David Kopriva. HOHQMesh is a mesh generator specifically designed for spectral element methods. It provides high-order boundary curve information (needed to accurately set boundary conditions) and elements can be larger (due to the high accuracy of the spatial approximation) compared to traditional finite element mesh generators. For more information about the design and features of HOHQMesh one can refer to its official documentation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"HOHQMesh is incorporated into the Trixi.jl framework via the registered Julia package HOHQMesh.jl. This package provides a Julia wrapper for the HOHQMesh generator that allows users to easily create mesh files without the need to build HOHQMesh from source. To install the HOHQMesh package execute","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"import Pkg; Pkg.add(\"HOHQMesh\")","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Now we are ready to generate an unstructured quadrilateral mesh that can be used by Trixi.jl.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Running-and-visualizing-an-unstructured-simulation","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Running and visualizing an unstructured simulation","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Trixi.jl supports solving hyperbolic problems on several mesh types. There is a default example for this mesh type that can be executed by","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using Trixi\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi_include(default_example_unstructured())\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This will compute a smooth, manufactured solution test case for the 2D compressible Euler equations on the curved quadrilateral mesh described in the Trixi.jl documentation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"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 unstructured quadrilateral meshes is post-processing the Trixi.jl output file(s) with the Trixi2Vtk tool and plotting them with ParaView.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"To convert the HDF5-formatted .h5 output file(s) from Trixi.jl into VTK format execute the following","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using Trixi2Vtk\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi2vtk(\"out/solution_000180.h5\", output_directory=\"out\")\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Note this step takes about 15-30 seconds as the package Trixi2Vtk must be precompiled and executed for the first time in your REPL session. The trixi2vtk command above will convert the solution file at the final time into a .vtu file which can be read in and visualized with ParaView. Optional arguments for trixi2vtk are: (1) Pointing to the output_directory where the new files will be saved; it defaults to the current directory. (2) Specifying a higher number of visualization nodes. For instance, if we want to use 12 uniformly spaced nodes for visualization we can execute","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"redirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi2vtk(\"out/solution_000180.h5\", output_directory=\"out\", nvisnodes=12)\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"By default trixi2vtk sets nvisnodes to be the same as the number of nodes specified in the elixir file used to run the simulation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Finally, if you want to convert all the solution files to VTK execute","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"redirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\ntrixi2vtk(\"out/solution_000*.h5\", output_directory=\"out\", nvisnodes=12)\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"then it is possible to open the .pvd file with ParaView and create a video of the simulation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Creating-a-mesh-using-HOHQMesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Creating a mesh using HOHQMesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The creation of an unstructured quadrilateral mesh using HOHQMesh.jl is driven by a control file. In this file the user dictates the domain to be meshed, prescribes any desired boundary curvature, the polynomial order of said boundaries, etc. In this tutorial we cover several basic features of the possible control inputs. For a complete discussion on this topic see the HOHQMesh control file documentation.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"To begin, we provide a complete control file in this tutorial. After this we give a breakdown of the control file components to explain the chosen parameters.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Suppose we want to create a mesh of a domain with straight sided outer boundaries and a curvilinear \"ice cream cone\" shaped object at its center.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: mesh_boundary_cartoon)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The associated ice_cream_straight_sides.control file is created below.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"open(\"out/ice_cream_straight_sides.control\", \"w\") do io\n println(io, raw\"\"\"\n\\begin{CONTROL_INPUT}\n \\begin{RUN_PARAMETERS}\n mesh file name = ice_cream_straight_sides.mesh\n plot file name = ice_cream_straight_sides.tec\n stats file name = none\n mesh file format = ISM-v2\n polynomial order = 4\n plot file format = skeleton\n \\end{RUN_PARAMETERS}\n\n \\begin{BACKGROUND_GRID}\n x0 = [-8.0, -8.0, 0.0]\n dx = [1.0, 1.0, 0.0]\n N = [16,16,1]\n \\end{BACKGROUND_GRID}\n\n \\begin{SPRING_SMOOTHER}\n smoothing = ON\n smoothing type = LinearAndCrossBarSpring\n number of iterations = 25\n \\end{SPRING_SMOOTHER}\n\n\\end{CONTROL_INPUT}\n\n\\begin{MODEL}\n\n \\begin{INNER_BOUNDARIES}\n\n \\begin{CHAIN}\n name = IceCreamCone\n \\begin{END_POINTS_LINE}\n name = LeftSlant\n xStart = [-2.0, 1.0, 0.0]\n xEnd = [ 0.0, -3.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{END_POINTS_LINE}\n name = RightSlant\n xStart = [ 0.0, -3.0, 0.0]\n xEnd = [ 2.0, 1.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{CIRCULAR_ARC}\n name = IceCream\n units = degrees\n center = [ 0.0, 1.0, 0.0]\n radius = 2.0\n start angle = 0.0\n end angle = 180.0\n \\end{CIRCULAR_ARC}\n \\end{CHAIN}\n\n \\end{INNER_BOUNDARIES}\n\n\\end{MODEL}\n\\end{FILE}\n\"\"\")\nend","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The first three blocks of information are wrapped within a CONTROL_INPUT environment block as they define the core components of the quadrilateral mesh that will be generated.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The first block of information in RUN_PARAMETERS is","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{RUN_PARAMETERS}\n mesh file name = ice_cream_straight_sides.mesh\n plot file name = ice_cream_straight_sides.tec\n stats file name = none\n mesh file format = ISM-v2\n polynomial order = 4\n plot file format = skeleton\n\\end{RUN_PARAMETERS}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The mesh and plot file names will be the files created by HOHQMesh once successfully executed. The stats file name is 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.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.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The second block of information in BACKGROUND_GRID is","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{BACKGROUND_GRID}\n x0 = [-8.0, -8.0, 0.0]\n dx = [1.0, 1.0, 0.0]\n N = [16,16,1]\n\\end{BACKGROUND_GRID}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This lays a grid of Cartesian elements for the domain beginning at the point x0 as its bottom-left corner. The value of dx, which could differ in each direction if desired, controls the step size taken in each Cartesian direction. The values in N set how many Cartesian box elements are set in each coordinate direction. The above parameters define a 16times 16 element square mesh on -88^2. Further, this sets up four outer boundaries of the domain that are given the default names: Top, Left, Bottom, Right.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The third block of information in SPRING_SMOOTHER is","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{SPRING_SMOOTHER}\n smoothing = ON\n smoothing type = LinearAndCrossBarSpring\n number of iterations = 25\n\\end{SPRING_SMOOTHER}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Once HOHQMesh generates the mesh, a spring-mass-dashpot model is created to smooth the mesh and create \"nicer\" quadrilateral elements. The default parameters of Hooke's law for the spring-mass-dashpot model have been selected after a fair amount of experimentation across many meshes. If you wish to deactivate this feature you can set smoothing = OFF (or remove this block from the control file).","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"After the CONTROL_INPUT environment block comes the MODEL environment block. It is here where the user prescribes curved boundary information with either:","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"An OUTER_BOUNDARY (covered in the next section of this tutorial).\nOne or more INNER_BOUNDARIES.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"There are several options to describe the boundary curve data to HOHQMesh like splines or parametric curves.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"For the example ice_cream_straight_sides.control we define three internal boundaries; two straight-sided and one as a circular arc. Within the HOHQMesh control input each curve must be assigned to a CHAIN as shown below in the complete INNER_BOUNDARIES block.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{INNER_BOUNDARIES}\n\n \\begin{CHAIN}\n name = IceCreamCone\n \\begin{END_POINTS_LINE}\n name = LeftSlant\n xStart = [-2.0, 1.0, 0.0]\n xEnd = [ 0.0, -3.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{END_POINTS_LINE}\n name = RightSlant\n xStart = [ 0.0, -3.0, 0.0]\n xEnd = [ 2.0, 1.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{CIRCULAR_ARC}\n name = IceCream\n units = degrees\n center = [ 0.0, 1.0, 0.0]\n radius = 2.0\n start angle = 0.0\n end angle = 180.0\n \\end{CIRCULAR_ARC}\n \\end{CHAIN}\n\n\\end{INNER_BOUNDARIES}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"It is important to note there are two name quantities one for the CHAIN and one for the PARAMETRIC_EQUATION_CURVE. The name for the CHAIN is used internally by HOHQMesh, so if you have multiple CHAINs they must be given a unique name. The name for the PARAMETRIC_EQUATION_CURVE will be printed to the appropriate boundaries within the .mesh file produced by HOHQMesh.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We create the mesh file ice_cream_straight_sides.mesh and its associated file for plotting ice_cream_straight_sides.tec by using HOHQMesh.jl's function generate_mesh.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using HOHQMesh\ncontrol_file = joinpath(\"out\", \"ice_cream_straight_sides.control\")\noutput = generate_mesh(control_file);\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The mesh file ice_cream_straight_sides.mesh and its associated file for plotting ice_cream_straight_sides.tec are placed in the out folder. The resulting mesh generated by HOHQMesh.jl is given in the following figure.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: mesh_straight_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We note that Trixi.jl uses the boundary name information from the control file to assign boundary conditions in an elixir file. Therefore, the name should start with a letter and consist only of alphanumeric characters and underscores. Please note that the name will be treated as case sensitive.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Example-simulation-on-ice_cream_straight_sides.mesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Example simulation on ice_cream_straight_sides.mesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"With this newly generated mesh we are ready to run a Trixi.jl simulation on an unstructured quadrilateral mesh. For this we must create a new elixir file.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The elixir file given below creates an initial condition for a uniform background flow state with a free stream Mach number of 0.3. A focus for this part of the tutorial is to specify the boundary conditions and to construct the new mesh from the file that was generated in the previous exercise.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"It is straightforward to set the different boundary condition types in an elixir by assigning a particular function to a boundary name inside a Julia dictionary, Dict, variable. Observe that the names of these boundaries match those provided by HOHQMesh either by default, e.g. Bottom, or user assigned, e.g. IceCream. For this problem setup use","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Freestream boundary conditions on the four box edges.\nFree slip wall boundary condition on the interior curved boundaries.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"To construct the unstructured quadrilateral mesh from the HOHQMesh file we point to the appropriate location with the variable mesh_file and then feed this into the constructor for the UnstructuredMesh2D type in Trixi.jl","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"# create the unstructured mesh from your mesh file\nusing Trixi\nmesh_file = joinpath(\"out\", \"ice_cream_straight_sides.mesh\")\nmesh = UnstructuredMesh2D(mesh_file);","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The complete elixir file for this simulation example is given below.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using OrdinaryDiffEq, Trixi\n\nequations = CompressibleEulerEquations2D(1.4) # set gas gamma = 1.4\n\n# freestream flow state with Ma_inf = 0.3\n@inline function uniform_flow_state(x, t, equations::CompressibleEulerEquations2D)\n\n # set the freestream flow parameters\n rho_freestream = 1.0\n u_freestream = 0.3\n p_freestream = inv(equations.gamma)\n\n theta = 0.0 # zero angle of attack\n si, co = sincos(theta)\n v1 = u_freestream * co\n v2 = u_freestream * si\n\n prim = SVector(rho_freestream, v1, v2, p_freestream)\n return prim2cons(prim, equations)\nend\n\n# initial condition\ninitial_condition = uniform_flow_state\n\n# boundary condition types\nboundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state)\n\n# boundary condition dictionary\nboundary_conditions = Dict( :Bottom => boundary_condition_uniform_flow,\n :Top => boundary_condition_uniform_flow,\n :Right => boundary_condition_uniform_flow,\n :Left => boundary_condition_uniform_flow,\n :LeftSlant => boundary_condition_slip_wall,\n :RightSlant => boundary_condition_slip_wall,\n :IceCream => boundary_condition_slip_wall );\n\n# DGSEM solver.\n# 1) polydeg must be >= the polynomial order set in the HOHQMesh control file to guarantee\n# freestream preservation. As a extra task try setting polydeg=3\n# 2) VolumeIntegralFluxDifferencing with central volume flux is activated\n# for dealiasing\nvolume_flux = flux_ranocha\nsolver = DGSEM(polydeg=4, surface_flux=flux_hll,\n volume_integral=VolumeIntegralFluxDifferencing(volume_flux))\n\n# create the unstructured mesh from your mesh file\nmesh_file = joinpath(\"out\", \"ice_cream_straight_sides.mesh\")\nmesh = UnstructuredMesh2D(mesh_file)\n\n# Create semidiscretization with all spatial discretization-related components\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,\n boundary_conditions=boundary_conditions)\n\n# Create ODE problem from semidiscretization with time span from 0.0 to 2.0\ntspan = (0.0, 2.0)\node = semidiscretize(semi, tspan)\n\n\n# Create the callbacks to output solution files and adapt the time step\nsummary_callback = SummaryCallback()\nsave_solution = SaveSolutionCallback(interval=10,\n save_initial_solution=true,\n save_final_solution=true)\nstepsize_callback = StepsizeCallback(cfl=1.0)\n\ncallbacks = CallbackSet(summary_callback, save_solution, stepsize_callback)\n\nredirect_stdio(stdout=devnull, stderr=devnull) do # code that prints annoying stuff we don't want to see here #hide\n# Evolve ODE problem in time using `solve` from OrdinaryDiffEq\nsol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),\n dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback\n save_everystep=false, callback=callbacks);\n# print the timer summary\nsummary_callback()\nend #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Visualization of the solution is carried out in a similar way as above. That is, one converts the .h5 output files with trixi2vtk and then plot the solution in ParaView. An example plot of the pressure at the final time is shown below.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: simulation_straight_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Making-a-mesh-with-a-curved-outer-boundary","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Making a mesh with a curved outer boundary","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Let us modify the mesh from the previous task and place a circular outer boundary instead of straight-sided outer boundaries. Note, the \"ice cream cone\" shape is still placed at the center of the domain.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We create the new control file ice_cream_curved_sides.control file below and will then highlight the major differences compared to ice_cream_straight_sides.control.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"open(\"out/ice_cream_curved_sides.control\", \"w\") do io\n println(io, raw\"\"\"\n\\begin{CONTROL_INPUT}\n \\begin{RUN_PARAMETERS}\n mesh file name = ice_cream_curved_sides.mesh\n plot file name = ice_cream_curved_sides.tec\n stats file name = none\n mesh file format = ISM-v2\n polynomial order = 4\n plot file format = skeleton\n \\end{RUN_PARAMETERS}\n\n \\begin{BACKGROUND_GRID}\n background grid size = [1.0, 1.0, 0.0]\n \\end{BACKGROUND_GRID}\n\n \\begin{SPRING_SMOOTHER}\n smoothing = ON\n smoothing type = LinearAndCrossBarSpring\n number of iterations = 25\n \\end{SPRING_SMOOTHER}\n\n\\end{CONTROL_INPUT}\n\n\\begin{MODEL}\n\n \\begin{OUTER_BOUNDARY}\n \\begin{PARAMETRIC_EQUATION_CURVE}\n name = OuterCircle\n xEqn = x(t) = 8.0*sin(2.0*pi*t)\n yEqn = y(t) = 8.0*cos(2.0*pi*t)\n zEqn = z(t) = 0.0\n \\end{PARAMETRIC_EQUATION_CURVE}\n\n \\end{OUTER_BOUNDARY}\n\n \\begin{INNER_BOUNDARIES}\n\n \\begin{CHAIN}\n name = IceCreamCone\n \\begin{END_POINTS_LINE}\n name = LeftSlant\n xStart = [-2.0, 1.0, 0.0]\n xEnd = [ 0.0, -3.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{END_POINTS_LINE}\n name = RightSlant\n xStart = [ 0.0, -3.0, 0.0]\n xEnd = [ 2.0, 1.0, 0.0]\n \\end{END_POINTS_LINE}\n\n \\begin{CIRCULAR_ARC}\n name = IceCream\n units = degrees\n center = [ 0.0, 1.0, 0.0]\n radius = 2.0\n start angle = 0.0\n end angle = 180.0\n \\end{CIRCULAR_ARC}\n \\end{CHAIN}\n\n \\end{INNER_BOUNDARIES}\n\n\\end{MODEL}\n\\end{FILE}\n\"\"\")\nend","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The first alteration is that we have altered the second block of information BACKGROUND_GRID within the CONTROL_INPUT to be","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"\\begin{BACKGROUND_GRID}\n background grid size = [1.0, 1.0, 0.0]\n\\end{BACKGROUND_GRID}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This mesh control file has an outer boundary that determines the extent of the domain to be meshed. Therefore, we only need to supply the background grid size to the BACKGROUND_GRID control input.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The second alteration is that the MODEL now contains information for an OUTER_BOUNDARY. In this case it is a circle of radius 8 centered at [0.0, 0.0, 0.0] written as a set of PARAMETRIC_EQUATION_CURVEs.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":" \\begin{OUTER_BOUNDARY}\n\n \\begin{PARAMETRIC_EQUATION_CURVE}\n name = OuterCircle\n xEqn = x(t) = 8.0*sin(2.0*pi*t)\n yEqn = y(t) = 8.0*cos(2.0*pi*t)\n zEqn = z(t) = 0.0\n \\end{PARAMETRIC_EQUATION_CURVE}\n\n \\end{OUTER_BOUNDARY}","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Just as with the inner boundary curves, we must assign a name to the OUTER_BOUNDARY. It will be included in the generated .mesh file and is used within the Trixi.jl elixir file to set boundary conditions.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Again, we create the .mesh and .tec files with HOHQMesh.jl's function generate_mesh","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"control_file = joinpath(\"out\", \"ice_cream_curved_sides.control\")\noutput = generate_mesh(control_file);\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The files are placed in the out folder.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The resulting mesh generated by HOHQMesh.jl is given in the following figure.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: mesh_curved_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Running-Trixi.jl-on-ice_cream_curved_sides.mesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Running Trixi.jl on ice_cream_curved_sides.mesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"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 OuterCircle instead of four edges of a bounding box.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"# boundary condition dictionary\nboundary_conditions = Dict( :OuterCircle => boundary_condition_uniform_flow,\n :LeftSlant => boundary_condition_slip_wall,\n :RightSlant => boundary_condition_slip_wall,\n :IceCream => boundary_condition_slip_wall );\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Also, we must update the construction of the mesh from our new mesh file ice_cream_curved_sides.mesh that is located in the out folder.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"# create the unstructured mesh from your mesh file\nmesh_file = joinpath(\"out\", \"ice_cream_curved_sides.mesh\")\nmesh = UnstructuredMesh2D(mesh_file);\nnothing #hide","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We can then post-process the solution file at the final time on the new mesh with Trixi2Vtk and visualize with ParaView.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: simulation_curved_sides)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Setting-up-a-simulation-with-AMR-via-P4estMesh","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Setting up a simulation with AMR via P4estMesh","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"The above explained mesh file format of ISM-V2 only works with UnstructuredMesh2D and so does not support AMR. On the other hand, the mesh type P4estMesh allows AMR. The mesh constructor for the P4estMesh imports an unstructured, conforming mesh from an Abaqus mesh file (.inp).","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"As described above, the first block of the HOHQMesh control file contains the parameter mesh file format. If you set mesh file format = ABAQUS instead of ISM-V2, HOHQMesh.jl's function generate_mesh creates an Abaqus mesh file .inp.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using HOHQMesh\ncontrol_file = joinpath(\"out\", \"ice_cream_straight_sides.control\")\noutput = generate_mesh(control_file);","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"Now, you can create a P4estMesh from your mesh file. It is described in detail in the P4est-based mesh part of the Trixi.jl docs.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using Trixi\nmesh_file = joinpath(\"out\", \"ice_cream_straight_sides.inp\")\nmesh = P4estMesh{2}(mesh_file)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"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.jl, see the matching tutorial.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"amr_indicator = IndicatorLöhner(semi, variable=density)\n\namr_controller = ControllerThreeLevel(semi, amr_indicator,\n base_level=0,\n med_level =1, med_threshold=0.05,\n max_level =3, max_threshold=0.1)\n\namr_callback = AMRCallback(semi, amr_controller,\n interval=5,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true)\n\ncallbacks = CallbackSet(..., amr_callback)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"We can then post-process the solution file at the final time on the new mesh with Trixi2Vtk and visualize with ParaView, see the appropriate visualization section for details.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"(Image: simulation_straight_sides_p4est_amr)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/#Package-versions","page":"16 Unstructured meshes with HOHQMesh.jl","title":"Package versions","text":"","category":"section"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\", \"Trixi2Vtk\", \"HOHQMesh\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"","category":"page"},{"location":"tutorials/hohqmesh_tutorial/","page":"16 Unstructured meshes with HOHQMesh.jl","title":"16 Unstructured meshes with HOHQMesh.jl","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"EditURL = \"../../literate/src/files/DGMulti_2.jl\"","category":"page"},{"location":"tutorials/DGMulti_2/#DGMulti_2","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8: Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"","category":"section"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"For a tutorial about DG schemes via the DGMulti solver please visit the previous tutorial. The DGMulti solver also supports other methods than DG. The important property a method has to fulfill is the summation-by-parts (SBP) property. The package SummationByPartsOperators.jl provides such methods, like a finite difference SBP (FD SBP) scheme. To do this, you need to create an SBP derivative operator and pass that as approximation_type to the DGMulti constructor. For example, the classical second-order FD SBP operator can be created as","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly\nD = derivative_operator(MattssonNordström2004(), derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"Here, the arguments xmin and xmax do not matter beyond setting the real type used for the operator - they just set a reference element and are rescaled on the physical elements. The parameter N determines the number of finite difference nodes. Then, D can be used as approximation_type like SBP() in a multi-block fashion. In multiple dimensions, such a 1D SBP operator will be used in a tensor product fashion, i.e., in each coordinate direction. In particular, you can use them only on 1D, 2D Quad(), and 3D Hex() elements.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"You can also use fully periodic single-block FD methods by creating a periodic SBP operator. For example, a fully periodic FD operator can be constructed as","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"D = periodic_derivative_operator(derivative_order=1, accuracy_order=2,\n xmin=0.0, xmax=1.0, N=11)","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"An example using such an FD method is implemented in elixir_euler_fdsbp_periodic.jl. For all parameters and other calling options, please have a look in the documentation of SummationByPartsOperators.jl.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"Another possible method is for instance a continuous Galerkin (CGSEM) method. You can use such a method with polynomial degree of 3 (N=4 Legendre Lobatto nodes on [0, 1]) coupled continuously on a uniform mesh with Nx=10 elements by setting approximation_type to","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly\nD = couple_continuously(legendre_derivative_operator(xmin=0.0, xmax=1.0, N=4),\n UniformPeriodicMesh1D(xmin=-1.0, xmax=1.0, Nx=10))","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"To choose a discontinuous coupling (DGSEM), use couple_discontinuously() instead of couple_continuously().","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"For more information and other SBP operators, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.","category":"page"},{"location":"tutorials/DGMulti_2/#Package-versions","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"Package versions","text":"","category":"section"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"StartUpDG\", \"SummationByPartsOperators\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"","category":"page"},{"location":"tutorials/DGMulti_2/","page":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"EditURL = \"../../literate/src/files/parabolic_terms.jl\"","category":"page"},{"location":"tutorials/parabolic_terms/#parabolic_terms","page":"12 Parabolic terms","title":"12: Parabolic terms","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"Experimental support for parabolic diffusion terms is available in Trixi.jl. This demo illustrates parabolic terms for the advection-diffusion equation.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"using OrdinaryDiffEq\nusing Trixi","category":"page"},{"location":"tutorials/parabolic_terms/#Splitting-a-system-into-hyperbolic-and-parabolic-parts.","page":"12 Parabolic terms","title":"Splitting a system into hyperbolic and parabolic parts.","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"For a mixed hyperbolic-parabolic system, we represent the hyperbolic and parabolic parts of the system separately. We first define the hyperbolic (advection) part of the advection-diffusion equation.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"advection_velocity = (1.5, 1.0)\nequations_hyperbolic = LinearScalarAdvectionEquation2D(advection_velocity);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"Next, we define the parabolic diffusion term. The constructor requires knowledge of equations_hyperbolic to be passed in because the LaplaceDiffusion2D applies diffusion to every variable of the hyperbolic system.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"diffusivity = 5.0e-2\nequations_parabolic = LaplaceDiffusion2D(diffusivity, equations_hyperbolic);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/#Boundary-conditions","page":"12 Parabolic terms","title":"Boundary conditions","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"As with the equations, we define boundary conditions separately for the hyperbolic and parabolic part of the system. For this example, we impose inflow BCs for the hyperbolic system (no condition is imposed on the outflow), and we impose Dirichlet boundary conditions for the parabolic equations. Both BoundaryConditionDirichlet and BoundaryConditionNeumann are defined for LaplaceDiffusion2D.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"The hyperbolic and parabolic boundary conditions are assumed to be consistent with each other.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"boundary_condition_zero_dirichlet = BoundaryConditionDirichlet((x, t, equations) -> SVector(0.0))\n\nboundary_conditions_hyperbolic = (; x_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 + 0.5 * x[2])),\n y_neg = boundary_condition_zero_dirichlet,\n y_pos = boundary_condition_do_nothing,\n x_pos = boundary_condition_do_nothing)\n\nboundary_conditions_parabolic = (; x_neg = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 + 0.5 * x[2])),\n y_neg = boundary_condition_zero_dirichlet,\n y_pos = boundary_condition_zero_dirichlet,\n x_pos = boundary_condition_zero_dirichlet);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/#Defining-the-solver-and-mesh","page":"12 Parabolic terms","title":"Defining the solver and mesh","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"The process of creating the DG solver and mesh is the same as for a purely hyperbolic system of equations.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\ncoordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))\ncoordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4,\n periodicity=false, n_cells_max=30_000) # set maximum capacity of tree data structure\n\ninitial_condition = (x, t, equations) -> SVector(0.0);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/#Semidiscretizing-and-solving","page":"12 Parabolic terms","title":"Semidiscretizing and solving","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"To semidiscretize a hyperbolic-parabolic system, we create a SemidiscretizationHyperbolicParabolic. This differs from a SemidiscretizationHyperbolic in that we pass in a Tuple containing both the hyperbolic and parabolic equation, as well as a Tuple containing the hyperbolic and parabolic boundary conditions.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"semi = SemidiscretizationHyperbolicParabolic(mesh,\n (equations_hyperbolic, equations_parabolic),\n initial_condition, solver;\n boundary_conditions=(boundary_conditions_hyperbolic,\n boundary_conditions_parabolic))","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"The rest of the code is identical to the hyperbolic case. We create a system of ODEs through semidiscretize, defining callbacks, and then passing the system to OrdinaryDiffEq.jl.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"tspan = (0.0, 1.5)\node = semidiscretize(semi, tspan)\ncallbacks = CallbackSet(SummaryCallback())\ntime_int_tol = 1.0e-6\nsol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol,\n ode_default_options()..., callback=callbacks);\nnothing #hide","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"We can now visualize the solution, which develops a boundary layer at the outflow boundaries.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"using Plots\nplot(sol)","category":"page"},{"location":"tutorials/parabolic_terms/#Package-versions","page":"12 Parabolic terms","title":"Package versions","text":"","category":"section"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"","category":"page"},{"location":"tutorials/parabolic_terms/","page":"12 Parabolic terms","title":"12 Parabolic terms","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"EditURL = \"../../literate/src/files/index.jl\"","category":"page"},{"location":"tutorials/introduction/#Tutorials-for-Trixi.jl","page":"Introduction","title":"Tutorials for Trixi.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"The tutorial section for Trixi.jl also contains interactive step-by-step explanations via Binder.","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Right now, you are using the classic documentation. The corresponding interactive notebooks can be opened in Binder and viewed in nbviewer via the icons (Image: ) and (Image: ) in the respective tutorial. You can also open the raw notebook files via (Image: ).","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.jl at the time of caching.","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"There are tutorials for the following topics:","category":"page"},{"location":"tutorials/introduction/#[1-First-steps-in-Trixi.jl](@ref-getting_started)","page":"Introduction","title":"1 First steps in Trixi.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial provides guidance for getting started with Trixi.jl, and Julia as well. It outlines the installation procedures for both Julia and Trixi.jl, the execution of Trixi.jl elixirs, the fundamental structure of a Trixi.jl setup, the visualization of results, and the development process for Trixi.jl.","category":"page"},{"location":"tutorials/introduction/#[2-Behind-the-scenes-of-a-simulation-setup](@ref-behind_the_scenes_simulation_setup)","page":"Introduction","title":"2 Behind the scenes of a simulation setup","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial will guide you through a simple Trixi.jl setup (\"elixir\"), giving an overview of what happens in the background during the initialization of a simulation. While the setup described herein does not cover all details, it involves relatively stable parts of Trixi.jl that are unlikely to undergo significant changes in the near future. The goal is to clarify some of the more fundamental, technical concepts that are applicable to a variety of (also more complex) configurations.s","category":"page"},{"location":"tutorials/introduction/#[3-Introduction-to-DG-methods](@ref-scalar_linear_advection_1d)","page":"Introduction","title":"3 Introduction to DG methods","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial gives an introduction to discontinuous Galerkin (DG) methods with the example of the scalar linear advection equation in 1D. Starting with some theoretical explanations, we first implement a raw version of a discontinuous Galerkin spectral element method (DGSEM). Then, we will show how to use features of Trixi.jl to achieve the same result.","category":"page"},{"location":"tutorials/introduction/#[4-DGSEM-with-flux-differencing](@ref-DGSEM_FluxDiff)","page":"Introduction","title":"4 DGSEM with flux differencing","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.jl and analyse entropy conservation for two different flux combinations.","category":"page"},{"location":"tutorials/introduction/#[5-Shock-capturing-with-flux-differencing-and-stage-limiter](@ref-shock_capturing)","page":"Introduction","title":"5 Shock capturing with flux differencing and stage limiter","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.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.","category":"page"},{"location":"tutorials/introduction/#[6-Non-periodic-boundary-conditions](@ref-non_periodic_boundaries)","page":"Introduction","title":"6 Non-periodic boundary conditions","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"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.","category":"page"},{"location":"tutorials/introduction/#[7-DG-schemes-via-DGMulti-solver](@ref-DGMulti_1)","page":"Introduction","title":"7 DG schemes via DGMulti solver","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial is about the more general DG solver DGMulti, introduced here. We are showing some examples for this solver, for instance with discretization nodes by Gauss or triangular elements. Moreover, we present a simple way to include pre-defined triangulate meshes for non-Cartesian domains using the package StartUpDG.jl.","category":"page"},{"location":"tutorials/introduction/#[8-Other-SBP-schemes-(FD,-CGSEM)-via-DGMulti-solver](@ref-DGMulti_2)","page":"Introduction","title":"8 Other SBP schemes (FD, CGSEM) via DGMulti solver","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Supplementary to the previous tutorial about DG schemes via the DGMulti solver we now present the possibility for DGMulti to use other SBP schemes via the package SummationByPartsOperators.jl. For instance, we show how to set up a finite differences (FD) scheme and a continuous Galerkin (CGSEM) method.","category":"page"},{"location":"tutorials/introduction/#[9-Upwind-FD-SBP-schemes](@ref-upwind_fdsbp)","page":"Introduction","title":"9 Upwind FD SBP schemes","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"General SBP schemes can not only be used via the DGMulti solver but also with a general DG solver. In particular, upwind finite difference SBP methods can be used together with the TreeMesh. Similar to general SBP schemes in the DGMulti framework, the interface is based on the package SummationByPartsOperators.jl.","category":"page"},{"location":"tutorials/introduction/#[10-Adding-a-new-scalar-conservation-law](@ref-adding_new_scalar_equations)","page":"Introduction","title":"10 Adding a new scalar conservation law","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial explains how to add a new physics model using the example of the cubic conservation law. First, we define the equation using a struct CubicEquation and the physical flux. Then, the corresponding standard setup in Trixi.jl (mesh, solver, semi and ode) is implemented and the ODE problem is solved by OrdinaryDiffEq's solve method.","category":"page"},{"location":"tutorials/introduction/#[11-Adding-a-non-conservative-equation](@ref-adding_nonconservative_equation)","page":"Introduction","title":"11 Adding a non-conservative equation","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"In this part, another physics model is implemented, the nonconservative linear advection equation. We run two different simulations with different levels of refinement and compare the resulting errors.","category":"page"},{"location":"tutorials/introduction/#[12-Parabolic-terms](@ref-parabolic_terms)","page":"Introduction","title":"12 Parabolic terms","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes how parabolic terms are implemented in Trixi.jl, e.g., to solve the advection-diffusion equation.","category":"page"},{"location":"tutorials/introduction/#[13-Adding-new-parabolic-terms](@ref-adding_new_parabolic_terms)","page":"Introduction","title":"13 Adding new parabolic terms","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes how new parabolic terms can be implemented using Trixi.jl.","category":"page"},{"location":"tutorials/introduction/#[14-Adaptive-mesh-refinement](@ref-adaptive_mesh_refinement)","page":"Introduction","title":"14 Adaptive mesh refinement","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Adaptive mesh refinement (AMR) helps to increase the accuracy in sensitive or turbolent regions while 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.","category":"page"},{"location":"tutorials/introduction/#[15-Structured-mesh-with-curvilinear-mapping](@ref-structured_mesh_mapping)","page":"Introduction","title":"15 Structured mesh with curvilinear mapping","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"In this tutorial, the use of Trixi.jl's structured curved mesh type StructuredMesh 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.","category":"page"},{"location":"tutorials/introduction/#[16-Unstructured-meshes-with-HOHQMesh.jl](@ref-hohqmesh_tutorial)","page":"Introduction","title":"16 Unstructured meshes with HOHQMesh.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"The purpose of this tutorial is to demonstrate how to use the UnstructuredMesh2D functionality of Trixi.jl. This begins by running and visualizing an available unstructured quadrilateral mesh example. Then, the tutorial will demonstrate how to conceptualize a problem with curved boundaries, generate a curvilinear mesh using the available HOHQMesh software in the Trixi.jl ecosystem, and then run a simulation using Trixi.jl on said mesh. In the end, the tutorial briefly explains how to simulate an example using AMR via P4estMesh.","category":"page"},{"location":"tutorials/introduction/#[17-P4est-mesh-from-gmsh](@ref-p4est_from_gmsh)","page":"Introduction","title":"17 P4est mesh from gmsh","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes how to obtain a P4estMesh from an existing mesh generated by gmsh or any other meshing software that can export to the Abaqus input .inp format. The tutorial demonstrates how edges/faces can be associated with boundary conditions based on the physical nodesets.","category":"page"},{"location":"tutorials/introduction/#[18-Explicit-time-stepping](@ref-time_stepping)","page":"Introduction","title":"18 Explicit time stepping","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial is about time integration using 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.","category":"page"},{"location":"tutorials/introduction/#[19-Differentiable-programming](@ref-differentiable_programming)","page":"Introduction","title":"19 Differentiable programming","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This part deals with some basic differentiable programming topics. For example, a Jacobian, its eigenvalues and a curve of total energy (through the simulation) are calculated and plotted for a few semidiscretizations. Moreover, we calculate an example for propagating errors with Measurement.jl at the end.","category":"page"},{"location":"tutorials/introduction/#[20-Custom-semidiscretization](@ref-custom_semidiscretization)","page":"Introduction","title":"20 Custom semidiscretization","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This tutorial describes the semidiscretiations of Trixi.jl and explains how to extend them for custom tasks.","category":"page"},{"location":"tutorials/introduction/#Examples-in-Trixi.jl","page":"Introduction","title":"Examples in Trixi.jl","text":"","category":"section"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"Trixi.jl already contains several more coding examples, the so-called elixirs. You can find them in the folder 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 advection or euler) and other special characteristics like the initial condition (e.g. gauss, astro_jet, blast_wave) or the included simulation features (e.g. amr, shockcapturing).","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"","category":"page"},{"location":"tutorials/introduction/","page":"Introduction","title":"Introduction","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"EditURL = \"../../../literate/src/files/first_steps/changing_trixi.jl\"","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#changing_trixi","page":"1.3 Changing Trixi.jl itself","title":"1.3: First steps in Trixi.jl: Changing Trixi.jl itself","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"If you plan on editing Trixi.jl itself, you can download Trixi.jl locally and run it from the cloned directory.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#Cloning-Trixi.jl","page":"1.3 Changing Trixi.jl itself","title":"Cloning Trixi.jl","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/#Windows","page":"1.3 Changing Trixi.jl itself","title":"Windows","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"If you are using Windows, you can clone Trixi.jl by using the GitHub Desktop tool:","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"If you do not have a GitHub account yet, create it on the GitHub website.\nDownload and install GitHub Desktop and then log in to your account.\nOpen GitHub Desktop, press Ctrl+Shift+O.\nIn the opened window, paste trixi-framework/Trixi.jl and choose the path to the folder where you want to save Trixi.jl. Then click Clone and Trixi.jl will be cloned to your computer.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Now you cloned Trixi.jl and only need to tell Julia to use the local clone as the package sources:","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Open a terminal using Win+r and cmd. Navigate to the folder with the cloned Trixi.jl using cd.\nCreate a new directory run, enter it, and start Julia with the --project=. flag:\nmkdir run\ncd run\njulia --project=.\nNow run the following commands to install all relevant packages:\nusing Pkg; Pkg.develop(PackageSpec(path=\"..\")) # Tell Julia to use the local Trixi.jl clone\nPkg.add([\"OrdinaryDiffEq\", \"Plots\"]) # Install additional packages","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Now you already installed Trixi.jl from your local clone. Note that if you installed Trixi.jl this way, you always have to start Julia with the --project flag set to your run directory, e.g.,","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"julia --project=.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"if already inside the run directory.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#Linux","page":"1.3 Changing Trixi.jl itself","title":"Linux","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"You can clone Trixi.jl to your computer by executing the following commands:","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"git clone git@github.com:trixi-framework/Trixi.jl.git\n# If an error occurs, try the following:\n# git clone https://github.com/trixi-framework/Trixi.jl\ncd Trixi.jl\nmkdir run\ncd run\njulia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=\"..\"))' # Tell Julia to use the local Trixi.jl clone\njulia --project=. -e 'using Pkg; Pkg.add([\"OrdinaryDiffEq\", \"Plots\"])' # Install additional packages","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Note that if you installed Trixi.jl this way, you always have to start Julia with the --project flag set to your run directory, e.g.,","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"julia --project=.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"if already inside the run directory.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/#Additional-reading","page":"1.3 Changing Trixi.jl itself","title":"Additional reading","text":"","category":"section"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"To further delve into Trixi.jl, you may have a look at the following introductory tutorials.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"Introduction to DG methods will teach you how to set up a simple way to approximate the solution of a hyperbolic partial differential equation. It will be especially useful to learn about the Discontinuous Galerkin method and the way it is implemented in Trixi.jl.\nAdding a new scalar conservation law and Adding a non-conservative equation describe how to add new physics models that are not yet included in Trixi.jl.\nCallbacks gives an overview of how to regularly execute specific actions during a simulation, e.g., to store the solution or adapt the mesh.","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"","category":"page"},{"location":"tutorials/first_steps/changing_trixi/","page":"1.3 Changing Trixi.jl itself","title":"1.3 Changing Trixi.jl itself","text":"This page was generated using Literate.jl.","category":"page"},{"location":"reference-trixi/#Trixi.jl-API","page":"Trixi.jl","title":"Trixi.jl API","text":"","category":"section"},{"location":"reference-trixi/","page":"Trixi.jl","title":"Trixi.jl","text":"CurrentModule = Trixi","category":"page"},{"location":"reference-trixi/","page":"Trixi.jl","title":"Trixi.jl","text":"Modules = [Trixi]","category":"page"},{"location":"reference-trixi/#Trixi.Trixi","page":"Trixi.jl","title":"Trixi.Trixi","text":"Trixi\n\nTrixi.jl is a numerical simulation framework for hyperbolic conservation laws. 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.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures.\n\nTo get started, run your first simulation with Trixi.jl using\n\ntrixi_include(default_example())\n\nSee also: trixi-framework/Trixi.jl\n\n\n\n\n\n","category":"module"},{"location":"reference-trixi/#Trixi.boundary_condition_do_nothing","page":"Trixi.jl","title":"Trixi.boundary_condition_do_nothing","text":"boundary_condition_do_nothing = Trixi.BoundaryConditionDoNothing()\n\nImposing no boundary condition just evaluates the flux at the inner state.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.boundary_condition_periodic","page":"Trixi.jl","title":"Trixi.boundary_condition_periodic","text":"boundary_condition_periodic = Trixi.BoundaryConditionPeriodic()\n\nA singleton struct indicating periodic boundary conditions.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.flux_hll","page":"Trixi.jl","title":"Trixi.flux_hll","text":"flux_hll\n\nSee FluxHLL.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.flux_hlle","page":"Trixi.jl","title":"Trixi.flux_hlle","text":"flux_hlle\n\nSee min_max_speed_einfeldt. This is a FluxHLL-type two-wave solver with special estimates of the wave speeds.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.flux_lax_friedrichs","page":"Trixi.jl","title":"Trixi.flux_lax_friedrichs","text":"flux_lax_friedrichs\n\nSee FluxLaxFriedrichs.\n\n\n\n\n\n","category":"constant"},{"location":"reference-trixi/#Trixi.AMRCallback","page":"Trixi.jl","title":"Trixi.AMRCallback","text":"AMRCallback(semi, controller [,adaptor=AdaptorAMR(semi)];\n interval,\n adapt_initial_condition=true,\n adapt_initial_condition_only_refine=true,\n dynamic_load_balancing=true)\n\nPerforms adaptive mesh refinement (AMR) every interval time steps for a given semidiscretization semi using the chosen controller.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AbstractEquations","page":"Trixi.jl","title":"Trixi.AbstractEquations","text":"AbstractEquations{NDIMS, NVARS}\n\nAn abstract supertype of specific equations such as the compressible Euler equations. The type parameters encode the number of spatial dimensions (NDIMS) and the number of primary variables (NVARS) of the physics model.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AbstractMesh","page":"Trixi.jl","title":"Trixi.AbstractMesh","text":"AbstractMesh{NDIMS}\n\nAn abstract supertype of specific mesh types such as TreeMesh or StructuredMesh. The type parameters encode the number of spatial dimensions (NDIMS).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AcousticPerturbationEquations2D","page":"Trixi.jl","title":"Trixi.AcousticPerturbationEquations2D","text":"AcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global)\n\nAcoustic perturbation equations (APE) in two space dimensions. The equations are given by\n\nbeginaligned\n fracpartialmathbfvpartial t + nabla (barmathbfvcdotmathbfv)\n + nablaleft( fracbarc^2 tildepbarrho right) = 0 \n fracpartial tildeppartial t +\n nablacdot (barrho mathbfv + barmathbfv tildep) = 0\nendaligned\n\nThe bar bar(cdot) indicates time-averaged quantities. The unknowns of the APE are the perturbed velocities mathbfv = (v_1 v_2)^T and the scaled perturbed pressure tildep = fracpbarc^2, where p denotes the perturbed pressure and the perturbed variables are defined by phi = phi - barphi.\n\nIn addition to the unknowns, Trixi.jl currently stores the mean values in the state vector, i.e. the state vector used internally is given by\n\nmathbfu =\n beginpmatrix\n v_1 v_2 tildep barv_1 barv_2 barc barrho\n endpmatrix\n\nThis affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the mean values must be zero.\nThe mean values have to be considered when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes these variables too.\nTrixi.jl's visualization tools will visualize the mean values by default.\n\nThe constructor accepts a 2-tuple v_mean_global and scalars c_mean_global and rho_mean_global which can be used to make the definition of initial conditions for problems with constant mean flow more flexible. These values are ignored if the mean values are defined internally in an initial condition.\n\nThe equations are based on the APE-4 system introduced in the following paper:\n\nRoland Ewert and Wolfgang Schröder (2003) Acoustic perturbation equations based on flow decomposition via source filtering DOI: 10.1016/S0021-9991(03)00168-2\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.Adiabatic","page":"Trixi.jl","title":"Trixi.Adiabatic","text":"struct Adiabatic\n\nUsed to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_normal_flux_function should be a function with signature boundary_value_normal_flux_function(x, t, equations) and return a scalar value for the normal heat flux at point x and time t.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AliveCallback","page":"Trixi.jl","title":"Trixi.AliveCallback","text":"AliveCallback(analysis_interval=0, alive_interval=analysis_interval÷10)\n\nInexpensive callback showing that a simulation is still running by printing some information such as the current time to the screen every alive_interval time steps. If analysis_interval ≂̸ 0, the output is omitted every analysis_interval time steps.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AnalysisCallback","page":"Trixi.jl","title":"Trixi.AnalysisCallback","text":"AnalysisCallback(semi; interval=0,\n save_analysis=false,\n output_directory=\"out\",\n analysis_filename=\"analysis.dat\",\n extra_analysis_errors=Symbol[],\n extra_analysis_integrals=())\n\nAnalyze a numerical solution every interval time steps and print the results to the screen. If save_analysis, the results are also saved in joinpath(output_directory, analysis_filename).\n\nAdditional errors can be computed, e.g. by passing extra_analysis_errors = (:l2_error_primitive, :linf_error_primitive) or extra_analysis_errors = (:conservation_error,).\n\nIf you want to omit the computation (to safe compute-time) of the default_analysis_errors, specify analysis_errors = Symbol[]. Note: default_analysis_errors are :l2_error and :linf_error for all equations. If you want to compute extra_analysis_errors such as :conservation_error solely, i.e., without :l2_error, :linf_error you need to specify analysis_errors = [:conservation_error] instead of extra_analysis_errors = [:conservation_error].\n\nFurther scalar functions func in extra_analysis_integrals are applied to the numerical solution and integrated over the computational domain. Some examples for this are entropy, energy_kinetic, energy_internal, and energy_total. You can also write your own function with the same signature as the examples listed above and pass it via extra_analysis_integrals. See the developer comments about Trixi.analyze, Trixi.pretty_form_utf, and Trixi.pretty_form_ascii for further information on how to create custom analysis quantities.\n\nIn addition, the analysis callback records and outputs a number of quantities that are useful for evaluating the computational performance, such as the total runtime, the performance index (time/DOF/rhs!), the time spent in garbage collection (GC), or the current memory usage (alloc'd memory).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AnalysisCallbackCoupled","page":"Trixi.jl","title":"Trixi.AnalysisCallbackCoupled","text":"AnalysisCallbackCoupled(semi, callbacks...)\n\nCombine multiple analysis callbacks for coupled simulations with a SemidiscretizationCoupled. For each coupled system, an indididual AnalysisCallback must be created and passed to the AnalysisCallbackCoupled in order, i.e., in the same sequence as the indidvidual semidiscretizations are stored in the SemidiscretizationCoupled.\n\nwarning: Experimental code\nThis is an experimental feature and can change any time.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.AveragingCallback","page":"Trixi.jl","title":"Trixi.AveragingCallback","text":"AveragingCallback(semi::SemidiscretizationHyperbolic, tspan; output_directory=\"out\",\n filename=\"averaging.h5\")\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nA callback that averages the flow field described by semi which must be a semidiscretization of the compressible Euler equations in two dimensions. The callback records the mean velocity, mean speed of sound, mean density, and mean vorticity for each node over the time interval given by tspan and stores the results in an HDF5 file filename in the directory output_directory. Note that this callback does not support adaptive mesh refinement (AMRCallback).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionCoupled","page":"Trixi.jl","title":"Trixi.BoundaryConditionCoupled","text":"BoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter)\n\nBoundary condition to glue two meshes together. Solution values at the boundary of another mesh will be used as boundary values. This requires the use of SemidiscretizationCoupled. The other mesh is specified by other_semi_index, which is the index of the mesh in the tuple of semidiscretizations.\n\nNote that the elements and nodes of the two meshes at the coupled boundary must coincide. This is currently only implemented for StructuredMesh.\n\nArguments\n\nother_semi_index: the index in SemidiscretizationCoupled of the semidiscretization from which the values are copied\nindices::Tuple: node/cell indices at the boundary of the mesh in the other semidiscretization. See examples below.\nuEltype::Type: element type of solution\ncoupling_converter::CouplingConverter: function to call for converting the solution state of one system to the other system\n\nExamples\n\n# Connect the left boundary of mesh 2 to our boundary such that our positive\n# boundary direction will match the positive y direction of the other boundary\nBoundaryConditionCoupled(2, (:begin, :i), Float64, fun)\n\n# Connect the same two boundaries oppositely oriented\nBoundaryConditionCoupled(2, (:begin, :i_backwards), Float64, fun)\n\n# Using this as y_neg boundary will connect `our_cells[i, 1, j]` to `other_cells[j, end-i, end]`\nBoundaryConditionCoupled(2, (:j, :i_backwards, :end), Float64, fun)\n\nwarning: Experimental code\nThis is an experimental feature and can change any time.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionDirichlet","page":"Trixi.jl","title":"Trixi.BoundaryConditionDirichlet","text":"BoundaryConditionDirichlet(boundary_value_function)\n\nCreate a Dirichlet boundary condition that uses the function boundary_value_function to specify the values at the boundary. This can be used to create a boundary condition that specifies exact boundary values by passing the exact solution of the equation. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as\n\nboundary_value_function(x, t, equations)\n\nwhere x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.\n\nExamples\n\njulia> BoundaryConditionDirichlet(initial_condition_convergence_test)\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionNavierStokesWall","page":"Trixi.jl","title":"Trixi.BoundaryConditionNavierStokesWall","text":"struct BoundaryConditionNavierStokesWall\n\nCreates a wall-type boundary conditions for the compressible Navier-Stokes equations. The fields boundary_condition_velocity and boundary_condition_heat_flux are intended to be boundary condition types such as the NoSlip velocity boundary condition and the Adiabatic or Isothermal heat boundary condition.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundaryConditionNeumann","page":"Trixi.jl","title":"Trixi.BoundaryConditionNeumann","text":"BoundaryConditionNeumann(boundary_normal_flux_function)\n\nSimilar to BoundaryConditionDirichlet, but creates a Neumann boundary condition for parabolic equations that uses the function boundary_normal_flux_function to specify the values of the normal flux at the boundary. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as\n\nboundary_normal_flux_function(x, t, equations)\n\nwhere x specifies the coordinates, t is the current time, and equation is the corresponding system of equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.BoundsCheckCallback","page":"Trixi.jl","title":"Trixi.BoundsCheckCallback","text":"BoundsCheckCallback(; output_directory=\"out\", save_errors=false, interval=1)\n\nSubcell limiting techniques with SubcellLimiterIDP are constructed to adhere certain local or global bounds. To make sure that these bounds are actually met, this callback calculates the maximum deviation from the bounds. The maximum deviation per applied bound is printed to the screen at the end of the simulation. For more insights, when setting save_errors=true the occurring errors are exported every interval time steps during the simulation. Then, the maximum deviations since the last export are saved in \"output_directory/deviations.txt\". The BoundsCheckCallback has to be applied as a stage callback for the SSPRK time integration scheme.\n\nnote: Note\nFor SubcellLimiterIDP, the solution is corrected in the a posteriori correction stage SubcellLimiterIDPCorrection. So, to check the final solution, this bounds check callback must be called after the correction stage.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CarpenterKennedy2N43","page":"Trixi.jl","title":"Trixi.CarpenterKennedy2N43","text":" CarpenterKennedy2N43()\n\nCarpenter, Kennedy (1994) Third order 2N storage RK schemes with error control\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CarpenterKennedy2N54","page":"Trixi.jl","title":"Trixi.CarpenterKennedy2N54","text":"CarpenterKennedy2N54()\n\nThe following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of\n\nCarpenter, Kennedy (1994) Fourth order 2N storage RK schemes, Solution 3\n\nusing the same interface as OrdinaryDiffEq.jl.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquations1D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquations1D","text":"CompressibleEulerEquations1D(gamma)\n\nThe compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1 rho v_1^2 + p (rho e +p) v_1\nendpmatrix\n=\nbeginpmatrix\n0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in one space dimension. Here, rho is the density, v_1 the velocity, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho v_1^2 right)\n\nthe pressure.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquations2D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquations2D","text":"CompressibleEulerEquations2D(gamma)\n\nThe compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v_1 rho v_1^2 + p rho v_1 v_2 (rho e +p) v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + p (rho e +p) v_2\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in two space dimensions. Here, rho is the density, v_1, v_2 the velocities, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2) right)\n\nthe pressure.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquations3D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquations3D","text":"CompressibleEulerEquations3D(gamma)\n\nThe compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2 rho v_3 rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v_1 rho v_1^2 + p rho v_1 v_2 rho v_1 v_3 ( rho e +p) v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + p rho v_1 v_3 ( rho e +p) v_2\nendpmatrix\n+\nfracpartialpartial z\nbeginpmatrix\nrho v_3 rho v_1 v_3 rho v_2 v_3 rho v_3^2 + p ( rho e +p) v_3\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in three space dimensions. Here, rho is the density, v_1, v_2, v_3 the velocities, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2+v_3^2) right)\n\nthe pressure.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerEquationsQuasi1D","page":"Trixi.jl","title":"Trixi.CompressibleEulerEquationsQuasi1D","text":"CompressibleEulerEquationsQuasi1D(gamma)\n\nThe quasi-1d compressible Euler equations (see Chan et al. DOI: 10.48550/arXiv.2307.12089 for details)\n\nfracpartialpartial t\nbeginpmatrix\na rho a rho v_1 a e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\na rho v_1 a rho v_1^2 a v_1 (e +p)\nendpmatrix\n+ \na fracpartialpartial x\nbeginpmatrix\n0 p 0 \nendpmatrix\n=\nbeginpmatrix\n0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in one space dimension. Here, rho is the density, v_1 the velocity, e the specific total energy rather than specific internal energy, a the (possibly) variable nozzle width, and\n\np = (gamma - 1) left( e - frac12 rho v_1^2 right)\n\nthe pressure.\n\nThe nozzle width function a(x) is set inside the initial condition routine for a particular problem setup. To test the conservative form of the compressible Euler equations one can set the nozzle width variable a to one. \n\nIn addition to the unknowns, Trixi.jl currently stores the nozzle width values at the approximation points despite being fixed in time. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the nozzle width must be zero.\nThe nozzle width values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the nozzle width by default.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerMulticomponentEquations1D","page":"Trixi.jl","title":"Trixi.CompressibleEulerMulticomponentEquations1D","text":"CompressibleEulerMulticomponentEquations1D(; gammas, gas_constants)\n\nMulticomponent version of the compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho v_1 rho e rho_1 rho_2 vdots rho_n\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1^2 + p (rho e +p) v_1 rho_1 v_1 rho_2 v_1 vdots rho_n v_1\nendpmatrix\n\n=\nbeginpmatrix\n0 0 0 0 vdots 0\nendpmatrix\n\nfor calorically perfect gas in one space dimension. Here, rho_i is the density of component i, rho=sum_i=1^nrho_i the sum of the individual rho_i, v_1 the velocity, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho v_1^2 right)\n\nthe pressure,\n\ngamma=fracsum_i=1^nrho_i C_vigamma_isum_i=1^nrho_i C_vi\n\ntotal heat capacity ratio, gamma_i heat capacity ratio of component i,\n\nC_vi=fracRgamma_i-1\n\nspecific heat capacity at constant volume of component i.\n\nIn case of more than one component, the specific heat ratios gammas and the gas constants gas_constants should be passed as tuples, e.g., gammas=(1.4, 1.667).\n\nThe remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleEulerMulticomponentEquations2D","page":"Trixi.jl","title":"Trixi.CompressibleEulerMulticomponentEquations2D","text":"CompressibleEulerMulticomponentEquations2D(; gammas, gas_constants)\n\nMulticomponent version of the compressible Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho v_1 rho v_2 rho e rho_1 rho_2 vdots rho_n\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\nrho v_1^2 + p rho v_1 v_2 ( rho e +p) v_1 rho_1 v_1 rho_2 v_1 vdots rho_n v_1\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_1 v_2 rho v_2^2 + p ( rho e +p) v_2 rho_1 v_2 rho_2 v_2 vdots rho_n v_2\nendpmatrix\n=\nbeginpmatrix\n0 0 0 0 0 vdots 0\nendpmatrix\n\nfor calorically perfect gas in two space dimensions. Here, rho_i is the density of component i, rho=sum_i=1^nrho_i the sum of the individual rho_i, v_1, v_2 the velocities, e the specific total energy rather than specific internal energy, and\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2 + v_2^2) right)\n\nthe pressure,\n\ngamma=fracsum_i=1^nrho_i C_vigamma_isum_i=1^nrho_i C_vi\n\ntotal heat capacity ratio, gamma_i heat capacity ratio of component i,\n\nC_vi=fracRgamma_i-1\n\nspecific heat capacity at constant volume of component i.\n\nIn case of more than one component, the specific heat ratios gammas and the gas constants gas_constants in [kJ/(kg*K)] should be passed as tuples, e.g., gammas=(1.4, 1.667).\n\nThe remaining variables like the specific heats at constant volume cv or the specific heats at constant pressure cp are then calculated considering a calorically perfect gas.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleNavierStokesDiffusion1D","page":"Trixi.jl","title":"Trixi.CompressibleNavierStokesDiffusion1D","text":"CompressibleNavierStokesDiffusion1D(equations; mu, Pr,\n gradient_variables=GradientVariablesPrimitive())\n\nContains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations1D.\n\nequations: instance of the CompressibleEulerEquations1D\nmu: dynamic viscosity,\nPr: Prandtl number,\ngradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().\n\nFluid properties such as the dynamic viscosity mu can be provided in any consistent unit system, e.g., [mu] = kg m⁻¹ s⁻¹.\n\nThe particular form of the compressible Navier-Stokes implemented is\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v rho e\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v rho v^2 + p (rho e + p) v\nendpmatrix\n=\nfracpartialpartial x\nbeginpmatrix\n0 tau tau v - q\nendpmatrix\n\nwhere the system is closed with the ideal gas assumption giving\n\np = (gamma - 1) left( rho e - frac12 rho v^2 right)\n\nas the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations1D. The terms on the right hand side of the system above are built from the viscous stress\n\ntau = mu fracpartialpartial x v\n\nwhere the heat flux is\n\nq = -kappa fracpartialpartial x left(Tright)quad T = fracpRrho\n\nwhere T is the temperature and kappa is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is\n\nkappa = fracgamma mu R(gamma - 1)textrmPr\n\nFrom this combination of temperature T and thermal conductivity kappa we see that the gas constant R cancels and the heat flux becomes\n\nq = -kappa fracpartialpartial x left(Tright) = -fracgamma mu(gamma - 1)textrmPr fracpartialpartial x left(fracprhoright)\n\nwhich is the form implemented below in the flux function.\n\nIn one spatial dimensions we require gradients for two quantities, e.g., primitive quantities\n\nfracpartialpartial x v fracpartialpartial x T\n\nor the entropy variables\n\nfracpartialpartial x w_2 fracpartialpartial x w_3\n\nwhere\n\nw_2 = fracrho v1p w_3 = -fracrhop\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleNavierStokesDiffusion2D","page":"Trixi.jl","title":"Trixi.CompressibleNavierStokesDiffusion2D","text":"CompressibleNavierStokesDiffusion2D(equations; mu, Pr,\n gradient_variables=GradientVariablesPrimitive())\n\nContains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations2D.\n\nequations: instance of the CompressibleEulerEquations2D\nmu: dynamic viscosity,\nPr: Prandtl number,\ngradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().\n\nFluid properties such as the dynamic viscosity mu can be provided in any consistent unit system, e.g., [mu] = kg m⁻¹ s⁻¹.\n\nThe particular form of the compressible Navier-Stokes implemented is\n\nfracpartialpartial t\nbeginpmatrix\nrho rho mathbfv rho e\nendpmatrix\n+\nnabla cdot\nbeginpmatrix\n rho mathbfv rho mathbfvmathbfv^T + p underlineI (rho e + p) mathbfv\nendpmatrix\n=\nnabla cdot\nbeginpmatrix\n0 underlinetau underlinetaumathbfv - mathbfq\nendpmatrix\n\nwhere the system is closed with the ideal gas assumption giving\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2) right)\n\nas the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor\n\nunderlinetau = mu left(nablamathbfv + left(nablamathbfvright)^Tright) - frac23 mu left(nablacdotmathbfvright)underlineI\n\nwhere underlineI is the 2times 2 identity matrix and the heat flux is\n\nmathbfq = -kappanablaleft(Tright)quad T = fracpRrho\n\nwhere T is the temperature and kappa is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is\n\nkappa = fracgamma mu R(gamma - 1)textrmPr\n\nFrom this combination of temperature T and thermal conductivity kappa we see that the gas constant R cancels and the heat flux becomes\n\nmathbfq = -kappanablaleft(Tright) = -fracgamma mu(gamma - 1)textrmPrnablaleft(fracprhoright)\n\nwhich is the form implemented below in the flux function.\n\nIn two spatial dimensions we require gradients for three quantities, e.g., primitive quantities\n\nnabla v_1 nabla v_2 nabla T\n\nor the entropy variables\n\nnabla w_2 nabla w_3 nabla w_4\n\nwhere\n\nw_2 = fracrho v_1p w_3 = fracrho v_2p w_4 = -fracrhop\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.CompressibleNavierStokesDiffusion3D","page":"Trixi.jl","title":"Trixi.CompressibleNavierStokesDiffusion3D","text":"CompressibleNavierStokesDiffusion3D(equations; mu, Pr,\n gradient_variables=GradientVariablesPrimitive())\n\nContains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations3D.\n\nequations: instance of the CompressibleEulerEquations3D\nmu: dynamic viscosity,\nPr: Prandtl number,\ngradient_variables: which variables the gradients are taken with respect to. Defaults to GradientVariablesPrimitive().\n\nFluid properties such as the dynamic viscosity mu can be provided in any consistent unit system, e.g., [mu] = kg m⁻¹ s⁻¹.\n\nThe particular form of the compressible Navier-Stokes implemented is\n\nfracpartialpartial t\nbeginpmatrix\nrho rho mathbfv rho e\nendpmatrix\n+\nnabla cdot\nbeginpmatrix\n rho mathbfv rho mathbfvmathbfv^T + p underlineI (rho e + p) mathbfv\nendpmatrix\n=\nnabla cdot\nbeginpmatrix\n0 underlinetau underlinetaumathbfv - mathbfq\nendpmatrix\n\nwhere the system is closed with the ideal gas assumption giving\n\np = (gamma - 1) left( rho e - frac12 rho (v_1^2+v_2^2+v_3^2) right)\n\nas the pressure. The value of the adiabatic constant gamma is taken from the CompressibleEulerEquations2D. The terms on the right hand side of the system above are built from the viscous stress tensor\n\nunderlinetau = mu left(nablamathbfv + left(nablamathbfvright)^Tright) - frac23 mu left(nablacdotmathbfvright)underlineI\n\nwhere underlineI is the 3times 3 identity matrix and the heat flux is\n\nmathbfq = -kappanablaleft(Tright)quad T = fracpRrho\n\nwhere T is the temperature and kappa is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is\n\nkappa = fracgamma mu R(gamma - 1)textrmPr\n\nFrom this combination of temperature T and thermal conductivity kappa we see that the gas constant R cancels and the heat flux becomes\n\nmathbfq = -kappanablaleft(Tright) = -fracgamma mu(gamma - 1)textrmPrnablaleft(fracprhoright)\n\nwhich is the form implemented below in the flux function.\n\nIn two spatial dimensions we require gradients for three quantities, e.g., primitive quantities\n\nnabla v_1 nabla v_2 nabla v_3 nabla T\n\nor the entropy variables\n\nnabla w_2 nabla w_3 nabla w_4 nabla w_5\n\nwhere\n\nw_2 = fracrho v_1p w_3 = fracrho v_2p w_4 = fracrho v_3p w_5 = -fracrhop\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ControllerThreeLevel","page":"Trixi.jl","title":"Trixi.ControllerThreeLevel","text":"ControllerThreeLevel(semi, indicator; base_level=1,\n med_level=base_level, med_threshold=0.0,\n max_level=base_level, max_threshold=1.0)\n\nAn AMR controller based on three levels (in descending order of precedence):\n\nset the target level to max_level if indicator > max_threshold\nset the target level to med_level if indicator > med_threshold; if med_level < 0, set the target level to the current level\nset the target level to base_level otherwise\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ControllerThreeLevelCombined","page":"Trixi.jl","title":"Trixi.ControllerThreeLevelCombined","text":"ControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;\n base_level=1,\n med_level=base_level, med_threshold=0.0,\n max_level=base_level, max_threshold=1.0,\n max_threshold_secondary=1.0)\n\nAn AMR controller based on three levels (in descending order of precedence):\n\nset the target level to max_level if indicator_primary > max_threshold\nset the target level to med_level if indicator_primary > med_threshold; if med_level < 0, set the target level to the current level\nset the target level to base_level otherwise\n\nIf indicator_secondary >= max_threshold_secondary, set the target level to max_level.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DG","page":"Trixi.jl","title":"Trixi.DG","text":"DG(; basis, mortar, surface_integral, volume_integral)\n\nCreate a discontinuous Galerkin method. If basis isa LobattoLegendreBasis, this creates a DGSEM.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DGMulti-Tuple{SummationByPartsOperators.AbstractDerivativeOperator}","page":"Trixi.jl","title":"Trixi.DGMulti","text":"DGMulti(approximation_type::AbstractDerivativeOperator;\n element_type::AbstractElemShape,\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n kwargs...)\n\nCreate a summation by parts (SBP) discretization on the given element_type using a tensor product structure based on the 1D SBP derivative operator passed as approximation_type.\n\nFor more info, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMulti-Tuple{}","page":"Trixi.jl","title":"Trixi.DGMulti","text":"DGMulti(; polydeg::Integer,\n element_type::AbstractElemShape,\n approximation_type=Polynomial(),\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n RefElemData_kwargs...)\n\nCreate a discontinuous Galerkin method which uses\n\napproximations of polynomial degree polydeg\nelement type element_type (Tri(), Quad(), Tet(), and Hex() currently supported)\n\nOptional:\n\napproximation_type (default is Polynomial(); SBP() also supported for Tri(), Quad(), and Hex() element types).\nRefElemData_kwargs are additional keyword arguments for RefElemData, such as quad_rule_vol. For more info, see the StartUpDG.jl docs.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh{NDIMS, ...}\n\nDGMultiMesh describes a mesh type which wraps StartUpDG.MeshData and boundary_faces in a dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured).\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Tuple{DGMulti{2, Tri, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{2, Tri, ApproxType}} where {ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any, Dict{Symbol, Int64}}","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti{2, Tri}, triangulateIO, boundary_dict::Dict{Symbol, Int})\n\ndg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).\ntriangulateIO is a TriangulateIO mesh representation\nboundary_dict is a Dict{Symbol, Int} which associates each integer TriangulateIO boundary tag with a Symbol.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType<:SummationByPartsOperators.AbstractPeriodicDerivativeOperator, SurfaceIntegral, VolumeIntegral, Mortar}}, Tuple{NDIMS}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti)\n\nConstructs a single-element DGMultiMesh for a single periodic element given a DGMulti with approximation_type set to a periodic (finite difference) SBP operator from SummationByPartsOperators.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any, AbstractArray}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti{NDIMS}, vertex_coordinates, EToV;\n is_on_boundary=nothing,\n periodicity=ntuple(_->false, NDIMS)) where {NDIMS}\n\ndg::DGMulti contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).\nvertex_coordinates is a tuple of vectors containing x,y,... components of the vertex coordinates\nEToV is a 2D array containing element-to-vertex connectivities for each element\nis_on_boundary specifies boundary using a Dict{Symbol, <:Function}\nperiodicity is a tuple of booleans specifying if the domain is periodic true/false in the (x,y,z) direction.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any, Any}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension, mapping;\n is_on_boundary=nothing,\n periodicity=ntuple(_ -> false, NDIMS), kwargs...) where {NDIMS}\n\nConstructs a Curved() DGMultiMesh with element type dg.basis.element_type.\n\nmapping is a function which maps from a reference [-1, 1]^NDIMS domain to a mapped domain, e.g., xy = mapping(x, y) in 2D.\nis_on_boundary specifies boundary using a Dict{Symbol, <:Function}\nperiodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, Any}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti, cells_per_dimension;\n coordinates_min=(-1.0, -1.0), coordinates_max=(1.0, 1.0),\n is_on_boundary=nothing,\n periodicity=ntuple(_ -> false, NDIMS))\n\nConstructs a Cartesian DGMultiMesh with element type dg.basis.element_type. The domain is the tensor product of the intervals [coordinates_min[i], coordinates_max[i]].\n\nis_on_boundary specifies boundary using a Dict{Symbol, <:Function}\nperiodicity is a tuple of Bools specifying periodicity = true/false in the (x,y,z) direction.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiMesh-Union{Tuple{NDIMS}, Tuple{DGMulti{NDIMS, ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar, <:StartUpDG.RefElemData{NDIMS, ElemType, ApproxType}} where {ElemType, ApproxType, SurfaceIntegral, VolumeIntegral, Mortar}, String}} where NDIMS","page":"Trixi.jl","title":"Trixi.DGMultiMesh","text":"DGMultiMesh(dg::DGMulti, filename::String)\n\ndg::DGMulti contains information associated with the reference element (e.g., quadrature, basis evaluation, differentiation, etc).\nfilename is a path specifying a .mesh file generated by HOHQMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGSEM","page":"Trixi.jl","title":"Trixi.DGSEM","text":"DGSEM(; RealT=Float64, polydeg::Integer,\n surface_flux=flux_central,\n surface_integral=SurfaceIntegralWeakForm(surface_flux),\n volume_integral=VolumeIntegralWeakForm(),\n mortar=MortarL2(basis))\n\nCreate a discontinuous Galerkin spectral element method (DGSEM) using a LobattoLegendreBasis with polynomials of degree polydeg.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DissipationGlobalLaxFriedrichs","page":"Trixi.jl","title":"Trixi.DissipationGlobalLaxFriedrichs","text":"DissipationGlobalLaxFriedrichs(λ)\n\nCreate a global Lax-Friedrichs dissipation operator with dissipation coefficient λ.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.DissipationLocalLaxFriedrichs","page":"Trixi.jl","title":"Trixi.DissipationLocalLaxFriedrichs","text":"DissipationLocalLaxFriedrichs(max_abs_speed=max_abs_speed_naive)\n\nCreate a local Lax-Friedrichs dissipation operator where the maximum absolute wave speed is estimated as max_abs_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to max_abs_speed_naive.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.EulerAcousticsCouplingCallback","page":"Trixi.jl","title":"Trixi.EulerAcousticsCouplingCallback","text":"EulerAcousticsCouplingCallback\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nA callback that couples the acoustic perturbation equations and compressible Euler equations. Must be used in conjunction with SemidiscretizationEulerAcoustics. This callback manages the flow solver - which is always one time step ahead of the acoustics solver - and calculates the acoustic source term after each time step. The linearized Lamb vector is used as the source term, i.e.\n\nmathbfs = -(mathbfomega times barmathbfv\n + barmathbfomega times mathbfv)\n\nwhere mathbfv denotes the velocity, mathbfomega denotes the vorticity, the bar bar(cdot) indicates time-averaged quantities (see AveragingCallback) and prime (cdot) denotes perturbed quantities defined by phi = phi - barphi. Note that the perturbed quantities here are based entirely on the pure flow solution and should not be confused with the state variables of the acoustic perturbation equations.\n\nIn addition, this callback manages the time step size for both solvers and initializes the mean values of the acoustic perturbation equations using results obtained with the AveragingCallback.\n\nMichael Schlottke-Lakemper (2017) A direct-hybrid method for aeroacoustic analysis DOI: 10.18154/RWTH-2017-04082\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.EulerAcousticsCouplingCallback-Tuple{Any, AbstractString, Any, Real, Real}","page":"Trixi.jl","title":"Trixi.EulerAcousticsCouplingCallback","text":"EulerAcousticsCouplingCallback(ode_euler, averaging_file::AbstractString, alg,\n cfl_acoustics::Real, cfl_euler::Real; kwargs...)\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nCreates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_file (see AveragingCallback).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.EulerAcousticsCouplingCallback-Tuple{Any, DiscreteCallback{<:Any, <:AveragingCallback}, Any, Real, Real}","page":"Trixi.jl","title":"Trixi.EulerAcousticsCouplingCallback","text":"EulerAcousticsCouplingCallback(ode_euler,\n averaging_callback::DiscreteCallback{<:Any, <:AveragingCallback},\n alg, cfl_acoustics::Real, cfl_euler::Real; kwargs...)\n\nwarning: Experimental code\nThis callback is experimental and may change in any future release.\n\nCreates an EulerAcousticsCouplingCallback based on the pure flow ODEProblem given by ode_euler. Creates an integrator using the time integration method alg and the keyword arguments to solve ode_euler (consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics for the acoustics solver and cfl_euler for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_callback (see AveragingCallback).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.FDSBP","page":"Trixi.jl","title":"Trixi.FDSBP","text":"FDSBP(D_SBP; surface_integral, volume_integral)\n\nSpecialization of DG methods that uses general summation by parts (SBP) operators from SummationByPartsOperators.jl. In particular, this includes classical finite difference (FD) SBP methods. These methods have the same structure as classical DG methods - local operations on elements with connectivity through interfaces without imposing any continuity constraints.\n\nD_SBP is an SBP derivative operator from SummationByPartsOperators.jl. The other arguments have the same meaning as in DG or DGSEM.\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxHLL","page":"Trixi.jl","title":"Trixi.FluxHLL","text":"FluxHLL(min_max_speed=min_max_speed_davis)\n\nCreate an HLL (Harten, Lax, van Leer) numerical flux where the minimum and maximum wave speeds are estimated as λ_min, λ_max = min_max_speed(u_ll, u_rr, orientation_or_normal_direction, equations), defaulting to min_max_speed_davis. Original paper:\n\nAmiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxHydrostaticReconstruction","page":"Trixi.jl","title":"Trixi.FluxHydrostaticReconstruction","text":"FluxHydrostaticReconstruction(numerical_flux, hydrostatic_reconstruction)\n\nwarning: Experimental code\nThis numerical flux is experimental and may change in any future release.\n\nAllow for some kind of hydrostatic reconstruction of the solution state prior to the surface flux computation. This is a particular strategy to ensure that the method remains well-balanced for the shallow water equations, see ShallowWaterEquations1D or ShallowWaterEquations2D.\n\nFor example, the hydrostatic reconstruction from Audusse et al. is implemented in one and two spatial dimensions, see hydrostatic_reconstruction_audusse_etal or the original paper\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\nOther hydrostatic reconstruction techniques are available, particularly to handle wet / dry fronts. A good overview of the development and application of hydrostatic reconstruction can be found in\n\nGuoxian Chen and Sebastian Noelle A unified surface-gradient and hydrostatic reconstruction scheme for the shallow water equations (2021) RWTH Aachen preprint\nAndreas Buttinger-Kreuzhuber, Zsolt Horváth, Sebastian Noelle, Günter Blöschl and Jürgen Waser (2019) A fast second-order shallow water scheme on two-dimensional structured grids over abrupt topography DOI: 10.1016/j.advwatres.2019.03.010\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxLMARS","page":"Trixi.jl","title":"Trixi.FluxLMARS","text":"FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nLow Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.\n\nReferences:\n\nXi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxLMARS-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.FluxLMARS","text":"FluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nLow Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c of the speed of sound.\n\nReferences:\n\nXi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.FluxLaxFriedrichs","page":"Trixi.jl","title":"Trixi.FluxLaxFriedrichs","text":"FluxLaxFriedrichs(max_abs_speed=max_abs_speed_naive)\n\nLocal Lax-Friedrichs (Rusanov) flux with maximum wave speed estimate provided by max_abs_speed, cf. DissipationLocalLaxFriedrichs and max_abs_speed_naive.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxPlusDissipation","page":"Trixi.jl","title":"Trixi.FluxPlusDissipation","text":"FluxPlusDissipation(numerical_flux, dissipation)\n\nCombine a numerical_flux with a dissipation operator to create a new numerical flux.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxRotated","page":"Trixi.jl","title":"Trixi.FluxRotated","text":"FluxRotated(numerical_flux)\n\nCompute a numerical_flux flux in direction of a normal vector by rotating the solution, computing the numerical flux in x-direction, and rotating the calculated flux back.\n\nRequires a rotationally invariant equation with equation-specific functions rotate_to_x and rotate_from_x.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.FluxUpwind","page":"Trixi.jl","title":"Trixi.FluxUpwind","text":"FluxUpwind(splitting)\n\nA numerical flux f(u_left, u_right) = f⁺(u_left) + f⁻(u_right) based on flux vector splitting.\n\nThe SurfaceIntegralUpwind with a given splitting is equivalent to the SurfaceIntegralStrongForm with FluxUpwind(splitting) as numerical flux (up to floating point differences). Note, that SurfaceIntegralUpwind is only available on TreeMesh.\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.GlmSpeedCallback","page":"Trixi.jl","title":"Trixi.GlmSpeedCallback","text":"GlmSpeedCallback(; glm_scale=0.5, cfl)\n\nUpdate the divergence cleaning wave speed c_h according to the time step computed in StepsizeCallback for the ideal GLM-MHD equations. The cfl number should be set to the same value as for the time step size calculation. The glm_scale ensures that the GLM wave speed is lower than the fastest physical waves in the MHD solution and should thus be set to a value within the interval [0,1]. Note that glm_scale = 0 deactivates the divergence cleaning.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.GradientVariablesPrimitive","page":"Trixi.jl","title":"Trixi.GradientVariablesPrimitive","text":"GradientVariablesPrimitive and GradientVariablesEntropy are gradient variable type parameters for CompressibleNavierStokesDiffusion1D. By default, the gradient variables are set to be GradientVariablesPrimitive. Specifying GradientVariablesEntropy instead uses the entropy variable formulation from\n\nHughes, Mallet, Franca (1986) A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the compressible Euler and Navier-Stokes equations and the second law of thermodynamics. https://doi.org/10.1016/0045-7825(86)90127-1\n\nUnder GradientVariablesEntropy, the Navier-Stokes discretization is provably entropy stable.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HypDiffN3Erk3Sstar52","page":"Trixi.jl","title":"Trixi.HypDiffN3Erk3Sstar52","text":"HypDiffN3Erk3Sstar52()\n\nFive stage, second-order accurate explicit Runge-Kutta scheme with stability region optimized for the hyperbolic diffusion equation with LLF flux and polynomials of degree polydeg=3.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HyperbolicDiffusionEquations1D","page":"Trixi.jl","title":"Trixi.HyperbolicDiffusionEquations1D","text":"HyperbolicDiffusionEquations1D\n\nThe linear hyperbolic diffusion equations in one space dimension. A description of this system can be found in Sec. 2.5 of the book\n\nMasatsuka (2013) I Do Like CFD, Too: Vol 1. Freely available at http://www.cfdbooks.com/\n\nFurther analysis can be found in the paper\n\nNishikawa (2007) A first-order system approach for diffusion equation. I: Second-order residual-distribution schemes DOI: 10.1016/j.jcp.2007.07.029\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HyperbolicDiffusionEquations2D","page":"Trixi.jl","title":"Trixi.HyperbolicDiffusionEquations2D","text":"HyperbolicDiffusionEquations2D\n\nThe linear hyperbolic diffusion equations in two space dimensions. A description of this system can be found in Sec. 2.5 of the book \"I Do Like CFD, Too: Vol 1\". The book is freely available at http://www.cfdbooks.com/ and further analysis can be found in the paper by Nishikawa DOI: 10.1016/j.jcp.2007.07.029\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.HyperbolicDiffusionEquations3D","page":"Trixi.jl","title":"Trixi.HyperbolicDiffusionEquations3D","text":"HyperbolicDiffusionEquations3D\n\nThe linear hyperbolic diffusion equations in three space dimensions. A description of this system can be found in Sec. 2.5 of the book \"I Do Like CFD, Too: Vol 1\". The book is freely available at http://www.cfdbooks.com/ and further analysis can be found in the paper by Nishikawa DOI: 10.1016/j.jcp.2007.07.029\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdEquations1D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdEquations1D","text":"IdealGlmMhdEquations1D(gamma)\n\nThe ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in one space dimension.\n\nnote: Note\nThere is no divergence cleaning variable psi because the divergence-free constraint is satisfied trivially in one spatial dimension.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdEquations2D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdEquations2D","text":"IdealGlmMhdEquations2D(gamma)\n\nThe ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in two space dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdEquations3D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdEquations3D","text":"IdealGlmMhdEquations3D(gamma)\n\nThe ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma in three space dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdMulticomponentEquations1D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdMulticomponentEquations1D","text":"IdealGlmMhdMulticomponentEquations1D\n\nThe ideal compressible multicomponent GLM-MHD equations in one space dimension.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IdealGlmMhdMulticomponentEquations2D","page":"Trixi.jl","title":"Trixi.IdealGlmMhdMulticomponentEquations2D","text":"IdealGlmMhdMulticomponentEquations2D\n\nThe ideal compressible multicomponent GLM-MHD equations in two space dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IndicatorHennemannGassner","page":"Trixi.jl","title":"Trixi.IndicatorHennemannGassner","text":"IndicatorHennemannGassner(equations::AbstractEquations, basis;\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable)\nIndicatorHennemannGassner(semi::AbstractSemidiscretization;\n alpha_max=0.5,\n alpha_min=0.001,\n alpha_smooth=true,\n variable)\n\nIndicator used for shock-capturing (when passing the equations and the basis) or adaptive mesh refinement (AMR, when passing the semi).\n\nSee also VolumeIntegralShockCapturingHG.\n\nReferences\n\nHennemann, Gassner (2020) \"A provably entropy stable subcell shock capturing approach for high order split form DG\" arXiv: 2008.12044\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IndicatorLöhner","page":"Trixi.jl","title":"Trixi.IndicatorLöhner","text":"IndicatorLöhner (equivalent to IndicatorLoehner)\n\nIndicatorLöhner(equations::AbstractEquations, basis;\n f_wave=0.2, variable)\nIndicatorLöhner(semi::AbstractSemidiscretization;\n f_wave=0.2, variable)\n\nAMR indicator adapted from a FEM indicator by Löhner (1987), also used in the FLASH code as standard AMR indicator. The indicator estimates a weighted second derivative of a specified variable locally.\n\nWhen constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.\n\nReferences\n\nLöhner (1987) \"An adaptive finite element scheme for transient problems in CFD\" doi: 10.1016/0045-7825(87)90098-3\nhttps://flash.rochester.edu/site/flashcode/usersupport/flash4ug_4p62/node59.html#SECTION05163100000000000000\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.IndicatorMax","page":"Trixi.jl","title":"Trixi.IndicatorMax","text":"IndicatorMax(equations::AbstractEquations, basis; variable)\nIndicatorMax(semi::AbstractSemidiscretization; variable)\n\nA simple indicator returning the maximum of variable in an element. When constructed to be used for AMR, pass the semi. Pass the equations, and basis if this indicator should be used for shock capturing.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.InviscidBurgersEquation1D","page":"Trixi.jl","title":"Trixi.InviscidBurgersEquation1D","text":"InviscidBurgersEquation1D\n\nThe inviscid Burgers' equation\n\npartial_t u + frac12 partial_1 u^2 = 0\n\nin one space dimension.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.Isothermal","page":"Trixi.jl","title":"Trixi.Isothermal","text":"struct Isothermal\n\nUsed to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and return a scalar value for the temperature at point x and time t.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LaplaceDiffusion1D","page":"Trixi.jl","title":"Trixi.LaplaceDiffusion1D","text":"LaplaceDiffusion1D(diffusivity, equations)\n\nLaplaceDiffusion1D represents a scalar diffusion term nabla cdot (kappanabla u)) with diffusivity kappa applied to each solution component defined by equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LaplaceDiffusion2D","page":"Trixi.jl","title":"Trixi.LaplaceDiffusion2D","text":"LaplaceDiffusion2D(diffusivity, equations)\n\nLaplaceDiffusion2D represents a scalar diffusion term nabla cdot (kappanabla u)) with diffusivity kappa applied to each solution component defined by equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LaplaceDiffusion3D","page":"Trixi.jl","title":"Trixi.LaplaceDiffusion3D","text":"LaplaceDiffusion3D(diffusivity, equations)\n\nLaplaceDiffusion3D represents a scalar diffusion term nabla cdot (kappanabla u)) with diffusivity kappa applied to each solution component defined by equations.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LatticeBoltzmannEquations2D","page":"Trixi.jl","title":"Trixi.LatticeBoltzmannEquations2D","text":"LatticeBoltzmannEquations2D(; Ma, Re, collision_op=collision_bgk,\n c=1, L=1, rho0=1, u0=nothing, nu=nothing)\n\nThe Lattice-Boltzmann equations\n\npartial_t u_alpha + v_alpha1 partial_1 u_alpha + v_alpha2 partial_2 u_alpha = 0\n\nin two space dimensions for the D2Q9 scheme.\n\nThe characteristic Mach number and Reynolds numbers are specified as Ma and Re. By the default, the collision operator collision_op is set to the BGK model. c, L, and rho0 specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0 directly (Ma needs to be set to nothing in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu directly (in this case, Re needs to be set to nothing).\n\nThe nine discrete velocity directions of the D2Q9 scheme are sorted as follows [4]:\n\n 6 2 5 y\n ┌───┼───┐ │\n │ │ │\n 3 ┼ 9 ┼ 1 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 7 4 8 z\n\nNote that usually the velocities are numbered from 0 to 8, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 9, where 1 through 8 correspond to the velocity directions in [4] and 9 is the zero velocity.\n\nThe corresponding opposite directions are:\n\n1 ←→ 3\n2 ←→ 4\n3 ←→ 1\n4 ←→ 2\n5 ←→ 7\n6 ←→ 8\n7 ←→ 5\n8 ←→ 6\n9 ←→ 9\n\nThe main sources for the base implementation were\n\nMisun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024\nKarsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.\nDieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0\nDieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LatticeBoltzmannEquations3D","page":"Trixi.jl","title":"Trixi.LatticeBoltzmannEquations3D","text":"LatticeBoltzmannEquations3D(; Ma, Re, collision_op=collision_bgk,\n c=1, L=1, rho0=1, u0=nothing, nu=nothing)\n\nThe Lattice-Boltzmann equations\n\npartial_t u_alpha + v_alpha1 partial_1 u_alpha + v_alpha2 partial_2 u_alpha + v_alpha3 partial_3 u_alpha = 0\n\nin three space dimensions for the D3Q27 scheme.\n\nThe characteristic Mach number and Reynolds numbers are specified as Ma and Re. By the default, the collision operator collision_op is set to the BGK model. c, L, and rho0 specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0 directly (Ma needs to be set to nothing in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu directly (in this case, Re needs to be set to nothing).\n\nThe twenty-seven discrete velocity directions of the D3Q27 scheme are sorted as follows [4]:\n\nplane at z = -1:\n 24 17 21 y\n ┌───┼───┐ │\n │ │ │\n 10 ┼ 6 ┼ 15 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 20 12 26 z\nplane at z = 0:\n 14 3 7 y\n ┌───┼───┐ │\n │ │ │\n 2 ┼ 27 ┼ 1 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 8 4 13 z\nplane at z = +1:\n 25 11 19 y\n ┌───┼───┐ │\n │ │ │\n 16 ┼ 5 ┼ 9 ──── x\n │ │ ╱\n └───┼───┘ ╱\n 22 18 23 z\n\nNote that usually the velocities are numbered from 0 to 26, where 0 corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1 to 27, where 1 through 26 correspond to the velocity directions in [4] and 27 is the zero velocity.\n\nThe corresponding opposite directions are:\n\n1 ←→ 2\n2 ←→ 1\n3 ←→ 4\n4 ←→ 3\n5 ←→ 6\n6 ←→ 5\n7 ←→ 8\n8 ←→ 7\n9 ←→ 10\n10 ←→ 9\n11 ←→ 12\n12 ←→ 11\n13 ←→ 14\n14 ←→ 13\n15 ←→ 16\n16 ←→ 15\n17 ←→ 18\n18 ←→ 17\n19 ←→ 20\n20 ←→ 19\n21 ←→ 22\n22 ←→ 21\n23 ←→ 24\n24 ←→ 23\n25 ←→ 26\n26 ←→ 25\n27 ←→ 27\n\nThe main sources for the base implementation were\n\nMisun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024\nKarsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.\nDieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0\nDieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearScalarAdvectionEquation1D","page":"Trixi.jl","title":"Trixi.LinearScalarAdvectionEquation1D","text":"LinearScalarAdvectionEquation1D\n\nThe linear scalar advection equation\n\npartial_t u + a partial_1 u = 0\n\nin one space dimension with constant velocity a.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearScalarAdvectionEquation2D","page":"Trixi.jl","title":"Trixi.LinearScalarAdvectionEquation2D","text":"LinearScalarAdvectionEquation2D\n\nThe linear scalar advection equation\n\npartial_t u + a_1 partial_1 u + a_2 partial_2 u = 0\n\nin two space dimensions with constant velocity a.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearScalarAdvectionEquation3D","page":"Trixi.jl","title":"Trixi.LinearScalarAdvectionEquation3D","text":"LinearScalarAdvectionEquation3D\n\nThe linear scalar advection equation\n\npartial_t u + a_1 partial_1 u + a_2 partial_2 u + a_3 partial_3 u = 0\n\nin three space dimensions with constant velocity a.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LinearizedEulerEquations2D","page":"Trixi.jl","title":"Trixi.LinearizedEulerEquations2D","text":"LinearizedEulerEquations2D(v_mean_global, c_mean_global, rho_mean_global)\n\nLinearized euler equations in two space dimensions. The equations are given by\n\npartial_t\nbeginpmatrix\n rho v_1 v_2 p\nendpmatrix\n+\npartial_x\nbeginpmatrix\n barrho v_1 + barv_1 rho barv_1 v_1 + fracpbarrho barv_1 v_2 barv_1 p + c^2 barrho v_1\nendpmatrix\n+\npartial_y\nbeginpmatrix\n barrho v_2 + barv_2 rho barv_2 v_1 barv_2 v_2 + fracpbarrho barv_2 p + c^2 barrho v_2\nendpmatrix\n=\nbeginpmatrix\n 0 0 0 0\nendpmatrix\n\nThe bar bar(cdot) indicates uniform mean flow variables and c is the speed of sound. The unknowns are the acoustic velocities v = (v_1 v_2), the pressure p and the density rho.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.LobattoLegendreBasis","page":"Trixi.jl","title":"Trixi.LobattoLegendreBasis","text":"LobattoLegendreBasis([RealT=Float64,] polydeg::Integer)\n\nCreate a nodal Lobatto-Legendre basis for polynomials of degree polydeg.\n\nFor the special case polydeg=0 the DG method reduces to a finite volume method. Therefore, this function sets the center point of the cell as single node. This exceptional case is currently only supported for TreeMesh!\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.NoSlip","page":"Trixi.jl","title":"Trixi.NoSlip","text":"struct NoSlip\n\nUse to create a no-slip boundary condition with BoundaryConditionNavierStokesWall. The field boundary_value_function should be a function with signature boundary_value_function(x, t, equations) and should return a SVector{NDIMS} whose entries are the velocity vector at a point x and time t.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.NonConservativeLocal","page":"Trixi.jl","title":"Trixi.NonConservativeLocal","text":"NonConservativeLocal()\n\nStruct used for multiple dispatch on non-conservative flux functions in the format of \"local * symmetric\". When the argument nonconservative_type is of type NonConservativeLocal, the function returns the local part of the non-conservative term.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.NonConservativeSymmetric","page":"Trixi.jl","title":"Trixi.NonConservativeSymmetric","text":"NonConservativeSymmetric()\n\nStruct used for multiple dispatch on non-conservative flux functions in the format of \"local * symmetric\". When the argument nonconservative_type is of type NonConservativeSymmetric, the function returns the symmetric part of the non-conservative term.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.P4estMesh","page":"Trixi.jl","title":"Trixi.P4estMesh","text":"P4estMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nAn unstructured curved mesh based on trees that uses the C library p4est to manage trees and mesh refinement.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.P4estMesh-Tuple{Any}","page":"Trixi.jl","title":"Trixi.P4estMesh","text":"P4estMesh(trees_per_dimension; polydeg,\n mapping=nothing, faces=nothing, coordinates_min=nothing, coordinates_max=nothing,\n RealT=Float64, initial_refinement_level=0, periodicity=true, unsaved_changes=true,\n p4est_partition_allow_for_coarsening=true)\n\nCreate a structured curved P4estMesh of the specified size.\n\nThere are three ways to map the mesh to the physical domain.\n\nDefine a mapping that maps the hypercube [-1, 1]^n.\nSpecify a Tuple faces of functions that parametrize each face.\nCreate a rectangular mesh by specifying coordinates_min and coordinates_max.\n\nNon-periodic boundaries will be called :x_neg, :x_pos, :y_neg, :y_pos, :z_neg, :z_pos.\n\nArguments\n\ntrees_per_dimension::NTupleE{NDIMS, Int}: the number of trees in each dimension.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.\nmapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.\nfaces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\np4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.P4estMesh-Union{Tuple{String}, Tuple{NDIMS}} where NDIMS","page":"Trixi.jl","title":"Trixi.P4estMesh","text":"P4estMesh{NDIMS}(meshfile::String;\n mapping=nothing, polydeg=1, RealT=Float64,\n initial_refinement_level=0, unsaved_changes=true,\n p4est_partition_allow_for_coarsening=true,\n boundary_symbols = nothing)\n\nMain mesh constructor for the P4estMesh that imports an unstructured, conforming mesh from an Abaqus mesh file (.inp). Each element of the conforming mesh parsed from the meshfile is created as a p4est tree datatype.\n\nTo create a curved unstructured mesh P4estMesh two strategies are available:\n\np4est_mesh_from_hohqmesh_abaqus: High-order, curved boundary information created by HOHQMesh.jl is available in the meshfile. The mesh polynomial degree polydeg of the boundaries is provided from the meshfile. The computation of the mapped tree coordinates is done with transfinite interpolation with linear blending similar to UnstructuredMesh2D. Boundary name information is also parsed from the meshfile such that different boundary conditions can be set at each named boundary on a given tree.\np4est_mesh_from_standard_abaqus: By default, with mapping=nothing and polydeg=1, this creates a straight-sided from the information parsed from the meshfile. If a mapping function is specified then it computes the mapped tree coordinates via polynomial interpolants with degree polydeg. The mesh created by this function will only have one boundary :all if boundary_symbols is not specified. If boundary_symbols is specified the mesh file will be parsed for nodesets defining the boundary nodes from which boundary edges (2D) and faces (3D) will be assigned.\n\nNote that the mapping and polydeg keyword arguments are only used by the p4est_mesh_from_standard_abaqus function. The p4est_mesh_from_hohqmesh_abaqus function obtains the mesh polydeg directly from the meshfile and constructs the transfinite mapping internally.\n\nThe particular strategy is selected according to the header present in the meshfile where the constructor checks whether or not the meshfile was created with HOHQMesh.jl. If the Abaqus file header is not present in the meshfile then the P4estMesh is created with the function p4est_mesh_from_standard_abaqus.\n\nThe default keyword argument initial_refinement_level=0 corresponds to a forest where the number of trees is the same as the number of elements in the original meshfile. Increasing the initial_refinement_level allows one to uniformly refine the base mesh given in the meshfile to create a forest with more trees before the simulation begins. For example, if a two-dimensional base mesh contains 25 elements then setting initial_refinement_level=1 creates an initial forest of 2^2 * 25 = 100 trees.\n\nArguments\n\nmeshfile::String: an uncurved Abaqus mesh file that can be imported by p4est.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\np4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.\nboundary_symbols::Vector{Symbol}: A vector of symbols that correspond to the boundary names in the meshfile. If nothing is passed then all boundaries are named :all. \n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ParametersEulerGravity","page":"Trixi.jl","title":"Trixi.ParametersEulerGravity","text":"ParametersEulerGravity(; background_density=0.0,\n gravitational_constant=1.0,\n cfl=1.0,\n resid_tol=1.0e-4,\n n_iterations_max=10^4,\n timestep_gravity=timestep_gravity_erk52_3Sstar!)\n\nSet up parameters for the gravitational part of a SemidiscretizationEulerGravity.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ParsaniKetchesonDeconinck3Sstar32","page":"Trixi.jl","title":"Trixi.ParsaniKetchesonDeconinck3Sstar32","text":"ParsaniKetchesonDeconinck3Sstar32()\n\nParsani, Ketcheson, Deconinck (2013) Optimized explicit RK schemes for the spectral difference method applied to wave propagation problems DOI: 10.1137/120885899\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ParsaniKetchesonDeconinck3Sstar94","page":"Trixi.jl","title":"Trixi.ParsaniKetchesonDeconinck3Sstar94","text":"ParsaniKetchesonDeconinck3Sstar94()\n\nParsani, Ketcheson, Deconinck (2013) Optimized explicit RK schemes for the spectral difference method applied to wave propagation problems DOI: 10.1137/120885899\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PerformanceCounter","page":"Trixi.jl","title":"Trixi.PerformanceCounter","text":"PerformanceCounter()\n\nA PerformanceCounter can be used to track the runtime performance of some calls. Add a new runtime measurement via put!(counter, runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PerformanceCounterList","page":"Trixi.jl","title":"Trixi.PerformanceCounterList","text":"PerformanceCounterList{N}()\n\nA PerformanceCounterList{N} can be used to track the runtime performance of calls to multiple functions, adding them up. Add a new runtime measurement via put!(counter.counters[i], runtime) and get the averaged runtime of all measurements added so far via take!(counter), resetting the counter.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PlotData1D","page":"Trixi.jl","title":"Trixi.PlotData1D","text":"PlotData1D\n\nHolds all relevant data for creating 1D plots of multiple solution variables and to visualize the mesh.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PlotData1D-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.PlotData1D","text":"PlotData1D(u, semi [or mesh, equations, solver, cache];\n solution_variables=nothing, nvisnodes=nothing)\n\nCreate a new PlotData1D object that can be used for visualizing 1D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.\n\nnvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.\n\nWhen visualizing data from a two-dimensional simulation, a 1D slice is extracted for plotting. slice specifies the axis along which the slice is extracted and may be :x, or :y. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0). Both of these values are ignored when visualizing 1D data. This applies analogously to three-dimensional simulations, where slice may be :xy, :xz, or :yz.\n\nAnother way to visualize 2D/3D data is by creating a plot along a given curve. This is done with the keyword argument curve. It can be set to a list of 2D/3D points which define the curve. When using curve any other input from slice or point will be ignored.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData1D-Tuple{Union{ODESolution{T, N, uType, uType2, DType, tType, rateType, P} where {T, N, uType, uType2, DType, tType, rateType, P<:(ODEProblem{uType_, tType_, isinplace, P_} where {uType_, tType_, isinplace, P_<:Trixi.AbstractSemidiscretization})}, Trixi.TimeIntegratorSolution}}","page":"Trixi.jl","title":"Trixi.PlotData1D","text":"PlotData1D(sol; kwargs...)\n\nCreate a PlotData1D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData2DCartesian","page":"Trixi.jl","title":"Trixi.PlotData2DCartesian","text":"PlotData2D\n\nHolds all relevant data for creating 2D plots of multiple solution variables and to visualize the mesh.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PolytropicEulerEquations2D","page":"Trixi.jl","title":"Trixi.PolytropicEulerEquations2D","text":"PolytropicEulerEquations2D(gamma, kappa)\n\nThe polytropic Euler equations\n\nfracpartialpartial t\nbeginpmatrix\nrho rho v_1 rho v_2\nendpmatrix\n+\nfracpartialpartial x\nbeginpmatrix\n rho v_1 rho v_1^2 + kapparho^gamma rho v_1 v_2\nendpmatrix\n+\nfracpartialpartial y\nbeginpmatrix\nrho v_2 rho v_1 v_2 rho v_2^2 + kapparho^gamma\nendpmatrix\n=\nbeginpmatrix\n0 0 0\nendpmatrix\n\nfor an ideal gas with ratio of specific heats gamma in two space dimensions. Here, rho is the density and v_1 andv_2 the velocities and\n\np = kapparho^gamma\n\nthe pressure, which we replaced using this relation.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.PositivityPreservingLimiterZhangShu","page":"Trixi.jl","title":"Trixi.PositivityPreservingLimiterZhangShu","text":"PositivityPreservingLimiterZhangShu(; threshold, variables)\n\nThe fully-discrete positivity-preserving limiter of\n\nZhang, Shu (2011) Maximum-principle-satisfying and positivity-preserving high-order schemes for conservation laws: survey and new developments doi: 10.1098/rspa.2011.0153\n\nThe limiter is applied to all scalar variables in their given order using the associated thresholds to determine the minimal acceptable values. The order of the variables is important and might have a strong influence on the robustness.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SaveRestartCallback","page":"Trixi.jl","title":"Trixi.SaveRestartCallback","text":"SaveRestartCallback(; interval=0,\n save_final_restart=true,\n output_directory=\"out\")\n\nSave the current numerical solution in a restart file every interval time steps.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SaveSolutionCallback","page":"Trixi.jl","title":"Trixi.SaveSolutionCallback","text":"SaveSolutionCallback(; interval::Integer=0,\n dt=nothing,\n save_initial_solution=true,\n save_final_solution=true,\n output_directory=\"out\",\n solution_variables=cons2prim)\n\nSave the current numerical solution in regular intervals. Either pass interval to save every interval time steps or pass dt to save in intervals of dt in terms of integration time by adding additional (shortened) time steps where necessary (note that this may change the solution). solution_variables can be any callable that converts the conservative variables at a single point to a set of solution variables. The first parameter passed to solution_variables will be the set of conservative variables and the second parameter is the equation struct.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationCoupled","page":"Trixi.jl","title":"Trixi.SemidiscretizationCoupled","text":"SemidiscretizationCoupled\n\nA struct used to bundle multiple semidiscretizations. semidiscretize will return an ODEProblem that synchronizes time steps between the semidiscretizations. Each call of rhs! will call rhs! for each semidiscretization individually. The semidiscretizations can be coupled by gluing meshes together using BoundaryConditionCoupled.\n\nwarning: Experimental code\nThis is an experimental feature and can change any time.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationCoupled-Tuple","page":"Trixi.jl","title":"Trixi.SemidiscretizationCoupled","text":"SemidiscretizationCoupled(semis...)\n\nCreate a coupled semidiscretization that consists of the semidiscretizations passed as arguments.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SemidiscretizationEulerAcoustics","page":"Trixi.jl","title":"Trixi.SemidiscretizationEulerAcoustics","text":"SemidiscretizationEulerAcoustics(semi_acoustics::SemiAcoustics, semi_euler::SemiEuler;\n source_region=x->true, weights=x->1.0)\n\nwarning: Experimental code\nThis semidiscretization is experimental and may change in any future release.\n\nConstruct a semidiscretization of the acoustic perturbation equations that is coupled with the compressible Euler equations via source terms for the perturbed velocity. Both semidiscretizations have to use the same mesh and solvers with a shared basis. The coupling region is described by a function source_region that maps the coordinates of a single node to true or false depending on whether the point lies within the coupling region or not. A weighting function weights that maps coordinates to weights is applied to the acoustic source terms. Note that this semidiscretization should be used in conjunction with EulerAcousticsCouplingCallback and only works in two dimensions.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationEulerGravity","page":"Trixi.jl","title":"Trixi.SemidiscretizationEulerGravity","text":"SemidiscretizationEulerGravity\n\nA struct containing everything needed to describe a spatial semidiscretization of a the compressible Euler equations with self-gravity, reformulating the Poisson equation for the gravitational potential as steady-state problem of the hyperblic diffusion equations.\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) \"A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics\" arXiv: 2008.10593\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationEulerGravity-Union{Tuple{SemiGravity}, Tuple{SemiEuler}, Tuple{Mesh}, Tuple{SemiEuler, SemiGravity, Any}} where {Mesh, SemiEuler<:(SemidiscretizationHyperbolic{Mesh, <:Trixi.AbstractCompressibleEulerEquations}), SemiGravity<:(SemidiscretizationHyperbolic{Mesh, <:Trixi.AbstractHyperbolicDiffusionEquations})}","page":"Trixi.jl","title":"Trixi.SemidiscretizationEulerGravity","text":"SemidiscretizationEulerGravity(semi_euler::SemiEuler, semi_gravity::SemiGravity, parameters)\n\nConstruct a semidiscretization of the compressible Euler equations with self-gravity. parameters should be given as ParametersEulerGravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolic","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolic","text":"SemidiscretizationHyperbolic\n\nA struct containing everything needed to describe a spatial semidiscretization of a hyperbolic conservation law.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolic-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolic","text":"SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;\n source_terms=nothing,\n boundary_conditions=boundary_condition_periodic,\n RealT=real(solver),\n uEltype=RealT,\n initial_cache=NamedTuple())\n\nConstruct a semidiscretization of a hyperbolic PDE.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolicParabolic","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolicParabolic","text":"SemidiscretizationHyperbolicParabolic\n\nA struct containing everything needed to describe a spatial semidiscretization of a mixed hyperbolic-parabolic conservation law.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SemidiscretizationHyperbolicParabolic-Tuple{Any, Tuple, Any, Any}","page":"Trixi.jl","title":"Trixi.SemidiscretizationHyperbolicParabolic","text":"SemidiscretizationHyperbolicParabolic(mesh, both_equations, initial_condition, solver;\n solver_parabolic=default_parabolic_solver(),\n source_terms=nothing,\n both_boundary_conditions=(boundary_condition_periodic, boundary_condition_periodic),\n RealT=real(solver),\n uEltype=RealT,\n both_initial_caches=(NamedTuple(), NamedTuple()))\n\nConstruct a semidiscretization of a hyperbolic-parabolic PDE.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ShallowWaterEquations1D","page":"Trixi.jl","title":"Trixi.ShallowWaterEquations1D","text":"ShallowWaterEquations1D(; gravity, H0 = 0)\n\nShallow water equations (SWE) in one space dimension. The equations are given by\n\nbeginaligned\n fracpartial hpartial t + fracpartialpartial x(h v) = 0 \n fracpartialpartial t(h v) + fracpartialpartial xleft(h v^2 + fracg2h^2right)\n + g h fracpartial bpartial x = 0\nendaligned\n\nThe unknown quantities of the SWE are the water height h and the velocity v. The gravitational constant is denoted by g and the (possibly) variable bottom topography function b(x). Conservative variable water height h is measured from the bottom topography b, therefore one also defines the total water height as H = h + b.\n\nThe additional quantity H_0 is also available to store a reference value for the total water height that is useful to set initial conditions or test the \"lake-at-rest\" well-balancedness.\n\nThe bottom topography function b(x) is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.\n\nIn addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height H or the entropy variables. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the bottom topography must be zero.\nThe bottom topography values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the bottom topography by default.\n\nReferences for the SWE are many but a good introduction is available in Chapter 13 of the book:\n\nRandall J. LeVeque (2002) Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ShallowWaterEquations2D","page":"Trixi.jl","title":"Trixi.ShallowWaterEquations2D","text":"ShallowWaterEquations2D(; gravity, H0 = 0)\n\nShallow water equations (SWE) in two space dimensions. The equations are given by\n\nbeginaligned\n fracpartial hpartial t + fracpartialpartial x(h v_1)\n + fracpartialpartial y(h v_2) = 0 \n fracpartialpartial t(h v_1) + fracpartialpartial xleft(h v_1^2 + fracg2h^2right)\n + fracpartialpartial y(h v_1 v_2) + g h fracpartial bpartial x = 0 \n fracpartialpartial t(h v_2) + fracpartialpartial x(h v_1 v_2)\n + fracpartialpartial yleft(h v_2^2 + fracg2h^2right) + g h fracpartial bpartial y = 0\nendaligned\n\nThe unknown quantities of the SWE are the water height h and the velocities mathbfv = (v_1 v_2)^T. The gravitational constant is denoted by g and the (possibly) variable bottom topography function b(xy). Conservative variable water height h is measured from the bottom topography b, therefore one also defines the total water height as H = h + b.\n\nThe additional quantity H_0 is also available to store a reference value for the total water height that is useful to set initial conditions or test the \"lake-at-rest\" well-balancedness.\n\nThe bottom topography function b(xy) is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero.\n\nIn addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height H or the entropy variables. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the bottom topography must be zero.\nThe bottom topography values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the bottom topography by default.\n\nReferences for the SWE are many but a good introduction is available in Chapter 13 of the book:\n\nRandall J. LeVeque (2002) Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ShallowWaterEquationsQuasi1D","page":"Trixi.jl","title":"Trixi.ShallowWaterEquationsQuasi1D","text":"ShallowWaterEquationsQuasi1D(; gravity, H0 = 0, threshold_limiter = nothing threshold_wet = nothing)\n\nThe quasi-1D shallow water equations (SWE). The equations are given by\n\nbeginaligned\n fracpartialpartial t(a h) + fracpartialpartial x(a h v) = 0 \n fracpartialpartial t(a h v) + fracpartialpartial x(a h v^2)\n + g a h fracpartialpartial x(h + b) = 0\nendaligned\n\nThe unknown quantities of the Quasi-1D SWE are the water height h and the scaled velocity v. The gravitational constant is denoted by g, the (possibly) variable bottom topography function b(x), and (possibly) variable channel width a(x). The water height h is measured from the bottom topography b, therefore one also defines the total water height as H = h + b.\n\nThe additional quantity H_0 is also available to store a reference value for the total water height that is useful to set initial conditions or test the \"lake-at-rest\" well-balancedness.\n\nThe bottom topography function b(x) and channel width a(x) are set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b to zero and a to one. \n\nIn addition to the unknowns, Trixi.jl currently stores the bottom topography and channel width values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height H or the entropy variables. This affects the implementation and use of these equations in various ways:\n\nThe flux values corresponding to the bottom topography and channel width must be zero.\nThe bottom topography and channel width values must be included when defining initial conditions, boundary conditions or source terms.\nAnalysisCallback analyzes this variable.\nTrixi.jl's visualization tools will visualize the bottom topography and channel width by default.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SimpleSSPRK33","page":"Trixi.jl","title":"Trixi.SimpleSSPRK33","text":"SimpleSSPRK33(; stage_callbacks=())\n\nThe third-order SSP Runge-Kutta method of Shu and Osher.\n\nReferences\n\nShu, Osher (1988) \"Efficient Implementation of Essentially Non-oscillatory Shock-Capturing Schemes\" (Eq. 2.18) DOI: 10.1016/0021-9991(88)90177-5\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SteadyStateCallback","page":"Trixi.jl","title":"Trixi.SteadyStateCallback","text":"SteadyStateCallback(; abstol=1.0e-8, reltol=1.0e-6)\n\nTerminates the integration when the residual_steady_state(du, equations) falls below the threshold specified by abstol, reltol.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StepsizeCallback","page":"Trixi.jl","title":"Trixi.StepsizeCallback","text":"StepsizeCallback(; cfl=1.0)\n\nSet the time step size according to a CFL condition with CFL number cfl if the time integration method isn't adaptive itself.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StructuredMesh","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nA structured curved mesh.\n\nDifferent numbers of cells per dimension are possible and arbitrary functions can be used as domain faces.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StructuredMesh-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; periodicity=true)\n\nCreate a StructuredMesh that represents a uncurved structured mesh with a rectangular domain.\n\nArguments\n\ncells_per_dimension::NTuple{NDIMS, Int}: the number of cells in each dimension.\ncoordinates_min::NTuple{NDIMS, RealT}: coordinate of the corner in the negative direction of each dimension.\ncoordinates_max::NTuple{NDIMS, RealT}: coordinate of the corner in the positive direction of each dimension.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.StructuredMesh-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh(cells_per_dimension, mapping; RealT=Float64, unsaved_changes=true, mapping_as_string=mapping2string(mapping, length(cells_per_dimension)))\n\nCreate a StructuredMesh of the given size and shape that uses RealT as coordinate type.\n\nArguments\n\ncells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.\nmapping: a function of NDIMS variables to describe the mapping, which transforms the reference mesh to the physical domain. If no mapping_as_string is defined, this function must be defined with the name mapping to allow for restarts. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.\nRealT::Type: the type that should be used for coordinates.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\nmapping_as_string::String: the code that defines the mapping. If CodeTracking can't find the function definition, it can be passed directly here. The code string must define the mapping function with the name mapping. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.StructuredMesh-Tuple{Any, Tuple}","page":"Trixi.jl","title":"Trixi.StructuredMesh","text":"StructuredMesh(cells_per_dimension, faces; RealT=Float64, unsaved_changes=true, faces_as_string=faces2string(faces))\n\nCreate a StructuredMesh of the given size and shape that uses RealT as coordinate type.\n\nArguments\n\ncells_per_dimension::NTupleE{NDIMS, Int}: the number of cells in each dimension.\nfaces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D).\nRealT::Type: the type that should be used for coordinates.\nperiodicity: either a Bool deciding if all of the boundaries are periodic or an NTuple{NDIMS, Bool} deciding for each dimension if the boundaries in this dimension are periodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.StructuredMeshView","page":"Trixi.jl","title":"Trixi.StructuredMeshView","text":"StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS}\n\nA view on a structured curved mesh.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.StructuredMeshView-Union{Tuple{StructuredMesh{NDIMS, RealT}}, Tuple{RealT}, Tuple{NDIMS}} where {NDIMS, RealT}","page":"Trixi.jl","title":"Trixi.StructuredMeshView","text":"StructuredMeshView(parent; index_min, index_max)\n\nCreate a StructuredMeshView on a StructuredMesh parent.\n\nArguments\n\nparent: the parent StructuredMesh.\nindex_min: starting indices of the parent mesh.\nindex_max: ending indices of the parent mesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SubcellLimiterIDP","page":"Trixi.jl","title":"Trixi.SubcellLimiterIDP","text":"SubcellLimiterIDP(equations::AbstractEquations, basis;\n local_minmax_variables_cons = String[],\n positivity_variables_cons = String[],\n positivity_variables_nonlinear = [],\n positivity_correction_factor = 0.1,\n max_iterations_newton = 10,\n newton_tolerances = (1.0e-12, 1.0e-14),\n gamma_constant_newton = 2 * ndims(equations))\n\nSubcell invariant domain preserving (IDP) limiting used with VolumeIntegralSubcellLimiting including:\n\nLocal maximum/minimum Zalesak-type limiting for conservative variables (local_minmax_variables_cons)\nPositivity limiting for conservative variables (positivity_variables_cons) and nonlinear variables\n\n(positivity_variables_nonlinear)\n\nConservative variables to be limited are passed as a vector of strings, e.g. local_minmax_variables_cons = [\"rho\"] and positivity_variables_cons = [\"rho\"]. For nonlinear variables the specific functions are passed in a vector, e.g. positivity_variables_nonlinear = [pressure].\n\nThe bounds are calculated using the low-order FV solution. The positivity limiter uses positivity_correction_factor such that u^new >= positivity_correction_factor * u^FV. The limiting of nonlinear variables uses a Newton-bisection method with a maximum of max_iterations_newton iterations, relative and absolute tolerances of newton_tolerances and a provisional update constant gamma_constant_newton (gamma_constant_newton>=2*d, where d = #dimensions). See equation (20) of Pazner (2020) and equation (30) of Rueda-Ramírez et al. (2022).\n\nnote: Note\nThis limiter and the correction callback SubcellLimiterIDPCorrection only work together. Without the callback, no correction takes place, leading to a standard low-order FV scheme.\n\nReferences\n\nRueda-Ramírez, Pazner, Gassner (2022) Subcell Limiting Strategies for Discontinuous Galerkin Spectral Element Methods DOI: 10.1016/j.compfluid.2022.105627\nPazner (2020) Sparse invariant domain preserving discontinuous Galerkin methods with subcell convex limiting DOI: 10.1016/j.cma.2021.113876\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SubcellLimiterIDPCorrection","page":"Trixi.jl","title":"Trixi.SubcellLimiterIDPCorrection","text":"SubcellLimiterIDPCorrection()\n\nPerform antidiffusive correction stage for the a posteriori IDP limiter SubcellLimiterIDP called with VolumeIntegralSubcellLimiting.\n\nnote: Note\nThis callback and the actual limiter SubcellLimiterIDP only work together. This is not a replacement but a necessary addition.\n\nReferences\n\nRueda-Ramírez, Pazner, Gassner (2022) Subcell Limiting Strategies for Discontinuous Galerkin Spectral Element Methods DOI: 10.1016/j.compfluid.2022.105627\nPazner (2020) Sparse invariant domain preserving discontinuous Galerkin methods with subcell convex limiting DOI: 10.1016/j.cma.2021.113876\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SurfaceIntegralStrongForm","page":"Trixi.jl","title":"Trixi.SurfaceIntegralStrongForm","text":"SurfaceIntegralStrongForm(surface_flux=flux_central)\n\nThe classical strong form surface integral type for FD/DG methods.\n\nSee also VolumeIntegralStrongForm.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SurfaceIntegralUpwind","page":"Trixi.jl","title":"Trixi.SurfaceIntegralUpwind","text":"SurfaceIntegralUpwind(splitting)\n\nCouple elements with upwind simultaneous approximation terms (SATs) that use a particular flux splitting, e.g., splitting_steger_warming.\n\nSee also VolumeIntegralUpwind.\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.SurfaceIntegralWeakForm","page":"Trixi.jl","title":"Trixi.SurfaceIntegralWeakForm","text":"SurfaceIntegralWeakForm(surface_flux=flux_central)\n\nThe classical weak form surface integral type for DG methods as explained in standard textbooks.\n\nSee also VolumeIntegralWeakForm.\n\nReferences\n\nKopriva (2009) Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers doi: 10.1007/978-90-481-2261-5\nHesthaven, Warburton (2007) Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications doi: 10.1007/978-0-387-72067-8\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.T8codeMesh","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nAn unstructured curved mesh based on trees that uses the C library 't8code' to manage trees and mesh refinement.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Any}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(trees_per_dimension; polydeg, mapping=identity,\n RealT=Float64, initial_refinement_level=0, periodicity=true)\n\nCreate a structured potentially curved 'T8codeMesh' of the specified size.\n\nNon-periodic boundaries will be called ':xneg', ':xpos', ':yneg', ':ypos', ':zneg', ':zpos'.\n\nArguments\n\n'treesperdimension::NTupleE{NDIMS, Int}': the number of trees in each dimension.\n'polydeg::Integer': polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.\nmapping: a function of NDIMS variables to describe the mapping that transforms the reference mesh ([-1, 1]^n) to the physical domain. Use only one of mapping, faces and coordinates_min/coordinates_max.\nfaces::NTuple{2*NDIMS}: a tuple of 2 * NDIMS functions that describe the faces of the domain. Each function must take NDIMS-1 arguments. faces[1] describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described by faces[2]. faces[3:4] describe the faces in positive and negative y-direction respectively (in 2D and 3D). faces[5:6] describe the faces in positive and negative z-direction respectively (in 3D). Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_min: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\ncoordinates_max: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one of mapping, faces and coordinates_min/coordinates_max.\n'RealT::Type': the type that should be used for coordinates.\n'initialrefinementlevel::Integer': refine the mesh uniformly to this level before the simulation starts.\n'periodicity': either a 'Bool' deciding if all of the boundaries are periodic or an 'NTuple{NDIMS, Bool}' deciding for each dimension if the boundaries in this dimension are periodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Ptr{P4est.LibP4est.p4est_connectivity}}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(conn::Ptr{p4est_connectivity}; kwargs...)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.\n\nArguments\n\nconn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Ptr{P4est.LibP4est.p8est_connectivity}}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(conn::Ptr{p8est_connectivity}; kwargs...)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a p4est_connectivity data structure.\n\nArguments\n\nconn::Ptr{p4est_connectivity}: Pointer to a P4est connectivity object.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{Ptr{T8code.Libt8.t8_cmesh}}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(cmesh::Ptr{t8_cmesh},\n mapping=nothing, polydeg=1, RealT=Float64,\n initial_refinement_level=0)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a t8_cmesh data structure.\n\nArguments\n\ncmesh::Ptr{t8_cmesh}: Pointer to a cmesh object.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.T8codeMesh-Tuple{String, Any}","page":"Trixi.jl","title":"Trixi.T8codeMesh","text":"T8codeMesh(meshfile::String, ndims; kwargs...)\n\nMain mesh constructor for the T8codeMesh that imports an unstructured, conforming mesh from a Gmsh mesh file (.msh).\n\nArguments\n\nmeshfile::String: path to a Gmsh mesh file.\nndims: Mesh file dimension: 2 or 3.\nmapping: a function of NDIMS variables to describe the mapping that transforms the imported mesh to the physical domain. Use nothing for the identity map.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of 1 creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.TimeSeriesCallback","page":"Trixi.jl","title":"Trixi.TimeSeriesCallback","text":"TimeSeriesCallback(semi, point_coordinates;\n interval=1, solution_variables=cons2cons,\n output_directory=\"out\", filename=\"time_series.h5\",\n RealT=real(solver), uEltype=eltype(cache.elements))\n\nCreate a callback that records point-wise data at points given in point_coordinates every interval time steps. The point coordinates are to be specified either as a vector of coordinate tuples or as a two-dimensional array where the first dimension is the point number and the second dimension is the coordinate dimension. By default, the conservative variables are recorded, but this can be controlled by passing a different conversion function to solution_variables.\n\nAfter the last time step, the results are stored in an HDF5 file filename in directory output_directory.\n\nThe real data type RealT and data type for solution variables uEltype default to the respective types used in the solver and the cache.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.TrafficFlowLWREquations1D","page":"Trixi.jl","title":"Trixi.TrafficFlowLWREquations1D","text":"TrafficFlowLWREquations1D\n\nThe classic Lighthill-Witham Richards (LWR) model for 1D traffic flow. The car density is denoted by u in 0 1 and the maximum possible speed (e.g. due to speed limits) is v_textmax.\n\npartial_t u + v_textmax partial_1 u (1 - u) = 0\n\nFor more details see e.g. Section 11.1 of \n\nRandall LeVeque (2002)\n\nFinite Volume Methods for Hyperbolic Problems [DOI: 10.1017/CBO9780511791253]https://doi.org/10.1017/CBO9780511791253\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.TreeMesh","page":"Trixi.jl","title":"Trixi.TreeMesh","text":"TreeMesh{NDIMS} <: AbstractMesh{NDIMS}\n\nA Cartesian mesh based on trees of hypercubes to support adaptive mesh refinement.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.UnstructuredMesh2D","page":"Trixi.jl","title":"Trixi.UnstructuredMesh2D","text":"UnstructuredMesh2D <: AbstractMesh{2}\n\nAn unstructured (possibly curved) quadrilateral mesh.\n\nUnstructuredMesh2D(filename; RealT=Float64, periodicity=false)\n\nAll mesh information, neighbour coupling, and boundary curve information is read in from a mesh file filename.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.UnstructuredSortedBoundaryTypes","page":"Trixi.jl","title":"Trixi.UnstructuredSortedBoundaryTypes","text":"UnstructuredSortedBoundaryTypes\n\nGeneral container to sort the boundary conditions by type for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type to expedite computation during the call to calc_boundary_flux!. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ViscousFormulationBassiRebay1","page":"Trixi.jl","title":"Trixi.ViscousFormulationBassiRebay1","text":"ViscousFormulationBassiRebay1()\n\nThe classical BR1 flux from\n\nF. Bassi, S. Rebay (1997) A High-Order Accurate Discontinuous Finite Element Method for the Numerical Solution of the Compressible Navier-Stokes Equations DOI: 10.1006/jcph.1996.5572\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.ViscousFormulationLocalDG","page":"Trixi.jl","title":"Trixi.ViscousFormulationLocalDG","text":"ViscousFormulationLocalDG(penalty_parameter)\n\nThe local DG (LDG) flux from \"The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems\" by Cockburn and Shu (1998).\n\nNote that, since this implementation does not involve the parabolic \"upwinding\" vector, the LDG solver is equivalent to ViscousFormulationBassiRebay1 with an LDG-type penalization.\n\nCockburn and Shu (1998). The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems DOI: 10.1137/S0036142997316712\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VisualizationCallback-Tuple{}","page":"Trixi.jl","title":"Trixi.VisualizationCallback","text":"VisualizationCallback(; interval=0,\n solution_variables=cons2prim,\n variable_names=[],\n show_mesh=false,\n plot_data_creator=PlotData2D,\n plot_creator=show_plot,\n plot_arguments...)\n\nCreate a callback that visualizes results during a simulation, also known as in-situ visualization.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in any future releases.\n\nThe interval specifies the number of time step iterations after which a new plot is generated. The available variables to plot are configured with the solution_variables parameter, which acts the same way as for the SaveSolutionCallback. The variables to be actually plotted can be selected by providing a single string or a list of strings to variable_names, and if show_mesh is true, an additional plot with the mesh will be generated.\n\nTo customize the generated figure, plot_data_creator allows to use different plot data types. With plot_creator you can further specify an own function to visualize results, which must support the same interface as the default implementation show_plot. All remaining keyword arguments are collected and passed as additional arguments to the plotting command.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.VolumeIntegralFluxDifferencing","page":"Trixi.jl","title":"Trixi.VolumeIntegralFluxDifferencing","text":"VolumeIntegralFluxDifferencing(volume_flux)\n\nVolume integral type for DG methods based on SBP operators and flux differencing using a symmetric two-point volume_flux. This volume_flux needs to satisfy the interface of numerical fluxes in Trixi.jl.\n\nReferences\n\nLeFloch, Mercier, Rohde (2002) Fully Discrete, Entropy Conservative Schemes of Arbitrary Order doi: 10.1137/S003614290240069X\nFisher, Carpenter (2013) High-order entropy stable finite difference schemes for nonlinear conservation laws: Finite domains doi: 10.1016/j.jcp.2013.06.014\nHendrik Ranocha (2017) Comparison of Some Entropy Conservative Numerical Fluxes for the Euler Equations arXiv: 1701.02264 doi: 10.1007/s10915-017-0618-1\nChen, Shu (2017) Entropy stable high order discontinuous Galerkin methods with suitable quadrature rules for hyperbolic conservation laws doi: 10.1016/j.jcp.2017.05.025\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralPureLGLFiniteVolume","page":"Trixi.jl","title":"Trixi.VolumeIntegralPureLGLFiniteVolume","text":"VolumeIntegralPureLGLFiniteVolume(volume_flux_fv)\n\nA volume integral that only uses the subcell finite volume schemes of the VolumeIntegralShockCapturingHG.\n\nThis gives a formally O(1)-accurate finite volume scheme on an LGL-type subcell mesh (LGL = Legendre-Gauss-Lobatto).\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nHennemann, Gassner (2020) \"A provably entropy stable subcell shock capturing approach for high order split form DG\" arXiv: 2008.12044\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralShockCapturingHG","page":"Trixi.jl","title":"Trixi.VolumeIntegralShockCapturingHG","text":"VolumeIntegralShockCapturingHG(indicator; volume_flux_dg=flux_central,\n volume_flux_fv=flux_lax_friedrichs)\n\nShock-capturing volume integral type for DG methods using a convex blending of the finite volume method with numerical flux volume_flux_fv and the VolumeIntegralFluxDifferencing with volume flux volume_flux_dg. The amount of blending is determined by the indicator, e.g., IndicatorHennemannGassner.\n\nReferences\n\nHennemann, Gassner (2020) \"A provably entropy stable subcell shock capturing approach for high order split form DG\" arXiv: 2008.12044\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralStrongForm","page":"Trixi.jl","title":"Trixi.VolumeIntegralStrongForm","text":"VolumeIntegralStrongForm()\n\nThe classical strong form volume integral type for FD/DG methods.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralSubcellLimiting","page":"Trixi.jl","title":"Trixi.VolumeIntegralSubcellLimiting","text":"VolumeIntegralSubcellLimiting(limiter;\n volume_flux_dg, volume_flux_fv)\n\nA subcell limiting volume integral type for DG methods based on subcell blending approaches with a low-order FV method. Used with limiter SubcellLimiterIDP.\n\nnote: Note\nSubcell limiting methods are not fully functional on non-conforming meshes. This is mainly because the implementation assumes that low- and high-order schemes have the same surface terms, which is not guaranteed for non-conforming meshes. The low-order scheme with a high-order mortar is not invariant domain preserving.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralUpwind","page":"Trixi.jl","title":"Trixi.VolumeIntegralUpwind","text":"VolumeIntegralUpwind(splitting)\n\nSpecialized volume integral for finite difference summation-by-parts (FDSBP) solvers. Can be used together with the upwind SBP operators of Mattsson (2017) implemented in SummationByPartsOperators.jl. The splitting controls the discretization.\n\nSee also splitting_steger_warming, splitting_lax_friedrichs, splitting_vanleer_haenel.\n\nReferences\n\nMattsson (2017) Diagonal-norm upwind SBP operators doi: 10.1016/j.jcp.2017.01.042\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Trixi.VolumeIntegralWeakForm","page":"Trixi.jl","title":"Trixi.VolumeIntegralWeakForm","text":"VolumeIntegralWeakForm()\n\nThe classical weak form volume integral type for DG methods as explained in standard textbooks.\n\nReferences\n\nKopriva (2009) Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers doi: 10.1007/978-90-481-2261-5\nHesthaven, Warburton (2007) Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications doi: 10.1007/978-0-387-72067-8\n\nVolumeIntegralWeakForm() is only implemented for conserved terms as non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, see VolumeIntegralFluxDifferencing. This treatment is required to achieve, e.g., entropy-stability or well-balancedness.\n\n\n\n\n\n","category":"type"},{"location":"reference-trixi/#Base.getindex-Tuple{Trixi.AbstractPlotData, Any}","page":"Trixi.jl","title":"Base.getindex","text":"Base.getindex(pd::AbstractPlotData, variable_name)\n\nExtract a single variable variable_name from pd for plotting with Plots.plot.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Base.resize!-Tuple{Trixi.AbstractContainer, Any}","page":"Trixi.jl","title":"Base.resize!","text":"resize!(c::AbstractContainer, new_length) -> AbstractContainer\n\nResize c to contain new_length elements. If new_length is smaller than the current container length, the first new_length elements will be retained. If new_length is larger, the new elements are invalidated.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.compute_coefficients!-Tuple{Any, Any, Any, Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"PolynomialBases.compute_coefficients!","text":"compute_coefficients!(u_ode, func, t, semi::AbstractSemidiscretization)\n\nSame as compute_coefficients but stores the result in u_ode.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.compute_coefficients-Tuple{Any, Any, Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"PolynomialBases.compute_coefficients","text":"compute_coefficients(func, t, semi::AbstractSemidiscretization)\n\nCompute the discrete coefficients of the continuous function func at time t associated with the semidiscretization semi. For example, the discrete coefficients of func for a discontinuous Galerkin spectral element method (DGSEM) are the values of func at the Lobatto-Legendre nodes. Similarly, a classical finite difference method will use the values of func at the nodes of the grid assoociated with the semidiscretization semi.\n\nFor semidiscretizations semi associated with an initial condition, func can be omitted to use the given initial condition at time t.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.integrate-Tuple{Any, Any, LobattoLegendreBasis}","page":"Trixi.jl","title":"PolynomialBases.integrate","text":"integrate(f, u, basis::LobattoLegendreBasis)\n\nMap the function f to the coefficients u and integrate with respect to the quadrature rule given by basis.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#PolynomialBases.integrate-Union{Tuple{Func}, Tuple{Func, Any, Trixi.AbstractSemidiscretization}} where Func","page":"Trixi.jl","title":"PolynomialBases.integrate","text":"integrate([func=(u_node,equations)->u_node,] u_ode, semi::AbstractSemidiscretization; normalize=true)\n\nCall func(u_node, equations) for each vector of nodal variables u_node in u_ode and integrate the result using a quadrature associated with the semidiscretization semi.\n\nIf normalize is true, the result is divided by the total volume of the computational domain.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SciMLBase.add_tstop!-Tuple{Trixi.SimpleIntegratorSSP, Any}","page":"Trixi.jl","title":"SciMLBase.add_tstop!","text":"add_tstop!(integrator::SimpleIntegratorSSP, t)\n\nAdd a time stop during the time integration process. This function is called after the periodic SaveSolutionCallback to specify the next stop to save the solution.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SummationByPartsOperators.semidiscretize-Tuple{SemidiscretizationHyperbolicParabolic, Any}","page":"Trixi.jl","title":"SummationByPartsOperators.semidiscretize","text":"semidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan)\n\nWrap the semidiscretization semi as a split ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The parabolic right-hand side is the first function of the split ODE problem and will be used by default by the implicit part of IMEX methods from the SciML ecosystem.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SummationByPartsOperators.semidiscretize-Tuple{Trixi.AbstractSemidiscretization, Any, AbstractString}","page":"Trixi.jl","title":"SummationByPartsOperators.semidiscretize","text":"semidiscretize(semi::AbstractSemidiscretization, tspan, restart_file::AbstractString)\n\nWrap the semidiscretization semi as an ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem. The initial condition etc. is taken from the restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#SummationByPartsOperators.semidiscretize-Tuple{Trixi.AbstractSemidiscretization, Any}","page":"Trixi.jl","title":"SummationByPartsOperators.semidiscretize","text":"semidiscretize(semi::AbstractSemidiscretization, tspan)\n\nWrap the semidiscretization semi as an ODE problem in the time interval tspan that can be passed to solve from the SciML ecosystem.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.DGMultiBasis-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.DGMultiBasis","text":"DGMultiBasis(element_type, polydeg; approximation_type = Polynomial(), kwargs...)\n\nConstructs a basis for DGMulti solvers. Returns a \"StartUpDG.RefElemData\" object. The kwargs arguments are additional keyword arguments for RefElemData, such as quad_rule_vol. These are the same as the RefElemData_kwargs used in DGMulti. For more info, see the StartUpDG.jl docs.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.LBMCollisionCallback-Tuple{}","page":"Trixi.jl","title":"Trixi.LBMCollisionCallback","text":"LBMCollisionCallback()\n\nApply the Lattice-Boltzmann method (LBM) collision operator before each time step. See LatticeBoltzmannEquations2D for further details.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.P4estMeshCubedSphere-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.P4estMeshCubedSphere","text":"P4estMeshCubedSphere(trees_per_face_dimension, layers, inner_radius, thickness;\n polydeg, RealT=Float64,\n initial_refinement_level=0, unsaved_changes=true,\n p4est_partition_allow_for_coarsening=true)\n\nBuild a \"Cubed Sphere\" mesh as P4estMesh with 6 * trees_per_face_dimension^2 * layers trees.\n\nThe mesh will have two boundaries, :inside and :outside.\n\nArguments\n\ntrees_per_face_dimension::Integer: the number of trees in the first two local dimensions of each face.\nlayers::Integer: the number of trees in the third local dimension of each face, i.e., the number of layers of the sphere.\ninner_radius::Integer: the inner radius of the sphere.\nthickness::Integer: the thickness of the sphere. The outer radius will be inner_radius + thickness.\npolydeg::Integer: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.\nRealT::Type: the type that should be used for coordinates.\ninitial_refinement_level::Integer: refine the mesh uniformly to this level before the simulation starts.\nunsaved_changes::Bool: if set to true, the mesh will be saved to a mesh file.\np4est_partition_allow_for_coarsening::Bool: Must be true when using AMR to make mesh adaptivity independent of domain partitioning. Should be false for static meshes to permit more fine-grained partitioning.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData2D-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.PlotData2D","text":"PlotData2D(u, semi [or mesh, equations, solver, cache];\n solution_variables=nothing,\n grid_lines=true, max_supported_level=11, nvisnodes=nothing,\n slice=:xy, point=(0.0, 0.0, 0.0))\n\nCreate a new PlotData2D object that can be used for visualizing 2D/3D DGSEM solution data array u with Plots.jl. All relevant geometrical information is extracted from the semidiscretization semi. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables.\n\nIf grid_lines is true, also extract grid vertices for visualizing the mesh. The output resolution is indirectly set via max_supported_level: all data is interpolated to 2^max_supported_level uniformly distributed points in each spatial direction, also setting the maximum allowed refinement level in the solution. nvisnodes specifies the number of visualization nodes to be used. If it is nothing, twice the number of solution DG nodes are used for visualization, and if set to 0, exactly the number of nodes in the DG elements are used.\n\nWhen visualizing data from a three-dimensional simulation, a 2D slice is extracted for plotting. slice specifies the plane that is being sliced and may be :xy, :xz, or :yz. The slice position is specified by a point that lies on it, which defaults to (0.0, 0.0, 0.0). Both of these values are ignored when visualizing 2D data.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nExamples\n\njulia> using Trixi, Plots\n\njulia> trixi_include(default_example())\n[...]\n\njulia> pd = PlotData2D(sol)\nPlotData2D(...)\n\njulia> plot(pd) # To plot all available variables\n\njulia> plot(pd[\"scalar\"]) # To plot only a single variable\n\njulia> plot!(getmesh(pd)) # To add grid lines to the plot\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.PlotData2D-Tuple{Union{ODESolution{T, N, uType, uType2, DType, tType, rateType, P} where {T, N, uType, uType2, DType, tType, rateType, P<:(ODEProblem{uType_, tType_, isinplace, P_} where {uType_, tType_, isinplace, P_<:Trixi.AbstractSemidiscretization})}, Trixi.TimeIntegratorSolution}}","page":"Trixi.jl","title":"Trixi.PlotData2D","text":"PlotData2D(sol; kwargs...)\n\nCreate a PlotData2D object from a solution object created by either OrdinaryDiffEq.solve! (which returns a SciMLBase.ODESolution) or Trixi.jl's own solve! (which returns a TimeIntegratorSolution).\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ScalarPlotData2D-Tuple{Any, Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.ScalarPlotData2D","text":"ScalarPlotData2D(u, semi::AbstractSemidiscretization; kwargs...)\n\nReturns an PlotData2DTriangulated object which is used to visualize a single scalar field. u should be an array whose entries correspond to values of the scalar field at nodal points.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.SummaryCallback","page":"Trixi.jl","title":"Trixi.SummaryCallback","text":"SummaryCallback()\n\nCreate and return a callback that prints a human-readable summary of the simulation setup at the beginning of a simulation and then resets the timer. When the returned callback is executed directly, the current timer values are shown.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.TrivialCallback-Tuple{}","page":"Trixi.jl","title":"Trixi.TrivialCallback","text":"TrivialCallback()\n\nA callback that does nothing. This can be useful to disable some callbacks easily via trixi_include.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.adapt!-Tuple{T8codeMesh, Any}","page":"Trixi.jl","title":"Trixi.adapt!","text":"Trixi.adapt!(mesh::T8codeMesh, adapt_callback; kwargs...)\n\nAdapt a T8codeMesh according to a user-defined adapt_callback.\n\nArguments\n\nmesh::T8codeMesh: Initialized mesh object.\nadapt_callback: A user-defined callback which tells the adaption routines if an element should be refined, coarsened or stay unchanged.\nThe expected callback signature is as follows:\n`adapt_callback(forest, ltreeid, eclass_scheme, lelemntid, elements, is_family, user_data)`\n # Arguments\n - `forest`: Pointer to the analyzed forest.\n - `ltreeid`: Local index of the current tree where the analyzed elements are part of.\n - `eclass_scheme`: Element class of `elements`.\n - `lelemntid`: Local index of the first element in `elements`.\n - `elements`: Array of elements. If consecutive elements form a family\n they are passed together, otherwise `elements` consists of just one element.\n - `is_family`: Boolean signifying if `elements` represents a family or not.\n - `user_data`: Void pointer to some arbitrary user data. Default value is `C_NULL`.\n # Returns\n -1 : Coarsen family of elements.\n 0 : Stay unchanged.\n 1 : Refine element.\nkwargs:\nrecursive = true: Adapt the forest recursively. If true the caller must ensure that the callback returns 0 for every analyzed element at some point to stop the recursion.\nbalance = true: Make sure the adapted forest is 2^(NDIMS-1):1 balanced.\npartition = true: Partition the forest to redistribute elements evenly among MPI ranks.\nghost = true: Create a ghost layer for MPI data exchange.\nuser_data = C_NULL: Pointer to some arbitrary user-defined data.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.adapt_to_mesh_level!-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.adapt_to_mesh_level!","text":"adapt_to_mesh_level!(u_ode, semi, level)\nadapt_to_mesh_level!(sol::Trixi.TrixiODESolution, level)\n\nLike adapt_to_mesh_level, but modifies the solution and parts of the semidiscretization (mesh and caches) in place.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.adapt_to_mesh_level-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.adapt_to_mesh_level","text":"adapt_to_mesh_level(u_ode, semi, level)\nadapt_to_mesh_level(sol::Trixi.TrixiODESolution, level)\n\nUse the regular adaptive mesh refinement routines to adaptively refine/coarsen the solution u_ode with semidiscretization semi towards a uniformly refined grid with refinement level level. The solution and semidiscretization are copied such that the original objects remain unaltered.\n\nA convenience method accepts an ODE solution object, from which solution and semidiscretization are extracted as needed.\n\nSee also: adapt_to_mesh_level!\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.balance!-Tuple{T8codeMesh}","page":"Trixi.jl","title":"Trixi.balance!","text":"Trixi.balance!(mesh::T8codeMesh)\n\nBalance a T8codeMesh to ensure 2^(NDIMS-1):1 face neighbors.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_x-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_x","text":"boundary_condition_linear_x(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation1D)\n\nBoundary conditions for initial_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_x-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_x","text":"boundary_condition_linear_x(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation2D)\n\nBoundary conditions for initial_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_x_y-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_x_y","text":"boundary_condition_linear_x_y(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation2D)\n\nBoundary conditions for initial_condition_linear_x_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_y-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_y","text":"boundary_condition_linear_y(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation2D)\n\nBoundary conditions for initial_condition_linear_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_linear_z-Tuple{Any, Any, Any, Any, Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_linear_z","text":"boundary_condition_linear_z(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equation::LinearScalarAdvectionEquation1D)\n\nBoundary conditions for boundary_condition_linear_z.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_noslip_wall-Tuple{Any, Any, Any, Any, Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_noslip_wall","text":"boundary_condition_noslip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equations::LatticeBoltzmannEquations2D)\n\nNo-slip wall boundary condition using the bounce-back approach.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_poisson_nonperiodic-Tuple{Any, Any, Any, Any, Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_poisson_nonperiodic","text":"boundary_condition_poisson_nonperiodic(u_inner, orientation, direction, x, t,\n surface_flux_function,\n equations::HyperbolicDiffusionEquations1D)\n\nBoundary conditions used for convergence tests in combination with initial_condition_poisson_nonperiodic and source_terms_poisson_nonperiodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::AcousticPerturbationEquations2D)\n\nUse an orthogonal projection of the perturbed velocities to zero out the normal velocity while retaining the possibility of a tangential velocity in the boundary state. Further details are available in the paper:\n\nMarcus Bauer, Jürgen Dierke and Roland Ewert (2011) Application of a discontinuous Galerkin method to discretize acoustic perturbation equations DOI: 10.2514/1.J050333\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations2D)\n\nShould be used together with StructuredMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations3D)\n\nShould be used together with StructuredMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::CompressibleEulerEquations2D)\n\nDetermine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:\n\nJ. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF\n\nDetails about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761\n\nShould be used together with UnstructuredMesh2D.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::CompressibleEulerEquations3D)\n\nDetermine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:\n\nJ. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF\n\nDetails about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, AbstractVector, Any, Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,\n equations::ShallowWaterEquations2D)\n\nCreate a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value. For details see Section 9.2.5 of the book:\n\nEleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations1D)\n\nDetermine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:\n\nJ. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations2D)\n\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::CompressibleEulerEquations3D)\n\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation_or_normal, x, t, surface_flux_function,\n equations::ShallowWaterEquations1D)\n\nCreate a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value.\n\nFor details see Section 9.2.5 of the book:\n\nEleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_slip_wall-Tuple{Any, Any, Any, Any, Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_slip_wall","text":"boundary_condition_slip_wall(u_inner, orientation, direction, x, t,\n surface_flux_function, equations::ShallowWaterEquations2D)\n\nShould be used together with TreeMesh.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_wall-Tuple{Any, Any, Any, Any, Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_wall","text":"boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,\n equations::AcousticPerturbationEquations2D)\n\nBoundary conditions for a solid wall.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.boundary_condition_wall-Tuple{Any, Any, Any, Any, Any, Any, LinearizedEulerEquations2D}","page":"Trixi.jl","title":"Trixi.boundary_condition_wall","text":"boundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,\n equations::LinearizedEulerEquations2D)\n\nBoundary conditions for a solid wall.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_error_norms-Tuple{Any, Any, Any, Trixi.AbstractSemidiscretization, Any}","page":"Trixi.jl","title":"Trixi.calc_error_norms","text":"calc_error_norms([func=(u_node,equations)->u_node,] u_ode, t, analyzer, semi::AbstractSemidiscretization, cache_analysis)\n\nCalculate discrete L2 and L∞ error norms of func applied to each nodal variable u_node in u_ode. If no exact solution is available, \"errors\" are calculated using some reference state and can be useful for regression tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_fast_wavespeed_roe-Tuple{Any, Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.calc_fast_wavespeed_roe","text":"calc_fast_wavespeed_roe(u_ll, u_rr, direction, equations::IdealGlmMhdEquations1D)\n\nCompute the fast magnetoacoustic wave speed using Roe averages as given by\n\nCargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_fast_wavespeed_roe-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.calc_fast_wavespeed_roe","text":"calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations2D)\n\nCompute the fast magnetoacoustic wave speed using Roe averages as given by\n\nCargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_fast_wavespeed_roe-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.calc_fast_wavespeed_roe","text":"calc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)\n\nCompute the fast magnetoacoustic wave speed using Roe averages as given by\n\nCargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_wavespeed_roe-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.calc_wavespeed_roe","text":"calc_wavespeed_roe(u_ll, u_rr, direction::Integer,\n equations::ShallowWaterEquations1D)\n\nCalculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} See for instance equation (62) in \n\nPaul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044\n\nOr equation (9.17) in this lecture notes.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.calc_wavespeed_roe-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.calc_wavespeed_roe","text":"calc_wavespeed_roe(u_ll, u_rr, direction::Integer,\n equations::ShallowWaterEquations2D)\n\nCalculate Roe-averaged velocity v_roe and wavespeed c_roe = sqrt{g * h_roe} depending on direction. See for instance equation (62) in \n\nPaul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044\n\nOr this slides, slides 8 and 9.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.collision_bgk-Tuple{Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.collision_bgk","text":"collision_bgk(u, dt, equations::LatticeBoltzmannEquations2D)\n\nCollision operator for the Bhatnagar, Gross, and Krook (BGK) model.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.collision_bgk-Tuple{Any, Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.collision_bgk","text":"collision_bgk(u, dt, equations::LatticeBoltzmannEquations3D)\n\nCollision operator for the Bhatnagar, Gross, and Krook (BGK) model.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.cons2cons-Tuple{Any, Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.cons2cons","text":"cons2cons(u, equations)\n\nReturn the conserved variables u. While this function is as trivial as identity, it is also as useful.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.cons2entropy","page":"Trixi.jl","title":"Trixi.cons2entropy","text":"cons2entropy(u, equations)\n\nConvert the conserved variables u to the entropy variables for a given set of equations with chosen standard entropy.\n\nu is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by entropy2cons.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.cons2prim","page":"Trixi.jl","title":"Trixi.cons2prim","text":"cons2prim(u, equations)\n\nConvert the conserved variables u to the primitive variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by prim2cons.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.convergence_test-Tuple{Module, AbstractString, Any}","page":"Trixi.jl","title":"Trixi.convergence_test","text":"convergence_test([mod::Module=Main,] elixir::AbstractString, iterations; kwargs...)\n\nRun iterations Trixi.jl simulations using the setup given in elixir and compute the experimental order of convergence (EOC) in the L^2 and L^infty norm. In each iteration, the resolution of the respective mesh will be doubled. Additional keyword arguments kwargs... and the optional module mod are passed directly to trixi_include.\n\nThis function assumes that the spatial resolution is set via the keywords initial_refinement_level (an integer) or cells_per_dimension (a tuple of integers, one per spatial dimension).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_analysis_errors-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.default_analysis_errors","text":"default_analysis_errors(equations)\n\nDefault analysis errors (:l2_error and :linf_error) used by the AnalysisCallback.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_analysis_integrals-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.default_analysis_integrals","text":"default_analysis_integrals(equations)\n\nDefault analysis integrals used by the AnalysisCallback.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_example-Tuple{}","page":"Trixi.jl","title":"Trixi.default_example","text":"default_example()\n\nReturn the path to an example elixir that can be used to quickly see Trixi.jl in action on a TreeMesh. See also examples_dir and get_examples.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.default_example_unstructured-Tuple{}","page":"Trixi.jl","title":"Trixi.default_example_unstructured","text":"default_example_unstructured()\n\nReturn the path to an example elixir that can be used to quickly see Trixi.jl in action on an UnstructuredMesh2D. This simulation is run on the example curved, unstructured mesh given in the Trixi.jl documentation regarding unstructured meshes.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.density-Tuple{Real, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.density","text":"density(p::Real, equations::LatticeBoltzmannEquations2D)\ndensity(u, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic density from the pressure p or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.density-Tuple{Real, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.density","text":"density(p::Real, equations::LatticeBoltzmannEquations3D)\ndensity(u, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic density from the pressure p or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.download-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.download","text":"Trixi.download(src_url, file_path)\n\nDownload a file from given src_url to given file_path if file_path is not already a file. This function just returns file_path. This is a small wrapper of Downloads.download(src_url, file_path) that avoids race conditions when multiple MPI ranks are used.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_dof_global-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_dof_global","text":"each_dof_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the degrees of freedom (DOF) in dg. In particular, not the DOFs themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_face_node-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_face_node","text":"each_face_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the face nodes in dg. In particular, not the face_nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_face_node_global-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_face_node_global","text":"each_face_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the face nodes in mesh. In particular, not the face nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_quad_node-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_quad_node","text":"each_quad_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the quadrature nodes in dg. In particular, not the quadrature nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.each_quad_node_global-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.each_quad_node_global","text":"each_quad_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the global quadrature nodes in mesh. In particular, not the quadrature nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachboundary-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachboundary","text":"eachboundary(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the boundaries in cache. In particular, not the boundaries themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachcomponent-Tuple{Trixi.AbstractCompressibleEulerMulticomponentEquations}","page":"Trixi.jl","title":"Trixi.eachcomponent","text":"eachcomponent(equations::AbstractCompressibleEulerMulticomponentEquations)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the components in AbstractCompressibleEulerMulticomponentEquations. In particular, not the components themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachcomponent-Tuple{Trixi.AbstractIdealGlmMhdMulticomponentEquations}","page":"Trixi.jl","title":"Trixi.eachcomponent","text":"eachcomponent(equations::AbstractIdealGlmMhdMulticomponentEquations)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the components in AbstractIdealGlmMhdMulticomponentEquations. In particular, not the components themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachdim-Tuple{Any}","page":"Trixi.jl","title":"Trixi.eachdim","text":"eachdim(mesh)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the dimensions in AbstractTree. In particular, not the dimensions themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachdirection-Tuple{Trixi.AbstractTree}","page":"Trixi.jl","title":"Trixi.eachdirection","text":"eachdirection(tree::AbstractTree)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the directions in AbstractTree. In particular, not the directions themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in cache. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{DGMultiMesh, DGMulti{NDIMS, ElemType, ApproxType} where {NDIMS, ElemType, ApproxType}, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(mesh::DGMultiMesh, dg::DGMulti, other_args...)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in mesh. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.ElementContainer1D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::ElementContainer1D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.ElementContainer2D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::ElementContainer2D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.ElementContainer3D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::ElementContainer3D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachelement-Tuple{Trixi.UnstructuredElementContainer2D}","page":"Trixi.jl","title":"Trixi.eachelement","text":"eachelement(elements::UnstructuredElementContainer2D)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the elements in elements. In particular, not the elements themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachinterface-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachinterface","text":"eachinterface(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the interfaces in cache. In particular, not the interfaces themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachmortar-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachmortar","text":"eachmortar(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the mortars in cache. In particular, not the mortars themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachmpiinterface-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachmpiinterface","text":"eachmpiinterface(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the MPI interfaces in cache. In particular, not the interfaces themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachmpimortar-Tuple{DG, Any}","page":"Trixi.jl","title":"Trixi.eachmpimortar","text":"eachmpimortar(dg::DG, cache)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the MPI mortars in cache. In particular, not the mortars themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachnode-Tuple{DG}","page":"Trixi.jl","title":"Trixi.eachnode","text":"eachnode(dg::DG)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the nodes in dg. In particular, not the nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachnode-Tuple{LobattoLegendreBasis}","page":"Trixi.jl","title":"Trixi.eachnode","text":"eachnode(basis::LobattoLegendreBasis)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the nodes in basis. In particular, not the nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachnode-Tuple{Trixi.LobattoLegendreAnalyzer}","page":"Trixi.jl","title":"Trixi.eachnode","text":"eachnode(analyzer::LobattoLegendreAnalyzer)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the nodes in analyzer. In particular, not the nodes themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.eachvariable-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.eachvariable","text":"eachvariable(equations::AbstractEquations)\n\nReturn an iterator over the indices that specify the location in relevant data structures for the variables in equations. In particular, not the variables themselves are returned.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.energy_internal","page":"Trixi.jl","title":"Trixi.energy_internal","text":"energy_internal(u, equations)\n\nReturn the internal energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.energy_kinetic","page":"Trixi.jl","title":"Trixi.energy_kinetic","text":"energy_kinetic(u, equations)\n\nReturn the kinetic energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.energy_total","page":"Trixi.jl","title":"Trixi.energy_total","text":"energy_total(u, equations)\n\nReturn the total energy of the conserved variables u for a given set of equations, e.g., the CompressibleEulerEquations2D.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.entropy","page":"Trixi.jl","title":"Trixi.entropy","text":"entropy(u, equations)\n\nReturn the chosen entropy of the conserved variables u for a given set of equations.\n\nu is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.entropy2cons","page":"Trixi.jl","title":"Trixi.entropy2cons","text":"entropy2cons(w, equations)\n\nConvert the entropy variables w based on a standard entropy to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2entropy.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.equilibrium_distribution-Tuple{Any, Any, Any, Any, Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.equilibrium_distribution","text":"equilibrium_distribution(alpha, rho, v1, v2, v3, equations::LatticeBoltzmannEquations3D)\n\nCalculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2, v3.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.equilibrium_distribution-Tuple{Any, Any, Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.equilibrium_distribution","text":"equilibrium_distribution(alpha, rho, v1, v2, equations::LatticeBoltzmannEquations2D)\n\nCalculate the local equilibrium distribution for the distribution function with index alpha and given the macroscopic state defined by rho, v1, v2.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.examples_dir-Tuple{}","page":"Trixi.jl","title":"Trixi.examples_dir","text":"examples_dir()\n\nReturn the directory where the example files provided with Trixi.jl are located. If Trixi.jl is installed as a regular package (with ]add Trixi), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir:\n\nExamples\n\nreaddir(examples_dir())\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux","page":"Trixi.jl","title":"Trixi.flux","text":"flux(u, orientation_or_normal, equations)\n\nGiven the conservative variables u, calculate the (physical) flux in Cartesian direction orientation::Integer or in arbitrary direction normal::AbstractVector for the corresponding set of governing equations. orientation is 1, 2, and 3 for the x-, y-, and z-directions, respectively.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.flux-Tuple{Any, AbstractVector, Trixi.AbstractEquations{1}}","page":"Trixi.jl","title":"Trixi.flux","text":"flux(u, normal_direction::AbstractVector, equations::AbstractEquations{1})\n\nEnables calling flux with a non-integer argument normal_direction for one-dimensional equations. Returns the value of flux(u, 1, equations) scaled by normal_direction[1].\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_central-Tuple{Any, Any, Any, Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.flux_central","text":"flux_central(u_ll, u_rr, orientation_or_normal_direction, equations::AbstractEquations)\n\nThe classical central numerical flux f((u_ll) + f(u_rr)) / 2. When this flux is used as volume flux, the discretization is equivalent to the classical weak form DG method (except floating point errors).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chan_etal-Tuple{Any, Any, Integer, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_chan_etal","text":"@inline function fluxchanetal(ull, urr, orientation::Integer, equations::CompressibleEulerEquationsQuasi1D)\n\nConservative (symmetric) part of the entropy conservative flux for quasi 1D compressible Euler equations split form. This flux is a generalization of flux_ranocha for CompressibleEulerEquations1D. Further details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089 \n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chan_etal-Tuple{Any, Any, Integer, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_chan_etal","text":"flux_chan_etal(u_ll, u_rr, orientation,\n equations::ShallowWaterEquationsQuasi1D)\n\nTotal energy conservative (mathematical entropy for quasi 1D shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., FluxPlusDissipation(flux_chan_etal, DissipationLocalLaxFriedrichs()).\n\nFurther details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nEntropy conserving two-point flux by\n\nChandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)\n\nEntropy conserving two-point flux by\n\nChandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)\n\nEntropy conserving two-point flux by\n\nChandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations1D)\n\nEntropy conserving two-point flux by\n\nAyoub Gouasmi, Karthik Duraisamy (2020) \"Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations\" arXiv:1904.00972v3 [math.NA] 4 Feb 2020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_chandrashekar-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_chandrashekar","text":"flux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations2D)\n\nAdaption of the entropy conserving two-point flux by\n\nAyoub Gouasmi, Karthik Duraisamy (2020) \"Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations\" arXiv:1904.00972v3 [math.NA] 4 Feb 2020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)\n\nEntropy conserving two-point flux by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations2D)\n\nEntropy conserving two-point flux by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations3D)\n\nEntropy conserving two-point flux by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)\n\nEntropy conserving two-point flux adapted by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_derigs_etal-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_derigs_etal","text":"flux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdMulticomponentEquations2D)\n\nEntropy conserving two-point flux adapted by\n\nDerigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_fjordholm_etal","text":"flux_fjordholm_etal(u_ll, u_rr, orientation,\n equations::ShallowWaterEquations1D)\n\nTotal energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.\n\nDetails are available in Eq. (4.1) in the paper:\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_fjordholm_etal","text":"flux_fjordholm_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::ShallowWaterEquations2D)\n\nTotal energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal.\n\nDetails are available in Eq. (4.1) in the paper:\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_godunov-Tuple{Any, Any, Integer, LinearizedEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_godunov","text":"flux_godunov(u_ll, u_rr, orientation_or_normal_direction,\n equations::LinearizedEulerEquations2D)\n\nAn upwind flux for the linearized Euler equations based on diagonalization of the physical flux matrix. Given the physical flux Au, A=T Lambda T^-1 with Lambda being a diagonal matrix that holds the eigenvalues of A, decompose Lambda = Lambda^+ + Lambda^- where Lambda^+ and Lambda^- are diagonal matrices holding the positive and negative eigenvalues of A, respectively. Then for left and right states u_L u_R, the numerical flux calculated by this function is given by A^+ u_L + A^- u_R where A^pm = T Lambda^pm T^-1.\n\nThe diagonalization of the flux matrix can be found in\n\nR. F. Warming, Richard M. Beam and B. J. Hyett (1975) Diagonalization and simultaneous symmetrization of the gas-dynamic matrices DOI: 10.1090/S0025-5718-1975-0388967-5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdEquations1D)\n\nEntropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdEquations2D)\n\nEntropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdEquations3D)\n\nEntropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdMulticomponentEquations1D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hindenlang_gassner-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_hindenlang_gassner","text":"flux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,\n equations::IdealGlmMhdMulticomponentEquations2D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha to the MHD equations.\n\nReferences\n\nFlorian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nComputes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations2D)\n\nComputes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations3D)\n\nComputes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_hllc-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.flux_hllc","text":"flux_hllc(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)\n\nLi (2005)\n\nAn HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_kennedy_gruber-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_kennedy_gruber","text":"flux_kennedy_gruber(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nKinetic energy preserving two-point flux by\n\nKennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_kennedy_gruber-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_kennedy_gruber","text":"flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nKinetic energy preserving two-point flux by\n\nKennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_kennedy_gruber-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_kennedy_gruber","text":"flux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nKinetic energy preserving two-point flux by\n\nKennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_audusse_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_audusse_etal","text":"flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nNon-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.\n\nThis hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations1D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.\n\nFurther details on the hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_audusse_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_audusse_etal","text":"flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_audusse_etal(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nNon-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal on the conservative variables.\n\nThis hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations2D. Should be used together with FluxHydrostaticReconstruction and hydrostatic_reconstruction_audusse_etal in the surface flux to ensure consistency.\n\nFurther details for the hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_chan_etal-Tuple{Any, Any, Integer, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_chan_etal","text":"flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,\n equations::CompressibleEulerEquationsQuasi1D)\nflux_nonconservative_chan_etal(u_ll, u_rr, normal_direction, \n equations::CompressibleEulerEquationsQuasi1D)\nflux_nonconservative_chan_etal(u_ll, u_rr, normal_ll, normal_rr,\n equations::CompressibleEulerEquationsQuasi1D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the pressure CompressibleEulerEquationsQuasi1D and the nozzle width.\n\nFurther details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089 \n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_chan_etal-Tuple{Any, Any, Integer, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_chan_etal","text":"flux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquationsQuasi1D)\nflux_nonconservative_chan_etal(u_ll, u_rr, normal_direction::AbstractVector,\n equations::ShallowWaterEquationsQuasi1D) \nflux_nonconservative_chan_etal(u_ll, u_rr, \n normal_ll::AbstractVector, normal_rr::AbstractVector,\n equations::ShallowWaterEquationsQuasi1D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquationsQuasi1D and the channel width.\n\nFurther details are available in the paper:\n\nJesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_ersing_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_ersing_etal","text":"flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nwarning: Experimental code\nThis numerical flux is experimental and may change in any future release.\n\nNon-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.\n\nThis is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.\n\nFor further details see:\n\nPatrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_ersing_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_ersing_etal","text":"flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_ersing_etal(u_ll, u_rr,\n normal_direction_ll::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nwarning: Experimental code\nThis numerical flux is experimental and may change in any future release.\n\nNon-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nThis is a modified version of flux_nonconservative_wintermeyer_etal that gives entropy conservation and well-balancedness in both the volume and surface when combined with flux_wintermeyer_etal.\n\nFor further details see:\n\nPatrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_fjordholm_etal","text":"flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nNon-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations1D.\n\nThis contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.\n\nFurther details for the original finite volume formulation are available in\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\nand for curvilinear 2D case in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_fjordholm_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_fjordholm_etal","text":"flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_fjordholm_etal(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nNon-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nThis contains additional terms compared to flux_nonconservative_wintermeyer_etal that account for possible discontinuities in the bottom topography function. Thus, this flux should be used in general at interfaces. For flux differencing volume terms, flux_nonconservative_wintermeyer_etal is analytically equivalent but slightly cheaper.\n\nFurther details for the original finite volume formulation are available in\n\nUlrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042\n\nand for curvilinear 2D case in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell","text":"flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,\n equations::IdealGlmMhdEquations2D)\nflux_nonconservative_powell(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::IdealGlmMhdEquations2D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nReferences\n\nMarvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell","text":"flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,\n equations::IdealGlmMhdEquations3D)\nflux_nonconservative_powell(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::IdealGlmMhdEquations3D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations3D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nReferences\n\nMarvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell-Tuple{Any, Any, Integer, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell","text":"flux_nonconservative_powell(u_ll, u_rr, orientation::Integer,\n equations::IdealGlmMhdMulticomponentEquations2D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdMulticomponentEquations2D.\n\nReferences\n\nMarvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell_local_symmetric-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D, Trixi.NonConservativeSymmetric, Integer}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell_local_symmetric","text":"flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,\n equations::IdealGlmMhdEquations2D,\n nonconservative_type::NonConservativeSymmetric,\n nonconservative_term::Integer)\n\nSymmetric part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered \"fluxes\" for subcell limiting. See, e.g.,\n\nRueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.\n\nThis function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell_local_symmetric-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell_local_symmetric","text":"flux_nonconservative_powell_local_symmetric(u_ll, u_rr,\n orientation::Integer,\n equations::IdealGlmMhdEquations2D)\n\nNon-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D.\n\nThis implementation uses a non-conservative term that can be written as the product of local and symmetric parts. It is equivalent to the non-conservative flux of Bohm et al. (flux_nonconservative_powell) for conforming meshes but it yields different results on non-conforming meshes(!).\n\nThe two other flux functions with the same name return either the local or symmetric portion of the non-conservative flux based on the type of the nonconservativetype argument, employing multiple dispatch. They are used to compute the subcell fluxes in dg2dsubcelllimiters.jl.\n\nReferences\n\nRueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_powell_local_symmetric-Tuple{Any, Integer, IdealGlmMhdEquations2D, Trixi.NonConservativeLocal, Integer}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_powell_local_symmetric","text":"flux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,\n equations::IdealGlmMhdEquations2D,\n nonconservative_type::NonConservativeLocal,\n nonconservative_term::Integer)\n\nLocal part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered \"fluxes\" for subcell limiting. See, e.g.,\n\nRueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.\n\nThis function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_wintermeyer_etal","text":"flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D.\n\nFurther details are available in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_nonconservative_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_nonconservative_wintermeyer_etal","text":"flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations2D)\nflux_nonconservative_wintermeyer_etal(u_ll, u_rr,\n normal_direction_ll ::AbstractVector,\n normal_direction_average::AbstractVector,\n equations::ShallowWaterEquations2D)\n\nNon-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D.\n\nOn curvilinear meshes, this nonconservative flux depends on both the contravariant vector (normal direction) at the current node and the averaged one. This is different from numerical fluxes used to discretize conservative terms.\n\nFurther details are available in the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations1D)\n\nEntropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nEntropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nEntropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerMulticomponentEquations1D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha-Tuple{Any, Any, Integer, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.flux_ranocha","text":"flux_ranocha(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerMulticomponentEquations2D)\n\nAdaption of the entropy conserving and kinetic energy preserving two-point flux by\n\nHendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig\n\nSee also\n\nHendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_ranocha_turbo-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.flux_ranocha_turbo","text":"flux_ranocha_turbo(u_ll, u_rr, orientation_or_normal_direction, equations)\n\nEquivalent to flux_ranocha except that it may use specialized methods, e.g., when used with VolumeIntegralFluxDifferencing. These specialized methods may enable better use of SIMD instructions to increase runtime efficiency on modern hardware.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.flux_shima_etal","text":"flux_shima_etal(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nThis flux is is a modification of the original kinetic energy preserving two-point flux by\n\nYuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058\n\nThe modification is in the energy flux to guarantee pressure equilibrium and was developed by\n\nNao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_shima_etal","text":"flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nThis flux is is a modification of the original kinetic energy preserving two-point flux by\n\nYuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058\n\nThe modification is in the energy flux to guarantee pressure equilibrium and was developed by\n\nNao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.flux_shima_etal","text":"flux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::CompressibleEulerEquations3D)\n\nThis flux is is a modification of the original kinetic energy preserving two-point flux by\n\nYuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058\n\nThe modification is in the energy flux to guarantee pressure equilibrium and was developed by\n\nNao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_shima_etal_turbo-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.flux_shima_etal_turbo","text":"flux_shima_etal_turbo(u_ll, u_rr, orientation_or_normal_direction, equations)\n\nEquivalent to flux_shima_etal except that it may use specialized methods, e.g., when used with VolumeIntegralFluxDifferencing. These specialized methods may enable better use of SIMD instructions to increase runtime efficiency on modern hardware.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.flux_wintermeyer_etal","text":"flux_wintermeyer_etal(u_ll, u_rr, orientation,\n equations::ShallowWaterEquations1D)\n\nTotal energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.\n\nFurther details are available in Theorem 1 of the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_wintermeyer_etal-Tuple{Any, Any, Integer, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.flux_wintermeyer_etal","text":"flux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::ShallowWaterEquations2D)\n\nTotal energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux. The surface_flux should still use, e.g., flux_fjordholm_etal.\n\nFurther details are available in Theorem 1 of the paper:\n\nNiklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.flux_winters_etal-Tuple{Any, Any, AbstractVector, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.flux_winters_etal","text":"flux_winters_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::PolytropicEulerEquations2D)\n\nEntropy conserving two-point flux for isothermal or polytropic gases. Requires a special weighted Stolarsky mean for the evaluation of the density denoted here as stolarsky_mean. Note, for isothermal gases where gamma = 1 this stolarsky_mean becomes the ln_mean.\n\nFor details see Section 3.2 of the following reference\n\nAndrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_boundary_outer_state-Tuple{BoundaryConditionDirichlet, Any, Any, Any, Any, Vararg{Any}}","page":"Trixi.jl","title":"Trixi.get_boundary_outer_state","text":"get_boundary_outer_state(boundary_condition::BoundaryConditionDirichlet,\n cache, t, equations, dg, indices...)\n\nFor subcell limiting, the calculation of local bounds for non-periodic domains require the boundary outer state. This function returns the boundary value at time t and for node with spatial indices indices.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_examples-Tuple{}","page":"Trixi.jl","title":"Trixi.get_examples","text":"get_examples()\n\nReturn a list of all example elixirs that are provided by Trixi.jl. See also examples_dir and default_example.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_name-Tuple{Any}","page":"Trixi.jl","title":"Trixi.get_name","text":"get_name(x)\n\nReturns a name of x ready for pretty printing. By default, return string(y) if x isa Val{y} and return string(x) otherwise.\n\nExamples\n\njulia> Trixi.get_name(\"test\")\n\"test\"\n\njulia> Trixi.get_name(Val(:test))\n\"test\"\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.get_name-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.get_name","text":"get_name(equations::AbstractEquations)\n\nReturns the canonical, human-readable name for the given system of equations.\n\nExamples\n\njulia> Trixi.get_name(CompressibleEulerEquations1D(1.4))\n\"CompressibleEulerEquations1D\"\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.getmesh-Tuple{Trixi.AbstractPlotData}","page":"Trixi.jl","title":"Trixi.getmesh","text":"getmesh(pd::AbstractPlotData)\n\nExtract grid lines from pd for plotting with Plots.plot.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.global_mean_vars-Tuple{AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.global_mean_vars","text":"global_mean_vars(equations::AcousticPerturbationEquations2D)\n\nReturns the global mean variables stored in equations. This makes it easier to define flexible initial conditions for problems with constant mean flow.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.have_nonconservative_terms-Tuple{Trixi.AbstractEquations}","page":"Trixi.jl","title":"Trixi.have_nonconservative_terms","text":"have_nonconservative_terms(equations)\n\nTrait function determining whether equations represent a conservation law with or without nonconservative terms. Classical conservation laws such as the CompressibleEulerEquations2D do not have nonconservative terms. The ShallowWaterEquations2D with non-constant bottom topography are an example of equations with nonconservative terms. The return value will be True() or False() to allow dispatching on the return type.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.hydrostatic_reconstruction_audusse_etal-Tuple{Any, Any, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.hydrostatic_reconstruction_audusse_etal","text":"hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation::Integer,\n equations::ShallowWaterEquations1D)\n\nA particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations1D. The reconstructed solution states u_ll_star and u_rr_star variables are then used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.\n\nFurther details on this hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.hydrostatic_reconstruction_audusse_etal-Tuple{Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.hydrostatic_reconstruction_audusse_etal","text":"hydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation_or_normal_direction,\n equations::ShallowWaterEquations2D)\n\nA particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations2D. The reconstructed solution states u_ll_star and u_rr_star variables are used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction.\n\nFurther details for the hydrostatic reconstruction and its motivation can be found in\n\nEmmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.init_mpi-Tuple{}","page":"Trixi.jl","title":"Trixi.init_mpi","text":"init_mpi()\n\nInitialize MPI by calling MPI.Initialized(). The function will check if MPI is already initialized and if yes, do nothing, thus it is safe to call it multiple times.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.init_p4est-Tuple{}","page":"Trixi.jl","title":"Trixi.init_p4est","text":"init_p4est()\n\nInitialize p4est by calling p4est_init and setting the log level to SC_LP_ERROR. This function will check if p4est is already initialized and if yes, do nothing, thus it is safe to call it multiple times.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.init_t8code-Tuple{}","page":"Trixi.jl","title":"Trixi.init_t8code","text":"init_t8code()\n\nInitialize t8code by calling sc_init, p4est_init, and t8_init while setting the log level to SC_LP_ERROR. This function will check if t8code is already initialized and if yes, do nothing, thus it is safe to call it multiple times.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::AcousticPerturbationEquations2D)\n\nA constant initial condition where the state variables are zero and the mean flow is constant. Uses the global mean values from equations.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::CompressibleEulerEquations1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::CompressibleEulerEquations2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::CompressibleEulerEquations3D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::IdealGlmMhdEquations1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::IdealGlmMhdEquations2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::IdealGlmMhdEquations3D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::InviscidBurgersEquation1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LatticeBoltzmannEquations2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LatticeBoltzmannEquations3D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_constant-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_constant","text":"initial_condition_constant(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA constant initial condition to test free-stream preservation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::AcousticPerturbationEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test. Uses the global mean values from equations.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquations3D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerEquationsQuasi1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerMulticomponentEquations1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::CompressibleEulerMulticomponentEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations1D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations2D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations3D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdMulticomponentEquations1D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::IdealGlmMhdMulticomponentEquations2D)\n\nAn Alfvén wave as smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::InviscidBurgersEquation1D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA smooth initial condition used for convergence tests (in combination with BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, LinearizedEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::LinearizedEulerEquations2D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::PolytropicEulerEquations2D)\n\nManufactured smooth initial condition used for convergence tests in combination with source_terms_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::ShallowWaterEquations2D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::ShallowWaterEquationsQuasi1D)\n\nA smooth initial condition used for convergence tests in combination with source_terms_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_convergence_test-Tuple{Any, Any, TrafficFlowLWREquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_convergence_test","text":"initial_condition_convergence_test(x, t, equations::TrafficFlowLWREquations1D)\n\nA smooth initial condition used for convergence tests.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_density_wave-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_density_wave","text":"initial_condition_density_wave(x, t, equations::CompressibleEulerEquations1D)\n\nA sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper\n\nGregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026\n\nwith the following parameters\n\ndomain [-1, 1]\nmesh = 4x4\npolydeg = 5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_density_wave-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_density_wave","text":"initial_condition_density_wave(x, t, equations::CompressibleEulerEquations2D)\n\nA sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper\n\nGregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026\n\nwith the following parameters\n\ndomain [-1, 1]\nmesh = 4x4\npolydeg = 5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations1D)\n\nOne dimensional variant of the setup used for convergence tests of the Euler equations with self-gravity from\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nnote: Note\nThere is no additional source term necessary for the manufactured solution in one spatial dimension. Thus, source_terms_eoc_test_coupled_euler_gravity is not present there.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_eoc_test_coupled_euler_gravity or source_terms_eoc_test_euler.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations1D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_harmonic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, HyperbolicDiffusionEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_harmonic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_eoc_test_coupled_euler_gravity-Tuple{Any, Any, HyperbolicDiffusionEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_eoc_test_coupled_euler_gravity","text":"initial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with source_terms_harmonic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equations::AcousticPerturbationEquations2D)\n\nA Gaussian pulse in a constant mean flow. Uses the global mean values from equations.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA Gaussian pulse used together with BoundaryConditionDirichlet(initial_condition_gauss).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equation::LinearScalarAdvectionEquation2D)\n\nA Gaussian pulse used together with BoundaryConditionDirichlet(initial_condition_gauss).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_gauss-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_gauss","text":"initial_condition_gauss(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA Gaussian pulse.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_x-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_x","text":"initial_condition_linear_x(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA linear function of x[1] used together with boundary_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_x-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_x","text":"initial_condition_linear_x(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA linear function of x[1] used together with boundary_condition_linear_x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_x_y-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_x_y","text":"initial_condition_linear_x_y(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA linear function of x[1] + x[2] used together with boundary_condition_linear_x_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_y-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_y","text":"initial_condition_linear_y(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA linear function of x[1] used together with boundary_condition_linear_y.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_linear_z-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_linear_z","text":"initial_condition_linear_z(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA linear function of x[3] used together with boundary_condition_linear_z.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_poisson_nonperiodic-Tuple{Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_poisson_nonperiodic","text":"initial_condition_poisson_nonperiodic(x, t, equations::HyperbolicDiffusionEquations1D)\n\nA non-priodic smooth initial condition. Can be used for convergence tests in combination with source_terms_poisson_nonperiodic and boundary_condition_poisson_nonperiodic.\n\nnote: Note\nThe solution is periodic but the initial guess is not.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_sin-Tuple{Any, Any, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.initial_condition_sin","text":"initial_condition_sin(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA sine wave in the conserved variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_sin-Tuple{Any, Any, LinearScalarAdvectionEquation3D}","page":"Trixi.jl","title":"Trixi.initial_condition_sin","text":"initial_condition_sin(x, t, equations::LinearScalarAdvectionEquation1D)\n\nA sine wave in the conserved variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_sin_sin-Tuple{Any, Any, LinearScalarAdvectionEquation2D}","page":"Trixi.jl","title":"Trixi.initial_condition_sin_sin","text":"initial_condition_sin_sin(x, t, equations::LinearScalarAdvectionEquation2D)\n\nA sine wave in the conserved variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations1D)\n\nA weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations2D)\n\nA weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations3D)\n\nA weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations1D)\n\nA for multicomponent adapted weak blast wave adapted to multicomponent and taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations2D)\n\nA for multicomponent adapted weak blast wave taken from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations1D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations3D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations1D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, IdealGlmMhdMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations2D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquations2D)\n\nA weak blast wave adapted from\n\nSebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, ShallowWaterEquations1D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations1D)\n\nA weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.initial_condition_weak_blast_wave-Tuple{Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.initial_condition_weak_blast_wave","text":"initial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations2D)\n\nA weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.integrate_via_indices-Union{Tuple{Func}, Tuple{Func, Any, Trixi.AbstractSemidiscretization, Vararg{Any}}} where Func","page":"Trixi.jl","title":"Trixi.integrate_via_indices","text":"integrate_via_indices(func, u_ode, semi::AbstractSemidiscretization, args...; normalize=true)\n\nCall func(u, i..., element, equations, solver, args...) for all nodal indices i..., element and integrate the result using a quadrature associated with the semidiscretization semi.\n\nIf normalize is true, the result is divided by the total volume of the computational domain.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.inv_ln_mean-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.inv_ln_mean","text":"inv_ln_mean(x, y)\n\nCompute the inverse 1 / ln_mean(x, y) of the logarithmic mean ln_mean.\n\nThis function may be used to increase performance where the inverse of the logarithmic mean is needed, by replacing a (slow) division by a (fast) multiplication.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.jacobian_ad_forward-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.jacobian_ad_forward","text":"jacobian_ad_forward(semi::AbstractSemidiscretization;\n t0=zero(real(semi)),\n u0_ode=compute_coefficients(t0, semi))\n\nUses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.jacobian_fd-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.jacobian_fd","text":"jacobian_fd(semi::AbstractSemidiscretization;\n t0=zero(real(semi)),\n u0_ode=compute_coefficients(t0, semi))\n\nUses the right-hand side operator of the semidiscretization semi and simple second order finite difference to compute the Jacobian J of the semidiscretization semi at state u0_ode.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.linear_structure-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.linear_structure","text":"linear_structure(semi::AbstractSemidiscretization;\n t0=zero(real(semi)))\n\nWraps the right-hand side operator of the semidiscretization semi at time t0 as an affine-linear operator given by a linear operator A and a vector b.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ln_mean-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.ln_mean","text":"ln_mean(x, y)\n\nCompute the logarithmic mean\n\nln_mean(x, y) = (y - x) / (log(y) - log(x)) = (y - x) / log(y / x)\n\nProblem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Ismail and Roe (2009). Set ξ = y / x. Then, we have\n\n(y - x) / log(y / x) = (x + y) / log(ξ) * (ξ - 1) / (ξ + 1)\n\nSet f = (ξ - 1) / (ξ + 1) = (y - x) / (x + y). Then, we use the expansion\n\nlog(ξ) = 2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7) + O(ξ^9)\n\nInserting the first few terms of this expansion yields\n\n(y - x) / log(ξ) ≈ (x + y) * f / (2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7))\n = (x + y) / (2 + 2/3 * f^2 + 2/5 * f^4 + 2/7 * f^6)\n\nSince divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use\n\nf^2 = (y - x)^2 / (x + y)^2\n = (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)\n\nGiven ε = 1.0e-4, we use the following algorithm.\n\nif f^2 < ε\n # use the expansion above\nelse\n # use the direct formula (y - x) / log(y / x)\nend\n\nReferences\n\nIsmail, Roe (2009). Affordable, entropy-consistent Euler flux functions II: Entropy production at shocks. DOI: 10.1016/j.jcp.2009.04.021\nAgner Fog. Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD, and VIA CPUs. https://www.agner.org/optimize/instruction_tables.pdf\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_adaptive_time_integrator!-Tuple{Any, AbstractString}","page":"Trixi.jl","title":"Trixi.load_adaptive_time_integrator!","text":"load_adaptive_time_integrator!(integrator, restart_file::AbstractString)\n\nLoad the context information for time integrators with error-based step size control saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_dt-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_dt","text":"load_dt(restart_file::AbstractString)\n\nLoad the time step size (dt in OrdinaryDiffEq.jl) saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_mesh-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_mesh","text":"load_mesh(restart_file::AbstractString; n_cells_max)\n\nLoad the mesh from the restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_time-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_time","text":"load_time(restart_file::AbstractString)\n\nLoad the time saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_timestep!-Tuple{Any, AbstractString}","page":"Trixi.jl","title":"Trixi.load_timestep!","text":"load_timestep!(integrator, restart_file::AbstractString)\n\nLoad the time step number saved in a restart_file and assign it to both the time step number and and the number of accepted steps (iter and stats.naccept in OrdinaryDiffEq.jl, respectively) in integrator.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.load_timestep-Tuple{AbstractString}","page":"Trixi.jl","title":"Trixi.load_timestep","text":"load_timestep(restart_file::AbstractString)\n\nLoad the time step number (iter in OrdinaryDiffEq.jl) saved in a restart_file.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.max-Tuple","page":"Trixi.jl","title":"Trixi.max","text":"max(x, y, ...)\n\nReturn the maximum of the arguments. See also the maximum function to take the maximum element from a collection.\n\nThis version in Trixi.jl is semantically equivalent to Base.max but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).\n\nExamples\n\njulia> max(2, 5, 1)\n5\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.max_abs_speed_naive","page":"Trixi.jl","title":"Trixi.max_abs_speed_naive","text":"max_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations)\nmax_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nSimple and fast estimate of the maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, based only on the local wave speeds associated to u_ll and u_rr.\n\nFor non-integer arguments normal_direction in one dimension, max_abs_speed_naive returns abs(normal_direction[1]) * max_abs_speed_naive(u_ll, u_rr, 1, equations).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.min-Tuple","page":"Trixi.jl","title":"Trixi.min","text":"min(x, y, ...)\n\nReturn the minimum of the arguments. See also the minimum function to take the minimum element from a collection.\n\nThis version in Trixi.jl is semantically equivalent to Base.min but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaNs (or signed zeros).\n\nExamples\n\njulia> min(2, 5, 1)\n1\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_davis","page":"Trixi.jl","title":"Trixi.min_max_speed_davis","text":"min_max_speed_davis(u_ll, u_rr, orientation::Integer, equations)\nmin_max_speed_davis(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nSimple and fast estimates of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr.\n\nS.F. Davis (1988) Simplified Second-Order Godunov-Type Methods DOI: 10.1137/0909030\n\nSee eq. (10.38) from\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761\n\nSee also FluxHLL, min_max_speed_naive, min_max_speed_einfeldt.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations)\nmin_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nMore advanced mininmal and maximal wave speed computation based on\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\noriginally developed for the compressible Euler equations. A compact representation can be found in this lecture notes, eq. (9.28).\n\nSee also FluxHLL, min_max_speed_naive, min_max_speed_davis.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, AbstractVector, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, AbstractVector, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nOriginal publication:\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\n\nCompactly summarized:\n\nSiddhartha Mishra, Ulrik Skre Fjordholm and Rémi Abgrall Numerical methods for conservation laws and related equations. Link\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)\n\nComputes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.\n\nBernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021\nBernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, IdealGlmMhdEquations1D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations1D)\n\nCalculate minimum and maximum wave speeds for HLL-type fluxes as in\n\nLi (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, IdealGlmMhdEquations2D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations2D)\n\nCalculate minimum and maximum wave speeds for HLL-type fluxes as in\n\nLi (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_einfeldt-Tuple{Any, Any, Integer, IdealGlmMhdEquations3D}","page":"Trixi.jl","title":"Trixi.min_max_speed_einfeldt","text":"min_max_speed_einfeldt(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)\n\nCalculate minimum and maximum wave speeds for HLL-type fluxes as in\n\nLi (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.min_max_speed_naive","page":"Trixi.jl","title":"Trixi.min_max_speed_naive","text":"min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations)\nmin_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)\n\nSimple and fast estimate(!) of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr, usually based only on the local wave speeds associated to u_ll and u_rr. Slightly more diffusive than min_max_speed_davis.\n\nAmiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002\n\nSee eq. (10.37) from\n\nEleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761\n\nSee also FluxHLL, min_max_speed_davis, min_max_speed_einfeldt.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.modify_dt_for_tstops!-Tuple{Trixi.SimpleIntegratorSSP}","page":"Trixi.jl","title":"Trixi.modify_dt_for_tstops!","text":"modify_dt_for_tstops!(integrator::SimpleIntegratorSSP)\n\nModify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.multiply_dimensionwise-Tuple{AbstractMatrix, AbstractMatrix}","page":"Trixi.jl","title":"Trixi.multiply_dimensionwise","text":"multiply_dimensionwise(matrix::AbstractMatrix, data_in::AbstractArray{<:Any, NDIMS+1})\n\nMultiply the array data_in by matrix in each coordinate direction, where data_in is assumed to have the first coordinate for the number of variables and the remaining coordinates are multiplied by matrix.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.n_nonconservative_terms","page":"Trixi.jl","title":"Trixi.n_nonconservative_terms","text":"n_nonconservative_terms(equations)\n\nNumber of nonconservative terms in the form local * symmetric for a particular equation. This function needs to be specialized only if equations with nonconservative terms are combined with certain solvers (e.g., subcell limiting).\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.ndofs-Tuple{Trixi.AbstractSemidiscretization}","page":"Trixi.jl","title":"Trixi.ndofs","text":"ndofs(semi::AbstractSemidiscretization)\n\nReturn the number of degrees of freedom associated with each scalar variable.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.negative_part-Tuple{Any}","page":"Trixi.jl","title":"Trixi.negative_part","text":"negative_part(x)\n\nReturn x if x is negative, else zero. In other words, return (x - abs(x)) / 2 for real numbers x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ode_default_options-Tuple{}","page":"Trixi.jl","title":"Trixi.ode_default_options","text":"ode_default_options()\n\nReturn the default options for OrdinaryDiffEq's solve. Pass ode_default_options()... to solve to only return the solution at the final time and enable MPI aware error-based step size control, whenever MPI is used. For example, use solve(ode, alg; ode_default_options()...).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ode_norm-Tuple{Number, Any}","page":"Trixi.jl","title":"Trixi.ode_norm","text":"ode_norm(u, t)\n\nImplementation of the weighted L2 norm of Hairer and Wanner used for error-based step size control in OrdinaryDiffEq.jl. This function is aware of MPI and uses global MPI communication when running in parallel.\n\nYou must pass this function as a keyword argument internalnorm=ode_norm to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.\n\nSee the \"Advanced Adaptive Stepsize Control\" section of the documentation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.ode_unstable_check-NTuple{4, Any}","page":"Trixi.jl","title":"Trixi.ode_unstable_check","text":"ode_unstable_check(dt, u, semi, t)\n\nImplementation of the basic check for instability used in OrdinaryDiffEq.jl. Instead of checking something like any(isnan, u), this function just checks isnan(dt). This helps when using MPI parallelization, since no additional global communication is required and all ranks will return the same result.\n\nYou should pass this function as a keyword argument unstable_check=ode_unstable_check to OrdinaryDiffEq.jl's solve when using error-based step size control with MPI parallel execution of Trixi.jl.\n\nSee the \"Miscellaneous\" section of the documentation.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.partition!-Tuple{T8codeMesh}","page":"Trixi.jl","title":"Trixi.partition!","text":"Trixi.partition!(mesh::T8codeMesh)\n\nPartition a T8codeMesh in order to redistribute elements evenly among MPI ranks.\n\nArguments\n\nmesh::T8codeMesh: Initialized mesh object.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.partition!-Tuple{TreeMesh{NDIMS, <:Trixi.ParallelTree{NDIMS}} where NDIMS}","page":"Trixi.jl","title":"Trixi.partition!","text":"partition!(mesh::ParallelTreeMesh, allow_coarsening=true)\n\nPartition mesh using a static domain decomposition algorithm based on leaf cell count and tree structure. If allow_coarsening is true, the algorithm will keep leaf cells together on one rank when needed for local coarsening (i.e. when all children of a cell are leaves).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.positive_part-Tuple{Any}","page":"Trixi.jl","title":"Trixi.positive_part","text":"positive_part(x)\n\nReturn x if x is positive, else zero. In other words, return (x + abs(x)) / 2 for real numbers x.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.pressure-Tuple{Real, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.pressure","text":"pressure(rho::Real, equations::LatticeBoltzmannEquations2D)\npressure(u, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic pressure from the density rho or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.pressure-Tuple{Real, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.pressure","text":"pressure(rho::Real, equations::LatticeBoltzmannEquations3D)\npressure(u, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic pressure from the density rho or the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.prim2cons","page":"Trixi.jl","title":"Trixi.prim2cons","text":"prim2cons(u, equations)\n\nConvert the primitive variables u to the conserved variables for a given set of equations. u is a vector type of the correct length nvariables(equations). Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2prim.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.residual_steady_state-Tuple{Any, HyperbolicDiffusionEquations3D}","page":"Trixi.jl","title":"Trixi.residual_steady_state","text":"residual_steady_state(du, ::AbstractHyperbolicDiffusionEquations)\n\nUsed to determine the termination criterion of a SteadyStateCallback. For hyperbolic diffusion, this checks convergence of the potential phi.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.rotate_from_x","page":"Trixi.jl","title":"Trixi.rotate_from_x","text":"rotate_from_x(u, normal, equations)\n\nApply the rotation that maps the x-axis onto normal to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.\n\nSee also: rotate_to_x\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.rotate_to_x","page":"Trixi.jl","title":"Trixi.rotate_to_x","text":"rotate_to_x(u, normal, equations)\n\nApply the rotation that maps normal onto the x-axis to the convservative variables u. This is used by FluxRotated to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.\n\nSee also: rotate_from_x\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.save_plot-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.save_plot","text":"save_plot(plot_data, variable_names;\n show_mesh=true, plot_arguments=Dict{Symbol,Any}(),\n time=nothing, timestep=nothing)\n\nVisualize the plot data object provided in plot_data and save result as a PNG file in the out directory, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.\n\nThe timestep is used in the filename. time is currently unused by this function.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nSee also: VisualizationCallback, show_plot\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.set_log_type-Tuple{Any}","page":"Trixi.jl","title":"Trixi.set_log_type","text":"Trixi.set_log_type(type; force = true)\n\nSet the type of the (natural) log function to be used in Trixi.jl. The default is \"sqrt_Trixi_NaN\" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to \"sqrt_Base\" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.set_sqrt_type-Tuple{Any}","page":"Trixi.jl","title":"Trixi.set_sqrt_type","text":"Trixi.set_sqrt_type(type; force = true)\n\nSet the type of the square root function to be used in Trixi.jl. The default is \"sqrt_Trixi_NaN\" which returns NaN for negative arguments instead of throwing an error. Alternatively, you can set type to \"sqrt_Base\" to use the Julia built-in sqrt function which provides a stack-trace of the error which might come in handy when debugging code.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.show_plot-Tuple{Any, Any}","page":"Trixi.jl","title":"Trixi.show_plot","text":"show_plot(plot_data, variable_names;\n show_mesh=true, plot_arguments=Dict{Symbol,Any}(),\n time=nothing, timestep=nothing)\n\nVisualize the plot data object provided in plot_data and display result, plotting only the variables in variable_names and, optionally, the mesh (if show_mesh is true). Additionally, plot_arguments will be unpacked and passed as keyword arguments to the Plots.plot command.\n\nThis function is the default plot_creator argument for the VisualizationCallback. time and timestep are currently unused by this function.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\nSee also: VisualizationCallback, save_plot\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.solve","page":"Trixi.jl","title":"Trixi.solve","text":"solve(ode, alg; dt, callbacks, kwargs...)\n\nThe following structures and methods provide the infrastructure for SSP Runge-Kutta methods of type SimpleAlgorithmSSP.\n\nwarning: Experimental implementation\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, AcousticPerturbationEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::AcousticPerturbationEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations3D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerEquationsQuasi1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\nThis manufactured solution source term is specifically designed for the mozzle width 'a(x) = 1.5 - 0.5 * cos(x[1] * pi)' as defined in initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerMulticomponentEquations1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::CompressibleEulerMulticomponentEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::InviscidBurgersEquation1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, PolytropicEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::PolytropicEulerEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, ShallowWaterEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::ShallowWaterEquations2D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\nThis manufactured solution source term is specifically designed for the bottom topography function b(x,y) = 2 + 0.5 * sin(sqrt(2)*pi*x) + 0.5 * sin(sqrt(2)*pi*y) as defined in initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, ShallowWaterEquationsQuasi1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::ShallowWaterEquationsQuasi1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test (and BoundaryConditionDirichlet(initial_condition_convergence_test) in non-periodic domains).\n\nThis manufactured solution source term is specifically designed for the bottom topography function b(x) = 0.2 - 0.05 * sin(sqrt(2) * pi *x[1]) and channel width 'a(x)= 1 + 0.1 * cos(sqrt(2) * pi * x[1])' as defined in initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_convergence_test-Tuple{Any, Any, Any, TrafficFlowLWREquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_convergence_test","text":"source_terms_convergence_test(u, x, t, equations::TrafficFlowLWREquations1D)\n\nSource terms used for convergence tests in combination with initial_condition_convergence_test.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_coupled_euler_gravity-Tuple{Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_coupled_euler_gravity","text":"source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_coupled_euler_gravity-Tuple{Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_coupled_euler_gravity","text":"source_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_euler-Tuple{Any, Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_euler","text":"source_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations2D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_eoc_test_euler-Tuple{Any, Any, Any, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_eoc_test_euler","text":"source_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations3D)\n\nSetup used for convergence tests of the Euler equations with self-gravity used in\n\nMichael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593\n\nin combination with initial_condition_eoc_test_coupled_euler_gravity.\n\nnote: Note\nThis method is to be used for testing pure Euler simulations with analytic self-gravity. If you intend to do coupled Euler-gravity simulations, you need to use source_terms_eoc_test_coupled_euler_gravity instead.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_harmonic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_harmonic","text":"source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations1D)\n\nSource term that only includes the forcing from the hyperbolic diffusion system.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_harmonic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations2D}","page":"Trixi.jl","title":"Trixi.source_terms_harmonic","text":"source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations2D)\n\nSource term that only includes the forcing from the hyperbolic diffusion system.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_harmonic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations3D}","page":"Trixi.jl","title":"Trixi.source_terms_harmonic","text":"source_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations3D)\n\nSource term that only includes the forcing from the hyperbolic diffusion system.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.source_terms_poisson_nonperiodic-Tuple{Any, Any, Any, HyperbolicDiffusionEquations1D}","page":"Trixi.jl","title":"Trixi.source_terms_poisson_nonperiodic","text":"source_terms_poisson_nonperiodic(u, x, t,\n equations::HyperbolicDiffusionEquations1D)\n\nSource terms that include the forcing function f(x) and right hand side for the hyperbolic diffusion system that is used with initial_condition_poisson_nonperiodic and boundary_condition_poisson_nonperiodic.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_coirier_vanleer-Tuple{Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.splitting_coirier_vanleer","text":"splitting_coirier_vanleer(u, orientation::Integer,\n equations::CompressibleEulerEquations1D)\nsplitting_coirier_vanleer(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations1D)\n\nSplitting of the compressible Euler flux from Coirier and van Leer. The splitting has correction terms in the pressure splitting as well as the mass and energy flux components. The motivation for these corrections are to handle flows at the low Mach number limit.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nWilliam Coirier and Bram van Leer (1991) Numerical flux formulas for the Euler and Navier-Stokes equations. II - Progress in flux-vector splitting DOI: 10.2514/6.1991-1566\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_drikakis_tsangaris-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_drikakis_tsangaris","text":"splitting_drikakis_tsangaris(u, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\nsplitting_drikakis_tsangaris(u, which::Union{Val{:minus}, Val{:plus}}\n orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nImproved variant of the Steger-Warming flux vector splitting splitting_steger_warming for generalized coordinates. This splitting also reformulates the energy flux as in Hänel et al. to obtain conservation of the total temperature for inviscid flows.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nD. Drikakis and S. Tsangaris (1993) On the solution of the compressible Navier-Stokes equations using improved flux vector splitting methods DOI: 10.1016/0307-904X(93)90054-K\nD. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_lax_friedrichs-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_lax_friedrichs","text":"splitting_lax_friedrichs(u, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\nsplitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}\n orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nNaive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) similar to a flux splitting one would apply, e.g., to Burgers' equation.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_lax_friedrichs-Tuple{Any, Integer, InviscidBurgersEquation1D}","page":"Trixi.jl","title":"Trixi.splitting_lax_friedrichs","text":"splitting_lax_friedrichs(u, orientation::Integer,\n equations::InviscidBurgersEquation1D)\nsplitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::InviscidBurgersEquation1D)\n\nNaive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ = abs(u).\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_lax_friedrichs-Tuple{Any, Integer, LinearScalarAdvectionEquation1D}","page":"Trixi.jl","title":"Trixi.splitting_lax_friedrichs","text":"splitting_lax_friedrichs(u, orientation::Integer,\n equations::LinearScalarAdvectionEquation1D)\nsplitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::LinearScalarAdvectionEquation1D)\n\nNaive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u) and f⁻ = 0.5 (f - λ u) where λ is the absolute value of the advection velocity.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_steger_warming-Tuple{Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.splitting_steger_warming","text":"splitting_steger_warming(u, orientation::Integer,\n equations::CompressibleEulerEquations1D)\nsplitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations1D)\n\nSplitting of the compressible Euler flux of Steger and Warming.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nJoseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_steger_warming-Tuple{Any, Integer, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_steger_warming","text":"splitting_steger_warming(u, orientation::Integer,\n equations::CompressibleEulerEquations2D)\nsplitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations2D)\n\nSplitting of the compressible Euler flux of Steger and Warming. For curvilinear coordinates use the improved Steger-Warming-type splitting splitting_drikakis_tsangaris.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nJoseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_steger_warming-Tuple{Any, Integer, CompressibleEulerEquations3D}","page":"Trixi.jl","title":"Trixi.splitting_steger_warming","text":"splitting_steger_warming(u, orientation::Integer,\n equations::CompressibleEulerEquations3D)\nsplitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations3D)\n\nSplitting of the compressible Euler flux of Steger and Warming.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nJoseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_vanleer_haenel-Tuple{Any, Any, CompressibleEulerEquations2D}","page":"Trixi.jl","title":"Trixi.splitting_vanleer_haenel","text":"splitting_vanleer_haenel(u, orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\nsplitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}\n orientation_or_normal_direction,\n equations::CompressibleEulerEquations2D)\n\nSplitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice. For details on the curvilinear variant of this flux vector splitting see Anderson et al.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nBram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5\nD. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105\nMeng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum\nW. Kyle Anderson, James L. Thomas, and Bram van Leer (1986) Comparison of Finite Volume Flux Vector Splittings for the Euler Equations DOI: 10.2514/3.9465\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.splitting_vanleer_haenel-Tuple{Any, Integer, CompressibleEulerEquations1D}","page":"Trixi.jl","title":"Trixi.splitting_vanleer_haenel","text":"splitting_vanleer_haenel(u, orientation::Integer,\n equations::CompressibleEulerEquations1D)\nsplitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}\n orientation::Integer,\n equations::CompressibleEulerEquations1D)\n\nSplitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice.\n\nReturns a tuple of the fluxes \"minus\" (associated with waves going into the negative axis direction) and \"plus\" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which set to Val{:minus}() or Val{:plus}().\n\nwarning: Experimental implementation (upwind SBP)\nThis is an experimental feature and may change in future releases.\n\nReferences\n\nBram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5\nD. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105\nMeng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.stolarsky_mean-Tuple{Any, Any, Any}","page":"Trixi.jl","title":"Trixi.stolarsky_mean","text":"stolarsky_mean(x, y, gamma)\n\nCompute an instance of a weighted Stolarsky mean of the form\n\nstolarsky_mean(x, y, gamma) = (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))\n\nwhere gamma > 1.\n\nProblem: The formula above has a removable singularity at x == y. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y. Here, we use the approach proposed by Winters et al. (2020). Set f = (y - x) / (y + x) and g = gamma (for compact notation). Then, we use the expansions\n\n((1+f)^g - (1-f)^g) / g = 2*f + (g-1)(g-2)/3 * f^3 + (g-1)(g-2)(g-3)(g-4)/60 * f^5 + O(f^7)\n\nand\n\n((1+f)^(g-1) - (1-f)^(g-1)) / (g-1) = 2*f + (g-2)(g-3)/3 * f^3 + (g-2)(g-3)(g-4)(g-5)/60 * f^5 + O(f^7)\n\nInserting the first few terms of these expansions and performing polynomial long division we find that\n\nstolarsky_mean(x, y, gamma) ≈ (y + x) / 2 * (1 + (g-2)/3 * f^2 - (g+1)(g-2)(g-3)/45 * f^4 + (g+1)(g-2)(g-3)(2g(g-2)-9)/945 * f^6)\n\nSince divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use\n\nf^2 = (y - x)^2 / (x + y)^2\n = (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)\n\nGiven ε = 1.0e-4, we use the following algorithm.\n\nif f^2 < ε\n # use the expansion above\nelse\n # use the direct formula (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))\nend\n\nReferences\n\nAndrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w\nAgner Fog. Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD, and VIA CPUs. https://www.agner.org/optimize/instruction_tables.pdf\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.totalgamma-Tuple{Any, CompressibleEulerMulticomponentEquations1D}","page":"Trixi.jl","title":"Trixi.totalgamma","text":"totalgamma(u, equations::CompressibleEulerMulticomponentEquations1D)\n\nFunction that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.totalgamma-Tuple{Any, CompressibleEulerMulticomponentEquations2D}","page":"Trixi.jl","title":"Trixi.totalgamma","text":"totalgamma(u, equations::CompressibleEulerMulticomponentEquations2D)\n\nFunction that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.uses_amr-Tuple{Any}","page":"Trixi.jl","title":"Trixi.uses_amr","text":"uses_amr(callback)\n\nChecks whether the provided callback or CallbackSet is an AMRCallback or contains one.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.varnames","page":"Trixi.jl","title":"Trixi.varnames","text":"varnames(conversion_function, equations)\n\nReturn the list of variable names when applying conversion_function to the conserved variables associated to equations. This function is mainly used internally to determine output to screen and for IO, e.g., for the AnalysisCallback and the SaveSolutionCallback. Common choices of the conversion_function are cons2cons and cons2prim.\n\n\n\n\n\n","category":"function"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, Integer, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, orientation, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y) from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, Integer, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, orientation, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic velocity for the given orientation (1 -> x, 2 -> y, 3 -> z) from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, LatticeBoltzmannEquations2D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, equations::LatticeBoltzmannEquations2D)\n\nCalculate the macroscopic velocity vector from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.velocity-Tuple{Any, LatticeBoltzmannEquations3D}","page":"Trixi.jl","title":"Trixi.velocity","text":"velocity(u, equations::LatticeBoltzmannEquations3D)\n\nCalculate the macroscopic velocity vector from the particle distribution functions u.\n\n\n\n\n\n","category":"method"},{"location":"reference-trixi/#Trixi.@autoinfiltrate","page":"Trixi.jl","title":"Trixi.@autoinfiltrate","text":"@autoinfiltrate\n@autoinfiltrate condition::Bool\n\nInvoke the @infiltrate macro of the package Infiltrator.jl to create a breakpoint for ad-hoc interactive debugging in the REPL. If the optional argument condition is given, the breakpoint is only enabled if condition evaluates to true.\n\nAs opposed to using Infiltrator.@infiltrate directly, this macro does not require Infiltrator.jl to be added as a dependency to Trixi.jl. As a bonus, the macro will also attempt to load the Infiltrator module if it has not yet been loaded manually.\n\nNote: For this macro to work, the Infiltrator.jl package needs to be installed in your current Julia environment stack.\n\nSee also: Infiltrator.jl\n\nwarning: Internal use only\nPlease note that this macro is intended for internal use only. It is not part of the public API of Trixi.jl, and it thus can altered (or be removed) at any time without it being considered a breaking change.\n\n\n\n\n\n","category":"macro"},{"location":"reference-trixi/#Trixi.@threaded-Tuple{Any}","page":"Trixi.jl","title":"Trixi.@threaded","text":"@threaded for ... end\n\nSemantically the same as Threads.@threads when iterating over a AbstractUnitRange but without guarantee that the underlying implementation uses Threads.@threads or works for more general for loops. In particular, there may be an additional check whether only one thread is used to reduce the overhead of serial execution or the underlying threading capabilities might be provided by other packages such as Polyester.jl.\n\nwarn: Warn\nThis macro does not necessarily work for general for loops. For example, it does not necessarily support general iterables such as eachline(filename).\n\nSome discussion can be found at https://discourse.julialang.org/t/overhead-of-threads-threads/53964 and https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435.\n\n\n\n\n\n","category":"macro"},{"location":"styleguide/#Style-guide","page":"Style guide","title":"Style guide","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"Coding style is an inherently personal - and thus hotly contested - issue. Since code is usually \"written once, read often\", it helps regular developers, new users, and reviewers if code is formatted consistently. We therefore believe in the merit of using a common coding style throughout Trixi.jl, even at the expense that not everyone can be happy with every detailed style decision. If you came here because you are furious about our code formatting rules, here is a happy little whale for you to calm you down: 🐳","category":"page"},{"location":"styleguide/#Conventions","page":"Style guide","title":"Conventions","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"The following lists a few coding conventions for Trixi.jl. Note that in addition to these conventions, we apply and enforce automated source code formatting (see below for more details):","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"Modules, types, structs with CamelCase.\nFunctions, variables with lowercase snake_case.\nIndentation with 4 spaces (never tabs!)\nMaximum line length (strictly): 92.\nFunctions that mutate their input are named with a trailing !.\nFunctions order their parameters similar to Julia Base.\nThe main modified argument comes first. For example, if the right-hand side du is modified, it should come first. If only the cache is modified, e.g., in prolong2interfaces! and its siblings, put the cache first.\nOtherwise, use the order mesh, equations, solver, cache.\nIf something needs to be specified in more detail for dispatch, put the additional argument before the general one that is specified in more detail. For example, we use have_nonconservative_terms(equations), equations and dg.mortar, dg.\nPrefer for i in ... to for i = ... for better semantic clarity and greater flexibility.\nExecutable code should only use ASCII characters.\nDocstrings and comments can and should use Unicode characters where it helps understanding.\nMultiline expressions should be explicitly grouped by parentheses and not rely on Julia's implicit line continuation syntax.\nWhen naming multiple functions of a single or similar category, prefer to put the general classification first and the specialization second. Example: Use flux_central instead of central_flux. This helps when searching for available functions on the REPL (e.g., when trying to find all flux functions).","category":"page"},{"location":"styleguide/#automated-source-code-formatting","page":"Style guide","title":"Automated source code formatting","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"We use JuliaFormatter.jl to format the source code of Trixi.jl, which will also enforce some of the Conventions listed above (e.g., line length or indentation with 4 spaces are automatically handled, while capitalization of names is not). Our format is mostly based on the SciML-style formatting rules. For more details you can have a look at the current .JuliaFormatter.toml file that holds the configuration options we use for JuliaFormatter.jl.","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"Note that we expect all contributions to Trixi.jl to be formatted with JuliaFormatter.jl before being merged to the main branch. We ensure this by running a automated check on all PRs that verify that running JuliaFormatter.jl again will not change the source code.","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"To format your contributions before created a PR (or, at least, before requesting a review of your PR), you need to install JuliaFormatter.jl first by running","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"julia -e 'using Pkg; Pkg.add(\"JuliaFormatter\")'","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"You can then recursively format the core Julia files in the Trixi.jl repo by executing","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"julia -e 'using JuliaFormatter; format([\"benchmark\", \"examples\", \"ext\", \"src\", \"test\", \"utils\"])'","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"from inside the Trixi.jl repository. For convenience, there is also a script you can directly run from your terminal shell, which will automatically install JuliaFormatter in a temporary environment and then run it:","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"utils/trixi-format.jl","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"You can get more information about using the convenience script by running it with the --help/-h flag.","category":"page"},{"location":"styleguide/#Checking-formatting-before-committing","page":"Style guide","title":"Checking formatting before committing","text":"","category":"section"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"It can be convenient to check the formatting of source code automatically before each commit. We use git-hooks for it and provide a pre-commit script in the utils folder. The script uses JuliaFormatter.jl just like formatting script that runs over the whole Trixi.jl directory. You can copy the pre-commit-script into .git/hooks/pre-commit and it will check your formatting before each commit. If errors are found the commit is aborted and you can add the corrections via","category":"page"},{"location":"styleguide/","page":"Style guide","title":"Style guide","text":"git add -p","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"EditURL = \"../../literate/src/files/scalar_linear_advection_1d.jl\"","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#scalar_linear_advection_1d","page":"3 Introduction to DG methods","title":"3: Introduction to DG methods","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"(Image: ) (Image: ) (Image: )","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"This tutorial is about how to set up a simple way to approximate the solution of a hyperbolic partial differential equation. First, we will implement a basic and naive algorithm. Then, we will use predefined features from Trixi.jl to show how you can use Trixi.jl on your own.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We will implement the scalar linear advection equation in 1D with the advection velocity 1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u_t + u_x = 0 textfor tin mathbbR^+ xinOmega=-11","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We define the domain Omega by setting the boundaries.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"coordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We assume periodic boundaries and the following initial condition.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"initial_condition_sine_wave(x) = 1.0 + 0.5 * sin(pi * x)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#The-discontinuous-Galerkin-collocation-spectral-element-method-(DGSEM)","page":"3 Introduction to DG methods","title":"The discontinuous Galerkin collocation spectral element method (DGSEM)","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/#i.-Discretization-of-the-physical-domain","page":"3 Introduction to DG methods","title":"i. Discretization of the physical domain","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To improve precision we want to approximate the solution on small parts of the physical domain. So, we split the domain Omega=-1 1 into elements Q_l of length dx.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"n_elements = 16 # number of elements\n\ndx = (coordinates_max - coordinates_min) / n_elements # length of one element","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To make the calculation more efficient and storing less information, we transform each element Q_l with center point x_l to a reference element E=-1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Q_l=Bigx_l-fracdx2 x_l+fracdx2Big undersetx(xi)oversetxi(x)rightleftarrows -1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"So, for every element the transformation from the reference domain to the physical domain is defined by","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"x(xi) = x_l + fracdx2 xi xiin-1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Therefore,","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nu = u(x(xi) t) \nu_x = u_xi fracdxidx 3pt\nfracdxidx = (x_xi)^-1 = frac2dx = J^-1 \nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Here, J is the Jacobian determinant of the transformation.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Using this transformation, we can transform our equation for each element Q_l.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 u_t^Q_l + u_xi^Q_l = 0 text for tinmathbbR^+ xiin-1 1","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Here, u_t^Q_l and u_xi^Q_l denote the time and spatial derivatives of the solution on the element Q_l.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#ii.-Polynomial-approach","page":"3 Introduction to DG methods","title":"ii. Polynomial approach","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"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 xiin-1 1 in every physical element Q_l. This saves a lot of resources by reducing the amount of calculations needed and storing less information.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"For DGSEM we choose Lagrange basis functions l_j_j=0^N as our polynomial basis of degree N in -1 1. The solution in element Q_l can be approximated by","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"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)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with N+1 coefficients u_j^Q_l_j=0^N. 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.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"l_j(xi_i) = delta_ij =\nbegincases\n1 textif i=j \n0 textelse\nendcases","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Because of this property, the polynomial coefficients are exact the values of u^Q_l at the nodes","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u^Q_l(xi_i t) = sum_j=0^N u_j^Q_l(t) underbracel_j(xi_i)_=delta_ij = u_i^Q_l(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Next, we want to select the nodes xi_i_i=0^N, which we use for the construction of the Lagrange polynomials. We choose the N+1 Gauss-Lobatto nodes, which are used for the Gaussian-Lobatto quadrature. These always contain the boundary points at -1 and +1 and are well suited as interpolation nodes. The corresponding weights will be referred to as w_j_j=0^N. In Trixi.jl the basis with Lagrange polynomials on Gauss-Lobatto nodes is already defined.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Trixi\npolydeg = 3 #= polynomial degree = N =#\nbasis = LobattoLegendreBasis(polydeg)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The Gauss-Lobatto nodes are","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"nodes = basis.nodes","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with the corresponding weights","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"weights = basis.weights","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To illustrate how you can integrate using numerical quadrature with this Legendre-Gauss-Lobatto nodes, we give an example for f(x)=x^3. Since f is of degree 3, a polynomial interpolation with N=3 is exact. Therefore, the integral on -1 1 can be calculated by","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nint_-1^1 f(x) dx = int_-1^1 Big( sum_j=0^3 f(xi_j)l_j(x) Big) dx\n= sum_j=0^3 f(xi_j) int_-1^1 l_j(x)dx \n= sum_j=0^3 f(xi_j) w_j\n= sum_j=0^3 xi_j^3 w_j\nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Let's use our nodes and weights for N=3 and plug in","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"integral = sum(nodes.^3 .* weights)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Using this polynomial approach leads to the equation","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 dotu^Q_l(xi t) + u^Q_l(xi t) = 0","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with dotu=fracpartialpartial tu and u=fracpartialpartial xu. To approximate the solution, we need to get the polynomial coefficients u_j^Q_l_j=0^N for every element Q_l.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"After defining all nodes, we can implement the spatial coordinate x and its initial value u0 for every node.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"x = Matrix{Float64}(undef, length(nodes), n_elements)\nfor element in 1:n_elements\n x_l = coordinates_min + (element - 1) * dx + dx/2\n for i in 1:length(nodes)\n ξ = nodes[i] # nodes in [-1, 1]\n x[i, element] = x_l + dx/2 * ξ\n end\nend\n\nu0 = initial_condition_sine_wave.(x)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To have a look at the initial sinus curve, we plot it.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Plots\nplot(vec(x), vec(u0), label=\"initial condition\", legend=:topleft)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#iii.-Variational-formulation","page":"3 Introduction to DG methods","title":"iii. Variational formulation","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"After defining the equation and initial condition, we want to implement an algorithm to approximate the solution.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"From now on, we only write u instead of u^Q_l for simplicity, but consider that all the following calculation only concern one element. Multiplying the new equation with the smooth Lagrange polynomials l_i_i=0^N (test functions) and integrating over the reference element E=-11, we get the variational formulation of our transformed partial differential equation for i=0N:","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nint_-1^1 Big( fracdx2 dotu(xi t) + u(xi t) Big) l_i(xi)dxi\n = underbracefracdx2 int_-1^1 dotu(xi t) l_i(xi)dxi_textTerm I + underbraceint_-1^1 u(xi t) l_i(xi)dxi_textTerm II = 0\nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We deal with the two terms separately. We write int_-1 N^1 cdot dxi for the approximation of the integral using numerical quadrature with N+1 basis points. We use the Gauss-Lobatto nodes again. The numerical scalar product langlecdot cdotrangle_N is defined by langle f grangle_N = int_-1 N^1 f(xi) g(xi) dxi.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Term-I:","page":"3 Introduction to DG methods","title":"Term I:","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"In the following calculation we approximate the integral numerically with quadrature on the Gauss-Lobatto nodes xi_i_i=0^N and then use the Kronecker property of the Lagrange polynomials. This approach of using the same nodes for the interpolation and quadrature is called collocation.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"beginalign*\nfracdx2 int_-1^1 dotu(xi t) l_i(xi)dxi\napprox fracdx2 int_-1 N^1 dotu(xi t) l_i(xi)dxi \n= fracdx2 sum_k=0^N underbracedotu(xi_k t)_=dotu_k(t) underbracel_i(xi_k)_=delta_kiw_k \n= fracdx2 dotu_i(t) w_i\nendalign*","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We define the Legendre-Gauss-Lobatto (LGL) mass matrix M and by the Kronecker property follows:","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"M_ij = langle l_j l_irangle_N = delta_ij w_j ij=0N","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using LinearAlgebra\nM = diagm(weights)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Now, we can write the integral with this new matrix.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 int_-1 N^1 dotu(xi t) underlinel(xi)dxi = fracdx2 M underlinedotu(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"where underlinedotu = (dotu_0 dotu_N)^T and underlinel respectively.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Note: Since the LGL quadrature with N+1 nodes is exact up to functions of degree 2N-1 and dotu(xi t) l_i(xi) is of degree 2N, in general the following holds","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"int_-1^1 dotu(xi t) l_i(xi) dxi neq int_-1 N^1 dotu(xi t) l_i(xi) dxi","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"With an exact integration the mass matrix would be dense. Choosing numerical integrating and quadrature with the exact same nodes (collocation) leads to the sparse and diagonal mass matrix M. This is called mass lumping and has the big advantage of an easy invertation of the matrix.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Term-II:","page":"3 Introduction to DG methods","title":"Term II:","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We use spatial partial integration for the second term:","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"int_-1^1 u(xi t) l_i(xi) dxi = u l_i_-1^1 - int_-1^1 u l_idxi","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The resulting integral can be solved exactly with LGL quadrature since the polynomial is now of degree 2N-1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Again, we split the calculation in two steps.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Surface-term","page":"3 Introduction to DG methods","title":"Surface term","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"As mentioned before, we approximate the solution with a polynomial in every element. Therefore, in general the value of this approximation at the interfaces between two elements is not unique. To solve this problem we introduce the idea of the numerical flux u^*, which will give an exact value at the interfaces. One of many different approaches and definitions for the calculation of the numerical flux we will deal with in 4. Numerical flux.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u l_i_-1^1 = u^*big^1 l_i(+1) - u^*big_-1 l_i(-1)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Since the Gauss-Lobatto nodes contain the element boundaries -1 and +1, we can use the Kronecker property of l_i for the calculation of l_i(-1) and l_i(+1).","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u underlinel_-1^1 = u^*big^1 left(beginarrayc 0 vdots 0 1 endarrayright)\n- u^*big_-1 left(beginarrayc 1 0 vdots 0endarrayright)\n= B underlineu^*(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"with the boundary matrix","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"B = beginpmatrix\n-1 0 cdots 0\n0 0 cdots 0\nvdots vdots 0 0\n0 cdots 0 1\nendpmatrix\nqquadtextandqquad\nunderlineu^*(t) = left(beginarrayc u^*big_-1 0 vdots 0 u^*big^1endarrayright)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"B = diagm([-1; zeros(polydeg - 1); 1])","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Volume-term","page":"3 Introduction to DG methods","title":"Volume term","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"As mentioned before, the new integral can be solved exact since the function inside is of degree 2N-1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"- int_-1^1 u l_idxi = - int_-1 N^1 u l_i dxi\n= - sum_k=0^N u(xi_k t) l_i(xi_k) w_k\n= - sum_k=0^N u_k(t) D_ki w_k","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"where D is the derivative matrix defined by D_ki = l_i(xi_k) for ik=0N.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"D = basis.derivative_matrix","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To show why this matrix is called the derivative matrix, we go back to our example f(x)=x^3. We calculate the derivation of f at the Gauss-Lobatto nodes xi_k_k=0^N with N=8.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"f_x=xi_k = Big( sum_j=0^8 f(xi_j) l_j(x) Big)_x=xi_k = sum_j=0^8 f(xi_j) l_j(xi_k)\n= sum_j=0^8 f(xi_j) D_kj","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"for k=0N and therefore, underlinef = D underlinef.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"basis_N8 = LobattoLegendreBasis(8)\nplot(vec(x), x -> 3 * x^2, label=\"f'\", lw=2)\nscatter!(basis_N8.nodes, basis_N8.derivative_matrix * basis_N8.nodes.^3, label=\"Df\", lw=3)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Combining the volume term for every i=0N results in","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"int_-1^1 u underlinel dxi = - D^T M underlineu(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Putting all parts together we get the following equation for the element Q_l","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"fracdx2 M underlinedotu(t) = - B underlineu^*(t) + D^T M underlineu(t)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"or equivalent","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"underlinedotu^Q_l(t) = frac2dx Big - M^-1 B underlineu^Q_l^*(t) + M^-1 D^T M underlineu^Q_l(t)Big","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"This is called the weak form of the DGSEM.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Note: For every element Q_l we get a system of N+1 ordinary differential equations to calculate N+1 coefficients. Since the numerical flux u^* is depending on extern values at the interfaces, the equation systems of adjacent elements are weakly linked.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#numerical_flux","page":"3 Introduction to DG methods","title":"iv. Numerical flux","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"As mentioned above, we still have to handle the problem of different values at the same point at the interfaces. This happens with the ideas of the numerical flux f^*(u)=u^*. The role of f^* might seem minor in this simple example, but is important for more complicated problems. There are two values at the same spatial coordinate. Let's say we are looking at the interface between the elements Q_l and Q_l+1, while both elements got N+1 nodes as defined before. We call the first value of the right element u_R=u_0^Q_l+1 and the last one of the left element u_L=u_N^Q_l. So, for the value of the numerical flux on that interface the following holds","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u^* = u^*(u_L u_R)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"These values are interpreted as start values of a so-called Riemann problem. There are many different (approximate) Riemann solvers available and useful for different problems. We will use the local Lax-Friedrichs flux.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"surface_flux = flux_lax_friedrichs","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The only missing ingredient is the flux calculation at the boundaries -1 and +1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"u^Q_first^*big_-1 = u^Q_first^*big_-1(u^bound(-1) u_R)\nquadtextandquad\nu^Q_last^*big^1 = u^Q_last^*big^1(u_L u^bound(1))","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"The boundaries are periodic, which means that the last value of the last element u^Q_last_N is used as u_L at the first interface and accordingly for the other boundary.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Now, we implement a function, that calculates underlinedotu^Q_l for the given matrices, underlineu and underlineu^*.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"function rhs!(du, u, x, t)\n # Reset du and flux matrix\n du .= zero(eltype(du))\n flux_numerical = copy(du)\n\n # Calculate interface and boundary fluxes, $u^* = (u^*|_{-1}, 0, ..., 0, u^*|^1)^T$\n # Since we use the flux Lax-Friedrichs from Trixi.jl, we have to pass some extra arguments.\n # Trixi.jl needs the equation we are dealing with and an additional `1`, that indicates the\n # first coordinate direction.\n equations = LinearScalarAdvectionEquation1D(1.0)\n for element in 2:n_elements-1\n # left interface\n flux_numerical[1, element] = surface_flux(u[end, element-1], u[1, element], 1, equations)\n flux_numerical[end, element-1] = flux_numerical[1, element]\n # right interface\n flux_numerical[end, element] = surface_flux(u[end, element], u[1, element+1], 1, equations)\n flux_numerical[1, element+1] = flux_numerical[end, element]\n end\n # boundary flux\n flux_numerical[1, 1] = surface_flux(u[end, end], u[1, 1], 1, equations)\n flux_numerical[end, end] = flux_numerical[1, 1]\n\n # Calculate surface integrals, $- M^{-1} * B * u^*$\n for element in 1:n_elements\n du[:, element] -= (M \\ B) * flux_numerical[:, element]\n end\n\n # Calculate volume integral, $+ M^{-1} * D^T * M * u$\n for element in 1:n_elements\n flux = u[:, element]\n du[:, element] += (M \\ transpose(D)) * M * flux\n end\n\n # Apply Jacobian from mapping to reference element\n for element in 1:n_elements\n du[:, element] *= 2 / dx\n end\n\n return nothing\nend","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Combining all definitions and the function that calculates the right-hand side, we define the ODE and solve it until t=2 with OrdinaryDiffEq's solve function and the Runge-Kutta method RDPK3SpFSAL49(), which is optimized for discontinuous Galerkin methods and hyperbolic PDEs. We set some common error tolerances abstol=1.0e-6, reltol=1.0e-6 and pass save_everystep=false to avoid saving intermediate solution vectors in memory.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using OrdinaryDiffEq\ntspan = (0.0, 2.0)\node = ODEProblem(rhs!, u0, tspan, x)\n\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...)\n\nplot(vec(x), vec(sol.u[end]), label=\"solution at t=$(tspan[2])\", legend=:topleft, lw=3)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Alternative-Implementation-based-on-Trixi.jl","page":"3 Introduction to DG methods","title":"Alternative Implementation based on Trixi.jl","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Now, we implement the same example. But this time, we directly use the functionality that Trixi.jl provides.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Trixi, OrdinaryDiffEq, Plots","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"First, define the equation with a advection_velocity of 1.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"advection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Then, create a DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux. The implementation of the basis and the numerical flux is now already done.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We will now create a mesh with 16 elements for the physical domain [-1, 1] with periodic boundaries. We use Trixi.jl's standard mesh TreeMesh. Since it's limited to hypercube domains, we choose 2^4=16 elements. The mesh type supports AMR, that' why n_cells_max has to be set, even if we don't need AMR here.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"coordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4, # number of elements = 2^4\n n_cells_max=30_000) # set maximum capacity of tree data structure (only needed for AMR)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"A semidiscretization collects data structures and functions for the spatial discretization. In Trixi.jl, an initial condition has the following parameter structure and is of the type SVector.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"initial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t)))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"Again, combining all definitions and the function that calculates the right-hand side, we define the ODE and solve it until t=2 with OrdinaryDiffEq's solve function and the Runge-Kutta method RDPK3SpFSAL49().","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"tspan = (0.0, 2.0)\node_trixi = semidiscretize(semi, tspan)\n\nsol_trixi = solve(ode_trixi, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...);\nnothing #hide","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"We add a plot of the new approximated solution to the one calculated before.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"plot!(sol_trixi, label=\"solution at t=$(tspan[2]) with Trixi.jl\", legend=:topleft, linestyle=:dash, lw=2)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Summary-of-the-code","page":"3 Introduction to DG methods","title":"Summary of the code","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"To sum up, here is the complete code that we used.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Raw-implementation","page":"3 Introduction to DG methods","title":"Raw implementation","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"# basis: Legendre-Gauss-Lobatto\nusing Trixi, LinearAlgebra, OrdinaryDiffEq, Plots\npolydeg = 3 #= polynomial degree =#\nbasis = LobattoLegendreBasis(polydeg)\nnodes = basis.nodes # Gauss-Lobatto nodes in [-1, 1]\nD = basis.derivative_matrix\nM = diagm(basis.weights) # mass matrix\nB = diagm([-1; zeros(polydeg - 1); 1])\n\n# mesh\ncoordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nn_elements = 16 # number of elements\n\ndx = (coordinates_max - coordinates_min) / n_elements # length of one element\n\nx = Matrix{Float64}(undef, length(nodes), n_elements)\nfor element in 1:n_elements\n x_l = -1 + (element - 1) * dx + dx/2\n for i in 1:length(nodes) # basis points in [-1, 1]\n ξ = nodes[i]\n x[i, element] = x_l + dx/2 * ξ\n end\nend\n\n# initial condition\ninitial_condition_sine_wave(x) = 1.0 + 0.5 * sin(pi * x)\nu0 = initial_condition_sine_wave.(x)\n\nplot(vec(x), vec(u0), label=\"initial condition\", legend=:topleft)\n\n# flux Lax-Friedrichs\nsurface_flux = flux_lax_friedrichs\n\n# rhs! method\nfunction rhs!(du, u, x, t)\n # reset du\n du .= zero(eltype(du))\n flux_numerical = copy(du)\n\n # calculate interface and boundary fluxes\n equations = LinearScalarAdvectionEquation1D(1.0)\n for element in 2:n_elements-1\n # left interface\n flux_numerical[1, element] = surface_flux(u[end, element-1], u[1, element], 1, equations)\n flux_numerical[end, element-1] = flux_numerical[1, element]\n # right interface\n flux_numerical[end, element] = surface_flux(u[end, element], u[1, element+1], 1, equations)\n flux_numerical[1, element+1] = flux_numerical[end, element]\n end\n # boundary flux\n flux_numerical[1, 1] = surface_flux(u[end, end], u[1, 1], 1, equations)\n flux_numerical[end, end] = flux_numerical[1, 1]\n\n # calculate surface integrals\n for element in 1:n_elements\n du[:, element] -= (M \\ B) * flux_numerical[:, element]\n end\n\n # calculate volume integral\n for element in 1:n_elements\n flux = u[:, element]\n du[:, element] += (M \\ transpose(D)) * M * flux\n end\n\n # apply Jacobian from mapping to reference element\n for element in 1:n_elements\n du[:, element] *= 2 / dx\n end\n\n return nothing\nend\n\n# create ODE problem\ntspan = (0.0, 2.0)\node = ODEProblem(rhs!, u0, tspan, x)\n\n# solve\nsol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...)\n\nplot(vec(x), vec(sol.u[end]), label=\"solution at t=$(tspan[2])\", legend=:topleft, lw=3)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Alternative-Implementation-based-on-Trixi.jl-2","page":"3 Introduction to DG methods","title":"Alternative Implementation based on Trixi.jl","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using Trixi, OrdinaryDiffEq, Plots\n\n# equation with a advection_velocity of `1`.\nadvection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)\n\n# create DG solver with flux lax friedrichs and LGL basis\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\n# distretize domain with `TreeMesh`\ncoordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4, # number of elements = 2^4\n n_cells_max=30_000)\n\n# create initial condition and semidiscretization\ninitial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t)))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver)\n\n# solve\ntspan = (0.0, 2.0)\node_trixi = semidiscretize(semi, tspan)\nsol_trixi = solve(ode_trixi, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6, ode_default_options()...);\n\nplot!(sol_trixi, label=\"solution at t=$(tspan[2]) with Trixi.jl\", legend=:topleft, linestyle=:dash, lw=2)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/#Package-versions","page":"3 Introduction to DG methods","title":"Package versions","text":"","category":"section"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"These results were obtained using the following versions.","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"using InteractiveUtils\nversioninfo()\n\nusing Pkg\nPkg.status([\"Trixi\", \"OrdinaryDiffEq\", \"Plots\"],\n mode=PKGMODE_MANIFEST)","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"","category":"page"},{"location":"tutorials/scalar_linear_advection_1d/","page":"3 Introduction to DG methods","title":"3 Introduction to DG methods","text":"This page was generated using Literate.jl.","category":"page"},{"location":"reference-trixi2vtk/#Trixi2Vtk.jl-API","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.jl API","text":"","category":"section"},{"location":"reference-trixi2vtk/","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.jl","text":"CurrentModule = Trixi2Vtk","category":"page"},{"location":"reference-trixi2vtk/","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.jl","text":"Modules = [Trixi2Vtk]","category":"page"},{"location":"reference-trixi2vtk/#Trixi2Vtk.trixi2vtk-Tuple{Vararg{AbstractString}}","page":"Trixi2Vtk.jl","title":"Trixi2Vtk.trixi2vtk","text":"trixi2vtk(filename::AbstractString...;\n format=:vtu, verbose=false, hide_progress=false, pvd=nothing,\n output_directory=\".\", nvisnodes=nothing, save_celldata=true,\n reinterpolate=true, data_is_uniform=false)\n\nConvert Trixi-generated output files to VTK files (VTU or VTI).\n\nArguments\n\nfilename: One or more Trixi solution/restart/mesh files to convert to a VTK file. Filenames support file globbing, e.g., \"solution*\" to match all files starting with solution.\nformat: Output format for solution/restart files. Can be 'vtu' or 'vti'.\nverbose: Set to true to enable verbose output.\nhide_progress: Hide progress bar (will be hidden automatically if verbose is true).\npvd: Use this filename to store PVD file (instead of auto-detecting name). Note that only the name will be used (directory and file extension are ignored).\noutput_directory: Output directory where generated files are stored.\nnvisnodes: Number of visualization nodes per element. (default: number of DG nodes for StructuredMesh or UnstructuredMesh2D, twice the number of DG nodes for TreeMesh). A value of 0 (zero) uses the number of nodes in the DG elements.\nsave_celldata: Boolean value to determine if cell-based data should be saved. (default: true)\nreinterpolate: Boolean value to determine if data should be reinterpolated onto uniform points. When false the raw data at the compute nodes is copied into the appropriate format. (default: true)\ndata_is_uniform: Boolean to indicate if the data to be converted is from a finite difference method on a uniform grid of points. (default: false)\n\nExamples\n\njulia> trixi2vtk(\"out/solution_000*.h5\")\n[...]\n\n\n\n\n\n","category":"method"}] } diff --git a/previews/PR1624/styleguide/index.html b/previews/PR1624/styleguide/index.html index 1eb9b3a3b42..76b424459b4 100644 --- a/previews/PR1624/styleguide/index.html +++ b/previews/PR1624/styleguide/index.html @@ -1,2 +1,2 @@ -Style guide · Trixi.jl

    Style guide

    Coding style is an inherently personal - and thus hotly contested - issue. Since code is usually "written once, read often", it helps regular developers, new users, and reviewers if code is formatted consistently. We therefore believe in the merit of using a common coding style throughout Trixi.jl, even at the expense that not everyone can be happy with every detailed style decision. If you came here because you are furious about our code formatting rules, here is a happy little whale for you to calm you down: 🐳

    Conventions

    The following lists a few coding conventions for Trixi.jl. Note that in addition to these conventions, we apply and enforce automated source code formatting (see below for more details):

    • Modules, types, structs with CamelCase.
    • Functions, variables with lowercase snake_case.
    • Indentation with 4 spaces (never tabs!)
    • Maximum line length (strictly): 92.
    • Functions that mutate their input are named with a trailing !.
    • Functions order their parameters similar to Julia Base.
      • The main modified argument comes first. For example, if the right-hand side du is modified, it should come first. If only the cache is modified, e.g., in prolong2interfaces! and its siblings, put the cache first.
      • Otherwise, use the order mesh, equations, solver, cache.
      • If something needs to be specified in more detail for dispatch, put the additional argument before the general one that is specified in more detail. For example, we use have_nonconservative_terms(equations), equations and dg.mortar, dg.
    • Prefer for i in ... to for i = ... for better semantic clarity and greater flexibility.
    • Executable code should only use ASCII characters.
    • Docstrings and comments can and should use Unicode characters where it helps understanding.
    • Multiline expressions should be explicitly grouped by parentheses and not rely on Julia's implicit line continuation syntax.
    • When naming multiple functions of a single or similar category, prefer to put the general classification first and the specialization second. Example: Use flux_central instead of central_flux. This helps when searching for available functions on the REPL (e.g., when trying to find all flux functions).

    Automated source code formatting

    We use JuliaFormatter.jl to format the source code of Trixi.jl, which will also enforce some of the Conventions listed above (e.g., line length or indentation with 4 spaces are automatically handled, while capitalization of names is not). Our format is mostly based on the SciML-style formatting rules. For more details you can have a look at the current .JuliaFormatter.toml file that holds the configuration options we use for JuliaFormatter.jl.

    Note that we expect all contributions to Trixi.jl to be formatted with JuliaFormatter.jl before being merged to the main branch. We ensure this by running a automated check on all PRs that verify that running JuliaFormatter.jl again will not change the source code.

    To format your contributions before created a PR (or, at least, before requesting a review of your PR), you need to install JuliaFormatter.jl first by running

    julia -e 'using Pkg; Pkg.add("JuliaFormatter")'

    You can then recursively format the core Julia files in the Trixi.jl repo by executing

    julia -e 'using JuliaFormatter; format(["benchmark", "examples", "ext", "src", "test", "utils"])'

    from inside the Trixi.jl repository. For convenience, there is also a script you can directly run from your terminal shell, which will automatically install JuliaFormatter in a temporary environment and then run it:

    utils/trixi-format.jl

    You can get more information about using the convenience script by running it with the --help/-h flag.

    Checking formatting before committing

    It can be convenient to check the formatting of source code automatically before each commit. We use git-hooks for it and provide a pre-commit script in the utils folder. The script uses JuliaFormatter.jl just like formatting script that runs over the whole Trixi.jl directory. You can copy the pre-commit-script into .git/hooks/pre-commit and it will check your formatting before each commit. If errors are found the commit is aborted and you can add the corrections via

    git add -p
    +Style guide · Trixi.jl

    Style guide

    Coding style is an inherently personal - and thus hotly contested - issue. Since code is usually "written once, read often", it helps regular developers, new users, and reviewers if code is formatted consistently. We therefore believe in the merit of using a common coding style throughout Trixi.jl, even at the expense that not everyone can be happy with every detailed style decision. If you came here because you are furious about our code formatting rules, here is a happy little whale for you to calm you down: 🐳

    Conventions

    The following lists a few coding conventions for Trixi.jl. Note that in addition to these conventions, we apply and enforce automated source code formatting (see below for more details):

    • Modules, types, structs with CamelCase.
    • Functions, variables with lowercase snake_case.
    • Indentation with 4 spaces (never tabs!)
    • Maximum line length (strictly): 92.
    • Functions that mutate their input are named with a trailing !.
    • Functions order their parameters similar to Julia Base.
      • The main modified argument comes first. For example, if the right-hand side du is modified, it should come first. If only the cache is modified, e.g., in prolong2interfaces! and its siblings, put the cache first.
      • Otherwise, use the order mesh, equations, solver, cache.
      • If something needs to be specified in more detail for dispatch, put the additional argument before the general one that is specified in more detail. For example, we use have_nonconservative_terms(equations), equations and dg.mortar, dg.
    • Prefer for i in ... to for i = ... for better semantic clarity and greater flexibility.
    • Executable code should only use ASCII characters.
    • Docstrings and comments can and should use Unicode characters where it helps understanding.
    • Multiline expressions should be explicitly grouped by parentheses and not rely on Julia's implicit line continuation syntax.
    • When naming multiple functions of a single or similar category, prefer to put the general classification first and the specialization second. Example: Use flux_central instead of central_flux. This helps when searching for available functions on the REPL (e.g., when trying to find all flux functions).

    Automated source code formatting

    We use JuliaFormatter.jl to format the source code of Trixi.jl, which will also enforce some of the Conventions listed above (e.g., line length or indentation with 4 spaces are automatically handled, while capitalization of names is not). Our format is mostly based on the SciML-style formatting rules. For more details you can have a look at the current .JuliaFormatter.toml file that holds the configuration options we use for JuliaFormatter.jl.

    Note that we expect all contributions to Trixi.jl to be formatted with JuliaFormatter.jl before being merged to the main branch. We ensure this by running a automated check on all PRs that verify that running JuliaFormatter.jl again will not change the source code.

    To format your contributions before created a PR (or, at least, before requesting a review of your PR), you need to install JuliaFormatter.jl first by running

    julia -e 'using Pkg; Pkg.add("JuliaFormatter")'

    You can then recursively format the core Julia files in the Trixi.jl repo by executing

    julia -e 'using JuliaFormatter; format(["benchmark", "examples", "ext", "src", "test", "utils"])'

    from inside the Trixi.jl repository. For convenience, there is also a script you can directly run from your terminal shell, which will automatically install JuliaFormatter in a temporary environment and then run it:

    utils/trixi-format.jl

    You can get more information about using the convenience script by running it with the --help/-h flag.

    Checking formatting before committing

    It can be convenient to check the formatting of source code automatically before each commit. We use git-hooks for it and provide a pre-commit script in the utils folder. The script uses JuliaFormatter.jl just like formatting script that runs over the whole Trixi.jl directory. You can copy the pre-commit-script into .git/hooks/pre-commit and it will check your formatting before each commit. If errors are found the commit is aborted and you can add the corrections via

    git add -p
    diff --git a/previews/PR1624/testing/index.html b/previews/PR1624/testing/index.html index 84b4caeb69c..f02056bc5af 100644 --- a/previews/PR1624/testing/index.html +++ b/previews/PR1624/testing/index.html @@ -3,4 +3,4 @@ include(joinpath("test", "test_p4est_2d.jl")) julia> # Run all 1D tests for the Euler equations on the TreeMesh - include(joinpath("test", "test_tree_1d_euler.jl"))

    For the automated tests with GitHub Actions, we run multiple jobs in parallel to reduce the waiting time until all tests are finished. You can see the different components that are run as jobs by looking at the TRIXI_TEST variable in test/runtests.jl.

    Adding new tests

    We use Julia's built-in unit testing capabilities to configure tests. In general, newly added code must be covered by at least one test, and all new elixirs added to the examples/ directory must be used at least once during testing. New tests should be added to the corresponding test/test_xxx.jl file, e.g., a test involving the 3D linear advection equation on the TreeMesh would go into test/test_tree_3d_advection.jl. Please study one of the existing tests and stay consistent to the current style when creating new tests.

    Since we want to test as much as possible, we have a lot of tests and frequently create new ones. Naturally, this increases the time to wait for all tests to pass with each novel feature added to Trixi.jl. Therefore, new tests should be as short as reasonably possible, i.e., without being too insensitive to pick up changes or errors in the code.

    When you add new tests, please check whether all CI jobs still take approximately the same time. If the job where you added new tests takes much longer than everything else, please consider moving some tests from one job to another (or report this incident and ask the main developers for help).

    Test duration

    As a general rule, tests should last no more than 10 seconds when run with a single thread and after compilation (i.e., excluding the first run).

    Test coverage

    In addition to ensuring that the code produces the expected results, the automated tests also record the code coverage. The resulting coverage reports, i.e., which lines of code were executed by at least one test and are thus considered "covered" by testing, are automatically uploaded to Coveralls for easy analysis. Typically, you see a number of Coveralls results at the bottom of each pull request: One for each parallel job (see Testing setup), which can usually be ignored since they only cover parts of the code by definition, and a cumulative coverage result named coverage/coveralls. The "Details" link takes you to a detailed report on which lines of code are covered by tests, which ones are missed, and especially which new lines the pull requests adds to Trixi.jl's code base that are not yet covered by testing.

    Coverage requirements

    In general, we require pull requests to not decrease the overall test coverage percentage in main, with a hard lower bound of 97%.

    + include(joinpath("test", "test_tree_1d_euler.jl"))

    For the automated tests with GitHub Actions, we run multiple jobs in parallel to reduce the waiting time until all tests are finished. You can see the different components that are run as jobs by looking at the TRIXI_TEST variable in test/runtests.jl.

    Adding new tests

    We use Julia's built-in unit testing capabilities to configure tests. In general, newly added code must be covered by at least one test, and all new elixirs added to the examples/ directory must be used at least once during testing. New tests should be added to the corresponding test/test_xxx.jl file, e.g., a test involving the 3D linear advection equation on the TreeMesh would go into test/test_tree_3d_advection.jl. Please study one of the existing tests and stay consistent to the current style when creating new tests.

    Since we want to test as much as possible, we have a lot of tests and frequently create new ones. Naturally, this increases the time to wait for all tests to pass with each novel feature added to Trixi.jl. Therefore, new tests should be as short as reasonably possible, i.e., without being too insensitive to pick up changes or errors in the code.

    When you add new tests, please check whether all CI jobs still take approximately the same time. If the job where you added new tests takes much longer than everything else, please consider moving some tests from one job to another (or report this incident and ask the main developers for help).

    Test duration

    As a general rule, tests should last no more than 10 seconds when run with a single thread and after compilation (i.e., excluding the first run).

    Test coverage

    In addition to ensuring that the code produces the expected results, the automated tests also record the code coverage. The resulting coverage reports, i.e., which lines of code were executed by at least one test and are thus considered "covered" by testing, are automatically uploaded to Coveralls for easy analysis. Typically, you see a number of Coveralls results at the bottom of each pull request: One for each parallel job (see Testing setup), which can usually be ignored since they only cover parts of the code by definition, and a cumulative coverage result named coverage/coveralls. The "Details" link takes you to a detailed report on which lines of code are covered by tests, which ones are missed, and especially which new lines the pull requests adds to Trixi.jl's code base that are not yet covered by testing.

    Coverage requirements

    In general, we require pull requests to not decrease the overall test coverage percentage in main, with a hard lower bound of 97%.

    diff --git a/previews/PR1624/time_integration/index.html b/previews/PR1624/time_integration/index.html index 1f3a54d6b65..a3e06b64209 100644 --- a/previews/PR1624/time_integration/index.html +++ b/previews/PR1624/time_integration/index.html @@ -1,2 +1,2 @@ -Time integration · Trixi.jl

    Time integration methods

    Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, explicit Runge-Kutta methods from OrdinaryDiffEq.jl are tested extensively. Interesting classes of time integration schemes are

    Some common options for solve from OrdinaryDiffEq.jl are the following. Further documentation can be found in the SciML docs.

    • If you use a fixed time step method like CarpenterKennedy2N54, you need to pass a time step as dt=.... If you use a StepsizeCallback, the value passed as dt=... is irrelevant since it will be overwritten by the StepsizeCallback. If you want to use an adaptive time step method such as SSPRK43 or RDPK3SpFSAL49 and still want to use CFL-based step size control via the StepsizeCallback, you need to pass the keyword argument adaptive=false to solve.
    • You should usually set save_everystep=false. Otherwise, OrdinaryDiffEq.jl will (try to) save the numerical solution after every time step in RAM (until you run out of memory or start to swap).
    • You can set the maximal number of time steps via maxiters=....
    • SSP methods and many low-storage methods from OrdinaryDiffEq.jl support stage_limiter!s and step_limiter!s, e.g., PositivityPreservingLimiterZhangShu from Trixi.jl.
    • If you start Julia with multiple threads and want to use them also in the time integration method from OrdinaryDiffEq.jl, you need to pass the keyword argument thread=OrdinaryDiffEq.True() to the algorithm, e.g., RDPK3SpFSAL49(thread=OrdinaryDiffEq.True()) or CarpenterKennedy2N54(thread=OrdinaryDiffEq.True(), williamson_condition=false). For more information on using thread-based parallelism in Trixi.jl, please refer to Shared-memory parallelization with threads.
    • If you use error-based step size control (see also the section on error-based adaptive step sizes together with MPI, you need to pass internalnorm=ode_norm and you should pass unstable_check=ode_unstable_check to OrdinaryDiffEq's solve, which are both included in ode_default_options.
    Number of `rhs!` calls

    If you use explicit Runge-Kutta methods from OrdinaryDiffEq.jl, the total number of rhs! calls can be (slightly) bigger than the number of steps times the number of stages, e.g. to allow for interpolation (dense output), root-finding for continuous callbacks, and error-based time step control. In general, you often should not need to worry about this if you use Trixi.jl.

    +Time integration · Trixi.jl

    Time integration methods

    Trixi.jl is compatible with the SciML ecosystem for ordinary differential equations. In particular, explicit Runge-Kutta methods from OrdinaryDiffEq.jl are tested extensively. Interesting classes of time integration schemes are

    Some common options for solve from OrdinaryDiffEq.jl are the following. Further documentation can be found in the SciML docs.

    • If you use a fixed time step method like CarpenterKennedy2N54, you need to pass a time step as dt=.... If you use a StepsizeCallback, the value passed as dt=... is irrelevant since it will be overwritten by the StepsizeCallback. If you want to use an adaptive time step method such as SSPRK43 or RDPK3SpFSAL49 and still want to use CFL-based step size control via the StepsizeCallback, you need to pass the keyword argument adaptive=false to solve.
    • You should usually set save_everystep=false. Otherwise, OrdinaryDiffEq.jl will (try to) save the numerical solution after every time step in RAM (until you run out of memory or start to swap).
    • You can set the maximal number of time steps via maxiters=....
    • SSP methods and many low-storage methods from OrdinaryDiffEq.jl support stage_limiter!s and step_limiter!s, e.g., PositivityPreservingLimiterZhangShu from Trixi.jl.
    • If you start Julia with multiple threads and want to use them also in the time integration method from OrdinaryDiffEq.jl, you need to pass the keyword argument thread=OrdinaryDiffEq.True() to the algorithm, e.g., RDPK3SpFSAL49(thread=OrdinaryDiffEq.True()) or CarpenterKennedy2N54(thread=OrdinaryDiffEq.True(), williamson_condition=false). For more information on using thread-based parallelism in Trixi.jl, please refer to Shared-memory parallelization with threads.
    • If you use error-based step size control (see also the section on error-based adaptive step sizes together with MPI, you need to pass internalnorm=ode_norm and you should pass unstable_check=ode_unstable_check to OrdinaryDiffEq's solve, which are both included in ode_default_options.
    Number of `rhs!` calls

    If you use explicit Runge-Kutta methods from OrdinaryDiffEq.jl, the total number of rhs! calls can be (slightly) bigger than the number of steps times the number of stages, e.g. to allow for interpolation (dense output), root-finding for continuous callbacks, and error-based time step control. In general, you often should not need to worry about this if you use Trixi.jl.

    diff --git a/previews/PR1624/troubleshooting/index.html b/previews/PR1624/troubleshooting/index.html index 1d0196833db..47bac67e021 100644 --- a/previews/PR1624/troubleshooting/index.html +++ b/previews/PR1624/troubleshooting/index.html @@ -44,4 +44,4 @@ set_preferences!(uuid, "PrecompileNoSpecialize" => false) set_preferences!(uuid, "PrecompileNonStiff" => true) set_preferences!(uuid, "PrecompileStiff" => false) -end

    This disables precompilation of all implicit methods. This should usually not affect the runtime latency with Trixi.jl since most setups use explicit time integration methods.

    +end

    This disables precompilation of all implicit methods. This should usually not affect the runtime latency with Trixi.jl since most setups use explicit time integration methods.

    diff --git a/previews/PR1624/tutorials/DGMulti_1/14ff62ef.svg b/previews/PR1624/tutorials/DGMulti_1/32c730a1.svg similarity index 96% rename from previews/PR1624/tutorials/DGMulti_1/14ff62ef.svg rename to previews/PR1624/tutorials/DGMulti_1/32c730a1.svg index d881d88cebb..d0fa758a283 100644 --- a/previews/PR1624/tutorials/DGMulti_1/14ff62ef.svg +++ b/previews/PR1624/tutorials/DGMulti_1/32c730a1.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGMulti_1/a2206217.svg b/previews/PR1624/tutorials/DGMulti_1/4f2d02a8.svg similarity index 89% rename from previews/PR1624/tutorials/DGMulti_1/a2206217.svg rename to previews/PR1624/tutorials/DGMulti_1/4f2d02a8.svg index 061dc468e61..7907cef797f 100644 --- a/previews/PR1624/tutorials/DGMulti_1/a2206217.svg +++ b/previews/PR1624/tutorials/DGMulti_1/4f2d02a8.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGMulti_1/8705badf.svg b/previews/PR1624/tutorials/DGMulti_1/5a98715b.svg similarity index 96% rename from previews/PR1624/tutorials/DGMulti_1/8705badf.svg rename to previews/PR1624/tutorials/DGMulti_1/5a98715b.svg index c16e5bfd753..1a41c97be40 100644 --- a/previews/PR1624/tutorials/DGMulti_1/8705badf.svg +++ b/previews/PR1624/tutorials/DGMulti_1/5a98715b.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGMulti_1/20dac91b.svg b/previews/PR1624/tutorials/DGMulti_1/89397947.svg similarity index 96% rename from previews/PR1624/tutorials/DGMulti_1/20dac91b.svg rename to previews/PR1624/tutorials/DGMulti_1/89397947.svg index c709a5f7108..209388c3062 100644 --- a/previews/PR1624/tutorials/DGMulti_1/20dac91b.svg +++ b/previews/PR1624/tutorials/DGMulti_1/89397947.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGMulti_1/5397da78.svg b/previews/PR1624/tutorials/DGMulti_1/90b2bf4d.svg similarity index 90% rename from previews/PR1624/tutorials/DGMulti_1/5397da78.svg rename to previews/PR1624/tutorials/DGMulti_1/90b2bf4d.svg index 4992de5e0f9..0dd9fcd314a 100644 --- a/previews/PR1624/tutorials/DGMulti_1/5397da78.svg +++ b/previews/PR1624/tutorials/DGMulti_1/90b2bf4d.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGMulti_1/5dde0c2a.svg b/previews/PR1624/tutorials/DGMulti_1/a7c56f44.svg similarity index 90% rename from previews/PR1624/tutorials/DGMulti_1/5dde0c2a.svg rename to previews/PR1624/tutorials/DGMulti_1/a7c56f44.svg index d9288d6cb7c..5bf5270b65e 100644 --- a/previews/PR1624/tutorials/DGMulti_1/5dde0c2a.svg +++ b/previews/PR1624/tutorials/DGMulti_1/a7c56f44.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGMulti_1/index.html b/previews/PR1624/tutorials/DGMulti_1/index.html index 172f9d52a04..5e8def3e405 100644 --- a/previews/PR1624/tutorials/DGMulti_1/index.html +++ b/previews/PR1624/tutorials/DGMulti_1/index.html @@ -28,11 +28,11 @@ ──────────────────────────────────────────────────────────────────────────────────────────────────── Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3) ──────────────────────────────────────────────────────────────────────────────────────────────────── - #timesteps: 0 run time: 1.00200000e-06 s + #timesteps: 0 run time: 1.79400000e-06 s Δt: 0.00000000e+00 └── GC time: 0.00000000e+00 s (0.000%) sim. time: 0.00000000e+00 (0.000%) time/DOF/rhs!: NaN s PID: Inf s - #DOFs per field: 16384 alloc'd memory: 3198.023 MiB + #DOFs per field: 16384 alloc'd memory: 3069.815 MiB #elements: 1024 Variable: rho rho_v1 rho_v2 rho_e @@ -41,18 +41,18 @@ ∑∂S/∂U ⋅ Uₜ : -4.07691781e-17 ──────────────────────────────────────────────────────────────────────────────────────────────────── -#timesteps: 10 │ Δt: 8.7782e-03 │ sim. time: 6.2446e-02 (15.612%) │ run time: 1.4998e-01 s -#timesteps: 20 │ Δt: 1.2426e-02 │ sim. time: 1.7307e-01 (43.267%) │ run time: 2.9352e-01 s -#timesteps: 30 │ Δt: 1.3710e-02 │ sim. time: 3.0622e-01 (76.554%) │ run time: 4.3816e-01 s +#timesteps: 10 │ Δt: 8.7782e-03 │ sim. time: 6.2446e-02 (15.612%) │ run time: 1.4961e-01 s +#timesteps: 20 │ Δt: 1.2426e-02 │ sim. time: 1.7307e-01 (43.267%) │ run time: 2.9333e-01 s +#timesteps: 30 │ Δt: 1.3710e-02 │ sim. time: 3.0622e-01 (76.554%) │ run time: 4.3869e-01 s ──────────────────────────────────────────────────────────────────────────────────────────────────── Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3) ──────────────────────────────────────────────────────────────────────────────────────────────────── - #timesteps: 37 run time: 5.42295709e-01 s + #timesteps: 37 run time: 5.42931949e-01 s Δt: 9.57329122e-03 └── GC time: 0.00000000e+00 s (0.000%) - sim. time: 4.00000000e-01 (100.000%) time/DOF/rhs!: 9.08246248e-08 s - PID: 9.80244682e-08 s - #DOFs per field: 16384 alloc'd memory: 3202.885 MiB + sim. time: 4.00000000e-01 (100.000%) time/DOF/rhs!: 9.08742333e-08 s + PID: 9.81013921e-08 s + #DOFs per field: 16384 alloc'd memory: 3074.676 MiB #elements: 1024 Variable: rho rho_v1 rho_v2 rho_e @@ -65,8 +65,8 @@ Trixi.jl simulation finished. Final time: 0.4 Time steps: 37 (accepted), 37 (total) ────────────────────────────────────────────────────────────────────────────────────────────────────
    using Plots
     pd = PlotData2D(sol)
    -plot(pd)
    Example block output
    plot(pd["rho"])
    -plot!(getmesh(pd))
    Example block output

    This simulation is not as fast as the equivalent with TreeMesh since no special optimizations for quads (for instance tensor product structure) have been implemented. Figure 4 in "Efficient implementation of modern entropy stable and kinetic energy preserving discontinuous Galerkin methods for conservation laws" (2021) provides a nice runtime comparison between the different mesh types. On the other hand, the functions are more general and thus we have more option we can choose from.

    Simulation with Gauss nodes

    For instance, we can change the approximation type of our simulation.

    using Trixi, OrdinaryDiffEq
    +plot(pd)
    Example block output
    plot(pd["rho"])
    +plot!(getmesh(pd))
    Example block output

    This simulation is not as fast as the equivalent with TreeMesh since no special optimizations for quads (for instance tensor product structure) have been implemented. Figure 4 in "Efficient implementation of modern entropy stable and kinetic energy preserving discontinuous Galerkin methods for conservation laws" (2021) provides a nice runtime comparison between the different mesh types. On the other hand, the functions are more general and thus we have more option we can choose from.

    Simulation with Gauss nodes

    For instance, we can change the approximation type of our simulation.

    using Trixi, OrdinaryDiffEq
     equations = CompressibleEulerEquations2D(1.4)
     initial_condition = initial_condition_weak_blast_wave
    initial_condition_weak_blast_wave (generic function with 13 methods)

    We now use Gauss nodes instead of Gauss-Lobatto nodes which can be done for the element types Quad() and Hex(). Therefore, we set approximation_type=GaussSBP(). Alternatively, we can use a modal approach using the approximation type Polynomial().

    dg = DGMulti(polydeg = 3,
                  element_type = Quad(),
    @@ -95,11 +95,11 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                  0                run time:       1.09200000e-06 s
    + #timesteps:                  0                run time:       1.70300000e-06 s
      Δt:             0.00000000e+00                └── GC time:    0.00000000e+00 s (0.000%)
      sim. time:      0.00000000e+00 (0.000%)       time/DOF/rhs!:         NaN s
                                                    PID:                   Inf s
    - #DOFs per field:         16384                alloc'd memory:       3212.357 MiB
    + #DOFs per field:         16384                alloc'd memory:       3116.899 MiB
      #elements:                1024
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -108,19 +108,19 @@
      ∑∂S/∂U ⋅ Uₜ :  -1.01164379e-01
     ────────────────────────────────────────────────────────────────────────────────────────────────────
     
    -#timesteps:     10 │ Δt: 5.0548e-03 │ sim. time: 3.3436e-02 (8.359%)   │ run time: 4.7483e-01 s
    -#timesteps:     20 │ Δt: 8.8313e-03 │ sim. time: 1.0601e-01 (26.503%)  │ run time: 9.3679e-01 s
    -#timesteps:     30 │ Δt: 1.0521e-02 │ sim. time: 2.0438e-01 (51.094%)  │ run time: 1.3997e+00 s
    -#timesteps:     40 │ Δt: 1.1006e-02 │ sim. time: 3.1245e-01 (78.113%)  │ run time: 1.8657e+00 s
    +#timesteps:     10 │ Δt: 5.0548e-03 │ sim. time: 3.3436e-02 (8.359%)   │ run time: 4.7292e-01 s
    +#timesteps:     20 │ Δt: 8.8313e-03 │ sim. time: 1.0601e-01 (26.503%)  │ run time: 9.3443e-01 s
    +#timesteps:     30 │ Δt: 1.0521e-02 │ sim. time: 2.0438e-01 (51.094%)  │ run time: 1.3956e+00 s
    +#timesteps:     40 │ Δt: 1.1006e-02 │ sim. time: 3.1245e-01 (78.113%)  │ run time: 1.8586e+00 s
     
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                 48                run time:       2.26843167e+00 s
    - Δt:             1.00192333e-02                └── GC time:    2.37314840e-02 s (1.046%)
    - sim. time:      4.00000000e-01 (100.000%)     time/DOF/rhs!:  2.99992515e-07 s
    -                                               PID:            3.14022418e-07 s
    - #DOFs per field:         16384                alloc'd memory:       3173.187 MiB
    + #timesteps:                 48                run time:       2.23831944e+00 s
    + Δt:             1.00192333e-02                └── GC time:    0.00000000e+00 s (0.000%)
    + sim. time:      4.00000000e-01 (100.000%)     time/DOF/rhs!:  2.99326107e-07 s
    +                                               PID:            3.13160096e-07 s
    + #DOFs per field:         16384                alloc'd memory:       3119.269 MiB
      #elements:                1024
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -133,7 +133,7 @@
     Trixi.jl simulation finished.  Final time: 0.4  Time steps: 48 (accepted), 48 (total)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    using Plots
     pd = PlotData2D(sol)
    -plot(pd)
    Example block output

    Simulation with triangular elements

    Also, we can set another element type. We want to use triangles now.

    using Trixi, OrdinaryDiffEq
    +plot(pd)
    Example block output

    Simulation with triangular elements

    Also, we can set another element type. We want to use triangles now.

    using Trixi, OrdinaryDiffEq
     equations = CompressibleEulerEquations2D(1.4)
     initial_condition = initial_condition_weak_blast_wave
    initial_condition_weak_blast_wave (generic function with 13 methods)

    Since there is no direct equivalent to Gauss-Lobatto nodes on triangles, the approximation type SBP() now uses Gauss-Lobatto nodes on faces and special nodes in the interior of the triangular. More details can be found in the documentation of StartUpDG.jl.

    dg = DGMulti(polydeg = 3,
                  element_type = Tri(),
    @@ -162,11 +162,11 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                  0                run time:       8.21000000e-07 s
    + #timesteps:                  0                run time:       1.02200000e-06 s
      Δt:             0.00000000e+00                └── GC time:    0.00000000e+00 s (0.000%)
      sim. time:      0.00000000e+00 (0.000%)       time/DOF/rhs!:         NaN s
                                                    PID:                   Inf s
    - #DOFs per field:         30720                alloc'd memory:       3209.861 MiB
    + #DOFs per field:         30720                alloc'd memory:       3154.757 MiB
      #elements:                2048
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -175,19 +175,19 @@
      ∑∂S/∂U ⋅ Uₜ :  -6.74736856e-03
     ────────────────────────────────────────────────────────────────────────────────────────────────────
     
    -#timesteps:     10 │ Δt: 6.6947e-03 │ sim. time: 4.5960e-02 (11.490%)  │ run time: 8.3354e-01 s
    -#timesteps:     20 │ Δt: 1.0524e-02 │ sim. time: 1.3699e-01 (34.249%)  │ run time: 1.6361e+00 s
    -#timesteps:     30 │ Δt: 1.2096e-02 │ sim. time: 2.5197e-01 (62.993%)  │ run time: 2.4473e+00 s
    -#timesteps:     40 │ Δt: 1.2622e-02 │ sim. time: 3.7597e-01 (93.993%)  │ run time: 3.2825e+00 s
    +#timesteps:     10 │ Δt: 6.6947e-03 │ sim. time: 4.5960e-02 (11.490%)  │ run time: 9.1815e-01 s
    +#timesteps:     20 │ Δt: 1.0524e-02 │ sim. time: 1.3699e-01 (34.249%)  │ run time: 1.8208e+00 s
    +#timesteps:     30 │ Δt: 1.2096e-02 │ sim. time: 2.5197e-01 (62.993%)  │ run time: 2.7360e+00 s
    +#timesteps:     40 │ Δt: 1.2622e-02 │ sim. time: 3.7597e-01 (93.993%)  │ run time: 3.6590e+00 s
     
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                 42                run time:       3.45852516e+00 s
    + #timesteps:                 42                run time:       3.85511525e+00 s
      Δt:             1.13592115e-02                └── GC time:    0.00000000e+00 s (0.000%)
    - sim. time:      4.00000000e-01 (100.000%)     time/DOF/rhs!:  2.87364921e-07 s
    -                                               PID:            2.94546535e-07 s
    - #DOFs per field:         30720                alloc'd memory:       3218.772 MiB
    + sim. time:      4.00000000e-01 (100.000%)     time/DOF/rhs!:  3.21171731e-07 s
    +                                               PID:            3.28477038e-07 s
    + #DOFs per field:         30720                alloc'd memory:       3163.668 MiB
      #elements:                2048
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -200,8 +200,8 @@
     Trixi.jl simulation finished.  Final time: 0.4  Time steps: 42 (accepted), 42 (total)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    using Plots
     pd = PlotData2D(sol)
    -plot(pd)
    Example block output
    plot(pd["rho"])
    -plot!(getmesh(pd))
    Example block output

    Triangular meshes on non-Cartesian domains

    To use triangular meshes on a non-Cartesian domain, Trixi.jl uses the package StartUpDG.jl. The following example is based on elixir_euler_triangulate_pkg_mesh.jl and uses a pre-defined mesh from StartUpDG.jl.

    using Trixi, OrdinaryDiffEq

    We want to simulate the smooth initial condition initial_condition_convergence_test with source terms source_terms_convergence_test for the 2D compressible Euler equations.

    equations = CompressibleEulerEquations2D(1.4)
    +plot(pd)
    Example block output
    plot(pd["rho"])
    +plot!(getmesh(pd))
    Example block output

    Triangular meshes on non-Cartesian domains

    To use triangular meshes on a non-Cartesian domain, Trixi.jl uses the package StartUpDG.jl. The following example is based on elixir_euler_triangulate_pkg_mesh.jl and uses a pre-defined mesh from StartUpDG.jl.

    using Trixi, OrdinaryDiffEq

    We want to simulate the smooth initial condition initial_condition_convergence_test with source terms source_terms_convergence_test for the 2D compressible Euler equations.

    equations = CompressibleEulerEquations2D(1.4)
     initial_condition = initial_condition_convergence_test
     source_terms = source_terms_convergence_test
    source_terms_convergence_test (generic function with 13 methods)

    We create the solver DGMulti with triangular elements (Tri()) as before.

    dg = DGMulti(polydeg = 3, element_type = Tri(),
                  approximation_type=Polynomial(),
    @@ -242,11 +242,11 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                  0                run time:       1.22200000e-06 s
    + #timesteps:                  0                run time:       1.24200000e-06 s
      Δt:             1.49245207e-03                └── GC time:    0.00000000e+00 s (0.000%)
      sim. time:      0.00000000e+00 (0.000%)       time/DOF/rhs!:         NaN s
                                                    PID:                   Inf s
    - #DOFs per field:          5980                alloc'd memory:       3263.141 MiB
    + #DOFs per field:          5980                alloc'd memory:       3208.258 MiB
      #elements:                 598
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -255,12 +255,12 @@
      ∑∂S/∂U ⋅ Uₜ :  -1.23444983e-02
     ────────────────────────────────────────────────────────────────────────────────────────────────────
     
    -#timesteps:     20 │ Δt: 1.4925e-03 │ sim. time: 2.9849e-02 (14.925%)  │ run time: 5.3161e-01 s
    -#timesteps:     40 │ Δt: 1.4925e-03 │ sim. time: 5.9698e-02 (29.849%)  │ run time: 1.0536e+00 s
    -#timesteps:     60 │ Δt: 1.4925e-03 │ sim. time: 8.9547e-02 (44.774%)  │ run time: 1.5756e+00 s
    -#timesteps:     80 │ Δt: 1.4925e-03 │ sim. time: 1.1940e-01 (59.698%)  │ run time: 2.0982e+00 s
    -#timesteps:    100 │ Δt: 1.4925e-03 │ sim. time: 1.4925e-01 (74.623%)  │ run time: 2.6201e+00 s
    -#timesteps:    120 │ Δt: 1.4925e-03 │ sim. time: 1.7909e-01 (89.547%)  │ run time: 3.1433e+00 s
    +#timesteps:     20 │ Δt: 1.4925e-03 │ sim. time: 2.9849e-02 (14.925%)  │ run time: 5.3401e-01 s
    +#timesteps:     40 │ Δt: 1.4925e-03 │ sim. time: 5.9698e-02 (29.849%)  │ run time: 1.0564e+00 s
    +#timesteps:     60 │ Δt: 1.4925e-03 │ sim. time: 8.9547e-02 (44.774%)  │ run time: 1.5941e+00 s
    +#timesteps:     80 │ Δt: 1.4925e-03 │ sim. time: 1.1940e-01 (59.698%)  │ run time: 2.1160e+00 s
    +#timesteps:    100 │ Δt: 1.4925e-03 │ sim. time: 1.4925e-01 (74.623%)  │ run time: 2.6552e+00 s
    +#timesteps:    120 │ Δt: 1.4925e-03 │ sim. time: 1.7909e-01 (89.547%)  │ run time: 3.1771e+00 s
     ────────────────────────────────────────────────────────────────────────────────────────────────────
     Trixi.jl simulation finished.  Final time: 0.2  Time steps: 135 (accepted), 135 (total)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    @@ -269,11 +269,11 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGMulti(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                135                run time:       3.53566076e+00 s
    + #timesteps:                135                run time:       3.56933367e+00 s
      Δt:             1.14223386e-05                └── GC time:    0.00000000e+00 s (0.000%)
    - sim. time:      2.00000000e-01 (100.000%)     time/DOF/rhs!:  8.66420651e-07 s
    -                                               PID:            8.73154465e-07 s
    - #DOFs per field:          5980                alloc'd memory:       3263.614 MiB
    + sim. time:      2.00000000e-01 (100.000%)     time/DOF/rhs!:  8.74675765e-07 s
    +                                               PID:            8.81486185e-07 s
    + #DOFs per field:          5980                alloc'd memory:       3208.730 MiB
      #elements:                 598
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -283,7 +283,7 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    using Plots
     pd = PlotData2D(sol)
     plot(pd["rho"])
    -plot!(getmesh(pd))
    Example block output

    For more information, please have a look in the StartUpDG.jl documentation.

    Package versions

    These results were obtained using the following versions.

    using InteractiveUtils
    +plot!(getmesh(pd))
    Example block output

    For more information, please have a look in the StartUpDG.jl documentation.

    Package versions

    These results were obtained using the following versions.

    using InteractiveUtils
     versioninfo()
     
     using Pkg
    @@ -306,4 +306,4 @@
      [91a5bcdd] Plots v1.39.0
       [472ebc20] StartUpDG v0.17.7
       [a7f1ee26] Trixi v0.7.3-pre `~/work/Trixi.jl/Trixi.jl`
    -Info Packages marked with  have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

    This page was generated using Literate.jl.

    +Info Packages marked with have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

    This page was generated using Literate.jl.

    diff --git a/previews/PR1624/tutorials/DGMulti_2/index.html b/previews/PR1624/tutorials/DGMulti_2/index.html index 9843b975afe..e45a8345f73 100644 --- a/previews/PR1624/tutorials/DGMulti_2/index.html +++ b/previews/PR1624/tutorials/DGMulti_2/index.html @@ -33,4 +33,4 @@ Status `~/work/Trixi.jl/Trixi.jl/docs/Manifest.toml` [472ebc20] StartUpDG v0.17.7 [9f78cca6] SummationByPartsOperators v0.5.56 - [a7f1ee26] Trixi v0.7.3-pre `~/work/Trixi.jl/Trixi.jl`

    This page was generated using Literate.jl.

    + [a7f1ee26] Trixi v0.7.3-pre `~/work/Trixi.jl/Trixi.jl`

    This page was generated using Literate.jl.

    diff --git a/previews/PR1624/tutorials/DGSEM_FluxDiff/2377c765.svg b/previews/PR1624/tutorials/DGSEM_FluxDiff/b17d3038.svg similarity index 95% rename from previews/PR1624/tutorials/DGSEM_FluxDiff/2377c765.svg rename to previews/PR1624/tutorials/DGSEM_FluxDiff/b17d3038.svg index dca1276dc69..ced7c15f684 100644 --- a/previews/PR1624/tutorials/DGSEM_FluxDiff/2377c765.svg +++ b/previews/PR1624/tutorials/DGSEM_FluxDiff/b17d3038.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGSEM_FluxDiff/268fccc7.svg b/previews/PR1624/tutorials/DGSEM_FluxDiff/e17adda9.svg similarity index 94% rename from previews/PR1624/tutorials/DGSEM_FluxDiff/268fccc7.svg rename to previews/PR1624/tutorials/DGSEM_FluxDiff/e17adda9.svg index ef4cfb5dea6..f619e5ea2ae 100644 --- a/previews/PR1624/tutorials/DGSEM_FluxDiff/268fccc7.svg +++ b/previews/PR1624/tutorials/DGSEM_FluxDiff/e17adda9.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/DGSEM_FluxDiff/index.html b/previews/PR1624/tutorials/DGSEM_FluxDiff/index.html index cf526a82b5e..55765a5ad11 100644 --- a/previews/PR1624/tutorials/DGSEM_FluxDiff/index.html +++ b/previews/PR1624/tutorials/DGSEM_FluxDiff/index.html @@ -54,11 +54,11 @@ ──────────────────────────────────────────────────────────────────────────────────────────────────── Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3) ──────────────────────────────────────────────────────────────────────────────────────────────────── - #timesteps: 0 run time: 6.21000000e-07 s + #timesteps: 0 run time: 7.52000000e-07 s Δt: 0.00000000e+00 └── GC time: 0.00000000e+00 s (0.000%) sim. time: 0.00000000e+00 (0.000%) time/DOF/rhs!: NaN s PID: Inf s - #DOFs per field: 16384 alloc'd memory: 3279.058 MiB + #DOFs per field: 16384 alloc'd memory: 3223.579 MiB #elements: 1024 Variable: rho rho_v1 rho_v2 rho_e @@ -71,11 +71,11 @@ ──────────────────────────────────────────────────────────────────────────────────────────────────── Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3) ──────────────────────────────────────────────────────────────────────────────────────────────────── - #timesteps: 61 run time: 9.07143480e-01 s + #timesteps: 61 run time: 9.06007270e-01 s Δt: 2.65388338e-06 └── GC time: 0.00000000e+00 s (0.000%) - sim. time: 4.00000000e-01 (100.000%) time/DOF/rhs!: 9.15820099e-08 s - PID: 9.98607498e-08 s - #DOFs per field: 16384 alloc'd memory: 3280.786 MiB + sim. time: 4.00000000e-01 (100.000%) time/DOF/rhs!: 9.12567852e-08 s + PID: 9.97323972e-08 s + #DOFs per field: 16384 alloc'd memory: 3225.307 MiB #elements: 1024 Variable: rho rho_v1 rho_v2 rho_e @@ -83,7 +83,7 @@ Linf error: 2.91149630e-01 3.21787795e-01 3.22040740e-01 1.04645370e+00 ∑∂S/∂U ⋅ Uₜ : -4.30663196e-18 ────────────────────────────────────────────────────────────────────────────────────────────────────

    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.

    We can plot the approximated solution at the time t=0.4.

    using Plots
    -plot(sol)
    Example block output

    Now, we can use for instance the dissipative flux flux_lax_friedrichs as surface flux to get an entropy stable method.

    using OrdinaryDiffEq, Trixi
    +plot(sol)
    Example block output

    Now, we can use for instance the dissipative flux flux_lax_friedrichs as surface flux to get an entropy stable method.

    using OrdinaryDiffEq, Trixi
     
     gamma = 1.4
     equations = CompressibleEulerEquations2D(gamma)
    @@ -113,11 +113,11 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                  0                run time:       8.92000000e-07 s
    + #timesteps:                  0                run time:       8.11000000e-07 s
      Δt:             0.00000000e+00                └── GC time:    0.00000000e+00 s (0.000%)
      sim. time:      0.00000000e+00 (0.000%)       time/DOF/rhs!:         NaN s
                                                    PID:                   Inf s
    - #DOFs per field:         16384                alloc'd memory:       3279.776 MiB
    + #DOFs per field:         16384                alloc'd memory:       3224.258 MiB
      #elements:                1024
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -130,11 +130,11 @@
     ────────────────────────────────────────────────────────────────────────────────────────────────────
      Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
     ────────────────────────────────────────────────────────────────────────────────────────────────────
    - #timesteps:                 37                run time:       5.22229588e-01 s
    + #timesteps:                 37                run time:       5.27996330e-01 s
      Δt:             9.70561500e-03                └── GC time:    0.00000000e+00 s (0.000%)
    - sim. time:      4.00000000e-01 (100.000%)     time/DOF/rhs!:  8.70553181e-08 s
    -                                               PID:            9.41221379e-08 s
    - #DOFs per field:         16384                alloc'd memory:       3281.503 MiB
    + sim. time:      4.00000000e-01 (100.000%)     time/DOF/rhs!:  8.68042179e-08 s
    +                                               PID:            9.51686367e-08 s
    + #DOFs per field:         16384                alloc'd memory:       3225.985 MiB
      #elements:                1024
     
      Variable:       rho              rho_v1           rho_v2           rho_e
    @@ -142,7 +142,7 @@
      Linf error:     2.61815838e-01   2.48816692e-01   2.48316760e-01   9.30972696e-01
      ∑∂S/∂U ⋅ Uₜ :  -1.40306972e-04
     ────────────────────────────────────────────────────────────────────────────────────────────────────

    The change in entropy confirms the expected entropy stability.

    using Plots
    -plot(sol)
    Example block output

    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.jl provides for example flux_ranocha, flux_shima_etal, flux_chandrashekar, flux_kennedy_gruber. As surface flux you can use all volume fluxes and additionally for instance flux_lax_friedrichs, flux_hll, flux_hllc.

    Package versions

    These results were obtained using the following versions.

    using InteractiveUtils
    +plot(sol)
    Example block output

    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.jl provides for example flux_ranocha, flux_shima_etal, flux_chandrashekar, flux_kennedy_gruber. As surface flux you can use all volume fluxes and additionally for instance flux_lax_friedrichs, flux_hll, flux_hllc.

    Package versions

    These results were obtained using the following versions.

    using InteractiveUtils
     versioninfo()
     
     using Pkg
    @@ -164,4 +164,4 @@
      [1dea7af3] OrdinaryDiffEq v6.66.0
      [91a5bcdd] Plots v1.39.0
       [a7f1ee26] Trixi v0.7.3-pre `~/work/Trixi.jl/Trixi.jl`
    -Info Packages marked with  have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

    This page was generated using Literate.jl.

    +Info Packages marked with have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

    This page was generated using Literate.jl.

    diff --git a/previews/PR1624/tutorials/adaptive_mesh_refinement/50222a0c.svg b/previews/PR1624/tutorials/adaptive_mesh_refinement/dd5d7cce.svg similarity index 85% rename from previews/PR1624/tutorials/adaptive_mesh_refinement/50222a0c.svg rename to previews/PR1624/tutorials/adaptive_mesh_refinement/dd5d7cce.svg index 3d0abe929d8..10cbae0f7e6 100644 --- a/previews/PR1624/tutorials/adaptive_mesh_refinement/50222a0c.svg +++ b/previews/PR1624/tutorials/adaptive_mesh_refinement/dd5d7cce.svg @@ -1,35 +1,35 @@ - + - + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + diff --git a/previews/PR1624/tutorials/adaptive_mesh_refinement/index.html b/previews/PR1624/tutorials/adaptive_mesh_refinement/index.html index 45904ac2e85..5c975cabace 100644 --- a/previews/PR1624/tutorials/adaptive_mesh_refinement/index.html +++ b/previews/PR1624/tutorials/adaptive_mesh_refinement/index.html @@ -53,7 +53,7 @@ save_everystep=false, callback=callbacks);

    We plot the solution and add the refined mesh at the end of the simulation.

    using Plots
     pd = PlotData2D(sol)
     plot(pd)
    -plot!(getmesh(pd))
    Example block output

    More examples

    Trixi.jl provides many elixirs using AMR. We want to give some examples for different mesh types:

    Animations of more interesting and complicated AMR simulations can be found below and on Trixi.jl's youtube channel "Trixi Framework".

    First, we give a purely hyperbolic simulation of a Sedov blast wave with self-gravity. This simulation uses the mesh type TreeMesh as we did and the AMR indicator IndicatorHennemannGassner.

    Trixi2Vtk

    Trixi2Vtk converts Trixi.jl's .h5 output files to VTK files, which can be read by ParaView, VisIt, and other visualization tools. It automatically interpolates solution data from the original quadrature node locations to equidistant visualization nodes at a higher resolution, to make up for the loss of accuracy from going from a high-order polynomial representation to a piecewise constant representation in VTK.

    In the Julia REPL, first load the package Trixi2Vtk

    julia> using Trixi2Vtk

    To process an HDF5 file generated by Trixi.jl, execute

    julia> trixi2vtk(joinpath("out", "solution_000000.h5"), output_directory="out")

    This will create two unstructured VTK files in the out subdirectory that can be opened with ParaView or VisIt: solution_000000.vtu contains the discontinuous Galerkin solution data while solution_000000_celldata.vtu holds any cell-based values such as the current AMR indicator or the cell refinement level.

    "solution_000000_scalar_mesh"

    This allows you to generate VTK files for solution, restart and mesh files. By default, Trixi2Vtk generates .vtu (unstructured VTK) files for both cell/element data (e.g., cell ids, element ids) and node data (e.g., solution variables). This format visualizes each cell with the same number of nodes, independent of its size. Alternatively, you can provide format=:vti as a keyword argument to trixi2vtk, which causes Trixi2Vtk to generate .vti (image data VTK) files for the solution files, while still using .vtu files for cell-/element-based data. In .vti files, a uniform resolution is used throughout the entire domain, resulting in different number of visualization nodes for each element. This can be advantageous to create publication-quality images, but increases the file size.

    If you want to convert multiple solution/restart files at once, you can just supply multiple input files as the positional arguments to trixi2vtk, e.g.,

    julia> trixi2vtk("out/solution_000000.h5", "out/solution_000040.h5")

    You may also use file globbing to select a range of files based on filename patterns, e.g.,

    julia> trixi2vtk("out/solution_*.h5")

    to convert all solution files in the out/ directory or

    julia> trixi2vtk("out/restart_00[0-9]000.h5")

    to convert every one-thousandth restart file (out/restart_000000.h5, out/restart_001000.h5 etc.).

    When multiple solution/restart files are provided, Trixi2Vtk will also generate a .pvd file, which allows ParaView to read all .vtu/.vti files at once and which uses the time attribute in solution/restart files to inform ParaView about the solution time. A comprehensive list of all possible arguments for trixi2vtk can be found in the Trixi2Vtk.jl API.

    Further information regarding the development of Trixi2Vtk can be found in the development section.

    Makie.jl [experimental]

    In addition to Plots.jl support, Trixi.jl includes visualization utilities through Makie.jl. Trixi.jl provides Makie-based visualization options both for heatmap-type plots (similar to the Plots.jl recipes) as well as for interactive surface plots. Support is currently limited to the UnstructuredMesh2D type.

    Note

    Plotting via Makie.jl is still considered an experimental feature and might change in any future releases.

    A Makie plot can be created as follows: after running a simulation with Trixi.jl in the REPL, load a Makie backend (for example, GLMakie or CairoMakie).

    julia> using GLMakie

    To visualize the solution and mesh with a heatmap-type plot, simply run

    julia> plot(sol)
    Note

    Both Makie.jl and Plots.jl export plot, so if you load both libraries, you will have to specify which plot function to call via Plots.plot or Makie.plot.

    As with Plots.jl recipes, one can view individual solution components by creating a PlotData2D object and indexing into it with the desired variable name

    julia> pd = PlotData2D(sol)
     julia> plot(pd["rho"])

    Unlike the Plots.jl recipe, mesh plotting is controlled using the keyword argument plot_mesh = false, e.g.,

    julia> plot(sol; plot_mesh=false)

    The plot command also returns figure and axis handles, which can be used to edit plot titles or labels:

    julia> fig, axes = plot(sol)
    -julia> axes[1,1].title = "New title for subplot (1,1)"

    Trixi.jl also supports interactive surface plots using iplot. After executing

    julia> trixi_include(joinpath("examples", "unstructured_2d_dgsem", "elixir_euler_wall_bc.jl"))

    we can run

    julia> iplot(sol)

    This will open up an interactive visualization window:

    makie-example

    The plot can be rotated (click and hold), zoomed in and out (scroll up and down), and panned (hold right click and drag). Two toggle buttons control whether mesh lines are visible on top of and below the solution.

    Both plot and iplot use colormap = :inferno by default. A different colormap can be selected by providing an appropriate keyword argument. For example, plot(sol, colormap=:blues) and iplot(sol, colormap=:blues) produce the following figures:

    makie-plot-example makie-iplot-example

    +julia> axes[1,1].title = "New title for subplot (1,1)"

    Trixi.jl also supports interactive surface plots using iplot. After executing

    julia> trixi_include(joinpath("examples", "unstructured_2d_dgsem", "elixir_euler_wall_bc.jl"))

    we can run

    julia> iplot(sol)

    This will open up an interactive visualization window:

    makie-example

    The plot can be rotated (click and hold), zoomed in and out (scroll up and down), and panned (hold right click and drag). Two toggle buttons control whether mesh lines are visible on top of and below the solution.

    Both plot and iplot use colormap = :inferno by default. A different colormap can be selected by providing an appropriate keyword argument. For example, plot(sol, colormap=:blues) and iplot(sol, colormap=:blues) produce the following figures:

    makie-plot-example makie-iplot-example