Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: Core aspects of the basic setup #1699

Merged
merged 86 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3a3a58d
Doc: Core aspects of the basic setup
ArseniyKholod Nov 1, 2023
a342222
update pictures
ArseniyKholod Nov 1, 2023
69c9d57
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Nov 1, 2023
0fe2c87
Merge branch 'semidiscretization-doc' of https://github.com/ArseniyKh…
ArseniyKholod Nov 1, 2023
6c62bc8
Update innards_of_the_basic_setup.jl
ArseniyKholod Nov 1, 2023
bb518f5
mention ODE-Solvers
ArseniyKholod Nov 2, 2023
c5b8b28
Revert "Revert "Merge branch 'main' into semidiscretization-doc""
ArseniyKholod Nov 2, 2023
b8f8b0b
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Nov 2, 2023
85d6e8b
Revert "Merge branch 'main' into semidiscretization-doc"
ArseniyKholod Nov 2, 2023
df64699
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
39a9d78
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
26153db
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
35a61d3
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
e687172
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
740fbbb
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
4594ff8
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
d444631
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
3d7b59c
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
497118b
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
dd9ab85
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
96176b1
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
e874769
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
0179cf3
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
22b050f
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
b07e220
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
11e2687
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
d21db97
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
2f207a9
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
4dfef40
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
5a8669c
Update docs/literate/src/files/innards_of_the_basic_setup.jl
ArseniyKholod Nov 3, 2023
a2d71b3
Update docs/make.jl
ArseniyKholod Nov 3, 2023
e0693b9
Rename innards_of_the_basic_setup.jl to behind_the_scenes_simulation_…
ArseniyKholod Nov 3, 2023
3edd108
add plot scripts
ArseniyKholod Nov 3, 2023
6d5cbb2
Format_and_last_review_changes
ArseniyKholod Nov 3, 2023
f3d8d6e
spell+output_directory_figures
ArseniyKholod Nov 3, 2023
f9591f3
spell
ArseniyKholod Nov 3, 2023
452fb8c
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Nov 3, 2023
cc31a2c
Merge branch 'semidiscretization-doc' of https://github.com/ArseniyKh…
ArseniyKholod Nov 3, 2023
9aa8dd0
N->polydeg
ArseniyKholod Nov 3, 2023
536aac8
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Nov 3, 2023
971e875
add README for plots
ArseniyKholod Nov 3, 2023
42e04b8
line length <=100
ArseniyKholod Nov 3, 2023
43bf8b0
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Nov 5, 2023
837cff7
Update docs/literate/src/files/behind_the_scenes_simulation_setup_plo…
sloede Nov 8, 2023
b38516b
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Nov 8, 2023
49b5516
add empty lines
ArseniyKholod Nov 10, 2023
f5674ff
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
7da1488
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
91fac7f
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
691887e
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
2843ca9
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
cbbcc62
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
d7b1f40
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Nov 12, 2023
0123299
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 3, 2024
d981bb4
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Feb 3, 2024
01e875a
mention method of lines
ArseniyKholod Feb 3, 2024
09484d4
Update behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 3, 2024
af01b53
Update behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 3, 2024
2872a7d
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 4, 2024
290f27f
Merge branch 'main' into semidiscretization-doc
sloede Feb 7, 2024
e2909f9
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
74d9016
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
5d873b5
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
48bec7f
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
d2ef3a3
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
7f8d27c
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
d338f6e
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
8624a24
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
927140a
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Feb 11, 2024
aae8546
simplify rhs description
ArseniyKholod Feb 11, 2024
c3d140d
format
ArseniyKholod Feb 11, 2024
501b9d5
add interpolation to mortars
ArseniyKholod Feb 11, 2024
9d9a541
Update behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
072346b
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
DanielDoehring Feb 11, 2024
2c9c310
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
623b748
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
244d6f8
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
0ca226d
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
1eb7997
add resizability explanation
ArseniyKholod Feb 11, 2024
9ebd5e4
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 11, 2024
c39e5d9
format
ArseniyKholod Feb 11, 2024
7ff423c
add introduction as 2nd tutorial
ArseniyKholod Feb 13, 2024
c16b497
fix
ArseniyKholod Feb 13, 2024
49fb007
Update docs/literate/src/files/behind_the_scenes_simulation_setup.jl
ArseniyKholod Feb 15, 2024
a502c36
add unsafe_wrap explanation
ArseniyKholod Feb 16, 2024
e3ca61b
Merge branch 'main' into semidiscretization-doc
ArseniyKholod Feb 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
239 changes: 239 additions & 0 deletions docs/literate/src/files/behind_the_scenes_simulation_setup.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
#src # Behind the scenes of a simulation setup
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved

