Skip to content

Commit

Permalink
Use functions from analysis_integrals (#152)
Browse files Browse the repository at this point in the history
* use functions from analysis_integrals

* add test

* Update test/test_visualization.jl

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
JoshuaLampert and github-actions[bot] authored Sep 11, 2024
1 parent 6ab2051 commit 11355c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion test/test_visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ 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)
Expand Down

0 comments on commit 11355c0

Please sign in to comment.