Skip to content

Particle Surface Reconstruction

Here we will detect the surface points of the particle model and construct a closed surface through them. This functionality heavily relies on splashsurf. We need to first convert the particle information to a .ply file(s), which will be used as input for splashsurf.

There are several parameters that need to be determined, whether it is a single .ply file or a series of .ply files (animation):

MaterialPointVisualizer.pts2surf Method
julia
pts2surf(
    coords::AbstractArray, 
    output_file::String;
    radius::Real,
    density::Real,
    smoothing_length::Real=1.2,
    cube_size::Real=0.6,
    iso_surface_threshold::Real=0.6,
    mesh_smoothing_weights::Bool=true,
    mesh_smoothing_weights_normalization::Real=13.0,
    mesh_smoothing_iters::Int=25,
    normals_smoothing_iters::Int=10,
    mesh_cleanup::Bool=true,
    compute_normals::Bool=true,
    subdomain_grid::Bool=true,
    subdomain_num_cubes_per_dim::Int=64,
    output_mesh_smoothing_weights::Bool=true
)

Description:

  • radius: particle (primitive) radius should be half of the particle's diameter.

  • smoothing-length: It should be set around 1.2. The larger the value, the smoother the isosurface, but it will also artificially increase the fluid volume.

  • iso_surface-threshold: It can be used to offset the increase in fluid volume caused by factors such as larger particle radius, and a threshold of 0.6 seems to work quite well.

  • cube_size: Typically, it should not exceed 1. If the results are rough or the runtime is long, start increasing or decreasing from between 0.5 to 0.75.


  • 半径:粒子(原始)半径,应该是粒子直径的一半

  • 光滑长度:应围绕1.2设置。值越大,等值面越平滑,但也会人为地增加流体体积

  • 表面阈值:可以用来抵消由于较大粒子半径等因素导致的流体体积增加,0.6的阈值似乎效果不错

  • 立方体尺寸:通常不能大于1,如果结果粗糙或者运行时间长,从0.5~0.75之间开始增大或减小

source
MaterialPointVisualizer.hdf2surf Method
julia
hdf2surf(
    conf::NamedTuple;
    radius::Real,
    density::Real,
    smoothing_length::Real=1.2,
    cube_size::Real=0.6,
    iso_surface_threshold::Real=0.6,
    mesh_smoothing_weights::Bool=true,
    mesh_smoothing_weights_normalization::Real=13.0,
    mesh_smoothing_iters::Int=25,
    normals_smoothing_iters::Int=10,
    mesh_cleanup::Bool=true,
    compute_normals::Bool=true,
    subdomain_grid::Bool=true,
    subdomain_num_cubes_per_dim::Int=64,
    output_mesh_smoothing_weights::Bool=true
)

Description:

Generates surface reconstruction from the particle data stored in HDF5 file. conf is defined through MaterialPointSolver.jl and by default includes the fields prjdst (project directory path) and prjname (project name). If the original conf is lost, please construct it yourself, for example:

julia
conf = (prjdst="path/to/your/project", prjname="project_name").

Note:

  • Inside the function, use prjdst/prjname.h5 as the path to the HDF5 file.

  • This feature primarily provides surface reconstruction support for HDF5 files generated by MaterialPointSolver.jl.

If your HDF5 file is generated by other means, please refer to WriteVTK.jl.

Examples:

julia
conf = (prjdst="path/to/your/project", prjname="project_name")
hdf2surf(conf;
    radius=0.025,
    density=1000.0,
    smoothing_length=2.0,
    cube_size=0.5,
    iso_surface_threshold=0.6,
    mesh_smoothing_weights=true,
    mesh_smoothing_weights_normalization=13.0,
    mesh_smoothing_iters=25,
    normals_smoothing_iters=10,
    mesh_cleanup=true,
    compute_normals=true,
    subdomain_grid=true,
    subdomain_num_cubes_per_dim=64,
    output_mesh_smoothing_weights=true
)
source