Skip to content

Commit

Permalink
Merge branch 'main' into subcell-limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm authored Oct 22, 2024
2 parents 5895118 + 4a81e00 commit c7263f7
Show file tree
Hide file tree
Showing 122 changed files with 3,263 additions and 1,788 deletions.
39 changes: 6 additions & 33 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: format-check
name: Format suggestions

on:
push:
Expand All @@ -8,37 +8,10 @@ on:
pull_request:

jobs:
check-format:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
format-suggestions:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version = "0.13.0"))'
#
# TODO: Change the call below to
# format(".")
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version="1.0.60"))'
julia -e 'using JuliaFormatter; format(["benchmark", "examples", "ext", "src", "test", "utils"])'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
- uses: julia-actions/julia-format@v3
with:
version: "1.0.60"
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@v4
- name: Check spelling
uses: crate-ci/typos@v1.24.3
uses: crate-ci/typos@v1.25.0
26 changes: 26 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,39 @@ Trixi.jl follows the interpretation of [semantic versioning (semver)](https://ju
used in the Julia ecosystem. Notable changes will be documented in this file
for human readability.

## Changes when updating to v0.9 from v0.8.x

#### Added

- Boundary conditions are now supported on nonconservative terms ([#2062]).

#### Changed

- We removed the first argument `semi` corresponding to a `Semidiscretization` from the
`AnalysisSurfaceIntegral` constructor, as it is no longer needed (see [#1959]).
The `AnalysisSurfaceIntegral` now only takes the arguments `boundary_symbols` and `variable`.
([#2069])
- In functions `rhs!`, `rhs_parabolic!` we removed the unused argument `initial_condition`. ([#2037])
Users should not be affected by this.
- Nonconservative terms depend only on `normal_direction_average` instead of both
`normal_direction_average` and `normal_direction_ll`, such that the function signature is now
identical with conservative fluxes. This required a change of the `normal_direction` in
`flux_nonconservative_powell` ([#2062]).

#### Deprecated

#### Removed


## Changes in the v0.8 lifecycle

#### Changed

- The AMR routines for `P4estMesh` and `T8codeMesh` were changed to work on the product
of the Jacobian and the conserved variables instead of the conserved variables only
to make AMR fully conservative ([#2028]). This may change AMR results slightly.
- Subcell (IDP) limiting is now officially supported and not marked as experimental
anymore (see `VolumeIntegralSubcellLimiting`).

## Changes when updating to v0.8 from v0.7.x

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.8.11-DEV"
version = "0.9.3-DEV"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ installation and postprocessing procedures. Its features include:
* Discontinuous Galerkin methods
* Kinetic energy-preserving and entropy-stable methods based on flux differencing
* Entropy-stable shock capturing
* Positivity-preserving limiting
* [Finite difference summation by parts (SBP) methods](https://github.com/ranocha/SummationByPartsOperators.jl)
* Advanced limiting strategies
* Positivity-preserving limiting
* Subcell invariant domain-preserving (IDP) limiting
* Entropy-bounded limiting
* Compatible with the [SciML ecosystem for ordinary differential equations](https://diffeq.sciml.ai/latest/)
* [Explicit low-storage Runge-Kutta time integration](https://diffeq.sciml.ai/latest/solvers/ode_solve/#Low-Storage-Methods)
* [Strong stability preserving methods](https://diffeq.sciml.ai/latest/solvers/ode_solve/#Explicit-Strong-Stability-Preserving-Runge-Kutta-Methods-for-Hyperbolic-PDEs-(Conservation-Laws))
Expand Down
2 changes: 1 addition & 1 deletion benchmark/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
BenchmarkTools = "0.5, 0.7, 1.0"
OrdinaryDiffEq = "5.65, 6"
PkgBenchmark = "0.2.10"
Trixi = "0.4, 0.5, 0.6, 0.7, 0.8"
Trixi = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9"
42 changes: 24 additions & 18 deletions docs/literate/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ using Test: @testset
import Pkg

# Create markdown and notebook files for `file`
function create_files(title, file, repo_src, pages_dir, notebooks_dir; folder="")
function create_files(title, file, repo_src, pages_dir, notebooks_dir; folder = "")
notebook_filename = first(splitext(file)) * ".ipynb"
if !isempty(folder)
notebook_filename = joinpath(folder, notebook_filename)
end

binder_logo = "https://mybinder.org/badge_logo.svg"
binder_logo = "https://mybinder.org/badge_logo.svg"
nbviewer_logo = "https://img.shields.io/badge/render-nbviewer-f37726"
raw_notebook_logo = "https://img.shields.io/badge/raw-notebook-4cc61e"

notebook_path = "tutorials/notebooks/$notebook_filename"
binder_url = "https://mybinder.org/v2/gh/trixi-framework/Trixi.jl/tutorial_notebooks?filepath=$notebook_path"
binder_url = "https://mybinder.org/v2/gh/trixi-framework/Trixi.jl/tutorial_notebooks?filepath=$notebook_path"
nbviewer_url = "https://nbviewer.jupyter.org/github/trixi-framework/Trixi.jl/blob/tutorial_notebooks/$notebook_path"
raw_notebook_url = "https://raw.githubusercontent.com/trixi-framework/Trixi.jl/tutorial_notebooks/$notebook_path"

binder_badge = "# [![]($binder_logo)]($binder_url)"
binder_badge = "# [![]($binder_logo)]($binder_url)"
nbviewer_badge = "# [![]($nbviewer_logo)]($nbviewer_url)"
raw_notebook_badge = "# [![]($raw_notebook_logo)]($raw_notebook_url)"

Expand All @@ -28,25 +28,28 @@ function create_files(title, file, repo_src, pages_dir, notebooks_dir; folder=""
# available for the latest stable release of Trixi.jl at the time of caching.\n\n"
return string("# # $title\n\n", warning, content)
end
Literate.notebook(joinpath(repo_src, folder, file), joinpath(notebooks_dir, folder); execute=false, preprocess=preprocess_notebook, credit=false)
Literate.notebook(joinpath(repo_src, folder, file), joinpath(notebooks_dir, folder);
execute = false, preprocess = preprocess_notebook, credit = false)

# Generate markdown file
function preprocess_docs(content)
return string("# # [$title](@id $(splitext(file)[1]))\n $binder_badge\n $nbviewer_badge\n $raw_notebook_badge\n\n", content)
return string("# # [$title](@id $(splitext(file)[1]))\n $binder_badge\n $nbviewer_badge\n $raw_notebook_badge\n\n",
content)
end
Literate.markdown(joinpath(repo_src, folder, file), joinpath(pages_dir, folder); preprocess=preprocess_docs,)
Literate.markdown(joinpath(repo_src, folder, file), joinpath(pages_dir, folder);
preprocess = preprocess_docs,)
end

# Create tutorials with Literate.jl
function create_tutorials(files)
repo_src = joinpath(@__DIR__, "src", "files")
repo_src = joinpath(@__DIR__, "src", "files")

pages_dir = joinpath(@__DIR__, "..", "src", "tutorials")
notebooks_dir = joinpath(pages_dir, "notebooks")
pages_dir = joinpath(@__DIR__, "..", "src", "tutorials")
notebooks_dir = joinpath(pages_dir, "notebooks")

Sys.rm(pages_dir; recursive=true, force=true)
Sys.rm(pages_dir; recursive = true, force = true)

Sys.rm("out"; recursive=true, force=true)
Sys.rm("out"; recursive = true, force = true)

# Run tests on all tutorial files
@testset "TrixiTutorials" begin
Expand All @@ -59,15 +62,16 @@ function create_tutorials(files)
mod = gensym(filename[j][2][2])
@testset "$(filename[j][2][2])" begin
@eval module $mod
include(joinpath($repo_src, $(filename[j][2][1]), $(filename[j][2][2])))
include(joinpath($repo_src, $(filename[j][2][1]),
$(filename[j][2][2])))
end
end
end
else # Single files
mod = gensym(title)
@testset "$title" begin
@eval module $mod
include(joinpath($repo_src, $filename))
include(joinpath($repo_src, $filename))
end
end
end
Expand All @@ -85,18 +89,20 @@ function create_tutorials(files)
end
return content
end
Literate.markdown(joinpath(repo_src, "index.jl"), pages_dir; name="introduction", preprocess=preprocess_introduction)
Literate.markdown(joinpath(repo_src, "index.jl"), pages_dir; name = "introduction",
preprocess = preprocess_introduction)
# Navigation system for makedocs
pages = Any["Introduction" => "tutorials/introduction.md",]
pages = Any["Introduction" => "tutorials/introduction.md"]

# Create markdown and notebook files for tutorials
for (i, (title, filename)) in enumerate(files)
# Several files of one topic are created separately and pushed to `pages` together.
if filename isa Vector
vector = []
for j in eachindex(filename)
create_files("$i.$j: $title: $(filename[j][1])", filename[j][2][2], repo_src,
pages_dir, notebooks_dir; folder=filename[j][2][1])
create_files("$i.$j: $title: $(filename[j][1])", filename[j][2][2],
repo_src,
pages_dir, notebooks_dir; folder = filename[j][2][1])

path = "$(filename[j][2][1])/$(splitext(filename[j][2][2])[1]).md"
push!(vector, "$i.$j $(filename[j][1])" => "tutorials/$path")
Expand Down
70 changes: 33 additions & 37 deletions docs/literate/src/files/DGMulti_1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ dg = DGMulti(polydeg = 3,
cells_per_dimension = (32, 32)
mesh = DGMultiMesh(dg,
cells_per_dimension, # initial_refinement_level = 5
coordinates_min=(-2.0, -2.0),
coordinates_max=( 2.0, 2.0),
periodicity=true)
coordinates_min = (-2.0, -2.0),
coordinates_max = (2.0, 2.0),
periodicity = true)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
boundary_conditions=boundary_condition_periodic)
boundary_conditions = boundary_condition_periodic)
tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)

alive_callback = AliveCallback(alive_interval=10)
analysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))
alive_callback = AliveCallback(alive_interval = 10)
analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg))
callbacks = CallbackSet(analysis_callback, alive_callback);

# Run the simulation with the same time integration algorithm as before.
sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6,
callback=callbacks, save_everystep=false);
sol = solve(ode, RDPK3SpFSAL49(), abstol = 1.0e-6, reltol = 1.0e-6,
callback = callbacks, save_everystep = false);
#-
using Plots
pd = PlotData2D(sol)
Expand All @@ -60,7 +60,6 @@ plot!(getmesh(pd))
# (2021) provides a nice runtime comparison between the different mesh types. On the other hand,
# the functions are more general and thus we have more option we can choose from.


# ## Simulation with Gauss nodes
# For instance, we can change the approximation type of our simulation.
using Trixi, OrdinaryDiffEq
Expand All @@ -78,28 +77,27 @@ dg = DGMulti(polydeg = 3,

cells_per_dimension = (32, 32)
mesh = DGMultiMesh(dg,
cells_per_dimension, # initial_refinement_level = 5
coordinates_min=(-2.0, -2.0),
coordinates_max=( 2.0, 2.0),
periodicity=true)
cells_per_dimension, # initial_refinement_level = 5
coordinates_min = (-2.0, -2.0),
coordinates_max = (2.0, 2.0),
periodicity = true)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
boundary_conditions=boundary_condition_periodic)
boundary_conditions = boundary_condition_periodic)
tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)

alive_callback = AliveCallback(alive_interval=10)
analysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))
alive_callback = AliveCallback(alive_interval = 10)
analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg))
callbacks = CallbackSet(analysis_callback, alive_callback);

sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
ode_default_options()..., callback=callbacks);
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
ode_default_options()..., callback = callbacks);
#-
using Plots
pd = PlotData2D(sol)
plot(pd)


# ## Simulation with triangular elements
# Also, we can set another element type. We want to use triangles now.
using Trixi, OrdinaryDiffEq
Expand All @@ -119,21 +117,21 @@ dg = DGMulti(polydeg = 3,
cells_per_dimension = (32, 32)
mesh = DGMultiMesh(dg,
cells_per_dimension, # initial_refinement_level = 5
coordinates_min=(-2.0, -2.0),
coordinates_max=( 2.0, 2.0),
periodicity=true)
coordinates_min = (-2.0, -2.0),
coordinates_max = (2.0, 2.0),
periodicity = true)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
boundary_conditions=boundary_condition_periodic)
boundary_conditions = boundary_condition_periodic)
tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)

