Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write meta data to vtk files #199

Merged
merged 24 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 4 additions & 0 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,7 @@ macro autoinfiltrate(condition=true)
lnn,
esc(condition))
end

function type2string(type)
return string(nameof(typeof(type)))
end
27 changes: 27 additions & 0 deletions src/visualization/write2vtk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function trixi2vtk(v, u, t, system; output_directory="out", prefix="", iter=noth
# Store particle index
vtk["index"] = eachparticle(system)

# Write some meta data
vtk["time"] = t

# Extract custom quantities for this system
for (key, func) in custom_quantities
value = func(v, u, t, system)
Expand Down Expand Up @@ -75,6 +78,16 @@ function write2vtk!(vtk, v, u, t, system::WeaklyCompressibleSPHSystem)
for particle in eachparticle(system)]
vtk["pressure"] = system.pressure

# write meta data
vtk["solver"] = "WCSPH"
vtk["correction_method"] = type2string(system.correction)
vtk["acceleration"] = system.acceleration
vtk["viscosity"] = type2string(system.viscosity)
vtk["smoothing_kernel"] = type2string(system.smoothing_kernel)
vtk["smoothing_length"] = system.smoothing_length
vtk["density_calculator"] = type2string(system.density_calculator)
vtk["state_equation"] = type2string(system.state_equation)
svchb marked this conversation as resolved.
Show resolved Hide resolved

return vtk
end

Expand All @@ -97,6 +110,15 @@ function write2vtk!(vtk, v, u, t, model, system)
end

function write2vtk!(vtk, v, u, t, model::BoundaryModelDummyParticles, system)
@unpack boundary_model = system

# write meta data
vtk["boundary_model"] = "BoundaryModelDummyParticles"
vtk["smoothing_kernel"] = type2string(boundary_model.smoothing_kernel)
vtk["smoothing_length"] = boundary_model.smoothing_length
vtk["density_calculator"] = type2string(boundary_model.density_calculator)
vtk["state_equation"] = type2string(boundary_model.state_equation)

write2vtk!(vtk, v, u, t, model, model.viscosity, system)
end

Expand All @@ -105,6 +127,8 @@ function write2vtk!(vtk, v, u, t, model::BoundaryModelDummyParticles, viscosity,
for particle in eachparticle(system)]
vtk["pressure"] = model.pressure

# write meta data
vtk["viscosity_model"] = type2string(viscosity)
return vtk
end

Expand All @@ -115,5 +139,8 @@ function write2vtk!(vtk, v, u, t, model::BoundaryModelDummyParticles,
vtk["pressure"] = model.pressure
vtk["wall_velocity"] = view(model.cache.wall_velocity, 1:ndims(system), :)

# write meta data
vtk["viscosity_model"] = "ViscosityAdami"

return vtk
end