Skip to content

Commit

Permalink
Merge branch 'trixi-framework:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ArseniyKholod authored Jun 22, 2023
2 parents 41451f9 + bea4bfe commit 47a4f69
Show file tree
Hide file tree
Showing 92 changed files with 1,852 additions and 776 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling
uses: crate-ci/typos@v1.14.12
uses: crate-ci/typos@v1.15.1
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ for human readability.
#### Added

- Experimental support for 3D parabolic diffusion terms has been added.
- Capability to set truly discontinuous initial conditions in 1D.

#### Changed

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>", "Jesse Chan <[email protected]>"]
version = "0.5.29-pre"
version = "0.5.30-pre"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down
2 changes: 1 addition & 1 deletion docs/literate/src/files/adding_nonconservative_equation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ plot(sol)
# above.

error_1 = analysis_callback(sol).l2 |> first
@test isapprox(error_1, 0.0002961027497) #src
@test isapprox(error_1, 0.00029609575838969394) #src
# Next, we increase the grid resolution by one refinement level and run the
# simulation again.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/github-git.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ branch, and the corresponding pull request will be updated automatically.
Please note that a review has nothing to do with the lack of experience of the
person developing changes: We try to review all code before it gets added to
`main`, even from the most experienced developers. This is good practice and
helps to keep the error rate low while ensuring the the code is developed in a
helps to keep the error rate low while ensuring that the code is developed in a
consistent fashion. Furthermore, do not take criticism of your code personally -
we just try to keep Trixi.jl as accessible and easy to use for everyone.

Expand All @@ -121,7 +121,7 @@ Once your branch is reviewed and declared ready for merging by the reviewer,
make sure that all the latest changes have been pushed. Then, one of the
developers will merge your PR. If you are one of the developers, you can also go
to the pull request page on GitHub and and click on **Merge pull request**.
Voilá, you are done! Your branch will have been merged to
Voilà, you are done! Your branch will have been merged to
`main` and the source branch will have been deleted in the GitHub repository
(if you are not working in your own fork).

Expand Down
15 changes: 13 additions & 2 deletions docs/src/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ of your PR), you need to install JuliaFormatter.jl first by running
```shell
julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
```
You can then recursively format all Julia files in the Trixi.jl repo by executing
You can then recursively format the core Julia files in the Trixi.jl repo by executing
```shell
julia -e 'using JuliaFormatter; format(".")
julia -e 'using JuliaFormatter; format(["benchmark", "ext", "src", "utils"])'
```
from inside the Trixi.jl repository. For convenience, there is also a script you can
directly run from your terminal shell, which will automatically install JuliaFormatter in a
Expand All @@ -65,3 +65,14 @@ utils/trixi-format.jl
```
You can get more information about using the convenience script by running it with the
`--help`/`-h` flag.

### Checking formatting before committing
It can be convenient to check the formatting of source code automatically before each commit.
We use git-hooks for it and provide a `pre-commit` script in the `utils` folder. The script uses
[JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) just like formatting script that
runs over the whole Trixi.jl directory.
You can copy the `pre-commit`-script into `.git/hooks/pre-commit` and it will check your formatting
before each commit. If errors are found the commit is aborted and you can add the corrections via
```shell
git add -p
```
2 changes: 1 addition & 1 deletion docs/src/visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ create a [`PlotData1D`](@ref) with the keyword argument `curve` set to your list
Let's give an example of this with the basic advection equation from above by creating
a plot along the circle marked in green:

![2d-plot-along-cirlce](https://user-images.githubusercontent.com/72009492/130951042-e1849447-8e55-4798-9361-c8badb9f3a49.png)
![2d-plot-along-circle](https://user-images.githubusercontent.com/72009492/130951042-e1849447-8e55-4798-9361-c8badb9f3a49.png)

We can write a function like this, that outputs a list of points on a circle:
```julia
Expand Down
56 changes: 56 additions & 0 deletions examples/dgmulti_3d/elixir_advection_tensor_wedge.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using OrdinaryDiffEq
using Trixi
using LinearAlgebra