alive_callback = AliveCallback(alive_interval=10)
analysis_callback = AnalysisCallback(semi, interval=100, uEltype=real(dg))
alive_callback = AliveCallback(alive_interval = 10)
analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg))
callbacks = CallbackSet(analysis_callback, alive_callback);

sol = solve(ode, RDPK3SpFSAL49(); abstol=1.0e-6, reltol=1.0e-6,
ode_default_options()..., callback=callbacks);
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
ode_default_options()..., callback = callbacks);
#-
using Plots
pd = PlotData2D(sol)
Expand All @@ -142,7 +140,6 @@ plot(pd)
plot(pd["rho"])
plot!(getmesh(pd))


# ## Triangular meshes on non-Cartesian domains
# To use triangular meshes on a non-Cartesian domain, Trixi.jl uses the package [StartUpDG.jl](https://github.com/jlchan/StartUpDG.jl).
# The following example is based on [`elixir_euler_triangulate_pkg_mesh.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl)
Expand All @@ -157,7 +154,7 @@ source_terms = source_terms_convergence_test

# We create the solver `DGMulti` with triangular elements (`Tri()`) as before.
dg = DGMulti(polydeg = 3, element_type = Tri(),
approximation_type=Polynomial(),
approximation_type = Polynomial(),
surface_flux = flux_lax_friedrichs,
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))

