Polyhedron

In addition to the standard 3D model, we recommend obtaining a surface model file directly through other preprocessing software (there is no need for mesh discretization within the model). Using this STL file, we will voxelize it and fill it with uniform material points.

MaterialPointGenerator.polyhedron2particleMethod
polyhedron2particle(stl_file::String, output_file, h; method::String="voxel", 
    verbose::Bool=false)

Description:

Convert a polyhedron (.stl) to a set of particles. The function will write the populated particles of each voxel into a .xyz file. The voxel size is defined by h, it is suggest to be equal to the MPM background grid size. method can be "voxel" or "ray" in string.The verbose is a flag to show the time consumption of each step.

Example:

stl_file = "/path/to/your/model.stl"
output_file = "/path/to/your/model.xyz"
h = 0.1
polyhedron2particle(stl_file, output_file, h, verbose=true)
source

Note that h refers to the size of the grid in the MPM simulation. By default, we will fill each cell with 8 material points.

The method about "ray" is modified based on this work: https://link.springer.com/article/10.1007/s40571-024-00813-z.