This package converts density-based topology optimization results (from SIMP method) into smooth geometry defined by Signed Distance Functions (SDFs). The transformation precisely preserves the volume of the original optimized structure while eliminating jagged boundaries and intermediate density regions, making the resulting geometry suitable for manufacturing and further analysis.
Main function for transforming TO results into an implicit geometric representation using SDF:
rho2sdf(taskName, X, IEN, rho; options=Rho2sdfOptions())
taskName::String
: Base name for output filesX::Vector{Vector{Float64}}
: Mesh node coordinatesIEN::Vector{Vector{Int64}}
: Element connectivity (indices of element nodes)rho::Vector{Float64}
: Element densitiesoptions::Rho2sdfOptions
: Configuration options (optional)
Tuple
: (fine_sdf, fine_grid, sdf_grid, sdf_dists)vti
: SDF visualization in Paraview
The Rho2sdfOptions
struct allows for customization of the SDF generation process:
Rho2sdfOptions(;
threshold_density=0.5, # value for isocontour (0, 1)
sdf_grid_setup=:manual, # manual/automatic grid setup
export_nodal_densities=true, # export nodal field to Paraview
export_raw_sdf=true, # export non-smoothed SDF to Paraview
rbf_interp=false, # interpolate/approximate SDF values using RBFs
rbf_grid=:normal # normal/fine grid for RBFs interp/approx
)
- Threshold density value in range [0,1] used for isosurface generation
- If
nothing
, it will be automatically calculated from volume fraction
- SDF grid step configuration. Valid values:
:automatic
: Uses original mesh properties for grid step:manual
(default): Uses interactive grid setup allowing user configuration
- Controls whether nodal densities are exported to VTU format
- Default:
false
- Controls whether raw SDF values are exported to VTI format
- Default:
false
- Determines whether RBF interpolation or approximation is used
- Default:
true
(interpolation)
- Controls the resolution of the RBF grid
- Valid values:
:normal
(default): Standard resolution (smooth=1):fine
: Higher resolution (smooth=2)
# Basic usage with default options
result = rho2sdf("chapadlo", X, IEN, rho)
# Custom options
options = Rho2sdfOptions(
threshold_density=0.5,
sdf_grid_setup=:manual,
export_nodal_densities=true,
export_raw_sdf=true,
rbf_interp=true,
rbf_grid=:fine
)
result = rho2sdf("chapadlo", X, IEN, rho, options=options)
- Improvements to the calculation of nodal densities
- Use IPopt library for points where local coordinates were not found
- Extend implementation to include tetrahedral elements