# 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 this setup
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# does not cover all details, it is based on relatively stable parts of Trixi.jl that are unlikely
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# 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.
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved

# ## Basic setup

# Import essential libraries and specify an equation.

using Trixi, OrdinaryDiffEq
equations = LinearScalarAdvectionEquation2D((-0.2, 0.7))

# Generate a spatial discretization using a [`TreeMesh`](@ref) with a pre-coarsened set of cells.

coordinates_min = (-2.0, -2.0)
coordinates_max = (2.0, 2.0)

coarsening_patches = ((type = "box", coordinates_min = [0.0, -2.0],
coordinates_max = [2.0, 0.0]),)

mesh = TreeMesh(coordinates_min, coordinates_max, initial_refinement_level = 2,
n_cells_max = 30_000,
coarsening_patches = coarsening_patches)

# The created `TreeMesh` looks like the following:

# ![TreeMesh_example](https://github.com/trixi-framework/Trixi.jl/assets/119304909/d5ef76ee-8246-4730-a692-b472c06063a3)

# Instantiate a [`DGSEM`](@ref) solver with a user-specified polynomial degree. The solver
# will define `polydeg + 1` Gauss-Lobatto nodes and their associated weights within
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# 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`.

solver = DGSEM(polydeg = 3)

# Gauss-Lobatto nodes with `polydeg = 3`:

# ![Gauss-Lobatto_nodes_example](https://github.com/trixi-framework/Trixi.jl/assets/119304909/1d894611-801e-4f75-bff0-d77ca1c672e5)

# ## Overview of the [`SemidiscretizationHyperbolic`](@ref) type

# 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 solving process. This is where [`SemidiscretizationHyperbolic`](@ref) comes
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# into play.

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
solver)

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


# - `init_elements(leaf_cell_ids, mesh, equations, dg.basis, RealT, uEltype)`

# The fundamental elements for approximating a solution are the leaf
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# cells. This implies that on each leaf cell and in each spatial direction, the solution is
# treated as a polynomial of the degree specified in the `DGSEM` solver and evaluated at the
# Gauss-Lobatto nodes, which were previously illustrated. The `init_elements` function extracts
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# 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 axis
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# of every element.


# ![elements_example](https://github.com/trixi-framework/Trixi.jl/assets/119304909/9f486670-b579-4e42-8697-439540c8bbb4)

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


# - `init_interfaces(leaf_cell_ids, mesh, elements)`
benegee marked this conversation as resolved.
Show resolved Hide resolved

# At this point, the elements with nodes have been defined; however, they lack the necessary
# communication functionality. This is crucial because the solutions on the elements are not
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# independent of each other. Furthermore, nodes on the boundary of adjacent elements share
# the same spatial location, requiring a method to combine their solutions.
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved

# As 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 solutions between neighbors during the solving process.
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved

# In our visualization, these interfaces would conceptually resemble tubes connecting the
# corresponding elements.

# ![interfaces_example](https://github.com/trixi-framework/Trixi.jl/assets/119304909/bc3b6b02-afbc-4371-aaf7-c7bdc5a6c540)


# - `init_mortars(leaf_cell_ids, mesh, elements, dg.mortar)`

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

# Mortars store information about the connected elements, their relative positions, and allocate
# containers for storing the solutions along the boundaries between these elements.
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved

# In our visualization, mortars are represented as branched tubes.

# ![mortars_example](https://github.com/trixi-framework/Trixi.jl/assets/119304909/43a95a60-3a31-4b1f-8724-14049e7a0481)


# - `init_boundaries(leaf_cell_ids, mesh, elements)`

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

# In our visualization, boundaries and their corresponding nodes are highlighted with green,
# semi-transparent lines.

# ![boundaries_example](https://github.com/trixi-framework/Trixi.jl/assets/119304909/21996b20-4a22-4dfb-b16a-e2c22c2f29fe)

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

# In conclusion, a `HyperbolicSemidiscretization`'s primary purpose is to collect equations, the
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# 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).

# As evident from the earlier description of `SemidiscretizationHyperbolic`, it comprises numerous
# functions called recursively. Without delving into details, the structure of the primary calls
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# can be illustrated as follows:
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved

