From 76e98c5ce26f69624ce84b8b180907ca8346615f Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:50:55 +0200 Subject: [PATCH 01/23] 1st part of new comments processing --- .../files/first_steps/create_first_setup.jl | 21 +++-- .../src/files/first_steps/getting_started.jl | 88 +++++++++++-------- docs/make.jl | 2 +- 3 files changed, 65 insertions(+), 46 deletions(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 906a6f93461..05593560d0c 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -1,4 +1,4 @@ -#src # Create first setup +#src # Create your first setup # In this part of the introductory guide, we will create a first Trixi.jl setup as an extension of # [`elixir_advection_basic.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_advection_basic.jl). @@ -19,7 +19,9 @@ # 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](https://code.visualstudio.com/)). -# In this file you will create your setup. +# In this file you will create your setup. Alternatively, you can execute each line of the +# following code one by one in the Julia REPL. This will generate useful output for nearly every +# command and improve your comprehension of the process. # To be able to use functionalities of Trixi.jl, you always need to load Trixi.jl itself # and the [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) package. @@ -65,7 +67,8 @@ mesh = TreeMesh(coordinates_min, coordinates_max, # To approximate the solution of the defined model, we create a [`DGSEM`](@ref) 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](@ref scalar_linear_advection_1d) tutorial. +# check out the [Introduction to DG methods](@ref scalar_linear_advection_1d) tutorial. Per default +# `DGSEM` initializes the surface flux as central and the volume integral in the weak form. solver = DGSEM(polydeg=3) @@ -90,8 +93,8 @@ solver = DGSEM(polydeg=3) # [section about analyzing the solution](https://trixi-framework.github.io/Trixi.jl/stable/callbacks/#Analyzing-the-numerical-solution). function initial_condition_sinpi(x, t, equations::LinearScalarAdvectionEquation2D) - scalar = sinpi(x[1]) * sinpi(x[2]) - return SVector(scalar) + u = sinpi(x[1]) * sinpi(x[2]) + return SVector(u) end initial_condition = initial_condition_sinpi @@ -103,8 +106,8 @@ initial_condition = initial_condition_sinpi # equation itself as arguments and returns the source term as a static vector `SVector`. function source_term_exp_sinpi(u, x, t, equations::LinearScalarAdvectionEquation2D) - scalar = - 2 * exp(-t) * sinpi(2*(x[1] - t)) * sinpi(2*(x[2] - t)) - return SVector(scalar) + u = - 2 * exp(-t) * sinpi(2*(x[1] - t)) * sinpi(2*(x[2] - t)) + return SVector(u) end # Now we collect all the information that is necessary to define a spatial discretization, @@ -126,7 +129,7 @@ ode = semidiscretize(semi, tspan); # We will show you how to use some of the common callbacks. # To print a summary of the simulation setup at the beginning -# and to reset timers we use the [`SummaryCallback`](@ref). +# and to reset timers to zero, we use the [`SummaryCallback`](@ref). # When the returned callback is executed directly, the current timer values are shown. summary_callback = SummaryCallback() @@ -171,7 +174,7 @@ save_restart = SaveRestartCallback(interval = 100, save_final_restart = true) # function. callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback, save_solution, - save_restart) + save_restart); # The last step is to choose the time integration method. OrdinaryDiffEq.jl defines a wide range of # [ODE solvers](https://docs.sciml.ai/DiffEqDocs/latest/solvers/ode_solve/), e.g. diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 2bfaf33b5fc..1b267b48a52 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -32,6 +32,8 @@ # ```shell # winget install julia -s msstore # ``` +# Note: This installation method requires the use of MS Store, therefore, an MS Store account +# is necessary to proceed. # - Verify the successful installation of Julia by executing the following command in the terminal: # ```shell # julia @@ -69,11 +71,14 @@ # [Plots.jl](https://github.com/JuliaPlots/Plots.jl). # - Open a terminal and start Julia. -# - Execute following commands: +# - Execute the following commands to install all mentioned packages. Please note that the +# installation process involves downloading and precompiling the source code, which may take +# approximately 30 minutes. # ```julia # import Pkg # Pkg.add(["OrdinaryDiffEq", "Plots", "Trixi"]) # ``` +# - On Windows, the firewall may request for permission to install packages. # Now you have installed all these # packages. [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) provides time @@ -102,7 +107,40 @@ # 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`](@ref)) -# with a weak blast wave as the initial condition. +# with a weak blast wave as the initial condition and periodic boundary conditions. Compressible +# Euler equations describes the motions of an ideal gas. + +# The compressible Euler equations in two spatial dimensions, +# ```math +# \frac{\partial}{\partial t} +# \begin{pmatrix} +# \rho \\ \rho v_1 \\ \rho v_2 \\ \rho e +# \end{pmatrix} +# + +# \frac{\partial}{\partial x} +# \begin{pmatrix} +# \rho v_1 \\ \rho v_1^2 + p \\ \rho v_1 v_2 \\ (\rho e + p) v_1 +# \end{pmatrix} +# + +# \frac{\partial}{\partial y} +# \begin{pmatrix} +# \rho v_2 \\ \rho v_1 v_2 \\ \rho v_2^2 + p \\ (\rho e + p) v_2 +# \end{pmatrix} +# = +# \begin{pmatrix} +# 0 \\ 0 \\ 0 \\ 0 +# \end{pmatrix}, +# ``` +# 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 +# ```math +# p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2 + v_2^2) \right) +# ``` +# is the pressure. + +# The initial conditions for the weak blast wave are specified in +# [`compressible_euler_2d.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/src/equations/compressible_euler_2d.jl) # Start Julia in a terminal and execute the following code: @@ -113,9 +151,17 @@ using Trixi, OrdinaryDiffEq #hide #md trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_ec.jl")) #hide #md +# The solution was approximated over the [`TreeMesh`](@ref) using the CarpenterKennedy2N54 ODE +# solver. Further details about the ODE solver can be found on the +# [`DifferentialEquations.jl page`](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/) + # 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. +# defined in the executed example and it contains the solution at the final moment of the +# simulation. `sol.u` holds the vector of values at each saved timestep, while `sol.t` holds the +# corresponding times for each saved timestep. In this instance, only two timesteps were saved: the +# initial and final ones. The plot depicts the evolution of the weak blast wave at the final moment +# of time, showing the density, velocities, and pressure of the ideal gas across a 2D domain. using Plots plot(sol) @@ -146,39 +192,9 @@ get_examples() # ### Modifying an existing setup # 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, -# ```math -# \frac{\partial}{\partial t} -# \begin{pmatrix} -# \rho \\ \rho v_1 \\ \rho v_2 \\ \rho e -# \end{pmatrix} -# + -# \frac{\partial}{\partial x} -# \begin{pmatrix} -# \rho v_1 \\ \rho v_1^2 + p \\ \rho v_1 v_2 \\ (\rho e + p) v_1 -# \end{pmatrix} -# + -# \frac{\partial}{\partial y} -# \begin{pmatrix} -# \rho v_2 \\ \rho v_1 v_2 \\ \rho v_2^2 + p \\ (\rho e + p) v_2 -# \end{pmatrix} -# = -# \begin{pmatrix} -# 0 \\ 0 \\ 0 \\ 0 -# \end{pmatrix}, -# ``` -# 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 -# ```math -# p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2 + v_2^2) \right) -# ``` -# 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. +# `elixir_euler_ec.jl`. 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. # - Open the downloaded file `elixir_euler_ec.jl` with a text editor. # - Go to the line with the following code: diff --git a/docs/make.jl b/docs/make.jl index f752a7b0ee6..30213238d31 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -69,7 +69,7 @@ files = [ # Topic: introduction "First steps in Trixi.jl" => [ "Getting started" => ("first_steps", "getting_started.jl"), - "Create first setup" => ("first_steps", "create_first_setup.jl"), + "Create your first setup" => ("first_steps", "create_first_setup.jl"), "Changing Trixi.jl itself" => ("first_steps", "changing_trixi.jl"), ], "Behind the scenes of a simulation setup" => "behind_the_scenes_simulation_setup.jl", From 00feb523c6adf6b5bc67a1cae18276c9aa43ea70 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:51:24 +0300 Subject: [PATCH 02/23] 2nd part --- .../src/files/first_steps/changing_trixi.jl | 36 ++++++++- .../files/first_steps/create_first_setup.jl | 74 ++++++++++++------- .../src/files/first_steps/getting_started.jl | 2 +- 3 files changed, 81 insertions(+), 31 deletions(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index 551377a6a71..967e6345034 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -4,6 +4,14 @@ # the cloned directory. +# ## Forking Trixi.jl + +# To create your own fork of Trixi.jl, log in to your GitHub account, visit the +# [`Trixi.jl github`](https://github.com/trixi-framework/Trixi.jl) repository and click the `Fork` +# button located in the upper-right corner of the page. Then, click on `Create fork` in the opened +# window to complete the forking process. + + # ## Cloning Trixi.jl @@ -15,8 +23,10 @@ # - Download and install [GitHub Desktop](https://desktop.github.com/) and then log in to # your account. # - Open GitHub Desktop, press `Ctrl+Shift+O`. -# - In 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. +# - In the opened window, navigate to the `URL` tab and paste `trixi-framework/Trixi.jl` or +# `YourGitHubUserName/Trixi.jl` to clone your own fork of Trixi.jl, 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. # Now you cloned Trixi.jl and only need to tell Julia to use the local clone as the package sources: # - Open a terminal using `Win+r` and `cmd`. Navigate to the folder with the cloned Trixi.jl using `cd`. @@ -54,6 +64,9 @@ # julia --project=. -e 'using Pkg; Pkg.develop(PackageSpec(path=".."))' # Tell Julia to use the local Trixi.jl clone # julia --project=. -e 'using Pkg; Pkg.add(["OrdinaryDiffEq", "Plots"])' # Install additional packages # ``` +# Alternatively, you can clone your own fork of Trixi.jl by replacing the link +# `git@github.com:trixi-framework/Trixi.jl.git` with `git@github.com:YourGitHubUserName/Trixi.jl.git`. + # 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., # ```shell @@ -62,6 +75,25 @@ # if already inside the `run` directory. +# ## Developing Trixi.jl + +# If you've created and cloned your own fork of Trixi.jl, you can make local changes to Trixi.jl +# and propose them as a `Pull Request` to be merged into `trixi-framework/Trixi.jl`. + +# Linux and MacOS utilize the `git` version control system to manage changes between your local and +# remote repositories. The most commonly used commands include `add`, `commit`, `push` and `pull`. +# You can find detailed information about these functions in the +# [`Git documentation`](https://git-scm.com/docs). + +# For Windows and GitHub Desktop users, refer to the +# [`making-changes-in-a-branch`](https://docs.github.com/en/desktop/overview/getting-started-with-github-desktop#making-changes-in-a-branch) +# documentation. + +# After making local changes to Trixi.jl and pushing them to the remote repository, you can open a +# `Pull Request` from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow +# the `Review checklist` provided in the `Pull Request` to streamline the review process. + + # ## Additional reading # To further delve into Trixi.jl, you may have a look at the following introductory tutorials. diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 05593560d0c..625eaa1364c 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -130,7 +130,6 @@ ode = semidiscretize(semi, tspan); # To print a summary of the simulation setup at the beginning # and to reset timers to zero, we use the [`SummaryCallback`](@ref). -# When the returned callback is executed directly, the current timer values are shown. summary_callback = SummaryCallback() @@ -138,13 +137,18 @@ summary_callback = SummaryCallback() # The [`AnalysisCallback`](@ref) outputs some useful statistical information during the solving process # every `interval` time steps. -analysis_callback = AnalysisCallback(semi, interval = 5) +analysis_callback = AnalysisCallback(semi, interval = 20) + +# An inexpensive callback that indicates a simulation is still running by periodically printing +# information, such as the current time, to the screen every `alive_interval` time steps. + +alive_callback = AliveCallback(alive_interval = 10) # It is also possible to control the time step size using the [`StepsizeCallback`](@ref) if the time # integration method isn't adaptive itself. To get more details, look at # [CFL based step size control](@ref CFL-based-step-size-control). -stepsize_callback = StepsizeCallback(cfl = 1.6) +stepsize_callback = StepsizeCallback(cfl = 0.9) # To save the current solution in regular intervals we use the [`SaveSolutionCallback`](@ref). # We would like to save the initial and final solutions as well. The data @@ -152,7 +156,7 @@ stepsize_callback = StepsizeCallback(cfl = 1.6) # a solution from saved files using Trixi2Vtk.jl and ParaView, which is described below in the # section [Visualize the solution](@ref Visualize-the-solution). -save_solution = SaveSolutionCallback(interval = 5, +save_solution = SaveSolutionCallback(interval = 20, save_initial_solution = true, save_final_solution = true) @@ -173,19 +177,18 @@ save_restart = SaveRestartCallback(interval = 100, save_final_restart = true) # Create a `CallbackSet` to collect all callbacks so that they can be passed to the `solve` # function. -callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback, save_solution, - save_restart); +callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, stepsize_callback, + save_solution, save_restart); # The last step is to choose the time integration method. OrdinaryDiffEq.jl defines a wide range of -# [ODE solvers](https://docs.sciml.ai/DiffEqDocs/latest/solvers/ode_solve/), 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 +# [ODE solvers](https://docs.sciml.ai/DiffEqDocs/latest/solvers/ode_solve/), including the +# three-stage, third-order strong stability preserving Runge-Kutta method `SSPRK33`. 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. -sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0, - save_everystep = false, callback = callbacks); +sol = solve(ode, SSPRK33(); dt = 1.0, save_everystep = false, callback = callbacks); # Finally, we print the timer summary. @@ -205,17 +208,32 @@ summary_callback() # ### Using Plots.jl # The first option is to use the [Plots.jl](https://github.com/JuliaPlots/Plots.jl) package -# directly after calculations, when the solution is saved in the `sol` variable. We load the -# package and use the `plot` function. +# directly after calculations, when the solution is saved in the `sol` variable. using Plots -plot(sol) -# To show the mesh on the plot, we need to extract the visualization data from the solution as -# a [`PlotData2D`](@ref) object. Mesh extraction is possible using the [`getmesh`](@ref) function. +# As was shown in the [Getting started](@ref getting_started) section, you can plot all +# differential variables from the system of equations by executing the following. +# ```julia +# plot(sol) +# ``` +# Alternatively, you can configure the plot more precisely. Trixi.jl suggests a special structure +# to extract the visualization data from the solution as a [`PlotData2D`](@ref) object. + +pd = PlotData2D(sol); + +# You can plot specific variables from the system of equations by referring to their names. +# To obtain the names of all variables, execute the following. + +@show pd.variable_names; + +# Plot the variable named "scalar". + +plot(pd["scalar"]) + +# Mesh extraction is possible using the [`getmesh`](@ref) function. # Plots.jl has the `plot!` function that allows you to modify an already built graph. -pd = PlotData2D(sol) plot!(getmesh(pd)) @@ -225,38 +243,38 @@ plot!(getmesh(pd)) # `solve` function with [`SaveSolutionCallback`](@ref) 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](@ref) 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](https://www.paraview.org) or -# [VisIt](https://visit.llnl.gov) to plot the solution. The important thing is that currently -# Trixi2Vtk.jl supports conversion only for solutions in 2D and 3D spatial domains. +# With [Trixi2Vtk](@ref) you can convert the HDF5 output file generated by Trixi.jl into a VTK/VTU +# files. VTK/VTU are specialized formats designed to store structured data required for +# visualization purposes. This can be used in visualization tools such as +# [ParaView](https://www.paraview.org) or [VisIt](https://visit.llnl.gov) to plot the solution. # If you haven't added Trixi2Vtk.jl to your project yet, you can add it as follows. # ```julia # import Pkg # Pkg.add(["Trixi2Vtk"]) # ``` -# Now we load the Trixi2Vtk.jl package and convert the file `out/solution_000018.h5` with +# Now we load the Trixi2Vtk.jl package and convert the file `out/solution_000032.h5` with # the final solution using the [`trixi2vtk`](@ref) function saving the resulting file in the # `out` folder. using Trixi2Vtk -trixi2vtk(joinpath("out", "solution_000018.h5"), output_directory="out") +trixi2vtk(joinpath("out", "solution_000032.h5"), output_directory="out") -# Now two files `solution_000018.vtu` and `solution_000018_celldata.vtu` have been generated in the +# Now two files `solution_000032.vtu` and `solution_000032_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. # Now let's visualize the solution from the generated files in ParaView. Follow this short # instruction to get the visualization. # - Download, install and open [ParaView](https://www.paraview.org/download/). -# - Press `Ctrl+O` and select the generated files `solution_000018.vtu` and -# `solution_000018_celldata.vtu` from the `out` folder. +# - Press `Ctrl+O` and select the generated files `solution_000032.vtu` and +# `solution_000032_celldata.vtu` from the `out` folder. # - In the upper-left corner in the Pipeline Browser window, left-click on the eye-icon near -# `solution_000018.vtu`. +# `solution_000032.vtu`. # - In 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. # - Now 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`. +# Pipeline Browser window, left-click on the eye-icon near `solution_000032_celldata.vtu`. # - In the lower-left corner in the Properties window, change the Representation from Surface # to Wireframe. Then a white grid should appear on the visualization. # Now, if you followed the instructions exactly, you should get a similar image as shown in the diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 1b267b48a52..0cdf8dd2325 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -253,6 +253,6 @@ plot(p1, p2, p3, p4) #hide #md # 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](@ref create_first_setup). +# the introduction titled [Create your first setup](@ref create_first_setup). Sys.rm("out"; recursive=true, force=true) #hide #md \ No newline at end of file From ce72285b70c77d90d6550f4a240f8a14ecd6a513 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Sun, 31 Mar 2024 18:16:35 +0300 Subject: [PATCH 03/23] Update create_first_setup.jl --- .../literate/src/files/first_steps/create_first_setup.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 625eaa1364c..8dacf7ddc65 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -134,13 +134,14 @@ ode = semidiscretize(semi, tspan); summary_callback = SummaryCallback() # We also want to analyze the current state of the solution in regular intervals. -# The [`AnalysisCallback`](@ref) outputs some useful statistical information during the solving process -# every `interval` time steps. +# The [`AnalysisCallback`](@ref) outputs some useful statistical information during the solving +# process every `interval` time steps. analysis_callback = AnalysisCallback(semi, interval = 20) -# An inexpensive callback that indicates a simulation is still running by periodically printing -# information, such as the current time, to the screen every `alive_interval` time steps. +# To indicate that a simulation is still running by periodically printing information, such as the +# current time, to the screen every `alive_interval` time steps, we utilize the inexpensive +# [`AliveCallback`](@ref). alive_callback = AliveCallback(alive_interval = 10) From 826f2179ff7b55696778f2bb3027547034ace69d Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Sun, 31 Mar 2024 18:22:14 +0300 Subject: [PATCH 04/23] Update getting_started.jl --- docs/literate/src/files/first_steps/getting_started.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 0cdf8dd2325..805ee0ee300 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -139,7 +139,7 @@ # ``` # is the pressure. -# The initial conditions for the weak blast wave are specified in +# The weak blast wave initial conditions are specified in # [`compressible_euler_2d.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/src/equations/compressible_euler_2d.jl) # Start Julia in a terminal and execute the following code: From ebb708098b009c4128241c8e27a3b406ecbfeafd Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Sun, 31 Mar 2024 19:07:29 +0300 Subject: [PATCH 05/23] Update create_first_setup.jl --- docs/literate/src/files/first_steps/create_first_setup.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 8dacf7ddc65..a31a2f27f68 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -214,7 +214,7 @@ summary_callback() using Plots # As was shown in the [Getting started](@ref getting_started) section, you can plot all -# differential variables from the system of equations by executing the following. +# variables from the system of equations by executing the following. # ```julia # plot(sol) # ``` From bedd0b4711b77130a5fb179261ca4dd1d99adbea Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Sun, 31 Mar 2024 21:38:10 +0300 Subject: [PATCH 06/23] part 3 --- docs/literate/src/files/first_steps/create_first_setup.jl | 3 ++- docs/literate/src/files/first_steps/getting_started.jl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index a31a2f27f68..8ed1ccfa377 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -116,8 +116,9 @@ end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_term_exp_sinpi) +# tspan = (0.0, 1.0) -ode = semidiscretize(semi, tspan); +ode = semidiscretize(semi, tspan) # At this point, our problem is defined. We will use the `solve` function defined in # [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) to get the solution. diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 805ee0ee300..5c68adc6dc3 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -139,7 +139,7 @@ # ``` # is the pressure. -# The weak blast wave initial conditions are specified in +# The [`initial_condition_weak_blast_wave`](@ref) is specified in # [`compressible_euler_2d.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/src/equations/compressible_euler_2d.jl) # Start Julia in a terminal and execute the following code: @@ -218,6 +218,7 @@ function initial_condition_density_waves(x, t, equations::CompressibleEulerEquat return SVector(rho, rho*v1, rho*v2, rho_e) end initial_condition = initial_condition_density_waves +nothing; #hide #md # - 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. From 5fd2534884ae255cf6c2ad8502088a22b7c2ab86 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:41:34 +0300 Subject: [PATCH 07/23] add tutorial link --- docs/literate/src/files/first_steps/changing_trixi.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index 967e6345034..da1258b0674 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -97,6 +97,11 @@ # ## Additional reading # To further delve into Trixi.jl, you may have a look at the following introductory tutorials. +# - [Behind the scenes of a simulation setup](@ref behind_the_scenes_simulation_setup) 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. It clarifies some of the more +# fundamental, technical concepts that are applicable to a variety of (also more complex) +# configurations. # - [Introduction to DG methods](@ref scalar_linear_advection_1d) 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 From 9c8fff9e234dadd813cf4486b3283f977749cc4a Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:51:52 +0300 Subject: [PATCH 08/23] Update getting_started.jl --- docs/literate/src/files/first_steps/getting_started.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 5c68adc6dc3..1bcb502e705 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -192,9 +192,9 @@ get_examples() # ### Modifying an existing setup # As an example, we will change the initial condition for calculations that occur in -# `elixir_euler_ec.jl`. 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. +# `elixir_euler_ec.jl`. Initial conditions for [`CompressibleEulerEquations2D`](@ref) 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. # - Open the downloaded file `elixir_euler_ec.jl` with a text editor. # - Go to the line with the following code: From a7e6908b5139a5df5d57e846f771372f3bf76102 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:05:40 +0200 Subject: [PATCH 09/23] Update docs/literate/src/files/first_steps/changing_trixi.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/changing_trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index da1258b0674..92018c20f88 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -7,7 +7,7 @@ # ## Forking Trixi.jl # To create your own fork of Trixi.jl, log in to your GitHub account, visit the -# [`Trixi.jl github`](https://github.com/trixi-framework/Trixi.jl) repository and click the `Fork` +# [`Trixi.jl GitHub repository`](https://github.com/trixi-framework/Trixi.jl) and click the `Fork` # button located in the upper-right corner of the page. Then, click on `Create fork` in the opened # window to complete the forking process. From bbc2dea5089c59c2a8f3b26e93f450ef9a6b12a2 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:05:50 +0200 Subject: [PATCH 10/23] Update docs/literate/src/files/first_steps/changing_trixi.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/changing_trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index 92018c20f88..62ebbe78ae7 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -24,7 +24,7 @@ # your account. # - Open GitHub Desktop, press `Ctrl+Shift+O`. # - In the opened window, navigate to the `URL` tab and paste `trixi-framework/Trixi.jl` or -# `YourGitHubUserName/Trixi.jl` to clone your own fork of Trixi.jl, choose the +# `YourGitHubUserName/Trixi.jl` to clone your own fork of 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. From e90b4ffad87c3eb71a968a6b04e0eccad9416192 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:05:58 +0200 Subject: [PATCH 11/23] Update docs/literate/src/files/first_steps/changing_trixi.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/changing_trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index 62ebbe78ae7..a0167ba5b1a 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -83,7 +83,7 @@ # Linux and MacOS utilize the `git` version control system to manage changes between your local and # remote repositories. The most commonly used commands include `add`, `commit`, `push` and `pull`. # You can find detailed information about these functions in the -# [`Git documentation`](https://git-scm.com/docs). +# [Git documentation](https://git-scm.com/docs). # For Windows and GitHub Desktop users, refer to the # [`making-changes-in-a-branch`](https://docs.github.com/en/desktop/overview/getting-started-with-github-desktop#making-changes-in-a-branch) From 9cbaded4557d3d8e4fd48461aa748484c904f323 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:06:17 +0200 Subject: [PATCH 12/23] Update docs/literate/src/files/first_steps/changing_trixi.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/changing_trixi.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index a0167ba5b1a..84ce0ddcc3f 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -86,8 +86,7 @@ # [Git documentation](https://git-scm.com/docs). # For Windows and GitHub Desktop users, refer to the -# [`making-changes-in-a-branch`](https://docs.github.com/en/desktop/overview/getting-started-with-github-desktop#making-changes-in-a-branch) -# documentation. +# [documentation of GitHub Desktop](https://docs.github.com/en/desktop/overview/getting-started-with-github-desktop#making-changes-in-a-branch). # After making local changes to Trixi.jl and pushing them to the remote repository, you can open a # `Pull Request` from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow From 8121fa403d8fbf053fa1d0142cb6f362cbc42082 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:11:52 +0200 Subject: [PATCH 13/23] Update docs/literate/src/files/first_steps/changing_trixi.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/changing_trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index 84ce0ddcc3f..c0432d126d9 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -89,7 +89,7 @@ # [documentation of GitHub Desktop](https://docs.github.com/en/desktop/overview/getting-started-with-github-desktop#making-changes-in-a-branch). # After making local changes to Trixi.jl and pushing them to the remote repository, you can open a -# `Pull Request` from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow +# Pull Request from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow # the `Review checklist` provided in the `Pull Request` to streamline the review process. From 644711cb0bb4be75023dbbda18bcf2c0683d6fd8 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:12:02 +0200 Subject: [PATCH 14/23] Update docs/literate/src/files/first_steps/changing_trixi.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/changing_trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index c0432d126d9..d9f5a3783c3 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -90,7 +90,7 @@ # After making local changes to Trixi.jl and pushing them to the remote repository, you can open a # Pull Request from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow -# the `Review checklist` provided in the `Pull Request` to streamline the review process. +# the Review checklist provided in the Pull Request to streamline the review process. # ## Additional reading From 6d2b42b242f14419beac3430ac6d4e05b478e082 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:15:46 +0200 Subject: [PATCH 15/23] Update docs/literate/src/files/first_steps/getting_started.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/getting_started.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 1bcb502e705..9f6d9569973 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -107,8 +107,8 @@ # 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`](@ref)) -# with a weak blast wave as the initial condition and periodic boundary conditions. Compressible -# Euler equations describes the motions of an ideal gas. +# with a weak blast wave as the initial condition and periodic boundary conditions. The compressible +# Euler equations describe the motion of an ideal gas. # The compressible Euler equations in two spatial dimensions, # ```math From 980dd97fe82da2ba2a944cde4f0e7fa1ccc7919a Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:16:03 +0200 Subject: [PATCH 16/23] Update docs/literate/src/files/first_steps/getting_started.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/getting_started.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 9f6d9569973..24a9d0989ed 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -110,7 +110,7 @@ # with a weak blast wave as the initial condition and periodic boundary conditions. The compressible # Euler equations describe the motion of an ideal gas. -# The compressible Euler equations in two spatial dimensions, +# The compressible Euler equations in two spatial dimensions are given by # ```math # \frac{\partial}{\partial t} # \begin{pmatrix} From 556b6bbf13e94d79f86f2351ab90896a0abecd0b Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:16:12 +0200 Subject: [PATCH 17/23] Update docs/literate/src/files/first_steps/getting_started.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/getting_started.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 24a9d0989ed..6faa24bacb0 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -151,7 +151,7 @@ using Trixi, OrdinaryDiffEq #hide #md trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_ec.jl")) #hide #md -# The solution was approximated over the [`TreeMesh`](@ref) using the CarpenterKennedy2N54 ODE +# The solution was approximated over the [`TreeMesh`](@ref) using the `CarpenterKennedy2N54` ODE # solver. Further details about the ODE solver can be found on the # [`DifferentialEquations.jl page`](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/) From e2371ea70b15f8612a8dc9540555318e7ed008e6 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:16:23 +0200 Subject: [PATCH 18/23] Update docs/literate/src/files/first_steps/getting_started.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/getting_started.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 6faa24bacb0..191dfa992bf 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -152,8 +152,8 @@ using Trixi, OrdinaryDiffEq #hide #md trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_ec.jl")) #hide #md # The solution was approximated over the [`TreeMesh`](@ref) using the `CarpenterKennedy2N54` ODE -# solver. Further details about the ODE solver can be found on the -# [`DifferentialEquations.jl page`](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/) +# solver. Further details about the ODE solver can be found in the +# [documentation of OrdinaryDiffEq.jl](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/#Low-Storage-Methods) # 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 From f2ba355a5d89381b34099c3102ca40f5c9fa939d Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 1 Apr 2024 13:17:10 +0200 Subject: [PATCH 19/23] Update docs/literate/src/files/first_steps/getting_started.jl Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- docs/literate/src/files/first_steps/getting_started.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 191dfa992bf..a73370fb6f3 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -160,7 +160,7 @@ trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_eule # defined in the executed example and it contains the solution at the final moment of the # simulation. `sol.u` holds the vector of values at each saved timestep, while `sol.t` holds the # corresponding times for each saved timestep. In this instance, only two timesteps were saved: the -# initial and final ones. The plot depicts the evolution of the weak blast wave at the final moment +# initial and final ones. The plot depicts the distribution of the weak blast wave at the final moment # of time, showing the density, velocities, and pressure of the ideal gas across a 2D domain. using Plots From 9e5952a571784c15034dc7baed38053b41822baf Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:17:13 +0200 Subject: [PATCH 20/23] Apply suggestions from code review Co-authored-by: Hendrik Ranocha --- docs/literate/src/files/first_steps/changing_trixi.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/literate/src/files/first_steps/changing_trixi.jl b/docs/literate/src/files/first_steps/changing_trixi.jl index d9f5a3783c3..b8f1fff6de8 100644 --- a/docs/literate/src/files/first_steps/changing_trixi.jl +++ b/docs/literate/src/files/first_steps/changing_trixi.jl @@ -7,7 +7,7 @@ # ## Forking Trixi.jl # To create your own fork of Trixi.jl, log in to your GitHub account, visit the -# [`Trixi.jl GitHub repository`](https://github.com/trixi-framework/Trixi.jl) and click the `Fork` +# [Trixi.jl GitHub repository](https://github.com/trixi-framework/Trixi.jl) and click the `Fork` # button located in the upper-right corner of the page. Then, click on `Create fork` in the opened # window to complete the forking process. @@ -78,7 +78,7 @@ # ## Developing Trixi.jl # If you've created and cloned your own fork of Trixi.jl, you can make local changes to Trixi.jl -# and propose them as a `Pull Request` to be merged into `trixi-framework/Trixi.jl`. +# and propose them as a Pull Request (PR) to be merged into `trixi-framework/Trixi.jl`. # Linux and MacOS utilize the `git` version control system to manage changes between your local and # remote repositories. The most commonly used commands include `add`, `commit`, `push` and `pull`. @@ -89,7 +89,7 @@ # [documentation of GitHub Desktop](https://docs.github.com/en/desktop/overview/getting-started-with-github-desktop#making-changes-in-a-branch). # After making local changes to Trixi.jl and pushing them to the remote repository, you can open a -# Pull Request from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow +# Pull Request (PR) from your branch to the main branch of `trixi-framework/Trixi.jl`. Then, follow # the Review checklist provided in the Pull Request to streamline the review process. From a44024f7175e563f62106a2435677cb37dbbe855 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:51:53 +0300 Subject: [PATCH 21/23] Apply suggestions from code review Co-authored-by: Manuel Torrilhon --- .../files/first_steps/create_first_setup.jl | 13 ++++++---- .../src/files/first_steps/getting_started.jl | 24 ++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 8ed1ccfa377..5ac58c6ac4d 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -19,8 +19,9 @@ # 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](https://code.visualstudio.com/)). -# In this file you will create your setup. Alternatively, you can execute each line of the -# following code one by one in the Julia REPL. This will generate useful output for nearly every +# In this file you will create your setup and the file can then be executed in Julia using, for example, `trixi_include()`. +# Alternatively, you can execute each line of the following code one by one in the +# Julia REPL. This will generate useful output for nearly every # command and improve your comprehension of the process. # To be able to use functionalities of Trixi.jl, you always need to load Trixi.jl itself @@ -68,7 +69,7 @@ mesh = TreeMesh(coordinates_min, coordinates_max, # 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](@ref scalar_linear_advection_1d) tutorial. Per default -# `DGSEM` initializes the surface flux as central and the volume integral in the weak form. +# `DGSEM` initializes the surface flux as central and uses no volume flux in the weak form. solver = DGSEM(polydeg=3) @@ -116,7 +117,8 @@ end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_term_exp_sinpi) -# +# 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. tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) @@ -188,7 +190,8 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, ste # 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. +# need to save every step of the solution, as we are only interested the output provided by +# our callback [`SaveSolutionCallback`](@ref). sol = solve(ode, SSPRK33(); dt = 1.0, save_everystep = false, callback = callbacks); diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index a73370fb6f3..88ac7ba7bc2 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -32,8 +32,7 @@ # ```shell # winget install julia -s msstore # ``` -# Note: This installation method requires the use of MS Store, therefore, an MS Store account -# is necessary to proceed. +# Note: For this installation an MS Store account is necessary to proceed. # - Verify the successful installation of Julia by executing the following command in the terminal: # ```shell # julia @@ -73,15 +72,15 @@ # - Open a terminal and start Julia. # - Execute the following commands to install all mentioned packages. Please note that the # installation process involves downloading and precompiling the source code, which may take -# approximately 30 minutes. +# some time depending on your machine. # ```julia # import Pkg # Pkg.add(["OrdinaryDiffEq", "Plots", "Trixi"]) # ``` -# - On Windows, the firewall may request for permission to install packages. +# - On Windows, the firewall may request permission to install packages. -# Now you have installed all these -# packages. [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) provides time +# Besides Trixi.jl you have now installed two additional +# packages: [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) provides time # integration schemes used by Trixi.jl and [Plots.jl](https://github.com/JuliaPlots/Plots.jl) # can be used to directly visualize Trixi.jl results from the Julia REPL. @@ -107,8 +106,7 @@ # 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`](@ref)) -# with a weak blast wave as the initial condition and periodic boundary conditions. The compressible -# Euler equations describe the motion of an ideal gas. +# with a weak blast wave as the initial condition and periodic boundary conditions. # The compressible Euler equations in two spatial dimensions are given by # ```math @@ -151,14 +149,16 @@ using Trixi, OrdinaryDiffEq #hide #md trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_ec.jl")) #hide #md -# The solution was approximated over the [`TreeMesh`](@ref) using the `CarpenterKennedy2N54` ODE +# The output contains a recap of the setup and various information about the course of the simulation. +# For instance, the solution was approximated over the [`TreeMesh`](@ref) with 1024 effective cells using +# the `CarpenterKennedy2N54` ODE # solver. Further details about the ODE solver can be found in the # [documentation of OrdinaryDiffEq.jl](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/#Low-Storage-Methods) # 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. `sol.u` holds the vector of values at each saved timestep, while `sol.t` holds the +# defined in the executed example and it contains the solution after the simulation +# finishes. `sol.u` holds the vector of values at each saved timestep, while `sol.t` holds the # corresponding times for each saved timestep. In this instance, only two timesteps were saved: the # initial and final ones. The plot depicts the distribution of the weak blast wave at the final moment # of time, showing the density, velocities, and pressure of the ideal gas across a 2D domain. @@ -166,6 +166,8 @@ trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_eule using Plots plot(sol) +# ### Getting an existing setup file + # To obtain a list of all Trixi.jl elixirs execute # [`get_examples`](@ref). It returns the paths to all example setups. From 5bc3f8cfb8590099e2ed70786e0c03d110bd5853 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:21:01 +0300 Subject: [PATCH 22/23] apply review --- .../src/files/first_steps/create_first_setup.jl | 4 ++-- .../src/files/first_steps/getting_started.jl | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 5ac58c6ac4d..3c42cbf36e8 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -112,13 +112,13 @@ function source_term_exp_sinpi(u, x, t, equations::LinearScalarAdvectionEquation end # 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. semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_term_exp_sinpi) + # 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. + tspan = (0.0, 1.0) ode = semidiscretize(semi, tspan) diff --git a/docs/literate/src/files/first_steps/getting_started.jl b/docs/literate/src/files/first_steps/getting_started.jl index 88ac7ba7bc2..80ea78b51f4 100644 --- a/docs/literate/src/files/first_steps/getting_started.jl +++ b/docs/literate/src/files/first_steps/getting_started.jl @@ -19,10 +19,10 @@ # Trixi.jl is compatible with the latest stable release of Julia. Additional details regarding Julia # support can be found in the [`README.md`](https://github.com/trixi-framework/Trixi.jl#installation) -# 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](https://julialang.org/downloads/). +# file. After installation, the current default Julia version can be managed through the command +# line tool `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](https://julialang.org/downloads/). # ### Windows @@ -166,6 +166,7 @@ trixi_include(@__MODULE__,joinpath(examples_dir(), "tree_2d_dgsem", "elixir_eule using Plots plot(sol) + # ### Getting an existing setup file # To obtain a list of all Trixi.jl elixirs execute @@ -175,9 +176,6 @@ get_examples() # Editing an existing elixir is the best way to start your first own investigation using Trixi.jl. - -# ### Getting an existing setup file - # 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](https://github.com/trixi-framework/Trixi.jl). From 3c9302d015495b9e13fad8ea85dcf794f7fc716b Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:34:19 +0300 Subject: [PATCH 23/23] Apply suggestions from code review Co-authored-by: Michael Schlottke-Lakemper --- .../files/first_steps/create_first_setup.jl | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/literate/src/files/first_steps/create_first_setup.jl b/docs/literate/src/files/first_steps/create_first_setup.jl index 3c42cbf36e8..ae78a6a1546 100644 --- a/docs/literate/src/files/first_steps/create_first_setup.jl +++ b/docs/literate/src/files/first_steps/create_first_setup.jl @@ -19,7 +19,7 @@ # 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](https://code.visualstudio.com/)). -# In this file you will create your setup and the file can then be executed in Julia using, for example, `trixi_include()`. +# In this file, you will create your setup. The file can then be executed in Julia using, for example, `trixi_include()`. # Alternatively, you can execute each line of the following code one by one in the # Julia REPL. This will generate useful output for nearly every # command and improve your comprehension of the process. @@ -68,8 +68,9 @@ mesh = TreeMesh(coordinates_min, coordinates_max, # To approximate the solution of the defined model, we create a [`DGSEM`](@ref) 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](@ref scalar_linear_advection_1d) tutorial. Per default -# `DGSEM` initializes the surface flux as central and uses no volume flux in the weak form. +# check out the [Introduction to DG methods](@ref scalar_linear_advection_1d) tutorial. By default, +# in the weak formulation `DGSEM` initializes the surface flux as `flux_central` and uses the physical flux for +# the volume integral. solver = DGSEM(polydeg=3) @@ -116,7 +117,7 @@ end semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver; source_terms = source_term_exp_sinpi) -# which leaves us with an ODE problem in time with a span from 0.0 to 1.0. +# 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. tspan = (0.0, 1.0) @@ -137,14 +138,14 @@ ode = semidiscretize(semi, tspan) summary_callback = SummaryCallback() # We also want to analyze the current state of the solution in regular intervals. -# The [`AnalysisCallback`](@ref) outputs some useful statistical information during the solving -# process every `interval` time steps. +# The [`AnalysisCallback`](@ref) outputs some useful statistical information during the simulation +# every `interval` time steps. analysis_callback = AnalysisCallback(semi, interval = 20) -# To indicate that a simulation is still running by periodically printing information, such as the -# current time, to the screen every `alive_interval` time steps, we utilize the inexpensive -# [`AliveCallback`](@ref). +# To indicate that a simulation is still running, we utilize the inexpensive [`AliveCallback`](@ref) +# to periodically print information to the screen, such as the +# current time, every `alive_interval` time steps. alive_callback = AliveCallback(alive_interval = 10) @@ -222,8 +223,8 @@ using Plots # ```julia # plot(sol) # ``` -# Alternatively, you can configure the plot more precisely. Trixi.jl suggests a special structure -# to extract the visualization data from the solution as a [`PlotData2D`](@ref) object. +# Alternatively, you can configure the plot more precisely. Trixi.jl provides a special data type, +# [`PlotData2D`](@ref), to extract the visualization data from the solution. pd = PlotData2D(sol); @@ -232,7 +233,8 @@ pd = PlotData2D(sol); @show pd.variable_names; -# Plot the variable named "scalar". +# Plot the variable named "scalar" (which is the name of the variable for the +# linear advection equation in Trixi.jl). plot(pd["scalar"])