From 08a4c45c9c12a18e9ee9e4531ea61242c24f501b Mon Sep 17 00:00:00 2001 From: Jesse Chan <1156048+jlchan@users.noreply.github.com> Date: Mon, 6 Nov 2023 23:00:11 -0600 Subject: [PATCH 1/8] Update NEWS.md with quasi-1D SWE (#1710) --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index bc213fcea5..6baa7f77d2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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` From 3186df5be024f1253d282339058d7df3e1a02307 Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Tue, 7 Nov 2023 06:02:03 +0100 Subject: [PATCH 2/8] Add downstream tests for TrixiShallowWater.jl (#1707) * Add downstream tests for TrixiShallowWater.jl * Fix workflow name * Explain rationale for using `main` branch of downstream package --------- Co-authored-by: Hendrik Ranocha --- .github/workflows/downstream.yml | 93 ++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/downstream.yml diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml new file mode 100644 index 0000000000..d9e3a2d8a7 --- /dev/null +++ b/.github/workflows/downstream.yml @@ -0,0 +1,93 @@ +# 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: + - 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 From 276dc3ca22a4c72b81aa6659e57ff1382dd1ae0c Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Tue, 7 Nov 2023 10:33:05 +0100 Subject: [PATCH 3/8] add compat bounds for stdlibs (#1711) * add comapt bounds for stdlibs * set compat bounds of stdlibs to v1 * set compat bounds for stdlibs to v1 --- Project.toml | 3 +++ docs/Project.toml | 1 + test/Project.toml | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/Project.toml b/Project.toml index f19f7fdecc..497f4a1add 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -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" diff --git a/docs/Project.toml b/docs/Project.toml index ffa86e0b9f..3a091f5b4f 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -21,4 +21,5 @@ Literate = "2.9" Measurements = "2.5" OrdinaryDiffEq = "6.49.1" Plots = "1.9" +Test = "1" Trixi2Vtk = "0.3" diff --git a/test/Project.toml b/test/Project.toml index c45be49a5d..83b431e269 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -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 From 9acaa9033fc2d062ab0a7e6d219414cb9aa30eeb Mon Sep 17 00:00:00 2001 From: Michael Schlottke-Lakemper Date: Thu, 9 Nov 2023 08:07:17 +0100 Subject: [PATCH 4/8] Add Trixi2Vtk.jl to downstream tests (#1722) --- .github/workflows/downstream.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index d9e3a2d8a7..b40d5d365c 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -60,6 +60,7 @@ jobs: arch: - x64 package: + - Trixi2Vtk.jl - TrixiShallowWater.jl steps: - uses: actions/checkout@v4 From 63c625824c3d510611dcebba12a0319d7e9cad9a Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Fri, 10 Nov 2023 07:28:45 +0100 Subject: [PATCH 5/8] Fix bug (#1719) --- src/equations/compressible_euler_2d.jl | 2 +- test/test_p4est_2d.jl | 16 ++++++++-------- test/test_unit.jl | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 6c8f2e1e84..a992f99eaf 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -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_ diff --git a/test/test_p4est_2d.jl b/test/test_p4est_2d.jl index 546e5bff8a..07c6d02bbc 100644 --- a/test/test_p4est_2d.jl +++ b/test/test_p4est_2d.jl @@ -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)) diff --git a/test/test_unit.jl b/test/test_unit.jl index a73dfab550..29390161eb 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -1191,7 +1191,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) @@ -1215,7 +1215,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) From 910df76691685040cd46ed661253f7348cb35344 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 10 Nov 2023 07:44:38 +0100 Subject: [PATCH 6/8] fix IndicatorMax with multi-threading on ARM (#1723) --- src/solvers/dgsem_tree/indicators_1d.jl | 3 ++- src/solvers/dgsem_tree/indicators_2d.jl | 3 ++- src/solvers/dgsem_tree/indicators_3d.jl | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/solvers/dgsem_tree/indicators_1d.jl b/src/solvers/dgsem_tree/indicators_1d.jl index 8b57348861..40bfd1e98c 100644 --- a/src/solvers/dgsem_tree/indicators_1d.jl +++ b/src/solvers/dgsem_tree/indicators_1d.jl @@ -289,6 +289,7 @@ 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()] @@ -296,7 +297,7 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 3}, # 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) diff --git a/src/solvers/dgsem_tree/indicators_2d.jl b/src/solvers/dgsem_tree/indicators_2d.jl index 2f34e0eb66..da81b2a1d3 100644 --- a/src/solvers/dgsem_tree/indicators_2d.jl +++ b/src/solvers/dgsem_tree/indicators_2d.jl @@ -323,6 +323,7 @@ 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()] @@ -330,7 +331,7 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 4}, # 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) diff --git a/src/solvers/dgsem_tree/indicators_3d.jl b/src/solvers/dgsem_tree/indicators_3d.jl index 69041ed129..4036288939 100644 --- a/src/solvers/dgsem_tree/indicators_3d.jl +++ b/src/solvers/dgsem_tree/indicators_3d.jl @@ -234,6 +234,7 @@ 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()] @@ -241,7 +242,7 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 5}, # 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) From 9a00184c6ca656ce2fab4c8600bc837883a02b06 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Fri, 10 Nov 2023 07:46:35 +0100 Subject: [PATCH 7/8] Remove AMR CB from HLLE 2D Tree test (#1720) * remove amr cb * fmt --- test/test_tree_2d_euler.jl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl index db36cb7d79..93490f8ae0 100644 --- a/test/test_tree_2d_euler.jl +++ b/test/test_tree_2d_euler.jl @@ -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 From cb8181f6e5ae2fa74054ab227b2e19a393edcee0 Mon Sep 17 00:00:00 2001 From: Patrick Ersing <114223904+patrickersing@users.noreply.github.com> Date: Fri, 10 Nov 2023 15:59:07 +0100 Subject: [PATCH 8/8] Fix the wet/dry test for SWE (#1727) * Adjust tolerance to fix wet_dry test * apply formatter --- test/test_tree_1d_shallowwater.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_tree_1d_shallowwater.jl b/test/test_tree_1d_shallowwater.jl index 658f178c94..7ec3089d33 100644 --- a/test/test_tree_1d_shallowwater.jl +++ b/test/test_tree_1d_shallowwater.jl @@ -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