# ![SemidiscretizationHyperbolic_structure](https://github.com/trixi-framework/Trixi.jl/assets/119304909/8bf59422-0537-4d7a-9f13-d9b2253c19d7)

# ## Overview of the [`semidiscretize`](@ref) function

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

# The purpose of the [`semidiscretize`](@ref) function is to wrap the semidiscretization as an
# `ODEProblem` within the specified time interval, while also applying the initial conditions at
# the initial time. This `ODEProblem` can be subsequently passed to the `solve`
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# function from the [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) package or to
# [`Trixi.solve`](@ref).

ode = semidiscretize(semi, (0.0, 1.0));

# The `semidiscretize` function involves a deep tree of recursive calls, with the primary ones
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# explained below.


# - `allocate_coefficients(mesh, equations, solver, cache)`

# To 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. The
# `allocate_coefficients` function initializes `u_ode` as a 1D vector with a length that depends
# on the number of variables, elements, nodes, and dimensions. The use of a 1D vector format
# allows one to resize the mesh (and thus change the number of elements) while utilizing the
# functionalities of OrdinaryDiffEq.jl.
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved


# - `wrap_array(u_ode, semi)`

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

# This is why the `u_ode` vector is wrapped by the `wrap_array` function to create a
# multidimensional array `u`, with each dimension representing variables, nodes and elements.
# Consequently, navigation within this multidimensional array becomes noticeably easier.
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved

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


# - `compute_coefficients!(u, initial_conditions, t, mesh::DG, equations, solver, cache)`

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

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

# In summary, the internal workings of `semidiscretize` with brief descriptions can be presented
# as follows.

# ![semidiscretize_structure](https://github.com/trixi-framework/Trixi.jl/assets/119304909/491eddc4-aadb-4e29-8c76-a7c821d0674e)

# ## Functions `solve` and `rhs!`

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

sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 0.01,
save_everystep = false);

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

# Trixi.jl includes a set of `rhs!` functions designed to compute `du`, i.e.,
# ``\partial u/\partial t`` according to the structure
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
# 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.

# The problem is that `rhs!` functions within Trixi.jl are specialized for specific solver and mesh
# types. However, the types of arguments passed to `rhs!` by time integration methods do not
# explicitly provide this information. Consequently, 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!`. It performs this by extracting the
# necessary data from the integrator and passing them, along with the originally received
# arguments, to the specialized for solver and mesh types `rhs!` function, which is
# responsible for calculating `du`.
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved

# Path from the `solve` function call to the appropriate `rhs!` function call:

# ![rhs_structure](https://github.com/trixi-framework/Trixi.jl/assets/119304909/dbea9a0e-25a4-4afa-855e-01f1ad619982)

# Computed solution:

using Plots
plot(sol)
pd = PlotData2D(sol)
plot!(getmesh(pd))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Plots for the tutorial "Behind the scenes of a simulation setup"

To create all the images for the tutorial, execute the following command from the directory of this `README.md`:
```julia
pkg> activate .
julia> include.(readdir("src"; join=true))
```
To create all images from a different directory, substitute `"src"` with the path to the `src`
folder. The resulting images will be generated in your current directory as PNG files.

