Implicit2TetMesh is an experimental Julia package for generating high-quality tetrahedral meshes from implicit geometries defined by Signed Distance Functions (SDFs), inspired by isosurface stuffing algorithm. Implementation details are provided in the documentation below. For practical usage examples, see test/Examples/.
- Robust Meshing: High-quality tetrahedral mesh generation from implicit geometries using A15 (body-centered cubic) and Schlafli (orthoscheme) discretizations
- Isosurface Refinement: Advanced boundary processing with experimental NZZZ case handling for thin features relative to characteristic element size
- Volume Correction: Precise volume preservation using automatic surface node adjustment
- Geometric Constraints: Bounded plane definitions for selective node alignment
- Mesh Operations: Slicing, isolated component removal, inverted element fixing, and VTU export with mesh quality metrics
Requirements: Julia LTS (1.10.10)
# From Julia REPL, press ] to enter package mode
pkg> add https://github.com/jezekon/Implicit2TetMesh.jlor
git clone https://github.com/jezekon/Implicit2TetMesh.jl
Generate tetrahedral meshes from SDF data:
generate_tetrahedral_mesh(grid_file, sdf_file, output_prefix; options=MeshGenerationOptions())grid_file::String: Path to the JLD2 file containing the grid datasdf_file::String: Path to the JLD2 file containing the SDF valuesoutput_prefix::String: Prefix for output files (default: "output")options::MeshGenerationOptions: Configuration options (optional)
mesh::BlockMesh: The generated tetrahedral mesh- Output files:
.vtumesh visualization files for Paraview
Configure the mesh generation process with the following options:
MeshGenerationOptions(;
scheme::String = "A15", # Discretization scheme: "A15" or "Schlafli"
warp_param::Float64 = 0.3, # Warping intensity for plane alignment (0.0 = disabled)
plane_definitions::Union{Vector{PlaneDefinition}, Nothing} = nothing, # Cutting planes for BC application
quality_export::Bool = false, # Export detailed quality metrics
correct_volume::Bool = false, # Apply volume correction algorithm
experimental_nzzz::Bool = false # Enable experimental NZZZ case warping
)- scheme:
"A15": Body-centered cubic lattice discretization (recommended for most cases)"Schlafli": Orthoscheme discretization (better for axis-aligned features)
- warp_param: Controls how strongly nodes are attracted to cutting planes (0.0-1.0 range recommended)
- plane_definitions: Vector of
PlaneDefinitionobjects for boundary plane constraints - quality_export: When
true, exports additional quality metrics (Jacobian determinants, dihedral angles, volume ratios) - correct_volume: Enables iterative volume correction to match reference SDF volume (may increase processing time)
- experimental_nzzz: Enables experimental warping for NZZZ cases (one node outside, three on surface). Use with caution.
using Implicit2TetMesh
# Basic usage with default options
mesh = generate_tetrahedral_mesh(
"path/to/grid_data.jld2",
"path/to/sdf_data.jld2",
"beam"
)For complete examples with detailed documentation, see test/Examples/:
# Run beam example
julia --project=. test/Examples/beam.jl
julia --project=. test/Examples/gripper.jl- Improve NZZZ case handling based on dihedral angles
- Add support for NNZZ cases (two nodes outside, two on surface)
- Performance optimizations for large meshes
This package is an experimental tool. Please validate results carefully.
