Skip to content

Topology optimisation on a deformable mesh: notes

The bracket tutorial optimises the element densities and the node positions together (K. Jung and D.-N. Kim, Density-based topology optimization using a deformable mesh, Computers & Structures (2025), doi:10.1016/j.compstruc.2025.107879). These notes collect what was measured while building that method in jNO: how the manufacturability levers behave, what the solver choice costs, and which of a run's numbers are reproducible. Most were measured on the classic SIMP cantilever, a \(60\times30\) plate clamped on the left with a unit load over the lower right corner at a \(40\%\) volume fraction, solved with the same functions as the bracket; a few on a 3-D bracket. The numbers are for those problems, not for the tutorial's.

Manufacturability

Perimeter is a global budget, and converged designs exploit that

A design can meet \(P^\*\) exactly and still be locally serrated, paying for a spike here with flatness elsewhere. Measured on a converged 3-D bracket with the barrier active and satisfied, the angle between adjacent surface facets had a median of \(33.5^\circ\), a 99th percentile of \(88.9^\circ\), and \(27\%\) of adjacent pairs above \(60^\circ\) — a surface nobody would machine, scoring as well on eq. (38) as a smooth one would. Neither cheap lever fixes it: un-throttling node migration un-pinned the nodes (\(27.3\% \to 6.2\%\) sitting at their move bound) and moved the roughness only \(33.5^\circ \to 32.0^\circ\), while tightening \(P^\*\) from 44 to 31 bought \(26.9^\circ\) at \(91\%\) worse compliance. Both also collapsed the volume constraint, to \(V=0.705\) and \(0.635\) against the baseline's \(0.998\).

rho.curvature(zeta=0.1) is the local measure the perimeter is not — the discrete bending energy of a triangle mesh (Grinspun, Hirani, Desbrun & Schröder, Discrete Shells, SCA 2003, §3), summed over pairs of interior facets sharing a ridge (a mesh vertex in 2-D, a mesh edge in 3-D). Each pair costs \(|\Delta_i||\Delta_j|(1-\cos\theta_{ij})\) in the sharp limit, so it is zero unless both facets carry boundary and then grows with the angle between them. It is orientation-free (facet normal and density jump flip signs together), non-negative by construction, and exactly zero both on a flat boundary and where there is no boundary at all.

Add it as a penalty rather than a constraint — MMA already has the volume and the geometric bounds to trade against, and that trade is where the volume collapses:

S = rho.curvature(zeta=0.1)
terms.append(WEIGHT * S)          # weight in compliance units; see the scale note below

(This one is a sketch, not part of the script: the script uses perimeter control only.)

