Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ Trixi.jl follows the interpretation of
used in the Julia ecosystem. Notable changes will be documented in this file
for human readability.

## Changes when updating to v0.15 from v0.14.x

#### Changed

- `convergence_test` now returns both the mean convergence rates and the full errors matrix ([#2753]).

## Changes when updating to v0.14 from v0.13.x

#### Changed

- van Leer's limiters changed to snake case: `vanLeer` => `vanleer`
- A couple `struct`s have been made completely immutable, or only a couple fields thereof. Most notably, `save_solution.condition.save_initial_solution` where `save_solution isa SavesolutionCallback` can no longer be directly changed. Instead, the `@reset` macro from [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl) is used in the elixirs.
- van Leer's limiters changed to snake case: `vanLeer` => `vanleer` ([#2744])
- A couple `struct`s have been made completely immutable, or only a couple fields thereof ([#2640]). Most notably, `save_solution.condition.save_initial_solution` where `save_solution isa SavesolutionCallback` can no longer be directly changed. Instead, the `@reset` macro from [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl) is used in the elixirs.

## Changes in the v0.13 lifecycle

#### Added

- Initial 3D support for subcell limiting with `P4estMesh` was added ([#2582] and [#2647]).
In the new version, IDP positivity limiting for conservative variables (using
the keyword `positivity_variables_cons` in `SubcellLimiterIDP()`) and nonlinear
Expand All @@ -25,7 +32,7 @@ for human readability.
When the trait is set to `Trixi.True()`, a single method has to be defined, that computes and returns the tuple
`flux_cons(u_ll, u_rr) + 0.5f0 * flux_noncons(u_ll, u_rr)` and
`flux_cons(u_ll, u_rr) + 0.5f0 * flux_noncons(u_rr, u_ll)`.
- Added support for `source_terms_parabolic`, which allows users to specify gradient-dependent source terms when solving parabolic equations ([#2721]).
- Added support for `source_terms_parabolic`, which allows users to specify gradient-dependent source terms when solving parabolic equations ([#2721]).

## Changes when updating to v0.13 from v0.12.x

Expand Down
6 changes: 3 additions & 3 deletions src/auxiliary/special_elixirs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function convergence_test(mod::Module, elixir::AbstractString, iterations,

include_refined(mod, elixir, initial_resolution, iter; kwargs)

# @invokelatest is required for interactive use
# @invokelatest is required for interactive use
# due to world age issues on Julia 1.12 (and newer)
l2_error, linf_error = @invokelatest mod.analysis_callback(@invokelatest mod.sol)

Expand All @@ -49,7 +49,7 @@ function convergence_test(mod::Module, elixir::AbstractString, iterations,
end

# Use raw error values to compute EOC
# @invokelatest is required for interactive use
# @invokelatest is required for interactive use
# due to world age issues on Julia 1.12 (and newer)
return analyze_convergence(errors, iterations, (@invokelatest mod.semi))
end
Expand Down Expand Up @@ -123,7 +123,7 @@ function analyze_convergence(errors, iterations,
println("-"^100)
end

return eoc_mean_values
return eoc_mean_values, errorsmatrix
end

function convergence_test(elixir::AbstractString, iterations, RealT = Float64;
Expand Down
6 changes: 4 additions & 2 deletions src/semidiscretization/semidiscretization_coupled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ function analyze_convergence(errors_coupled, iterations,
end

eoc_mean_values = Vector{Dict{Symbol, Any}}(undef, nsystems(semi_coupled))
errorsmatrix = Vector{Dict{Symbol, Matrix{Float64}}}(undef, nsystems(semi_coupled))
for i in eachsystem(semi_coupled)
# Use visual cues to separate output from multiple systems
println()
Expand All @@ -790,9 +791,10 @@ function analyze_convergence(errors_coupled, iterations,
_, equations, _, _ = mesh_equations_solver_cache(semi)
variablenames = varnames(cons2cons, equations)

eoc_mean_values[i] = analyze_convergence(errors[i], iterations, variablenames)
eoc_mean_values[i], errorsmatrix[i] = analyze_convergence(errors[i], iterations,
variablenames)
Comment thread
JoshuaLampert marked this conversation as resolved.
Outdated
end

return eoc_mean_values
return eoc_mean_values, errorsmatrix
end
end # @muladd
6 changes: 3 additions & 3 deletions test/test_dgmulti_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ end

@trixi_testset "elixir_euler_flux_diff.jl (convergence)" begin
using Trixi: convergence_test
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"elixir_euler_flux_diff.jl"), 3)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"elixir_euler_flux_diff.jl"), 3)
@test isapprox(mean_convergence[:l2],
[4.1558759698638434, 3.977911306037128, 4.041421206468769],
rtol = 0.05)
Expand Down
6 changes: 3 additions & 3 deletions test/test_dgmulti_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ end

@trixi_testset "elixir_euler_weakform.jl (convergence)" begin
using Trixi: convergence_test
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"elixir_euler_weakform.jl"), 2)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"elixir_euler_weakform.jl"), 2)
@test isapprox(mean_convergence[:l2],
[
4.243843382379403,
Expand Down
66 changes: 33 additions & 33 deletions test/test_special_elixirs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ EXAMPLES_DIR = examples_dir()

@testset "Convergence test" begin
@timed_testset "tree_2d_dgsem" begin
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR, "tree_2d_dgsem",
"elixir_advection_extended.jl"),
3, initial_refinement_level = 2)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR, "tree_2d_dgsem",
"elixir_advection_extended.jl"),
3, initial_refinement_level = 2)
@test isapprox(mean_convergence[:l2], [4.0], rtol = 0.05)
end

@timed_testset "structured_2d_dgsem" begin
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"structured_2d_dgsem",
"elixir_advection_extended.jl"),
3, cells_per_dimension = (5, 9))
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"structured_2d_dgsem",
"elixir_advection_extended.jl"),
3, cells_per_dimension = (5, 9))
@test isapprox(mean_convergence[:l2], [4.0], rtol = 0.05)
end

@timed_testset "structured_2d_dgsem coupled" begin
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"structured_2d_dgsem",
"elixir_advection_coupled.jl"),
3)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"structured_2d_dgsem",
"elixir_advection_coupled.jl"),
3)
@test isapprox(mean_convergence[1][:l2], [4.0], rtol = 0.05)
@test isapprox(mean_convergence[2][:l2], [4.0], rtol = 0.05)
end
Expand All @@ -52,37 +52,37 @@ EXAMPLES_DIR = examples_dir()
no_refine = @cfunction((p4est, which_tree, quadrant)->Cint(0), Cint,
(Ptr{Trixi.p4est_t}, Ptr{Trixi.p4est_topidx_t},
Ptr{Trixi.p4est_quadrant_t}))
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR, "p4est_2d_dgsem",
"elixir_euler_source_terms_nonconforming_unstructured_flag.jl"),
2, refine_fn_c = no_refine)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR, "p4est_2d_dgsem",
"elixir_euler_source_terms_nonconforming_unstructured_flag.jl"),
2, refine_fn_c = no_refine)
@test isapprox(mean_convergence[:linf], [3.2, 3.2, 4.0, 3.7], rtol = 0.05)
end

