Skip to content

Commit

Permalink
Merge branch 'main' into HLLC_MHD_1D_Cartesian
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring authored Nov 11, 2023
2 parents bcf0d0c + cb8181f commit 5783b5c
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 24 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Note: this file is inspired by the downstream testing facilities in the SciML ecosystem
# x-ref: https://github.com/SciML/SciMLBase.jl/blob/ffe68aebedee5915190623cb08160d7ef1fbcce0/.github/workflows/Downstream.yml

name: Downstream
on:
push:
branches:
- main
paths-ignore:
- 'AUTHORS.md'
- 'CITATION.bib'
- 'CONTRIBUTING.md'
- 'LICENSE.md'
- 'NEWS.md'
- 'README.md'
- '.zenodo.json'
- '.github/workflows/benchmark.yml'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
- 'benchmark/**'
# - 'docs/**'
- 'utils/**'
pull_request:
paths-ignore:
- 'AUTHORS.md'
- 'CITATION.bib'
- 'CONTRIBUTING.md'
- 'LICENSE.md'
- 'NEWS.md'
- 'README.md'
- '.zenodo.json'
- '.github/workflows/benchmark.yml'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
- 'benchmark/**'
# - 'docs/**'
- 'utils/**'
workflow_dispatch:

# Cancel redundant CI tests automatically
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
if: "!contains(github.event.head_commit.message, 'skip ci')"
# We could also include the Julia version as in
# name: ${{ matrix.trixi_test }} - ${{ matrix.os }} - Julia ${{ matrix.version }} - ${{ matrix.arch }} - ${{ github.event_name }}
# to be more specific. However, that requires us updating the required CI tests whenever we update Julia.
name: ${{ matrix.package }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.9'
os:
- ubuntu-latest
arch:
- x64
package:
- Trixi2Vtk.jl
- TrixiShallowWater.jl
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)'
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- name: Retrieve downstream package
# Note: we retrieve the current `main` branch of the downstream package to ensure
# that compatibility errors we make in Trixi.jl are detected already here
# See also https://github.com/trixi-framework/Trixi.jl/pull/1707#discussion_r1382938895
uses: actions/checkout@v4
with:
repository: trixi-framework/${{ matrix.package }}
path: downstream
- name: Load upstream package into downstream environment
shell: julia --color=yes --project=downstream {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path="."))
Pkg.update()
- name: Run downstream tests (without coverage)
shell: julia --color=yes --project=downstream {0}
run: |
using Pkg
Pkg.test(coverage=false)
env:
TRIXI_TEST: upstream
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ for human readability.
- Capability to set truly discontinuous initial conditions in 1D.
- Wetting and drying feature and examples for 1D and 2D shallow water equations
- Implementation of the polytropic Euler equations in 2D
- Implementation of the quasi-1D shallow water equations
- Subcell positivity limiting support for conservative variables in 2D for `TreeMesh`
- AMR for hyperbolic-parabolic equations on 2D/3D `TreeMesh`

Expand Down
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ FillArrays = "0.13.2, 1"
ForwardDiff = "0.10.18"
HDF5 = "0.14, 0.15, 0.16, 0.17"
IfElse = "0.1"
LinearAlgebra = "1"
LinearMaps = "2.7, 3.0"
LoopVectorization = "0.12.118"
MPI = "0.20"
Expand All @@ -68,12 +69,14 @@ OffsetArrays = "1.3"
P4est = "0.4"
Polyester = "0.7.5"
PrecompileTools = "1.1"
Printf = "1"
RecipesBase = "1.1"
Reexport = "1.0"
Requires = "1.1"
SciMLBase = "1.90, 2"
Setfield = "0.8, 1"
SimpleUnPack = "1.1"
SparseArrays = "1"
StartUpDG = "0.17"
Static = "0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
StaticArrayInterface = "1.4"
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ Literate = "2.9"
Measurements = "2.5"
OrdinaryDiffEq = "6.49.1"
Plots = "1.9"
Test = "1"
Trixi2Vtk = "0.3"
2 changes: 1 addition & 1 deletion src/equations/compressible_euler_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ of the numerical flux.
v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho
v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho
v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2]
v_roe_mag = (v1_roe * normal_direction[1])^2 + (v2_roe * normal_direction[2])^2
v_roe_mag = v1_roe^2 + v2_roe^2

H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho
c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/indicators_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,15 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 3},
kwargs...)
@unpack alpha, indicator_threaded = indicator_max.cache
resize!(alpha, nelements(dg, cache))
indicator_variable = indicator_max.variable

@threaded for element in eachelement(dg, cache)
indicator = indicator_threaded[Threads.threadid()]