To generate a specific image, run the following command while replacing `"path/to/src"` and `"file_name"` with the appropriate values:
```julia
pkg> activate .
julia> include(joinpath("path/to/src", "file_name"))
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Plots
plot(Shape([(-2.3,4.5), (2.35,4.5), (2.35,2.5), (-2.3,2.5)]), linecolor="black", fillcolor="white", label=false,linewidth=2, size=(800,600), showaxis=false, grid=false, xlim=(-2.4,2.8), ylim=(-25,5.5))
annotate!(2.3, 3.5, ("SemidiscretizationHyperbolic(mesh, equations, initial_conditions, solver; source_terms,
boundary_conditions, RealT, uEltype, initial_cache) ", 10, :black, :right))
annotate!(-2.3, 1.5, ("creates and returns SemidiscretizationHyperbolic object, initialized using a mesh, equations,
initial_conditions, boundary_conditions, source_terms, solver and cache", 9, :black, :left))
plot!([-1.2,-1.2],[0.6,-2],arrow=true,color=:black,linewidth=2,label="")
plot!([-1.2,-1.4],[0.6,-2],arrow=true,color=:black,linewidth=2,label="")
plot!([-1.2,-1.],[0.6,-2],arrow=true,color=:black,linewidth=2,label="")
annotate!(-1, -0.7, ("specialized for mesh
and solver types", 9, :black, :left))
plot!([1.25,1.25],[0.6,-2],arrow=true,color=:black,linewidth=2,label="")
plot!([1.25,1.05],[0.6,-2],arrow=true,color=:black,linewidth=2,label="")
plot!([1.25,1.45],[0.6,-2],arrow=true,color=:black,linewidth=2,label="")
annotate!(1.48, -0.7, ("specialized for mesh
and boundary_conditions
types", 9, :black, :left))

plot!(Shape([(-2.3,-2), (-0.1,-2), (-0.1,-4), (-2.3,-4)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.2, -3, ("create_cache(mesh::TreeMesh, equations,
solver::Dg, RealT, uEltype)", 10, :black, :center))
plot!([-2.22,-2.22],[-4,-22],arrow=false,color=:black,linewidth=2,label="")

plot!(Shape([(-0.05,-2), (2.6,-2), (2.6,-4), (-0.05,-4)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(1.27, -3, ("digest_boundary_conditions(boundary_conditions,
mesh, solver, cache)", 10, :black, :center))
annotate!(2.6, -5, ("if necessary, converts passed boundary_conditions
into a suitable form for processing by Trixi.jl", 9, :black, :right))

plot!(Shape([(-2,-6), (-0.55,-6), (-0.55,-7.1), (-2,-7.1)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.95, -6.5, ("local_leaf_cells(mesh.tree)", 10, :black, :left))
annotate!(-2, -7.5, ("returns cells for which an element needs to be created (i.e. all leaf cells)", 9, :black, :left))
plot!([-2.22,-2],[-6.5,-6.5],arrow=true,color=:black,linewidth=2,label="")

plot!(Shape([(-2,-9), (1.73,-9), (1.73,-10.1), (-2,-10.1)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.95, -9.5, ("init_elements(leaf_cell_ids, mesh, equations, dg.basis, RealT, uEltype)", 10, :black, :left))
annotate!(-2, -10.5, ("creates and initializes elements, projects Gauss-Lobatto basis onto each of them", 9, :black, :left))
plot!([-2.22,-2],[-9.5,-9.5],arrow=true,color=:black,linewidth=2,label="")

plot!(Shape([(-2,-12), (0.4,-12), (0.4,-13.1), (-2,-13.1)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.95, -12.5, ("init_interfaces(leaf_cell_ids, mesh, elements)", 10, :black, :left))
annotate!(-2, -13.5, ("creates and initializes interfaces between each pair of adjacent elements of the same size", 9, :black, :left))
plot!([-2.22,-2],[-12.5,-12.5],arrow=true,color=:black,linewidth=2,label="")

plot!(Shape([(-2,-15), (0.5,-15), (0.5,-16.1), (-2,-16.1)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.95, -15.5, ("init_boundaries(leaf_cell_ids, mesh, elements)", 10, :black, :left))
annotate!(-2, -17, ("creates and initializes boundaries, remembers each boundary element, as well as the coordinates of
each boundary node", 9, :black, :left))
plot!([-2.22,-2],[-15.5,-15.5],arrow=true,color=:black,linewidth=2,label="")

plot!(Shape([(-1.6,-18), (1.3,-18), (1.3,-19.1), (-1.6,-19.1)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.55, -18.5, ("init_mortars(leaf_cell_ids, mesh, elements, dg.mortar)", 10, :black, :left))
annotate!(-1.6, -20, ("creates and initializes mortars (type of interfaces) between each triple of adjacent coarsened
and corresponding small elements", 9, :black, :left))
plot!([-2.22,-1.6],[-18.5,-18.5],arrow=true,color=:black,linewidth=2,label="")
annotate!(-2.15, -19, ("2D and 3D", 8, :black, :left))

plot!(Shape([(-2,-21), (1.5,-21), (1.5,-23.1), (-2,-23.1)]), linecolor="black", fillcolor="white", label=false,linewidth=2)
annotate!(-1.95, -22, ("create_cache(mesh, equations, dg.volume_integral, dg, uEltype)
for 2D and 3D create_cache(mesh, equations, dg.mortar, uEltype)", 10, :black, :left))
annotate!(-2, -23.5, ("add specialized parts of the cache required to compute the volume integral, etc.", 9, :black, :left))
plot!([-2.22,-2],[-22,-22],arrow=true,color=:black,linewidth=2,label="")

savefig("./SemidiscretizationHyperbolic")
Loading