Skip to content

Commit ec13ba7

Browse files
authored
Merge branch 'main' into simple-advection
2 parents 36b7ff3 + 245713c commit ec13ba7

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/io/write_vtk.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ end
269269
function write2vtk!(vtk, v, u, t, system::FluidSystem; write_meta_data=true)
270270
vtk["velocity"] = [current_velocity(v, system, particle)
271271
for particle in active_particles(system)]
272-
vtk["density"] = current_density(v, system)
272+
vtk["density"] = [current_density(v, system, particle)
273+
for particle in active_particles(system)]
273274
# Indexing the pressure is a workaround for slicing issue (see https://github.com/JuliaSIMD/StrideArrays.jl/issues/88)
274275
vtk["pressure"] = [current_pressure(v, system, particle)
275276
for particle in active_particles(system)]
@@ -373,13 +374,17 @@ end
373374
function write2vtk!(vtk, v, u, t, system::TotalLagrangianSPHSystem; write_meta_data=true)
374375
n_fixed_particles = nparticles(system) - n_moving_particles(system)
375376

376-
vtk["velocity"] = hcat(view(v, 1:ndims(system), :),
377-
zeros(ndims(system), n_fixed_particles))
377+
vtk["velocity"] = [current_velocity(v, system, particle)
378+
for particle in active_particles(system)]
378379
vtk["jacobian"] = [det(deformation_gradient(system, particle))
379380
for particle in eachparticle(system)]
380381

381382
vtk["von_mises_stress"] = von_mises_stress(system)
382383

384+
vtk["displacement"] = [current_coords(system, particle) -
385+
initial_coords(system, particle)
386+
for particle in eachparticle(system)]
387+
383388
sigma = cauchy_stress(system)
384389
vtk["sigma_11"] = sigma[1, 1, :]
385390
vtk["sigma_22"] = sigma[2, 2, :]

0 commit comments

Comments
 (0)