Trixi.jl
Trixi.jl copied to clipboard
Reconstructing a Makie scalar plot from *.h5 files
I wanted to plot scalar fields based on saved data (*.h5 files) produced from simulations, since the sol
object produced may not be defined after a simulation has concluded. I reconstructed the plotting as follows
using Base
using Trixi
using CairoMakie
PlotDataSeries = Base.get_extension(Trixi, :TrixiMakieExt).PlotDataSeries
pd = ScalarPlotData2D(u[1:9:end], semi)
pds1 = PlotDataSeries(pd, 1) # dummy integer as an argument
CairoMakie.plot(pds1; plot_mesh=false)
-
u
is a vector that contains all variables (1-9) in the order var1, var2, ..., var9 before moving onto the next point in the mesh. -
semi
is created from theSemidiscretizationHyperbolic(...)
function
Inputting pd
as in CairoMakie.plot(pd)
yields the following error:
MethodError: no method matching length(::Nothing)
which is why I created pds1
to wrap pd
.
It'd be nice if we could just do plot(pd)
. This shouldn't be hard to implement since it's basically the same code as the standard plotting stuff.