Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/docs/literate/src/files/index.jl
5591 views
1
# # Tutorials for Trixi.jl
2
3
# The tutorial section for [Trixi.jl](https://github.com/trixi-framework/Trixi.jl) also contains
4
# interactive step-by-step explanations via [Binder](https://mybinder.org).
5
6
# Right now, you are using the classic documentation. The corresponding interactive notebooks can
7
# be opened in [Binder](https://mybinder.org/) and viewed in [nbviewer](https://nbviewer.jupyter.org/)
8
# via the icons ![](https://mybinder.org/badge_logo.svg) and ![](https://img.shields.io/badge/render-nbviewer-f37726)
9
# in the respective tutorial.
10
# You can also open the raw notebook files via ![](https://img.shields.io/badge/raw-notebook-4cc61e).
11
12
# **Note:** To improve responsiveness via caching, the notebooks are updated only once a week. They are only
13
# available for the latest stable release of Trixi.jl at the time of caching.
14
15
# There are tutorials for the following topics:
16
17
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
18
# ### [{index} First steps in Trixi.jl](@ref getting_started)
19
#-
20
# This tutorial provides guidance for getting started with Trixi.jl, and Julia as well. It outlines
21
# the installation procedures for both Julia and Trixi.jl, the execution of Trixi.jl elixirs, the
22
# fundamental structure of a Trixi.jl setup, the visualization of results, and the development
23
# process for Trixi.jl.
24
25
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
26
# ### [{index} Behind the scenes of a simulation setup](@ref behind_the_scenes_simulation_setup)
27
#-
28
# This tutorial will guide you through a simple Trixi.jl setup ("elixir"), giving an overview of
29
# what happens in the background during the initialization of a simulation. While the setup
30
# described herein does not cover all details, it involves relatively stable parts of Trixi.jl that
31
# are unlikely to undergo significant changes in the near future. The goal is to clarify some of
32
# the more fundamental, *technical* concepts that are applicable to a variety of
33
# (also more complex) configurations.s
34
35
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
36
# ### [{index} Introduction to DG methods](@ref scalar_linear_advection_1d)
37
#-
38
# This tutorial gives an introduction to discontinuous Galerkin (DG) methods with the example of the
39
# scalar linear advection equation in 1D. Starting with some theoretical explanations, we first implement
40
# a raw version of a discontinuous Galerkin spectral element method (DGSEM). Then, we will show how
41
# to use features of Trixi.jl to achieve the same result.
42
43
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
44
# ### [{index} DGSEM with flux differencing](@ref DGSEM_FluxDiff)
45
#-
46
# To improve stability often the flux differencing formulation of the DGSEM (split form) is used.
47
# We want to present the idea and formulation on a basic 1D level. Then, we show how this formulation
48
# can be implemented in Trixi.jl and analyse entropy conservation for two different flux combinations.
49
50
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
51
# ### [{index} Shock capturing with flux differencing and stage limiter](@ref shock_capturing)
52
#-
53
# Using the flux differencing formulation, a simple procedure to capture shocks is a hybrid blending
54
# of a high-order DG method and a low-order subcell finite volume (FV) method. We present the idea on a
55
# very basic level and show the implementation in Trixi.jl. Then, a positivity preserving limiter is
56
# explained and added to an exemplary simulation of the Sedov blast wave with the 2D compressible Euler
57
# equations.
58
59
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
60
# ### [{index} Subcell limiting with the IDP Limiter](@ref subcell_shock_capturing)
61
#-
62
# Trixi.jl features a subcell-wise limiting strategy utilizing an Invariant Domain-Preserving (IDP)
63
# approach. This IDP approach computes a blending factor that balances the high-order
64
# discontinuous Galerkin (DG) method with a low-order subcell finite volume (FV) method for each
65
# node within an element. This localized approach minimizes the application of dissipation,
66
# resulting in less limiting compared to the element-wise strategy. Additionally, the framework
67
# supports both local bounds, which are primarily used for shock capturing, and global bounds.
68
# The application of global bounds ensures the minimal necessary limiting to meet physical
69
# admissibility conditions, such as ensuring the non-negativity of variables.
70
71
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
72
# ### [{index} Non-periodic boundary conditions](@ref non_periodic_boundaries)
73
#-
74
# Thus far, all examples used periodic boundaries. In Trixi.jl, you can also set up a simulation with
75
# non-periodic boundaries. This tutorial presents the implementation of the classical Dirichlet
76
# boundary condition with a following example. Then, other non-periodic boundaries are mentioned.
77
78
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
79
# ### [{index} DG schemes via `DGMulti` solver](@ref DGMulti_1)
80
#-
81
# This tutorial is about the more general DG solver [`DGMulti`](@ref), introduced [here](@ref DGMulti).
82
# We are showing some examples for this solver, for instance with discretization nodes by Gauss or
83
# triangular elements. Moreover, we present a simple way to include pre-defined triangulate meshes for
84
# non-Cartesian domains using the package [StartUpDG.jl](https://github.com/jlchan/StartUpDG.jl).
85
86
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
87
# ### [{index} Other SBP schemes (FD, CGSEM) via `DGMulti` solver](@ref DGMulti_2)
88
#-
89
# Supplementary to the previous tutorial about DG schemes via the `DGMulti` solver we now present
90
# the possibility for `DGMulti` to use other SBP schemes via the package
91
# [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl).
92
# For instance, we show how to set up a finite differences (FD) scheme and a continuous Galerkin
93
# (CGSEM) method.
94
95
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
96
# ### [{index} Upwind FD SBP schemes](@ref upwind_fdsbp)
97
#-
98
# General SBP schemes can not only be used via the [`DGMulti`](@ref) solver but
99
# also with a general `DG` solver. In particular, upwind finite difference SBP
100
# methods can be used together with the `TreeMesh`. Similar to general SBP
101
# schemes in the `DGMulti` framework, the interface is based on the package
102
# [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl).
103
104
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
105
# ### [{index} Adding a new scalar conservation law](@ref adding_new_scalar_equations)
106
#-
107
# This tutorial explains how to add a new physics model using the example of the cubic conservation
108
# law. First, we define the equation using a `struct` `CubicEquation` and the physical flux. Then,
109
# the corresponding standard setup in Trixi.jl (`mesh`, `solver`, `semi` and `ode`) is implemented
110
# and the ODE problem is solved by OrdinaryDiffEq's `solve` method.
111
112
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
113
# ### [{index} Adding a non-conservative equation](@ref adding_nonconservative_equation)
114
#-
115
# In this part, another physics model is implemented, the nonconservative linear advection equation.
116
# We run two different simulations with different levels of refinement and compare the resulting errors.
117
118
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
119
# ### [{index} Parabolic terms](@ref parabolic_terms)
120
#-
121
# This tutorial describes how parabolic terms are implemented in Trixi.jl, e.g.,
122
# to solve the advection-diffusion equation.
123
124
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
125
# ### [{index} Adding new parabolic terms](@ref adding_new_parabolic_terms)
126
#-
127
# This tutorial describes how new parabolic terms can be implemented using Trixi.jl.
128
129
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
130
# ### [{index} Parabolic source terms](@ref parabolic_source_terms)
131
#-
132
# This tutorial describes how parabolic source terms (e.g., source terms which depend on solution gradients)
133
# can be implemented in Trixi.jl using the advection-diffusion equation as an example.
134
135
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
136
# ### [{index} Adaptive mesh refinement](@ref adaptive_mesh_refinement)
137
#-
138
# Adaptive mesh refinement (AMR) helps to increase the accuracy in sensitive or turbolent regions while
139
# not wasting resources for less interesting parts of the domain. This leads to much more efficient
140
# simulations. This tutorial presents the implementation strategy of AMR in Trixi.jl, including the use of
141
# different indicators and controllers.
142
143
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
144
# ### [{index} Structured mesh with curvilinear mapping](@ref structured_mesh_mapping)
145
#-
146
# In this tutorial, the use of Trixi.jl's structured curved mesh type [`StructuredMesh`](@ref) is explained.
147
# We present the two basic option to initialize such a mesh. First, the curved domain boundaries
148
# of a circular cylinder are set by explicit boundary functions. Then, a fully curved mesh is
149
# defined by passing the transformation mapping.
150
151
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
152
# ### [{index} Unstructured meshes with HOHQMesh.jl](@ref hohqmesh_tutorial)
153
#-
154
# The purpose of this tutorial is to demonstrate how to use the [`UnstructuredMesh2D`](@ref)
155
# functionality of Trixi.jl. This begins by running and visualizing an available unstructured
156
# quadrilateral mesh example. Then, the tutorial will demonstrate how to conceptualize a problem
157
# with curved boundaries, generate a curvilinear mesh using the available [HOHQMesh](https://github.com/trixi-framework/HOHQMesh)
158
# software in the Trixi.jl ecosystem, and then run a simulation using Trixi.jl on said mesh.
159
# In the end, the tutorial briefly explains how to simulate an example using AMR via `P4estMesh`.
160
161
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
162
# ### [{index} P4est mesh from gmsh](@ref p4est_from_gmsh)
163
#-
164
# This tutorial describes how to obtain a [`P4estMesh`](@ref) from an existing mesh generated
165
# by [`gmsh`](https://gmsh.info/) or any other meshing software that can export to the Abaqus
166
# input `.inp` format. The tutorial demonstrates how edges/faces can be associated with boundary conditions based on the physical nodesets.
167
168
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
169
# ### [{index} Explicit time stepping](@ref time_stepping)
170
#-
171
# This tutorial is about time integration using [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl)
172
# and its sub-packages.
173
# It explains how to use their algorithms and presents two types of time step choices - with error-based
174
# and CFL-based adaptive step size control.
175
176
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
177
# ### [{index} Differentiable programming](@ref differentiable_programming)
178
#-
179
# This part deals with some basic differentiable programming topics. For example, a Jacobian, its
180
# eigenvalues and a curve of total energy (through the simulation) are calculated and plotted for
181
# a few semidiscretizations. Moreover, we calculate an example for propagating errors with Measurement.jl
182
# at the end.
183
184
#src Note to developers: Use "{ index }" (but without spaces, see next line) to enable automatic indexing
185
# ### [{index} Custom semidiscretization](@ref custom_semidiscretization)
186
#-
187
# This tutorial describes the [semidiscretiations](@ref overview-semidiscretizations) of Trixi.jl
188
# and explains how to extend them for custom tasks.
189
190
191
192
# ## Examples in Trixi.jl
193
# Trixi.jl already contains several more coding examples, the so-called `elixirs`. You can find them
194
# in the folder [`examples/`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/).
195
# They are structured by the underlying mesh type and the respective number of spatial dimensions.
196
# The name of an elixir is composed of the underlying system of conservation equations (for instance
197
# `advection` or `euler`) and other special characteristics like the initial condition
198
# (e.g. `gauss`, `astro_jet`, `blast_wave`) or the included simulation features
199
# (e.g. `amr`, `shockcapturing`).
200
201