36 Two complete minimal FEM algorithms and their verification boundary
This chapter closes the numerical and dataflow choices for one hyperelastic solid path and one compressible material-mesh fluid path. Both are finite-dimensional formulations with fully specified solution choices, presented through equations and practical explanation. They are not executable Rheon implementations. Equations, analytic checks and reasoning review are distinct from numerical validation and machine proofs. The earlier mixed incompressible P2/P1 equations remain an advanced candidate in Chapter34; they are not silently substituted for this selected fluid.
Fixed model, units and run contract
Use scales m, kg/m, m/s. Consequently s, kg, Pa, N, and J. Divide coordinates/displacements by L, velocities by V, time by t, mass by M, force residuals by F, and energies by E. All algorithm arrays below are dimensionless. Their numerical values happen to equal the stated SI values, but the normalization makes merit gradients and line-search steps dimensionally valid. A different scale choice changes the nondimensional inputs coherently, not the equations.
Both bodies start as , material density , , no body acceleration or applied dead traction, and no contact, heat, viscosity, gravity or remeshing. Material choice is immutable for a run:
- Solid S: , with exactly the Chapter31 energy . All three displacement components are fixed to zero on the reference x=0 face; all other faces have zero natural traction. The clamp supplies reactions. There is no pressure DOF.
- Fluid G: inviscid isentropic gas with , , , , , . Each coordinate face fixes only the displacement component normal to that plane. For example x=0 and x=1 fix d_x=0; tangential components are free except where another face imposes its normal condition. Tangential natural traction is zero. Positive absolute pressure creates normal wall reactions; no outside pressure offset, pressure pin or incompressibility constraint is introduced.
Initialize nodal velocity by
with input , default . It vanishes at all boundary nodes and satisfies either selected essential condition. It is interpolated by the P1 basis; no claim that this coarse piecewise-linear field is globally smooth is made. U=0 supplies the exact rest checks below. Use fixed , eight steps to ; no step doubling, rejection retry or adaptive timestep is hidden in this minimal path. A failed attempted step terminates the run with the previous accepted state intact.
These are declared teaching cases and algorithms, not calibrated materials, a general input-file format, a guarantee that every requested step converges, or production admission thresholds. Fluid G approximates a smooth isentropic/barotropic model; it supplies no shock-admissibility or shock-detection guarantee. Forcing, arbitrary geometry, thermal entropy evolution and the mixed incompressible model are explicit extensions rather than unspecified switches.
Exact mesh and element choices
Input mesh resolution is integer , default2. Nodes have coordinates , , and global ID . Assign cube ID i+n(j+nk), then element ID6*cube_id+permutation_rank, with ranks0–5 for the lexicographic permutations below. For every small cube with lower index , enumerate the six permutations of axes in lexicographic order. Form a tetrahedron with lattice vertices
If this construction’s reference determinant is negative, swap its second and third local vertices once to select positive reference orientation. This is a mesh-construction rule, never a repair of an inverted deformed element. Perform the reference determinant/orientation tests on integer lattice edge matrices B, whose determinant is plus or minus one. After the swap require det(B)=1. The selected n values have exactly represented binary64 coordinates and physical edge matrices B/n. Compute each physical reference determinant and inverse from these edge matrices, cache V0=det(B/n)/6 and gradients (B/n)^(-T) grad_xi N, and require the determinant to equal the exactly represented dyadic 1/n^3. The exact-real volume is 1/(6n^3); division by6 is rounded once in the stored V0, so the check on V0 compares with that same declared binary64 division. Do not replace a measure computed from actual reference geometry with a nominal measure to hide a mismatch. Neighboring cubes use the same axis convention, producing matching face triangulations. Boundary faces are those incident to one tetrahedron; orient their normals outward by testing against the opposite element vertex. Assert the expected node/tetrahedron counts and , two incident elements on every other face, no duplicate tetrahedra, and reference volume for every element. All boundary triangles lie on one of the six labelled planes.
Use the P1 barycentric shapes of Chapter32 for all three motion and velocity components. Reference gradients are constant. There are no edge nodes or pressure/energy basis DOFs. For each element store four node IDs, , gradients, and the material identity. With default n=2 there are27 nodes and48 tetrahedra. There are54 free scalar unknowns for S and27 for G. The largest permitted mesh has125 nodes/384 tetrahedra and at most300 free unknowns (S); do not infer a larger mesh from a successful allocation.
The integration choices are exact for this selected discrete field:
- Mass: use the analytic consistent scalar P1 element matrix , copied independently to the three vector component blocks. Do not use one-point mass or lumping in these implicit paths.
- Internal energy, force and tangent: use one barycentric point with physical reference weight . F and homogeneous material coefficients are constant on an affine P1 tetrahedron, so this integrates W, P times a basis gradient and the tangent contraction exactly for the finite-element field, despite W being nonlinear in F.
- External loads: zero in S/G. No boundary traction quadrature is called. Normal/clamp reactions are recovered from the full residual, including consistent inertia.
Assembly is serial in increasing element ID, then local node/component order; DOFs use node ID then x,y,z. Floating-point summation order is thereby specified for the described method, without claiming bitwise portability of logarithm/power libraries. All accepted fields are computed from the same nodal motion. The fluid has one geometric density/pressure authority: determines ; none is independently advected or repaired.
State, constraints and constitutive evaluation
Build a list of fixed scalar DOFs from the face conditions, sorted by global index; all prescribed displacement/velocity values are zero. R injects free coordinates into the full vector and fills fixed entries with zero. Shared edge/corner constraints are unioned, not counted twice for the same component. Cache full consistent M and reduced . Because fixed values are zero, this reduction introduces no missing prescribed acceleration/load term. Moving supports are outside the chosen path.
One accepted state owns and derived diagnostics. One candidate workspace owns trial d, velocity, geometry, W/P/tangent evaluation, residual, dense Jacobian and LU scratch. No history is committed during iterations. Both selected materials depend only on current F and immutable reference coefficients. Internal energies for G are derived from J, not hidden thermal state.
At each element,
Use exactly from Chapter31 for S and from Chapter34 for G. Each A is the derivative of its P, not an extra geometric stiffness added to it. Scatter-add all element contributions; never overwrite a shared-node contribution. Sum . For G report total mass , local density/pressure extrema and positive specific internal energy. For S report W and elastic stress without interpreting solid density as an independent evolved variable.
Admissibility and arithmetic policy
The mathematical sufficient geometry condition uses the following convex-body argument, specialized to P1: require on every tetrahedron. Each gradient is constant, so there is no unsampled element interior. It implies local nonsingularity and global injectivity on the convex reference cube in exact real arithmetic, and holds along the straight segment between two admissible displacement fields. For G it also keeps the boundary on the same six planes and the material domain the same box, allowing local compression/expansion but no mass flux through a wall.
Conditional proof. Continuity and the piecewise gradient bound on a convex body give by integrating along the straight segment. Consequently , proving injectivity. Singular values of are at least ; the path , s from0 to1, remains nonsingular and starts at identity, so its determinant remains positive. The same norm bound holds along convex interpolation between two admissible displacement fields. It covers the chosen Newton segments and straight accepted mesh path in exact real arithmetic. It rejects many valid large rotations/shears and is not extended to nonconvex bodies by assertion.
For G’s same-box claim, write C for the closed cube and for componentwise projection onto C. Given interior y, the map is a contraction with constant at most theta, so it has a unique fixed point in C. That point cannot lie on a coordinate face: there the corresponding d component is zero, while y’s corresponding coordinate is strictly between0 and1. Thus projection is inactive and . Boundary target points follow by continuity/compactness. Conversely the zero normal-face components and gradient bound keep each coordinate of chi inside C. Together with injectivity this proves onto the same cube under these exact-real assumptions; no computed collision certificate is inferred.
In a future binary64 implementation this is a computed acceptance diagnostic, not a rigorous outward-rounded geometry certificate. Evaluate all nine gradient entries, sum squares with finite checks, and require the computed sum . Independently require finite , finite inverse F, positive G density/pressure/energy and finite W/P/A. A finite geometry-domain violation (gradient norm above the bound or J<=0) marks a line-search trial INFEASIBLE and permits the next alpha. Any nonfinite arithmetic, division by zero, invalid EOS result or undefined log/power is terminal INVALID_ARITHMETIC for the attempted step; it is never hidden by further backtracking. An inadmissible initial/current accepted-iterate geometry terminates as INVALID_STATE. Do not take an absolute determinant, clamp a density or floor an internal energy. The exact-real injectivity proof must not be relabelled as verification of these rounded operations.
Specify binary64 round-to-nearest arithmetic for a prospective implementation, ordinary real log and positive-base power interfaces with failure checks, and no fast-math assumptions. A model implementation still needs environment/toolchain identification before execution evidence or bitwise-reproducibility claims. Check integer products before allocating. Reject construction beyond the declared n/count limits or if the requested raw numeric buffers exceed16 MiB; allocator/runtime overhead is separate and not measured here. Allocate dense M, reduced Jacobian, LU copy, element state and vectors once, and reuse them. No model/runtime download is part of construction.
Backward Euler and the actual nonlinear equation
Eliminate endpoint velocity using . With , the full displacement residual and tangent are
These formulas apply separately to S or G with its selected energy. They do not assert a universal energy inequality for either nonlinear W. At acceptance set and , and recover the full support reaction as on fixed DOFs. A positive internal residual is on the left of momentum balance; the required applied support force equals this constrained residual, with opposite force on the support.
Fully selected algebra and globalization
Use a dense direct LU solver with partial pivoting, not an unspecified Krylov method. Its left diagonal equilibration is . Form , , factor A using Gaussian elimination with largest-absolute remaining column pivot and smallest-row-index tie-break; apply the same row swaps to b, then forward/back substitution. An empty row, nonfinite arithmetic or pivot marks the direct attempt unusable. This is a numerical pivot policy, not a proven condition estimate. There is no additional preconditioner, iterative refinement or Krylov iteration. Recompute the unscaled full free linear defect and require
Do not call that recomputed defect an exact floating-point residual. It checks the represented operator through a new evaluation, subject to rounding.
Use merit , with r already in force-normalized units and free displacement coordinates normalized by L*. For a usable direct direction s, compute and require finite q<0. If factorization/linear-defect/descent fails, use the explicitly selected fallback , ; if g is zero/nonfinite or q is not negative, reject the step as stagnated or invalid. This fallback is a descent direction for the same residual merit; it changes no constitutive equation. Without normalization, a raw K^T r would have the wrong units to be a displacement direction.
Scale the chosen direction by a positive factor so , and recompute q after scaling. Try exactly the ordered candidates , . For each, form , check geometry/constitutive admissibility, evaluate its complete residual and merit, and accept the first satisfying
Finite domain-infeasible trials do not evaluate log/power or merit after the failed geometry gate. Nonfinite geometry, constitutive, residual or merit arithmetic instead terminates the attempted step immediately. If none passes, reject; no twentieth halving outside this roster is added. At most32 nonlinear updates are allowed per step. Test convergence at the initial residual and after every accepted update, including after update32:
The constant1 is the declared force scale, not a dimensionless replacement for an unknown physical load. If residual convergence fails and an accepted update has norm , reject as stagnation. Small displacement alone is never convergence. These fixed values make the reference algorithm concrete; they are not experimentally tuned or certified tolerances and do not alter Rheon thresholds.
From reference data to an accepted physical state
The reference mesh and selected material are fixed before time integration. Reference orientation, face incidence, boundary labels, node/element counts, actual volumes and basis gradients establish the geometry used by every later integral. The consistent mass and fixed/free maps are assembled once. All required numeric storage fits the declared budget before a state is advanced. The initial displacement is zero and the prescribed nodal bubble velocity satisfies the selected support or wall constraints; invalid input or nonfinite initial state prevents construction.
An attempted step keeps the previous accepted displacement, velocity and clock immutable. The initial displacement guess is that accepted displacement, which is feasible by construction. It differs from the inertial predictor entering the backward-Euler residual. Each candidate element then determines its displacement gradient, F, J and constitutive fields. Contributions to energy, force and tangent use the identical element state, integration rule and reference measures. The free residual and Jacobian are restrictions of the full inertial-plus-internal system, preserving the full constrained residual for support forces.
The residual convergence condition is evaluated at the initial guess and after each accepted nonlinear update, including the last permitted update. Until convergence, the selected equilibrated direct solve and bounded globalization determine a new candidate. Their pivot, linear-defect, descent, gradient-fallback, direction-size, backtracking and stagnation policies are exactly those stated above. A line-search residual always uses the same previous accepted state and timestep. Neither a rejected trial nor the latest nonlinear iterate becomes a new physical time level.
Convergence of the free residual alone is insufficient for publication of a physical state. Final geometry, material fields, full residual and diagnostics are recomputed, and the same finite, admissibility and residual conditions must still hold. Endpoint velocity follows from the displacement increment, acceleration from the velocity increment, and constrained components retain their prescribed represented values. Energy, mass/volume, reactions and the work ledger below are derived from this common endpoint. Nonfinite derived output prevents acceptance.
A final cancellation check separates the candidate from the accepted state. Only a successful complete endpoint replaces the accepted displacement, velocity, clock and diagnostics together. A failed or cancelled attempt leaves the previous state intact; this reference method makes no automatic retry. Eight successful attempts reach the declared final time, while any earlier terminal outcome returns exactly the already accepted prefix. The explanation specifies a bounded solution method, not an executed trajectory or a guarantee that every admitted input converges.
Each residual call inside line search uses the same accepted d_n,v_n and h, not the previous rejected trial. An unusable LU attempt or nonfinite direct-direction/linear-defect/descent computation may trigger the specified gradient fallback only when r,K remain finite and valid. This expressly limited algebra-solver recovery differs from invalid geometry/model/residual/merit arithmetic, which terminates the attempt. Nonfinite fallback or scaled-direction arithmetic also terminates; finite domain violations alone skip a line-search candidate. Cancellation at construction, assembly, linear solve, line search and final barrier returns a distinct cancelled outcome with no new accepted clock/state. There is no checkpoint/restart, recorder, GUI or hardware implementation claim.
Report nonnegative geometry metrics, mass, kinetic/internal energies and the measured discrete work defect, but do not require a fabricated energy theorem. Let be the final recomputed full residual and . Define and . Because fixed displacements do no work,
This exact-arithmetic identity follows by dotting backward-Euler momentum with Δd. The bracket has no universally claimed sign. A future floating-point run reports each term and its discrepancy; this exposition supplies no measured work closure or acceptance certificate. Similarly report and support reactions rather than claiming whole-body momentum conservation with fixed walls.
Worked analytic checks for the selected paths
Reference mass and initial kinetic energy. At default n=2 each tetrahedron has volume1/48 and mass1/48 kg. Its scalar consistent mass diagonal is1/480 kg, off-diagonal1/960 kg. The centre node belongs to24 tetrahedra: six in each of the two cells where it is the long-diagonal endpoint, and two in each of the other six incident cells. Thus its assembled scalar diagonal is1/20 kg. It is the only node with nonzero bubble velocity, U=1/16 m/s, so initial kinetic energy is J. This is an exact combinatorial/element integral calculation, not a mesh execution. Whole physical mass is1 kg; component blocks are repeated mass metrics, not three kilograms.
Exact rest. With U=0, S has F=I, W_s=P_s=0 and zero residual. G has F=I, rho=p=1 and e=W_g=3/2, so unit-box internal energy is3/2 J. Its full pressure residual is nonzero on constrained normal DOFs but zero on free DOFs; the continuum integrated wall reaction on fluid is −p n per square metre, one newton inward on each face. Opposite fluid load on the wall is outward. Fixed wall motion does zero work. These states satisfy every backward-Euler step algebraically; no numerical run is claimed.
Solid element shear. With , , J=1, the selected S law gives Pa and , other components zero. Its gradient norm1/8 is below theta. On an element, substitute those entries and the stored constant gradients into . This is a constitutive/assembly check, not a whole-box field satisfying the x=0 clamp, and must not be labelled an accepted global shear trajectory.
Fluid compression and linear response. The exact isentropic compression values and breathing tangent in Chapter34 check pressure sign, J powers and A_g. At initial rest the first Newton matrix is , with after assembled fixed-wall geometric cancellation. This is symmetric positive definite because M_f is positive definite, even though the gas has no shear stiffness. It does not prove later nonlinear matrices are positive definite; LU/fallback/failure rules remain necessary.
For a continuum linearized acoustic check in the same impermeable box, take , , , and small amplitude A:
Direct differentiation verifies and . It satisfies wall normal velocity conditions. This is a small-amplitude continuum target, not an exact finite-amplitude solution, not the default bubble initial data, and not an executed spatial/time convergence study. It supports a future separately admitted refinement check without conflating analytic and numerical evidence.
Open-source architectures worth studying
The source map pins versions, source paths and license evidence. The comparisons below are source-guided architectural observations, not comparative benchmarks or adoption decisions.
| Project and inspected version | Common architecture and lesson | Tradeoff/domain boundary |
|---|---|---|
| MFEM v4.7 ex10 | FE forms, mass and hyperelastic operators feed a separate ODE solver; reduced implicit nonlinear operator | Compact mechanics example; its reference diffusion damping is not a full moving-fluid viscous stress |
| Laghos v3.1 | Continuous kinematic and discontinuous thermodynamic spaces, shared force operator, full/partial assembly | Compressible Euler miniapp; high-order tensor-product action can reduce global matrix traffic, with different preconditioning/work costs |
Full assembly stores global sparse operators and enables established factorizations/AMG. Partial assembly stores quadrature/operator data and applies local basis maps; high-order tensor products can reduce work/storage. Neither label alone determines performance. MPI ghost accumulation must gather trial values before element evaluation and sum shared residual contributions afterwards; matrix-free and assembled paths must implement the same constrained action. Quadrature histories need accepted/candidate semantics even when a framework offers convenient mutable material objects.
A future Rheon implementation could adopt an existing library or implement a narrow operator set. That decision needs dependency/license/build/resource review and actual equation fit. The book imports no third-party code and does not prescribe a Rust wrapper or framework registry.
Verification ladder and meaningful failures
A complete minimal algorithm is not completed scientific qualification. The selected S/G paths need their own future checks; Stokes, mixed-pressure, viscous, capillary, contact and FSI items below belong to the explicitly separate advanced extensions. Establish evidence in increasing dependency order, with independent oracles and explicit bounds:
- Check basis partition/linear reproduction, affine maps, mass entries, traction signs and objective rigid motions against Chapter32’s exact hand calculations. Test deliberately reversed orientation and zero-volume input.
- Check material stress/energy/tangent directional consistency and assembled residual derivative using independent symbolic or finite-difference references over admitted positive-J states. A finite-difference comparison needs a scale sweep to expose truncation/cancellation; it is numerical evidence, not proof.
- Check constrained free/support force balance, internal resultant/torque and fixed-topology mass. Reject perturbed load area, omitted tangent block, pressure nullspace and swapped coordinate gradients at the intended boundary.
- Check linear axial/elastic waves and manufactured smooth solutions with independently derived source/boundary data. Separate spatial refinement, timestep refinement and quadrature refinement so one error does not mask another. Report L2/H1 displacement or velocity, pressure modulo only a legitimate gauge, stress/traction, volume and work errors.
- For fluid, include fixed-domain Stokes, rigid translation/rotation, hydrostatics under correctly signed boundary traction, viscous decay, free-surface motion and the endpoint-divergence counterexample. Measure total and local J/density errors, actual mixed conditioning, pressure/traction convergence and artificial work.
- Qualify contact, remap and FSI only after their own equations are implemented: gap/multiplier complementarity, frictional loss, continuous path feasibility, overlap balances, rigid-motion transfer, interface work, added-mass sensitivity and rollback. Breakup/merging need new domain-volume/transfer evidence.
- Test rejection/cancellation at nonzero accepted state, iteration/memory limits, restart identity if supported and stale-output protection. Native/cloud/GPU timings or accuracy require runs in each claimed environment with exact source/input and resource bounds.
For a smooth stable conforming elliptic problem with coercivity constant , continuity constant , exact integration and Galerkin orthogonality, Céa’s argument yields . Proof: test the error relation against , use coercivity and continuity, then divide by the error norm (zero error is immediate). Interpolation estimates on shape-regular meshes can give order-k energy errors and, with extra regularity/duality assumptions, higher L2 orders. This conditional linear result is not a convergence proof for finite-strain contact, moving mixed free surfaces, mesh degeneration or the proposed nonlinear timestep.
A future bounded qualification should start with one owned small mesh, one exact case, explicit maximum DOFs/steps/iterations, wall/CPU/memory/output limits and an independently reviewed oracle. Broader parameter sweeps, adversarial corrupted outputs and native performance follow only through a separate admission. The publication source and scope audit records these pending needs and the conservative implementation-source selection. No existing numerical threshold or proof receipt is broadened by these chapters.