@timed_testset "structured_3d_dgsem" begin
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"structured_3d_dgsem",
"elixir_advection_basic.jl"),
2, cells_per_dimension = (7, 4, 5))
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"structured_3d_dgsem",
"elixir_advection_basic.jl"),
2, cells_per_dimension = (7, 4, 5))
@test isapprox(mean_convergence[:l2], [4.0], rtol = 0.05)
end

@timed_testset "p4est_3d_dgsem" begin
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
"elixir_advection_unstructured_curved.jl"),
2, initial_refinement_level = 0)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
"elixir_advection_unstructured_curved.jl"),
2, initial_refinement_level = 0)
@test isapprox(mean_convergence[:l2], [2.7], rtol = 0.05)
end

@timed_testset "paper_self_gravitating_gas_dynamics" begin
mean_convergence = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"paper_self_gravitating_gas_dynamics",
"elixir_eulergravity_convergence.jl"),
2, tspan = (0.0, 0.25),
initial_refinement_level = 1)
mean_convergence, _ = convergence_test(@__MODULE__,
joinpath(EXAMPLES_DIR,
"paper_self_gravitating_gas_dynamics",
"elixir_eulergravity_convergence.jl"),
2, tspan = (0.0, 0.25),
initial_refinement_level = 1)
@test isapprox(mean_convergence[:l2], 4 * ones(4), atol = 0.4)
end
end
Expand Down
Loading