Implemented in: results_strain_recovery.py — compute_nodal_strain()
In the MLPG5 method, the displacement field is approximated by MLS shape functions, which are smooth (Ck, k ≥ 1) over the domain. Nodal strain can be computed by direct differentiation:
However, direct MLS differentiation at nodal positions is less accurate than at interior integration points, because nodal positions lie at the edge of — or outside — the quadrature region. The standard engineering remedy is Superconvergent Patch Recovery (SPR), which exploits the higher accuracy of integration-point strains to reconstruct a smooth, superconvergent nodal strain field.
GearMaster implements a variant called Weighted SPR with Constraints (SPR-C), adapted for meshfree analysis. For free boundary nodes, an additional traction-free constraint σ⋅n = 0 is enforced via a KKT system, which is the "C" (Constrained) extension to standard SPR (Zienkiewicz & Zhu, 1992b).
The strain samples are taken at Gauss points. Two sources exist, selected by the solver setting
recovery_sampling (Analysis Settings → Results post-processing):
"delaunay" (default, recommended). The cloud is triangulated (Delaunay) and
the Gauss points of the triangles (1/3/6-point rule for results_n_gauss = 1/2/≥3) are
used; triangles whose centroid is outside the domain (or inside a hole) are discarded. The sample density
follows the node density, so every patch of radius rsupp holds many
samples even in locally refined regions."grid" (legacy). A regular rectangular background grid with cell size equal to the
median nearest-neighbour distance hmed covers the node bounding box and
ngauss2 points are placed per cell. The density does not
follow local refinements: when the support radius of a refined node is smaller than the grid spacing the
patch holds too few samples and the fit is ill-conditioned (stress outliers of several times the maximum
stress were observed). The crack-propagation path always uses this source.(Legacy description of the grid:) cell size = median nearest-neighbour distance hmed, covering the node bounding box. In each cell, ngauss2 Gauss points are placed.
At each Gauss point xg, the MLS shape function derivatives ∂φJ/∂x and ∂φJ/∂y are evaluated, and strain is computed:
For non-convex domains (when domain_polygon is available), Gauss points outside
the domain polygon are skipped using matplotlib.path.Path.contains_points().
This prevents spurious strain samples in void regions (e.g. the corner of an L-shaped geometry).
For each node i, all Gauss-point strain samples within a local patch of radius rsupp,i are gathered via cKDTree. If fewer than 6 samples are found, the search radius is progressively widened (1.5×, then 2× the support radius). If still fewer than 3 samples remain, a direct MLS differentiation fallback is used.
The local polynomial basis is chosen adaptively:
| Number of samples | Polynomial | Terms (n_poly) |
|---|---|---|
| ≥ 6 | Quadratic: [1, Δx, Δy, Δx2, ΔxΔy, Δy2] | 6 |
| 3 – 5 | Linear: [1, Δx, Δy] | 3 |
| < 3 | Direct MLS differentiation (fallback) | — |
Coordinates are shifted to the node position: Δx = xg − xi, Δy = yg − yi. The polynomial value at node i is therefore the constant term a0 (only the intercept survives when Δx = Δy = 0).
Distance weights are computed with a Gaussian kernel centred at node i:
where dg = |xg − xi|. Integration-point strains close to node i receive higher weight.
For each strain component c ∈ {εxx, εyy, γxy}, the weighted least-squares problem is:
Solved via numpy.linalg.lstsq. The nodal strain is the constant term:
εc,i = a0,c.
On a free (Neumann) boundary edge, the physical traction must satisfy:
where NT = [nx, 0, ny; 0, ny, nx] is the traction-normal matrix. Since the polynomial is centred at node i, the traction constraint acts only on the constant terms [a0,εxx, a0,εyy, a0,γxy]:
All three strain components are solved simultaneously via a block KKT system of size 3 npoly + 2:
where Ceq, c⋅npoly+0 = Teq,c
encodes that the constraint acts on the intercept of each component.
The KKT system is solved with numpy.linalg.solve; if it is singular (degenerate
geometry), the code falls back to unconstrained weighted LS.
GM_Joint)
are excluded from SPR-C traction constraints: they are Dirichlet boundaries where
t = 0 is not the correct physical condition. The
fixed_dof_mask array distinguishes the two boundary types.
When a crack propagation analysis is active, the standard SPR-C procedure above must be modified to prevent the MLS gradient fit from sampling displacement values on the far side of the crack. Without this filter, the apparent displacement jump across the open gap produces a spurious, growing stress field at crack-isolated nodes (see Fracture — Section 4.5 for physical motivation).
The function compute_nodal_strain() accepts an optional
crack_visibility parameter (a BrokenEdgeConnectivity object).
When provided, the algorithm inserts two additional filters:
Before evaluating MLS shape function derivatives at Gauss point xg, the candidate support node set is filtered via:
This removes any support node J for which the segment xg → nodes[J] crosses a broken Voronoi ridge. If fewer than min_supp visible nodes remain (3 for linear basis, 6 for quadratic), the Gauss point is skipped and contributes no samples to any node patch.
After gathering all Gauss-point samples within the patch of node i, each sample is tested individually:
If fewer than min_supp samples survive, node i is classified as crack-isolated and its strain is set to zero:
crack_visibility=None (no crack),
both filters are completely absent and the function produces byte-for-byte identical
results to the original implementation.
filter_support_from_point and
segment_crosses_crack use the spatially cached broken-ridge KD-tree
described in the Fracture reference, so their cost is bounded regardless of how many
edges have been broken. The additional overhead per Gauss point is typically
negligible compared to the MLS shape-function evaluation.
filter_support_from_point(x_g, candidates);
skip Gauss point if < min_supp nodes remain visible.segment_crosses_crack(nodes[i], x_g) is True;
if < min_supp survive → strain[i] = 0, skip to next node.| Quantity | Formula | Function |
|---|---|---|
| Von Mises strain | εVM = √(εxx2 + εyy2 − εxxεyy + ¾γxy2) | von_mises_strain() |
| Principal strains | ε1,2 = (εxx+εyy)/2 ± √[(εxx−εyy)2/4 + (γxy/2)2] | principal_strains() |