###############################################################################
equations = LinearScalarAdvectionEquation3D(1.0, 1.0, 1.0)

initial_condition = initial_condition_convergence_test

# Define the polynomial degrees for the polynoms of the triangular base and the line
# of the tensor-prism
tensor_polydeg = (3, 4)

dg = DGMulti(element_type = Wedge(),
approximation_type = Polynomial(),
surface_flux = flux_lax_friedrichs,
polydeg = tensor_polydeg)


cells_per_dimension = (8, 8, 8)
mesh = DGMultiMesh(dg,
cells_per_dimension,
coordinates_min = (-1.0, -1.0, -1.0),
coordinates_max = (1.0, 1.0, 1.0),
periodicity = true)


semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
boundary_conditions=boundary_condition_periodic)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 100
analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))

alive_callback = AliveCallback(analysis_interval=analysis_interval)

# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
stepsize_callback = StepsizeCallback(cfl=1.0)

callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, stepsize_callback)


###############################################################################
# run the simulation

sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0,
save_everystep=false, callback=callbacks);

summary_callback() # print the timer summary
4 changes: 2 additions & 2 deletions examples/p4est_2d_dgsem/elixir_euler_sedov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ equations = CompressibleEulerEquations2D(1.4)
initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
The Sedov blast wave setup based on Flash
- http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)
# Set up polar coordinates
Expand All @@ -20,7 +20,7 @@ function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEq
y_norm = x[2] - inicenter[2]
r = sqrt(x_norm^2 + y_norm^2)

# Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
# Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
E = 1.0
p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Boundary conditions are supersonic Mach 3 inflow at the left portion of the domain
# and supersonic outflow at the right portion of the domain. The top and bottom of the
# channel as well as the cylinder are treated as Euler slip wall boundaries.
# This flow results in strong shock refletions / interactions as well as Kelvin-Helmholtz
# This flow results in strong shock reflections / interactions as well as Kelvin-Helmholtz
# instabilities at later times as two Mach stems form above and below the cylinder.
#
# For complete details on the problem setup see Section 5.7 of the paper:
Expand Down
4 changes: 2 additions & 2 deletions examples/p4est_3d_dgsem/elixir_euler_sedov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ equations = CompressibleEulerEquations3D(1.4)
initial_condition_medium_sedov_blast_wave(x, t, equations::CompressibleEulerEquations3D)
The Sedov blast wave setup based on Flash
- http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
with smaller strength of the initial discontinuity.
"""
function initial_condition_medium_sedov_blast_wave(x, t, equations::CompressibleEulerEquations3D)
Expand All @@ -22,7 +22,7 @@ function initial_condition_medium_sedov_blast_wave(x, t, equations::Compressible
z_norm = x[3] - inicenter[3]
r = sqrt(x_norm^2 + y_norm^2 + z_norm^2)

# Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
# Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
E = 1.0
p0_inner = 3 * (equations.gamma - 1) * E / (4 * pi * r0^2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The classical Jeans instability taken from
- Dominik Derigs, Andrew R. Winters, Gregor J. Gassner, Stefanie Walch (2016)
A Novel High-Order, Entropy Stable, 3D AMR MHD Solver with Guaranteed Positive Pressure
[arXiv: 1605.03572](https://arxiv.org/abs/1605.03572)
- Flash manual https://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel.pdf
- Flash manual https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
in CGS (centimeter, gram, second) units.
"""
function initial_condition_jeans_instability(x, t,
Expand All @@ -32,7 +32,7 @@ function initial_condition_jeans_instability(x, t,
pres0 = 1.5e7 # dyn/cm^2
delta0 = 1e-3
# set wave vector values for perturbation (units 1/cm)
# see FLASH manual: https://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel.pdf
# see FLASH manual: https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
kx = 2.0*pi/0.5 # 2π/λ_x, λ_x = 0.5
ky = 0.0 # 2π/λ_y, λ_y = 1e10
k_dot_x = kx*x[1] + ky*x[2]
Expand All @@ -49,7 +49,7 @@ function initial_condition_jeans_instability(x, t,
equations::HyperbolicDiffusionEquations2D)
# gravity equation: -Δϕ = -4πGρ
# Constants taken from the FLASH manual
# https://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel.pdf
# https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node189.html#SECTION010131000000000000000
rho0 = 1.5e7
delta0 = 1e-3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Adaptation of the Sedov blast wave with self-gravity taken from
A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics
[arXiv: 2008.10593](https://arxiv.org/abs/2008.10593)
based on
- http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
Should be used together with [`boundary_condition_sedov_self_gravity`](@ref).
"""
function initial_condition_sedov_self_gravity(x, t, equations::CompressibleEulerEquations2D)
# Set up polar coordinates
r = sqrt(x[1]^2 + x[2]^2)

# Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node184.html#SECTION010114000000000000000
# Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
r0 = 0.125 # = 4.0 * smallest dx (for domain length=8 and max-ref=8)
E = 1.0
p_inner = (equations.gamma - 1) * E / (pi * r0^2)
Expand Down Expand Up @@ -59,7 +59,7 @@ Adaptation of the Sedov blast wave with self-gravity taken from
A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics
[arXiv: 2008.10593](https://arxiv.org/abs/2008.10593)
based on
- http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
Should be used together with [`initial_condition_sedov_self_gravity`](@ref).
"""
function boundary_condition_sedov_self_gravity(u_inner, orientation, direction, x, t,
Expand Down Expand Up @@ -122,7 +122,7 @@ Adaptation of the Sedov blast wave with self-gravity taken from
A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics
[arXiv: 2008.10593](https://arxiv.org/abs/2008.10593)
based on
- http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
Should be used together with [`boundary_condition_sedov_self_gravity`](@ref).
"""
function initial_condition_sedov_self_gravity(x, t, equations::HyperbolicDiffusionEquations2D)
Expand All @@ -143,7 +143,7 @@ Adaptation of the Sedov blast wave with self-gravity taken from
A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics
[arXiv: 2008.10593](https://arxiv.org/abs/2008.10593)
based on
- http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114100000000000000
Should be used together with [`initial_condition_sedov_self_gravity`](@ref).
"""
function boundary_condition_sedov_self_gravity(u_inner, orientation, direction, x, t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ advection_velocity = 1.0
"""
initial_condition_composite(x, t, equations::LinearScalarAdvectionEquation1D)
Slight simplification of
Wave form that is a combination of a Gaussian pulse, a square wave, a triangle wave,
and half an ellipse with periodic boundary conditions.
Slight simplification from
- Jiang, Shu (1996)
Efficient Implementation of Weighted ENO Schemes
[DOI: 10.1006/jcph.1996.0130](https://doi.org/10.1006/jcph.1996.0130)
Expand Down Expand Up @@ -60,7 +62,7 @@ volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
solver = DGSEM(basis, surface_flux, volume_integral)

# Create curved mesh
cells_per_dimension = (125,)
cells_per_dimension = (120,)
coordinates_min = (-1.0,) # minimum coordinate
coordinates_max = (1.0,) # maximum coordinate
mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max,
Expand Down
8 changes: 4 additions & 4 deletions examples/structured_1d_dgsem/elixir_euler_sedov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ equations = CompressibleEulerEquations1D(1.4)
initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations1D)
The Sedov blast wave setup based on Flash
- http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
"""
function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations1D)
# Set up polar coordinates
inicenter = SVector(0.0)
x_norm = x[1] - inicenter[1]
r = abs(x_norm)

# Setup based on http://flash.uchicago.edu/site/flashcode/user_support/flash_ug_devel/node184.html#SECTION010114000000000000000
# Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION010114000000000000000
r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)
# r0 = 0.5 # = more reasonable setup
E = 1.0
Expand Down Expand Up @@ -78,8 +78,8 @@ save_solution = SaveSolutionCallback(interval=100,

stepsize_callback = StepsizeCallback(cfl=0.5)

callbacks = CallbackSet(summary_callback,
analysis_callback,
callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback,
save_solution,
stepsize_callback)
Expand Down
Loading

0 comments on commit 47a4f69

Please sign in to comment.