|
269 | 269 | function write2vtk!(vtk, v, u, t, system::FluidSystem; write_meta_data=true) |
270 | 270 | vtk["velocity"] = [current_velocity(v, system, particle) |
271 | 271 | 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)] |
273 | 274 | # Indexing the pressure is a workaround for slicing issue (see https://github.com/JuliaSIMD/StrideArrays.jl/issues/88) |
274 | 275 | vtk["pressure"] = [current_pressure(v, system, particle) |
275 | 276 | for particle in active_particles(system)] |
@@ -373,13 +374,17 @@ end |
373 | 374 | function write2vtk!(vtk, v, u, t, system::TotalLagrangianSPHSystem; write_meta_data=true) |
374 | 375 | n_fixed_particles = nparticles(system) - n_moving_particles(system) |
375 | 376 |
|
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)] |
378 | 379 | vtk["jacobian"] = [det(deformation_gradient(system, particle)) |
379 | 380 | for particle in eachparticle(system)] |
380 | 381 |
|
381 | 382 | vtk["von_mises_stress"] = von_mises_stress(system) |
382 | 383 |
|
| 384 | + vtk["displacement"] = [current_coords(system, particle) - |
| 385 | + initial_coords(system, particle) |
| 386 | + for particle in eachparticle(system)] |
| 387 | + |
383 | 388 | sigma = cauchy_stress(system) |
384 | 389 | vtk["sigma_11"] = sigma[1, 1, :] |
385 | 390 | vtk["sigma_22"] = sigma[2, 2, :] |
|
0 commit comments