From 89d5b86c2cfab4d5b0583a915468463065e1e67d Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Wed, 11 Sep 2024 13:26:27 +0200 Subject: [PATCH 1/3] use functions from analysis_integrals --- src/visualization.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/visualization.jl b/src/visualization.jl index 7918918c..f4c44d39 100644 --- a/src/visualization.jl +++ b/src/visualization.jl @@ -186,10 +186,10 @@ end for (i, (name, integral)) in enumerate(pairs(ints)) name in exclude && continue - name_function = getfield(@__MODULE__, name) + quantity = cb.affect!.analysis_integrals[i] @series begin subplot --> subplot - label := pretty_form_utf(name_function) * " " * label_extension + label := pretty_form_utf(quantity) * " " * label_extension title --> "change of invariants" xguide --> "t" yguide --> "change of invariants" From 406e5ad6383cec7e8093cde69c19d6e4705a0f3c Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Wed, 11 Sep 2024 13:35:07 +0200 Subject: [PATCH 2/3] add test --- test/test_visualization.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_visualization.jl b/test/test_visualization.jl index 56d6ff27..8db08b90 100644 --- a/test/test_visualization.jl +++ b/test/test_visualization.jl @@ -5,7 +5,9 @@ using DispersiveShallowWater using Plots @testset "Visualization" begin - trixi_include(@__MODULE__, default_example(), tspan = (0.0, 1.0)) + custom_integral(q, equations) = q[1]^2 + DispersiveShallowWater.pretty_form_utf(::typeof(custom_integral)) = "∫η²" + trixi_include(@__MODULE__, default_example(), tspan = (0.0, 1.0), extra_analysis_integrals = (waterheight_total, custom_integral)) @test_nowarn plot(semi => sol) @test_nowarn plot!(semi => sol, plot_initial = true) @test_nowarn plot(semi, sol, conversion = prim2cons, plot_bathymetry = false) From 71d8dcea37276a3c84223438663f5aebd310b8c1 Mon Sep 17 00:00:00 2001 From: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:35:44 +0200 Subject: [PATCH 3/3] Update test/test_visualization.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/test_visualization.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_visualization.jl b/test/test_visualization.jl index 8db08b90..f7e1a9be 100644 --- a/test/test_visualization.jl +++ b/test/test_visualization.jl @@ -7,7 +7,8 @@ using Plots @testset "Visualization" begin custom_integral(q, equations) = q[1]^2 DispersiveShallowWater.pretty_form_utf(::typeof(custom_integral)) = "∫η²" - trixi_include(@__MODULE__, default_example(), tspan = (0.0, 1.0), extra_analysis_integrals = (waterheight_total, custom_integral)) + trixi_include(@__MODULE__, default_example(), tspan = (0.0, 1.0), + extra_analysis_integrals = (waterheight_total, custom_integral)) @test_nowarn plot(semi => sol) @test_nowarn plot!(semi => sol, plot_initial = true) @test_nowarn plot(semi, sol, conversion = prim2cons, plot_bathymetry = false)