Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
f1400fd
Update vtk2trixi function to return `NamedTuple` instead of `InitialC…
marcelschurer Oct 17, 2025
217f711
Refactor vtk2trixi function to accept custom fields
marcelschurer Oct 17, 2025
0fa5900
Enhance vtk2trixi function to support scalar and vector custom quanti…
marcelschurer Oct 20, 2025
66f83a3
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Oct 20, 2025
38a9b2a
Fix typo in documentation for vtk2trixi function
marcelschurer Oct 21, 2025
5d1192a
Fix capitalization in comments
marcelschurer Oct 23, 2025
0713bdd
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Oct 23, 2025
2cf2b1c
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Nov 10, 2025
eb98b4f
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Nov 14, 2025
1d33e8b
Merge branch 'main' into vtk2trixi-return-named-tuple
LasNikas Nov 20, 2025
0b22696
Merge branch 'main' into vtk2trixi-return-named-tuple
svchb Nov 21, 2025
7e51a81
add ELTYPE
Nov 22, 2025
cac637d
Merge branch 'main' into read-with-eltype
Nov 22, 2025
ffa4a1c
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Dec 3, 2025
c51f2ac
Merge branch 'vtk2trixi-return-named-tuple' of https://github.com/mar…
marcelschurer Dec 3, 2025
2b2fb72
Fix formatting in documentation
marcelschurer Dec 3, 2025
d460b88
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Dec 3, 2025
a621cca
Merge branch 'main' into read-with-eltype
Dec 8, 2025
1b889b4
Merge branch 'main' into read-with-eltype
Dec 8, 2025
b043bd1
add `coordinates_eltype`
Dec 8, 2025
de55ebd
Merge branch 'main' into read-with-eltype
Dec 9, 2025
9515f84
Merge branch 'main' into vtk2trixi-return-named-tuple
marcelschurer Dec 9, 2025
a9b0f2f
Corrected failing doctest output
marcelschurer Dec 9, 2025
0359425
first prototype
Dec 10, 2025
fd15671
write Q
Dec 10, 2025
364e24e
gpu fix
Dec 10, 2025
c1b0abf
add checks
Dec 10, 2025
eeebcc2
add docs
Dec 10, 2025
d8b5b00
Corrected failing doctest output
marcelschurer Dec 10, 2025
d21a549
adapt pressure model
Dec 10, 2025
b4020c8
use `foreach_no_alloc`
Dec 11, 2025
55be6a6
fix unit tests
Dec 11, 2025
4fe3c7d
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Dec 11, 2025
a431873
fix unit tests
Dec 11, 2025
b27e54d
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Dec 11, 2025
9339bcb
fix unit tests
Dec 11, 2025
5aa8f30
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Dec 11, 2025
d8cda93
fix doc tests
Dec 11, 2025
be8a23e
better docs
Dec 11, 2025
8aff117
use stored type
Dec 12, 2025
868b449
add docs
Dec 12, 2025
6e390c2
add tests
Dec 12, 2025
f3a981b
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Dec 12, 2025
6121e7d
fix formatting
Dec 12, 2025
dc02bd8
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Dec 13, 2025
7369f71
fix eltype
Dec 13, 2025
3682dd8
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Dec 13, 2025
3a97e49
Merge branch 'main' into fix_pressure_model
Dec 15, 2025
4dcece2
Merge branch 'main' into flow-rate-per-boundary-zone
Dec 15, 2025
38e376a
Merge branch 'main' into read-with-eltype
Dec 15, 2025
f347da8
Merge branch 'main' into vtk2trixi-return-named-tuple
LasNikas Dec 16, 2025
b25415f
Merge remote-tracking branch 'marcel/vtk2trixi-return-named-tuple' in…
Dec 16, 2025
a912326
revise #959
Dec 16, 2025
29b5b1a
fix buffer
Jan 6, 2026
daceea2
first poc
Jan 6, 2026
039dd13
Merge branch 'poc-restart' into restart-from-vtu
Jan 6, 2026
e9750b0
add show
Jan 6, 2026
695fe6c
remove mass
Jan 6, 2026
3acfe6c
Merge branch 'poc-restart' into restart-from-vtu
Jan 6, 2026
2d8bce8
add preconditioning
Jan 6, 2026
616a2dc
fix inactive particles
Jan 6, 2026
a80518c
fix zone IDs
Jan 6, 2026
439cb6b
add test
Jan 6, 2026
f3049a4
make it gpu compatible
Jan 6, 2026
1c7cd38
add gpu tests
Jan 6, 2026
c605502
fix tests
Jan 7, 2026
5987957
Merge branch 'poc-restart' into restart-from-vtu
Jan 7, 2026
1cada77
add checks
Jan 7, 2026
100590e
add example
Jan 7, 2026
358848d
add docs
Jan 7, 2026
2b56dc8
fix typo
Jan 7, 2026
63b760a
Merge branch 'main' into flow-rate-per-boundary-zone
Jan 7, 2026
7c08761
implement suggestions
Jan 7, 2026
90402fb
Merge branch 'main' into read-with-eltype
Jan 7, 2026
4a6bca1
implement suggestions
Jan 7, 2026
bbeade4
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Jan 7, 2026
f8f788c
implement suggestions
Jan 7, 2026
ce0febf
Merge branch 'main' into read-with-eltype
Jan 7, 2026
9e4276a
use strings instead of RestartConditin
Jan 7, 2026
7564985
add test mixed types
Jan 7, 2026
2e744db
Merge branch 'main' into flow-rate-per-boundary-zone
Jan 7, 2026
b831fa5
Merge branch 'flow-rate-per-boundary-zone' into fix_pressure_model
Jan 7, 2026
6848fbf
Merge branch 'fix_pressure_model' into restart-from-vtu
Jan 7, 2026
c4ce276
Merge branch 'main' into poc-restart
Jan 7, 2026
5c600c4
Merge branch 'read-with-eltype' into poc-restart
Jan 7, 2026
54190e6
Merge branch 'poc-restart' into restart-from-vtu
Jan 7, 2026
16fcfba
Merge branch 'main' into vtk2trixi-return-named-tuple
Jan 10, 2026
cfba71c
add NEWS entry
Jan 10, 2026
2dcbc76
revise
Jan 10, 2026
0d587cd
fix doc test
Jan 10, 2026
f316d3d
Merge branch 'main' into restart-from-vtu
Jan 10, 2026
bb4e7da
Merge branch 'vtk2trixi-return-named-tuple' into restart-from-vtu
Jan 10, 2026
48a79e1
rm test file
Jan 10, 2026
f264c9a
fix merge bugs
Jan 10, 2026
df63263
fix preconditioning
Jan 10, 2026
e26a569
Merge branch 'main' into restart-from-vtu
Jan 13, 2026
47bc4c2
don't read IC
Jan 13, 2026
2ca0551
Merge branch 'main' into vtk2trixi-return-named-tuple
Jan 13, 2026
5afcc47
Merge branch 'main' into restart-from-vtu
Jan 15, 2026
ae5496a
fix merge bug
Jan 15, 2026
143e9dc
Merge branch 'dev' into vtk2trixi-return-named-tuple
Jan 19, 2026
cf0a4a2
Merge branch 'main' into vtk2trixi-return-named-tuple
Jan 20, 2026
a1fc021
fix NEWS entry
Jan 20, 2026
32872b0
Merge branch 'dev' into vtk2trixi-return-named-tuple
Jan 21, 2026
ab1476b
Merge branch 'vtk2trixi-return-named-tuple' into restart-from-vtu
Jan 21, 2026
8c50353
fix merge bug
Jan 22, 2026
6fa813a
Merge branch 'vtk2trixi-return-named-tuple' into restart-from-vtu
Jan 22, 2026
4b3b911
fix formatting
Jan 22, 2026
55635fc
better name
Jan 22, 2026
f02d724
add more tests
Jan 22, 2026
2542c15
Merge branch 'main' into restart-from-vtu
Apr 17, 2026
21853d3
Merge branch 'dev' into restart-from-vtu
Apr 17, 2026
6221cbc
revise example
Apr 17, 2026
16ee9d1
Merge branch 'dev' into restart-from-vtu
Apr 20, 2026
d69528d
Merge branch 'dev' into restart-from-vtu
Apr 22, 2026
ce37610
Merge branch 'dev' into restart-from-vtu
LasNikas Apr 28, 2026
68a7f28
Merge branch 'main' into restart-from-vtu
LasNikas Apr 29, 2026
1fbb618
Merge branch 'main' into restart-from-vtu
LasNikas May 8, 2026
c96fc3c
Merge branch 'main' into restart-from-vtu
May 9, 2026
ad7c722
Merge branch 'main' into restart-from-vtu
May 13, 2026
8ba5006
implement suggestions
May 13, 2026
393b644
add structure example
May 13, 2026
efeb666
add tests
May 13, 2026
a95dd22
fix description
May 13, 2026
d05f198
fix tests
May 13, 2026
c92869c
avoid outputs
May 13, 2026
64d41c4
add NEWS entry
May 13, 2026
79a5285
Merge branch 'main' into restart-from-vtu
svchb May 19, 2026
34d99e1
Merge branch 'main' into restart-from-vtu
LasNikas Jun 1, 2026
b80727d
implement suggestions
Jun 1, 2026
af8ac67
Merge branch 'main' into restart-from-vtu
LasNikas Jun 2, 2026
1526df9
Merge branch 'main' into restart-from-vtu
LasNikas Jun 16, 2026
ed07cfb
implement suggestions
Jun 16, 2026
adc70a6
fix gpu
Jun 16, 2026
4bcddda
apply formatter
Jun 16, 2026
c7e7439
fix
Jun 16, 2026
c4b9abe
Merge branch 'main' into restart-from-vtu
LasNikas Jun 23, 2026
8580bea
remove beam example
Jun 23, 2026
65d19d8
implement suggestions
Jun 23, 2026
5a94f66
undo density_calculator dispatch
Jun 24, 2026
9d8f83e
use non-adaptive scheme
Jun 24, 2026
6be58a7
apply formatter
Jun 24, 2026
6299703
fix cfl
Jun 24, 2026
08ae5d3
fix restart
Jun 24, 2026
e0bb790
adapt rtol again
Jun 24, 2026
f8828b1
add TODO
Jun 24, 2026
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
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ TrixiParticles.jl follows the interpretation of
[semantic versioning (semver)](https://julialang.github.io/Pkg.jl/dev/compatibility/#Version-specifier-format-1)
used in the Julia ecosystem. Notable changes will be documented in this file for human readability.

## Version 0.5.2

### Features
- Added the ability to restart simulations from VTK solution files generated by `SolutionSavingCallback`.
Users can now pass the `restart_with` keyword argument to `semidiscretize` (#1190).

## Version 0.5.1

### Features

- Implemented stage-level coupling for split integration (#1049).
- Added `MechanicalWorkCalculatorCallback` (#940).

Expand Down
31 changes: 31 additions & 0 deletions examples/postprocessing/restart_poiseuille_flow_2d.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ==========================================================================================
# Restart Example: Poiseuille Flow 2D
#
# This example demonstrates how to restart a simulation.
# We first run a simulation of 2D Poiseuille flow up to t=0.3s, then restart from the
# saved state and continue the simulation until t=0.6s.
# ==========================================================================================
using TrixiParticles

trixi_include(@__MODULE__,
joinpath(examples_dir(), "fluid", "poiseuille_flow_2d.jl"),
tspan=(0.0, 0.3), sound_speed_factor=10, particle_spacing=4e-5)

# Get latest iteration
iter = saving_callback.affect!.affect!.latest_saved_iter

restart_file_fluid = joinpath("out", "fluid_1_$iter.vtu")
restart_file_open_boundary = joinpath("out", "open_boundary_1_$iter.vtu")
restart_file_boundary = joinpath("out", "boundary_1_$iter.vtu")

ode_restart = semidiscretize(semi, (0.3, 0.6);
restart_with=(restart_file_fluid,
restart_file_open_boundary,
restart_file_boundary))

saving_callback = SolutionSavingCallback(dt=0.02, prefix="restart")

callbacks = CallbackSet(info_callback, saving_callback, UpdateCallback())

sol_restart = solve(ode_restart, RDPK3SpFSAL35(), abstol=1e-5, reltol=1e-3, dtmax=1e-2,
save_everystep=false, callback=callbacks)
1 change: 1 addition & 0 deletions src/TrixiParticles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ include("general/semidiscretization.jl")
include("general/gpu.jl")
include("preprocessing/preprocessing.jl")
include("io/io.jl")
include("general/restart.jl")
include("visualization/recipes_plots.jl")

export Semidiscretization, semidiscretize, restart_with!
Expand Down
5 changes: 5 additions & 0 deletions src/general/neighborhood_search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ end
end

# === Initialization ===

function initialize_neighborhood_searches!(semi, u0_ode, restart_with::Nothing)
initialize_neighborhood_searches!(semi)
end

function initialize_neighborhood_searches!(semi)
foreach_system(semi) do system
foreach_system(semi) do neighbor
Expand Down
139 changes: 139 additions & 0 deletions src/general/restart.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Update `v0_ode` and `u0_ode` with the data from the restart files
function set_initial_conditions!(v0_ode, u0_ode, semi, restart_with::Tuple{Vararg{String}})
# Check number of systems
if length(semi.systems) != length(restart_with)
throw(ArgumentError("number of systems in `semi` does not match number of restart files provided " *
"in `restart_with`"))
end

# Check that systems match
expected_system_names = system_names(semi.systems)
foreach_system(semi) do system
system_index = system_indices(system, semi)
filename = restart_with[system_index]
expected_system_name = expected_system_names[system_index]
if !occursin(expected_system_name, basename(splitext(filename)[1]))
throw(ArgumentError("Filename '$filename' for system $system_index does not contain expected name '$expected_system_name'. " *
"Expected a VTK file for system of type $(nameof(typeof(system)))."))
end
end

# Set initial conditions
foreach_noalloc(semi.systems, restart_with) do (system, restart_file)
v0_system = wrap_v(v0_ode, system, semi)
u0_system = wrap_u(u0_ode, system, semi)

restart_data = vtk2trixi(restart_file; create_initial_condition=false)
v_restart = restart_v(system, restart_data)
u_restart = restart_u(system, restart_data)

v0_system .= Adapt.adapt(semi.parallelization_backend, v_restart)
u0_system .= Adapt.adapt(semi.parallelization_backend, u_restart)

restore_previous_state!(system, restart_file)
end
end

# Compute a new `tspan` based on the restart files
function time_span(tspan, restart_with::Tuple{Vararg{String}})
# Read restart times from all files
restart_times = [vtk2trixi(file).time for file in restart_with]
t_restart = convert(eltype(tspan), first(restart_times))

# Check if all restart files have the same time
if !all(isapprox(t, t_restart) for t in restart_times)
throw(ArgumentError("all restart files must start from the same time"))
end

if !isapprox(tspan[1], t_restart)
@info "Adjusting initial time from $(tspan[1]) to restart time $t_restart"
end

return (t_restart, tspan[2])
end

function write_density_and_pressure!(v_restart, system, density_calculator,
pressure, density)
return v_restart
end

function write_density_and_pressure!(v_restart, system,
density_calculator::ContinuityDensity,
pressure, density)
v_restart[size(v_restart, 1), :] = density

return v_restart
end

function write_density_and_pressure!(v_restart, system::EntropicallyDampedSPHSystem,
density_calculator::ContinuityDensity,
pressure, density)
v_restart[size(v_restart, 1), :] = density
v_restart[size(v_restart, 1) - 1, :] = pressure

return v_restart
end

function write_density_and_pressure!(v_restart, system::EntropicallyDampedSPHSystem,
density_calculator::SummationDensity,
pressure, density)
v_restart[size(v_restart, 1) - 1, :] = pressure

return v_restart
end

restore_previous_state!(system, restart_file) = system

function initialize_neighborhood_searches!(semi, u0_ode,
restart_with::Tuple{Vararg{String}})
foreach_system(semi) do system
foreach_system(semi) do neighbor
initialize_neighborhood_search!(semi, system, neighbor, u0_ode)
end
end

return semi
end

function initialize_neighborhood_search!(semi, system, neighbor, u0_ode)
# TODO Initialize after adapting to the GPU.
# Currently, this cannot use `semi.parallelization_backend`
# because data is still on the CPU.
PointNeighbors.initialize!(get_neighborhood_search(system, neighbor, semi),
initial_restart_coordinates(system, u0_ode, semi),
initial_restart_coordinates(neighbor, u0_ode, semi),
eachindex_y=each_active_particle(neighbor),
parallelization_backend=PolyesterBackend())
return semi
end

function initialize_neighborhood_search!(semi, system::TotalLagrangianSPHSystem,
neighbor::TotalLagrangianSPHSystem, u0_ode)
# For TLSPH, the self-interaction NHS is already initialized in the system constructor
return semi
end

function initial_restart_coordinates(system, u0_ode, semi)
# Transfer to CPU if data is on the GPU. Do nothing if already on CPU.
return transfer2cpu(wrap_u(u0_ode, system, semi))
end

function initial_restart_coordinates(system::Union{WallBoundarySystem,
AbstractStructureSystem}, u0_ode, semi)
return initial_coordinates(system)
end

function initialize!(semi::Semidiscretization, restart_with::Tuple{Vararg{String}})
foreach_system(semi) do system
# Initialize this system
initialize_restart!(system, semi)
end

return semi
end

initialize_restart!(system, semi) = initialize!(system, semi)


# TODO
# Store controller values for an adaptive time stepping scheme
53 changes: 41 additions & 12 deletions src/general/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ end
end

"""
semidiscretize(semi, tspan; reset_threads=true)
semidiscretize(semi, tspan; reset_threads=true, restart_with=nothing)

Create an `ODEProblem` from the semidiscretization with the specified `tspan`.

Expand All @@ -193,6 +193,14 @@ Create an `ODEProblem` from the semidiscretization with the specified `tspan`.
- `tspan`: The time span over which the simulation will be run.

# Keywords
- `restart_with`: Can be used to restart the simulation from VTK solution files (see [`SolutionSavingCallback`](@ref)).
This can be either `nothing` (default, no restart) or a `Tuple` of filenames,
one for each system in the [`Semidiscretization`](@ref).
The order of the filenames must match the order of the systems in the [`Semidiscretization`](@ref).
Note that `semidiscretize` replaces the initial time (`tspan[1]`) with the timestamp read
from the VTK files. If the user-provided `tspan[1]` does not match the restart time,
it is adjusted and an info message is logged. If multiple files are provided, their
timestamps must match.
- `reset_threads`: A boolean flag to reset Polyester.jl threads before the simulation (default: `true`).
After an error within a threaded loop, threading might be disabled. Resetting the threads before the simulation
ensures that threading is enabled again for the simulation.
Expand All @@ -219,9 +227,16 @@ timespan: (0.0, 1.0)
u0: ([...], [...]) *this line is ignored by filter*
```
"""
function semidiscretize(semi, tspan; reset_threads=true)
function semidiscretize(semi, tspan; reset_threads=true, restart_with=nothing)
(; systems) = semi

if restart_with isa String
restart_with = (restart_with,)
elseif !isnothing(restart_with) && !(restart_with isa NTuple{<:Any, String})
throw(ArgumentError("`restart_with` must be `nothing`, a string, or a tuple of strings, " *
"got $(typeof(restart_with))"))
end

# Check that all systems have the same eltype
first_system = first(systems)
if !all(system -> eltype(system) === eltype(first_system), systems)
Expand Down Expand Up @@ -267,14 +282,11 @@ function semidiscretize(semi, tspan; reset_threads=true)
end

# Set initial condition
foreach_system_wrapped(semi, v0_ode, u0_ode) do system, v0_system, u0_system
write_u0!(u0_system, system)
write_v0!(v0_system, system)
end
set_initial_conditions!(v0_ode, u0_ode, semi, restart_with)

# TODO initialize after adapting to the GPU.
# Requires https://github.com/trixi-framework/PointNeighbors.jl/pull/86.
initialize_neighborhood_searches!(semi)
initialize_neighborhood_searches!(semi, u0_ode, restart_with)

if semi.parallelization_backend isa KernelAbstractions.GPU
# Convert all arrays in the systems to the correct array type.
Expand Down Expand Up @@ -304,10 +316,7 @@ function semidiscretize(semi, tspan; reset_threads=true)
end

# Initialize all particle systems
foreach_system(semi_new) do system
# Initialize this system
initialize!(system, semi_new)
end
initialize!(semi_new, restart_with)

# Reset callback flag that will be set by the `UpdateCallback`
semi_new.update_callback_used[] = false
Expand All @@ -318,7 +327,27 @@ function semidiscretize(semi, tspan; reset_threads=true)
# here, since we cannot change `p` from within the callback (only its contents).
p = @NamedTuple{semi::typeof(semi_new), split_integration_data::Any}((semi_new,
nothing))
return DynamicalODEProblem(kick!, drift!, v0_ode, u0_ode, tspan, p)

return DynamicalODEProblem(kick!, drift!, v0_ode, u0_ode,
time_span(tspan, restart_with), p)
end

function set_initial_conditions!(v0_ode, u0_ode, semi, restart_with::Nothing)
foreach_system_wrapped(semi, v0_ode, u0_ode) do system, v0_system, u0_system
write_u0!(u0_system, system)
write_v0!(v0_system, system)
end
end

time_span(tspan, restart_with::Nothing) = tspan

function initialize!(semi::Semidiscretization, restart_with::Nothing)
foreach_system(semi) do system
# Initialize this system
initialize!(system, semi)
end

return semi
end

"""
Expand Down
18 changes: 15 additions & 3 deletions src/io/read_vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@ function vtk2trixi(file; element_type=nothing, coordinates_eltype=nothing,
point_coords = ReadVTK.get_points(vtk_file)

cELTYPE = isnothing(coordinates_eltype) ? eltype(point_coords) : coordinates_eltype
ELTYPE = isnothing(element_type) ?
eltype(first(ReadVTK.get_data(point_data["pressure"]))) : element_type

if !isnothing(element_type)
ELTYPE = element_type
else
# Try to get element type from pressure or density (whichever exists)
ELTYPE = if "pressure" in keys(point_data)
eltype(first(ReadVTK.get_data(point_data["pressure"])))
elseif "material_density" in keys(point_data)
eltype(first(ReadVTK.get_data(point_data["material_density"])))
else
error("neither 'pressure' nor 'material_density' field found in VTK file")
end
end

results = Dict{Symbol, Any}()

Expand Down Expand Up @@ -87,7 +98,8 @@ function vtk2trixi(file; element_type=nothing, coordinates_eltype=nothing,
results[:particle_spacing]
results[:coordinates] = coordinates
results[:time] = "time" in keys(field_data) ?
first(ReadVTK.get_data(field_data["time"])) : zero(ELTYPE)
convert(ELTYPE, first(ReadVTK.get_data(field_data["time"]))) :
zero(ELTYPE)

append!(used_keys, ["index", "ndims"])
# Load any custom quantities
Expand Down
10 changes: 10 additions & 0 deletions src/io/write_vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,16 @@ function write2vtk!(vtk, v, u, t, system::OpenBoundarySystem)
for particle in eachparticle(system)]
vtk["pressure"] = [current_pressure(v, system, particle)
for particle in eachparticle(system)]
vtk["zone_id"] = [system.boundary_zone_indices[particle]
for particle in eachparticle(system)]

if any(pm -> isa(pm, AbstractPressureModel), system.cache.pressure_reference_values)
for (i, pressure_model) in enumerate(system.cache.pressure_reference_values)
if pressure_model isa AbstractPressureModel
vtk["boundary_zone_pressure_$i"] = system.cache.pressure_reference_values[i].pressure[]
end
end
end

if system.calculate_flow_rate
Q_total = zero(eltype(system))
Expand Down
Loading
Loading