Utilities

This sub-module of TopOpt defines penalty functions, projections, and low-level helpers shared across the package. The penalty and projection types control how raw design variables are mapped to physical densities before they enter the stiffness assembly.

Penalties

Penalties (SIMP-style) push intermediate densities toward 0 or 1 so that the optimization converges to a near-binary design.

TopOpt.Utilities.AbstractPenaltyType
AbstractPenalty{T}

Abstract type for SIMP-style penalties applied to density variables. T is the numeric type. Concrete subtypes: PowerPenaltyFun, RationalPenaltyFun, SinhPenaltyFun, ProjectedPenaltyFun.

source
TopOpt.Utilities.ProjectedPenaltyFunType
ProjectedPenaltyFun(penalty, proj)

Composite penalty that applies a projection (default HeavisideProjectionFun(10)) before the penalty. Pushes the design toward 0/1 and then penalises.

source

Projections

Projections are smooth approximations of a step function, used to sharpen the design. They can be applied standalone or composed with a penalty via ProjectedPenaltyFun.

Penalty accessors

TopOpt.Utilities.setpenalty!Function
setpenalty!(solver, p)

Update the penalty of solver to p (a number or an AbstractPenalty). Stashes the old penalty in getprevpenalty.

source

Design-density helper

TopOpt.Utilities.densityFunction
density(var, xmin)

Map a design variable var ∈ [0, 1] to a physical density in [xmin, 1]: ρ = var * (1 - xmin) + xmin. This is the interpolation step that gives void (xmin) a small but nonzero stiffness to keep the system non-singular.

source