Expand All @@ -168,11 +165,11 @@ meshIO = StartUpDG.triangulate_domain(StartUpDG.RectangularDomainWithHole());

# The pre-defined Triangulate geometry in StartUpDG has integer boundary tags. With [`DGMultiMesh`](@ref)
# we assign boundary faces based on these integer boundary tags and create a mesh compatible with Trixi.jl.
mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary=>1, :inner_boundary=>2))
mesh = DGMultiMesh(dg, meshIO, Dict(:outer_boundary => 1, :inner_boundary => 2))
#-
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :outer_boundary => boundary_condition_convergence_test,
:inner_boundary => boundary_condition_convergence_test)
:inner_boundary => boundary_condition_convergence_test)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
Expand All @@ -181,12 +178,12 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
tspan = (0.0, 0.2)
ode = semidiscretize(semi, tspan)

alive_callback = AliveCallback(alive_interval=20)
analysis_callback = AnalysisCallback(semi, interval=200, uEltype=real(dg))
alive_callback = AliveCallback(alive_interval = 20)
analysis_callback = AnalysisCallback(semi, interval = 200, uEltype = real(dg))
callbacks = CallbackSet(alive_callback, analysis_callback);

sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
dt = 0.5 * estimate_dt(mesh, dg), save_everystep = false, callback = callbacks);
#-
using Plots
pd = PlotData2D(sol)
Expand All @@ -195,7 +192,6 @@ plot!(getmesh(pd))

# For more information, please have a look in the [StartUpDG.jl documentation](https://jlchan.github.io/StartUpDG.jl/stable/).


# ## Package versions

# These results were obtained using the following versions.
Expand All @@ -205,4 +201,4 @@ versioninfo()

using Pkg
Pkg.status(["Trixi", "StartUpDG", "OrdinaryDiffEq", "Plots"],
mode=PKGMODE_MANIFEST)
mode = PKGMODE_MANIFEST)
Loading

0 comments on commit c7263f7

Please sign in to comment.