A weight needs a scale and the design cannot supply one, because at iteration 0 the density is uniform and the bending is exactly zero. Take it from the mesh instead — what a single flat cut already costs, purely from its own faceting. That floor is real (an unstructured interface zig-zags between tetrahedra rather than lying in the plane it approximates, the same reason a straight bar's perimeter measures above its length) but it does not track refinement: measured \(50.7\) at \(h=0.5\) against \(52.4\) at \(h=0.35\), across a \(2.6\times\) change in tet count. So WEIGHT = w / S_ref keeps \(w\) comparable across meshes.

The comparison that shows the two functionals are genuinely different: under a monotone staircase boundary the perimeter telescopes to one horizontal unit per column plus the total rise, whatever route the staircase takes. Three designs of identical volume and identical perimeter — \(14.0000\) to every decimal place — score \(S = 2\), \(10\), \(12\), exactly their right-angle counts.

one big step five small ones a staircase
perimeter \(P\) \(14.0000\) \(14.0000\) \(14.0000\)
bending \(S\) \(2\) \(10\) \(12\)

In 3-D the separation is milder and the honest number is the ratio between the functionals: a square corrugation at fixed volume raises \(P\) by \(1.59\times\) and \(S\) by \(1.90\times\); scrambling the same material raises \(P\) by \(14.6\times\) and \(S\) by \(48.2\times\). So bending is about \(1.2\times\) sharper on a fold and \(3.3\times\) sharper on noise — worth its own term, and not a replacement for perimeter control.

Under a deformable mesh the term is also differentiable in the node coordinates, which is half the point: it gives node migration a reason to align the boundary rather than merely shorten it.

The patch filter has a size limit, and it is lower than it looks

Eq. (18) is a geometric mean over \(N-2\) factors, and a mean dilutes a single outlier by \(1/N\). So the criterion's discriminating power is set by how many elements meet at the vertex. Measured on the shipped kernel (tests/test_patch_filter_scaling.py), with \(f_\text{solid}=1\) throughout:

\(N\) lone dense element one-node connection uniform grey hinge / solid
5 (3-D edge fan, \(6T/E\)) 0.100 0.013 0.831 0.01
6 (2-D vertex, \(3T/V\)) 0.178 0.038 0.842 0.04
8 0.316 0.112 0.853 0.11
12 0.501 0.755 0.862 0.76
27 (3-D vertex, \(4T/V\)) 0.758 0.845 0.870 0.85

At the size a 2-D triangulation actually produces (\(N\approx6\)) the filter separates a defect from a grey patch by a factor of \(4.7\), which is what makes it work. By \(N=12\) three-quarters of that is gone, and a valence-12 vertex is not exotic on an unstructured mesh — so on a badly graded 2-D mesh the filter quietly weakens where the patches are largest. At \(N\approx27\), the size of a tetrahedral vertex patch, a hinge sits within \(3\%\) of uniform grey and nothing downstream can act on it; SIMP cannot finish the job either, since \(0.758^3 = 0.44\) of solid against \(0.006\) for the \(0.178\) of a six-element patch.

This is a property of any mean — a density-weighted geometric mean with exponent \(1/\sum\rho\) behaves the same — so it is not recoverable by reweighting. The practical consequences: a 3-D vertex criterion needs an order statistic rather than eq. (18), while a 3-D edge fan (\(6T/E\approx5.2\)) sits in the regime where the formula is at its strongest — it discriminates a hinge three times more sharply than the 2-D vertex patch it was designed for — and so transfers verbatim. This is the extension Jung, Yun & Kim leave open in their §2.3.2.

Cost

The objective is an integral, (E * a(eps(u), eps(u))).integrate(fem), and .integrate(fem) is worth using where quadrature is actually needed. rho.integrate(fem) gives the right volume, but ρ is piecewise constant, so ∫ρ dΩ is exactly Σ ρ_k |K| — and routing it through the functional runs a full element map, plus its backward pass, to compute a weighted sum. Measured on the cantilever, at 400 iterations: compliance as an integral costs 84 s against 80 s for the frozen-load-vector version, about 4 %; adding the volume as an integral too pushed the same run past 7 minutes. The rule that falls out is not "avoid the functional" but "use it for what has an integrand" — an energy density needs the basis and the quadrature, a per-element sum does not.

This matters past tidiness. The objective used to be a dot product against a load vector evaluated outside the trace, and the volume a lambda over cell_volume() — so every new objective needed its own reduction over the DOF vector. As integrals, a stress constraint (((sigma_vm/SIG_Y)**p).integrate(fem)), a compliant mechanism's output displacement, and multiple load cases are all the same one construct.

Pick the solver — in 3-D it is most of the run

integrate(fem, solver=...) selects the backend for the solve every functional over that fem shares. It is the single biggest lever on a design loop, because the solve runs once forward and once adjoint per iteration on a sparsity that never changes — relocation moves nodes, not connectivity — so a backend that caches its symbolic analysis pays only the numeric re-factorisation:

C = (E * a(eps(u), eps(u))).integrate(fem, solver=jno.solve.lu(backend="pardiso"))

Measured on the 3-D cantilever, per design iteration, against the default:

tetrahedra default backend="pardiso" speed-up
2,847 620 ms 335 ms 1.9x
8,802 2,115 ms 665 ms 3.2x
14,063 4,014 ms 810 ms 5.0x

The margin grows with the mesh because the two scale differently on this operator — the default's SuperLU costs \(O(n^{1.9})\) against PARDISO's \(O(n^{1.55})\) — so it is worth most exactly where it is needed. Two reasons the headroom is there: the stiffness is symmetric positive definite (to \(5.6\times10^{-17}\)) while the default throws a general LU at it, and the default re-runs its symbolic analysis every call.

PARDISO with the patch filter

Those timings are measured on plain SIMP with a volume constraint. An earlier jNO aborted with PARDISO as soon as the density was reparameterised through rho.constrain(d.patch_filter()). On the current version that pair works: a 3-D bracket with the patch filter, moving nodes and lu(backend="pardiso") (63,027 tetrahedra, 37,632 dofs) ran 300 iterations in about ten minutes on a CPU. The GPU backend lu(backend="cudss") still fails on a parameter with a constraint map (open issue).

An iterative solver is not the answer here, which is worth stating because it is the usual advice at this size: smoothed-aggregation AMG with elasticity's near-nullspace converges fine (residual \(10^{-11}\)) but needs 103–145 CG iterations against the \(10^3\) SIMP contrast, landing at 244–1250 ms — an order of magnitude worse than the direct factorisation. Contrast is what makes a SIMP system hard for a multigrid hierarchy, and it is exactly what topology optimisation creates.

Reproducibility

Which of a run's numbers are reproducible? Not all of them, and the difference matters more than any single value. Four runs of the cantilever script — one before the objective was rewritten as an integral, two after, differing only in the Python and JAX build they ran on, and run D on a later jNO (parameters float64 since #123). All four are at mesh size \(1\) (4,226 elements); a later run at size \(0.5\) (16,828 elements) is a fifth sample of the same kind (compliance \(79.59\) with a \(0.5\) mesh, \(P=531\), over-report \(+2.2\%\)):

run A run B run C run D
compliance \(78.45\) \(78.33\) \(78.64\) \(78.41\)
volume fraction \(0.400\) \(0.3998\) \(0.3999\) \(0.4000\)
\(M_{nd}\) \(0.075\) \(0.066\) \(0.071\) \(0.062\)
perimeter \(P\) \(587.2\) \(504.1\) \(530.7\) \(445.9\)
over-report \(+13.6\%\) \(+5.4\%\) \(+10.2\%\) \(+4.2\%\)

Compliance and volume fraction are stable to a fraction of a percent — they are what the problem actually pins down. The perimeter and the reanalysis gap are not: they span \(446\)–\(587\) and \(+4.2\)–\(+13.6\%\). Runs B and C are the same source code, so this is not the rewrite; it is the problem. It is non-convex, and MMA's asymptote update is history-dependent with a branch in it — a variable that just reversed direction has its asymptotes pulled in, one moving steadily has them pushed out — so a change in the last bit of a floating-point operation flips that test for some variable, and the trajectories separate from there into different local optima.

(It is not the SIMP continuation, which would be the obvious suspect. Measured on this configuration at mesh size \(1\): penal stays at \(3.0\) and the continuation fires zero times in 400 iterations.)

The practical consequence: quote the over-report as a range, "\(+4\) to \(+14\%\)", and not to three figures, and treat a single run's perimeter as one sample rather than a measurement. (\(C = f\cdot u\) and \(C = \int \sigma(u){:}\varepsilon(u)\,d\Omega\) agree in value and in gradient analytically — both reduce to \(-u^{\mathsf T}(\partial K/\partial\rho)u\) — so the rewrite changes the arithmetic path, not the objective.)

Perimeter control earns its place, though not in every column. Running the same script with PSTAR = 0.0 gives \(P=849.2\), \(C=80.23\), \(M_{nd}=0.127\) and an over-report of \(+21.6\%\) (measured on the previous spelling of the objective and not re-run since). Against the spread above, the binariness separates cleanly — \(M_{nd}\) \(0.127\) uncontrolled against \(0.062\)–\(0.075\) controlled — and the perimeter obviously does. The over-report comparison does not: \(+21.6\%\) against a controlled range of \(+4.2\)–\(+13.6\%\) is a difference of the same size as the run-to-run scatter, so one uncontrolled run is not enough to claim it. What survives is the binariness, and the mechanism behind it: a design held to a length scale has fewer fine features to farm discretisation error with.

Do not read the accompanying drop in compliance (\(80.23 \to 78.45\)) as perimeter control being free. Without a length-scale restriction the continuum problem is not well posed — that is exactly why Ambrosio & Buttazzo introduced the perimeter constraint and Haber, Jog & Bendsøe implemented it — and numerically the unregularised run fragments instead of converging. On the companion half-MBB problem the uncontrolled run measurably fails to settle: doubling the iteration budget moved compliance the wrong way, \(209.9 \to 224.5\), with perimeter rising \(1274 \to 1302\). An uncontrolled baseline is therefore a poor reference point, and the honest claim here is that perimeter control makes the problem tractable enough to converge — not that it costs nothing.

For scale, the paper reports \(+17.6\%\) for conventional elements on its own cantilever and closes the gap to \(-0.5\%\) with the interpolation-cover enrichment of its 2026 follow-up (Computers & Structures 331 (2026) 108403), which the bracket tutorial does not use.