# Calculate indicator variables at Gauss-Lobatto nodes
for i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, element)
indicator[i] = indicator_max.variable(u_local, equations)
indicator[i] = indicator_variable(u_local, equations)
end

alpha[element] = maximum(indicator)
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/indicators_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,15 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 4},
kwargs...)
@unpack alpha, indicator_threaded = indicator_max.cache
resize!(alpha, nelements(dg, cache))
indicator_variable = indicator_max.variable

@threaded for element in eachelement(dg, cache)
indicator = indicator_threaded[Threads.threadid()]

# Calculate indicator variables at Gauss-Lobatto nodes
for j in eachnode(dg), i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, j, element)
indicator[i, j] = indicator_max.variable(u_local, equations)
indicator[i, j] = indicator_variable(u_local, equations)
end

alpha[element] = maximum(indicator)
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/indicators_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,15 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 5},
kwargs...)
@unpack alpha, indicator_threaded = indicator_max.cache
resize!(alpha, nelements(dg, cache))
indicator_variable = indicator_max.variable

@threaded for element in eachelement(dg, cache)
indicator = indicator_threaded[Threads.threadid()]

# Calculate indicator variables at Gauss-Lobatto nodes
for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, j, k, element)
indicator[i, j, k] = indicator_max.variable(u_local, equations)
indicator[i, j, k] = indicator_variable(u_local, equations)
end

alpha[element] = maximum(indicator)
Expand Down
5 changes: 5 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Aqua = "0.7"
BSON = "0.3.3"
CairoMakie = "0.6, 0.7, 0.8, 0.9, 0.10"
Downloads = "1"
Flux = "0.13.15, 0.14"
ForwardDiff = "0.10"
LinearAlgebra = "1"
MPI = "0.20"
OrdinaryDiffEq = "6.49.1"
Plots = "1.16"
Printf = "1"
Random = "1"
Test = "1"

[preferences.OrdinaryDiffEq]
PrecompileAutoSpecialize = false
Expand Down
16 changes: 8 additions & 8 deletions test/test_p4est_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ end
@trixi_testset "elixir_euler_sedov.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"),
l2=[
0.411541263324004,
0.2558929632770186,
0.2558929632770193,
1.298715766843915,
0.40853279043747015,
0.25356771650524296,
0.2535677165052422,
1.2984601729572691,
],
linf=[
1.3457201726152221,
1.3138961427140758,
1.313896142714079,
6.293305112638921,
1.3840909333784284,
1.3077772519086124,
1.3077772519086157,
6.298798630968632,
],
surface_flux=flux_hlle,
tspan=(0.0, 0.3))
Expand Down
4 changes: 3 additions & 1 deletion test/test_tree_1d_shallowwater.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ end
2.2447689894899726e-13,
1.9999999999999714,
],
tspan=(0.0, 0.25))
tspan=(0.0, 0.25),
# Soften the tolerance as test results vary between different CPUs
atol=1000 * eps())
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
21 changes: 12 additions & 9 deletions test/test_tree_2d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,22 @@ end
@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
l2=[
0.35267161504176747,
0.17218309138797958,
0.17218307467125854,
0.6236143054619037,
0.352405949321075,
0.17207721487429464,
0.17207721487433883,
0.6263024434020885,
],
linf=[
2.77484045816607,
1.8281111268370718,
1.8281110470490887,
6.24263735888126,
2.760997358628186,
1.8279186132509326,
1.8279186132502805,
6.251573757093399,
],
tspan=(0.0, 0.5),
surface_flux=flux_hlle)
callbacks=CallbackSet(summary_callback,
analysis_callback, alive_callback,
stepsize_callback),
surface_flux=flux_hlle),
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
4 changes: 2 additions & 2 deletions test/test_unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ end
u_values = [SVector(1.0, 0.5, -0.7, 1.0),
SVector(1.5, -0.2, 0.1, 5.0)]
fluxes = [flux_central, flux_ranocha, flux_shima_etal, flux_kennedy_gruber,
flux_hll, FluxHLL(min_max_speed_davis)]
flux_hll, FluxHLL(min_max_speed_davis), flux_hlle]

for f_std in fluxes
f_rot = FluxRotated(f_std)
Expand All @@ -1216,7 +1216,7 @@ end
SVector(1.5, -0.2, 0.1, 0.2, 5.0)]
fluxes = [flux_central, flux_ranocha, flux_shima_etal, flux_kennedy_gruber,
FluxLMARS(340),
flux_hll, FluxHLL(min_max_speed_davis)]
flux_hll, FluxHLL(min_max_speed_davis), flux_hlle]

for f_std in fluxes
f_rot = FluxRotated(f_std)
Expand Down

0 comments on commit 5783b5c

Please sign in to comment.