After Nathan Shauer,“Less than 500 lines self-contained Python finite element implementation of the phase-field method for fracture mechanics”, Advances in Engineering Software (2025), doi:10.1016/j.advengsoft.2025.104013.
- Against the author’s code
- 30 of 30 checks pass· see the checks
- Against the paper’s figures
- Compared with the author's Python reference outputs at commit 61037c6 and the 1D AT2 bar solution. The plots show our solver's results; the force plot also includes the Python reference. These comparisons do not establish agreement with figures printed in the article.
Research, not a design tool. Nothing here is an engineering result.
A square plate with a notch from its left edge to the centre is pulled apart at the top. The AT2 phase-field model represents the crack as a damage field d between 0 (intact) and 1 (broken), smeared over a length ℓ. The experiment pane runs the Stabileo Rust implementation in Stabileo’s viewer; the orange curve is what the author’s Python code computed.
What the paper shows
The reference repository provides a Python finite-element implementation of AT2 fracture with three examples: a tensile bar, a notched plate and three-point bending. The method and comparisons on this page refer to that code at commit 61037c6.
In the replay the damage grows smoothly ahead of the notch while rises almost linearly at first, then softens toward ; at the next increment , after , and the force drops to almost zero. shows the open crack on the deformed plate.
The model
Displacement u and damage d are both bilinear on quadrilaterals, integrated with 2×2 Gauss points; plane strain, small strain, quasi-static loading.
- Elasticity at fixed d: div(g(d) C : ε(u)) = 0 with g(d) = (1 − d)², applied to the whole stress.
- Damage (AT2) at fixed u: (Gc/ℓ + 2H) d − Gc ℓ Δd = 2H.
- Driving energy: H = ψ+ = ½ Σ σi εi over the positive principal strains, with σi the undamaged principal stresses. This reference-code hybrid split degrades the whole elastic stress. In mixed strain states a positive principal strain can pair with negative stress, giving negative driving energy and potentially negative damage. History mode clamps the driving energy to its nonnegative previous maximum; it does not impose nodal damage bounds.
- Alternating solution per load step: solve u with the current d, then d with the new u, until the elasticity residual ‖K(d)u − f‖ falls below 10−5.
- Irreversibility: none in the reference code; damage is recomputed from the current energy and is not bounded by 1. to keep it on unloading (not in the reference).
Units are kN and mm. The 1D uniaxial-stress AT2 estimate σc = √(27 E Gc / 256 ℓ) ≈ 2.82 kN/mm² here, so ℓ behaves as a strength as much as a regularisation length: and the peak load falls. The mesh matters too: the crack band needs elements a few times smaller than ℓ; .
How we reproduced it
- The author’s code (commit 61037c6, MIT licence) was run unmodified for its three examples in Python 3.12.15 with numpy 2.1.3 and scipy 1.14.1; every step’s force, iteration count, residual and damage range, and nodal fields at chosen steps, were saved with a manifest of versions and checksums.
- The Rust implementation regenerates the same meshes (bit-identical), applies the same boundary conditions, loop and stopping rule, and solves with the Stabileo engine’s sparse Cholesky factorisation.
- 30 named checks compare the two, each with a stated tolerance, in continuous integration. The browser bundle and the replay on this page are checked separately against the native build.
Comparison with the reference
| Check | Observed | Tolerance | Result |
|---|---|---|---|
| 1 · Mesh fingerprints | equal | — Exact | ✓ pass |
| 1 · Load-step count | equal | — Exact | ✓ pass |
| 1 · Iterations at every step | equal | — Exact | ✓ pass |
| 1 · Maximum damage at every step | 8.3 × 10−12 | 1 × 10−9 Relative difference | ✓ pass |
| 1 · Centre stress at every step | 1.1 × 10−12 | 1 × 10−9 |Δσ| / σc | ✓ pass |
| 1 · Nodal damage · step 50 | 4.5 × 10−10 | 1 × 10−8 max |Δd| | ✓ pass |
| 1 · Nodal damage · step 73 | 3.8 × 10−10 | 1 × 10−8 max |Δd| | ✓ pass |
| 1 · Nodal displacement · step 50 | 1.6 × 10−10 | 1 × 10−8 max |Δu| / max |u| | ✓ pass |
| 1 · Centre stress / 1D AT2 solution, max d < 0.25 | 7.3 × 10−5 | 1 × 10−3 |Δσ| / σc | ✓ pass |
| 2 · Mesh fingerprints | equal | — Exact | ✓ pass |
| 2 · Load-step count | equal | — Exact | ✓ pass |
| 2 · Iterations at every step | equal | — Exact | ✓ pass |
| 2 · Peak-force step | equal | — Exact | ✓ pass |
| 2 · Peak force | 1.2 × 10−12 | 1 × 10−9 Relative difference | ✓ pass |
| 2 · Force through the peak | 1.6 × 10−12 | 1 × 10−9 Relative difference | ✓ pass |
| 2 · Maximum damage through the peak | 4.2 × 10−12 | 1 × 10−9 Relative difference | ✓ pass |
| 2 · Force including fracture | 2.2 × 10−7 | 1 × 10−5 |ΔF| (kN) | ✓ pass |
| 2 · Nodal damage · step 56 | 5 × 10−11 | 1 × 10−8 max |Δd| | ✓ pass |
| 2 · Nodal displacement · step 56 | 8.5 × 10−11 | 1 × 10−8 max |Δu| / max |u| | ✓ pass |
| 2 · Nodal damage, reference or mirror · step 57 | 2.9 × 10−5 | 1 × 10−4 max |Δd| | ✓ pass |
| 2 · Nodal damage, reference or mirror · step 78 | 3.1 × 10−10 | 1 × 10−8 max |Δd| | ✓ pass |
| 3 · Mesh fingerprints | equal | — Exact | ✓ pass |
| 3 · Load-step count | equal | — Exact | ✓ pass |
| 3 · Iterations at every step | equal | — Exact | ✓ pass |
| 3 · Peak-force step | equal | — Exact | ✓ pass |
| 3 · Force through the peak | 4 × 10−11 | 1 × 10−9 Relative difference | ✓ pass |
| 3 · Force including fracture | 1 × 10−6 | 1 × 10−4 |ΔF| (kN) | ✓ pass |
| 3 · Nodal damage · step 56 | 6.9 × 10−11 | 1 × 10−8 max |Δd| | ✓ pass |
| 3 · Nodal displacement · step 56 | 1.1 × 10−10 | 1 × 10−8 max |Δu| / max |u| | ✓ pass |
| 3 · Nodal damage, reference or mirror · step 98 | 4.1 × 10−10 | 1 × 10−8 max |Δd| | ✓ pass |
The crack may choose either side of the notch plane through round-off. The final damage difference against the mirrored reference is 3.09 × 10−10. The thresholds in the table are comparison tolerances, not mathematical error bounds. Displacement fields are compared at example 1 step 50, example 2 step 56, and example 3 step 56. The damage tolerance at step 57 is 1e-4 because the crack jumps through the plate in one increment; the settled fields use 1e-8. These are comparison thresholds, not error bounds.
Step table (79 steps)
| step | top displacement u (mm) | Force F (kN) | iterations | residual | Maximum damage | Elastic energy (kN·mm) | Fracture energy Gc·Γ (kN·mm) | reference F, kN |
|---|---|---|---|---|---|---|---|---|
| 0 | 0.00010 | 0.01345287 | 1 | 2.8 × 10−8 | 0.0001 | 0.0000006726407 | 0.000000000005020209 | 0.01345287 |
| 1 | 0.00020 | 0.02690475 | 1 | 1.7 × 10−7 | 0.0004 | 0.000002690442 | 0.00000000008031908 | 0.02690475 |
| 2 | 0.00030 | 0.04035443 | 1 | 4.3 × 10−7 | 0.0009 | 0.00000605304 | 0.0000000004065996 | 0.04035443 |
| 3 | 0.00040 | 0.0538007 | 1 | 7.9 × 10−7 | 0.0016 | 0.00001075983 | 0.000000001285025 | 0.0538007 |
| 4 | 0.00050 | 0.06724236 | 1 | 1.3 × 10−6 | 0.0024 | 0.00001680997 | 0.000000003137237 | 0.06724236 |
| 5 | 0.00060 | 0.08067819 | 1 | 1.9 × 10−6 | 0.0035 | 0.00002420236 | 0.000000006505409 | 0.08067819 |
| 6 | 0.00070 | 0.09410698 | 1 | 2.6 × 10−6 | 0.0048 | 0.00003293568 | 0.00000001205232 | 0.09410698 |
| 7 | 0.00080 | 0.1075275 | 1 | 3.4 × 10−6 | 0.0063 | 0.00004300835 | 0.00000002056145 | 0.1075275 |
| 8 | 0.00090 | 0.1209386 | 1 | 4.4 × 10−6 | 0.0079 | 0.00005441856 | 0.00000003293714 | 0.1209386 |
| 9 | 0.00100 | 0.134339 | 1 | 5.5 × 10−6 | 0.0098 | 0.00006716425 | 0.00000005020477 | 0.134339 |
| 10 | 0.00110 | 0.1477276 | 1 | 6.7 × 10−6 | 0.0119 | 0.00008124311 | 0.00000007351096 | 0.1477276 |
| 11 | 0.00120 | 0.161103 | 1 | 8 × 10−6 | 0.0142 | 0.0000966526 | 0.0000001041238 | 0.161103 |
| 12 | 0.00130 | 0.1744642 | 1 | 9.4 × 10−6 | 0.0166 | 0.0001133899 | 0.0000001434334 | 0.1744642 |
| 13 | 0.00140 | 0.1877887 | 2 | 3.5 × 10−7 | 0.0194 | 0.0001314519 | 0.0000001931542 | 0.1877887 |
| 14 | 0.00150 | 0.2011143 | 2 | 4.5 × 10−7 | 0.0223 | 0.0001508354 | 0.0000002546024 | 0.2011143 |
| 15 | 0.00160 | 0.2144218 | 2 | 5.9 × 10−7 | 0.0255 | 0.000171537 | 0.0000003296798 | 0.2144218 |
| 16 | 0.00170 | 0.2277098 | 2 | 7.6 × 10−7 | 0.0289 | 0.0001935527 | 0.0000004202749 | 0.2277098 |
| 17 | 0.00180 | 0.2409771 | 2 | 9.6 × 10−7 | 0.0324 | 0.0002168786 | 0.0000005284013 | 0.2409771 |
| 18 | 0.00190 | 0.2542226 | 2 | 1.2 × 10−6 | 0.0362 | 0.0002415104 | 0.0000006561995 | 0.2542226 |
| 19 | 0.00200 | 0.267445 | 2 | 1.5 × 10−6 | 0.0403 | 0.0002674436 | 0.0000008059377 | 0.267445 |
| 20 | 0.00210 | 0.2806429 | 2 | 1.8 × 10−6 | 0.0446 | 0.0002946734 | 0.0000009800127 | 0.2806429 |
| 21 | 0.00220 | 0.2938153 | 2 | 2.2 × 10−6 | 0.0491 | 0.0003231946 | 0.000001180952 | 0.2938153 |
| 22 | 0.00230 | 0.3069608 | 2 | 2.7 × 10−6 | 0.0539 | 0.0003530022 | 0.000001411415 | 0.3069608 |
| 23 | 0.00240 | 0.3200782 | 2 | 3.2 × 10−6 | 0.0589 | 0.0003840904 | 0.000001674196 | 0.3200782 |
| 24 | 0.00250 | 0.3331662 | 2 | 3.8 × 10−6 | 0.0641 | 0.0004164535 | 0.000001972225 | 0.3331662 |
| 25 | 0.00260 | 0.3462235 | 2 | 4.5 × 10−6 | 0.0697 | 0.0004500854 | 0.00000230857 | 0.3462235 |
| 26 | 0.00270 | 0.3592489 | 2 | 5.3 × 10−6 | 0.0755 | 0.0004849797 | 0.000002686445 | 0.3592489 |
| 27 | 0.00280 | 0.372241 | 2 | 6.1 × 10−6 | 0.0816 | 0.0005211298 | 0.000003109206 | 0.372241 |
| 28 | 0.00290 | 0.3851986 | 2 | 7.1 × 10−6 | 0.0880 | 0.0005585288 | 0.000003580361 | 0.3851986 |
| 29 | 0.00300 | 0.3981203 | 2 | 8.3 × 10−6 | 0.0947 | 0.0005971694 | 0.000004103572 | 0.3981203 |
| 30 | 0.00310 | 0.4110048 | 2 | 9.6 × 10−6 | 0.1017 | 0.0006370443 | 0.000004682662 | 0.4110048 |
| 31 | 0.00320 | 0.4238411 | 3 | 2 × 10−6 | 0.1092 | 0.0006781436 | 0.000005323662 | 0.4238411 |
| 32 | 0.00330 | 0.4366456 | 3 | 2.4 × 10−6 | 0.1168 | 0.0007204625 | 0.000006027212 | 0.4366456 |
| 33 | 0.00340 | 0.4494086 | 3 | 2.9 × 10−6 | 0.1249 | 0.0007639913 | 0.000006799272 | 0.4494086 |
| 34 | 0.00350 | 0.4621286 | 3 | 3.5 × 10−6 | 0.1333 | 0.0008087209 | 0.000007644422 | 0.4621286 |
| 35 | 0.00360 | 0.4748041 | 3 | 4.3 × 10−6 | 0.1421 | 0.0008546423 | 0.000008567453 | 0.4748041 |
| 36 | 0.00370 | 0.4874337 | 3 | 5.1 × 10−6 | 0.1513 | 0.0009017459 | 0.000009573385 | 0.4874337 |
| 37 | 0.00380 | 0.5000156 | 3 | 6.2 × 10−6 | 0.1609 | 0.0009500217 | 0.00001066749 | 0.5000156 |
| 38 | 0.00390 | 0.5125483 | 3 | 7.4 × 10−6 | 0.1710 | 0.0009994594 | 0.00001185533 | 0.5125483 |
| 39 | 0.00400 | 0.52503 | 3 | 8.9 × 10−6 | 0.1816 | 0.001050048 | 0.00001314277 | 0.52503 |
| 40 | 0.00410 | 0.537452 | 4 | 3.3 × 10−6 | 0.1929 | 0.001101772 | 0.00001453996 | 0.537452 |
| 41 | 0.00420 | 0.5498249 | 4 | 4.1 × 10−6 | 0.2046 | 0.001154627 | 0.00001604682 | 0.5498249 |
| 42 | 0.00430 | 0.562141 | 4 | 5.1 × 10−6 | 0.2170 | 0.001208596 | 0.00001767348 | 0.562141 |
| 43 | 0.00440 | 0.574398 | 4 | 6.5 × 10−6 | 0.2299 | 0.001263667 | 0.00001942766 | 0.574398 |
| 44 | 0.00450 | 0.5865935 | 4 | 8.2 × 10−6 | 0.2437 | 0.001319824 | 0.00002131774 | 0.5865935 |
| 45 | 0.00460 | 0.5987187 | 5 | 4.2 × 10−6 | 0.2584 | 0.001377047 | 0.00002335834 | 0.5987187 |
| 46 | 0.00470 | 0.6107814 | 5 | 5.5 × 10−6 | 0.2739 | 0.001435329 | 0.00002555083 | 0.6107814 |
| 47 | 0.00480 | 0.6227733 | 5 | 7.4 × 10−6 | 0.2903 | 0.001494646 | 0.0000279108 | 0.6227733 |
| 48 | 0.00490 | 0.6346904 | 5 | 9.9 × 10−6 | 0.3080 | 0.001554977 | 0.00003045171 | 0.6346904 |
| 49 | 0.00500 | 0.6465205 | 6 | 6.8 × 10−6 | 0.3272 | 0.001616292 | 0.0000331988 | 0.6465205 |
| 50 | 0.00510 | 0.65827 | 6 | 9.7 × 10−6 | 0.3479 | 0.001678574 | 0.00003615699 | 0.65827 |
| 51 | 0.00520 | 0.6699181 | 7 | 8 × 10−6 | 0.3708 | 0.001741775 | 0.0000393686 | 0.6699181 |
| 52 | 0.00530 | 0.6814596 | 8 | 7.6 × 10−6 | 0.3962 | 0.001805857 | 0.00004286155 | 0.6814596 |
| 53 | 0.00540 | 0.6928765 | 9 | 8.5 × 10−6 | 0.4250 | 0.001870754 | 0.00004668914 | 0.6928765 |
| 54 | 0.00550 | 0.704134 | 11 | 8.1 × 10−6 | 0.4588 | 0.001936356 | 0.00005094941 | 0.704134 |
| 55 | 0.00560 | 0.7151725 | 14 | 8.7 × 10−6 | 0.5006 | 0.00200247 | 0.00005582035 | 0.7151725 |
| 56 | 0.00570 | 0.7257948 | 22 | 9.3 × 10−6 | 0.5606 | 0.002068501 | 0.00006187247 | 0.7257948 |
| 57 | 0.00580 | 0.0004754389 | 308 | 8.3 × 10−6 | 1.0081 | 0.000001380029 | 0.001477904 | 0.0004752194 |
| 58 | 0.00590 | 0.0004541939 | 2 | 4.6 × 10−7 | 1.0081 | 0.000001339005 | 0.001477991 | 0.0004541974 |
| 59 | 0.00600 | 0.0004334678 | 2 | 2.5 × 10−7 | 1.0083 | 0.000001299518 | 0.001478075 | 0.0004334679 |
| 60 | 0.00610 | 0.0004139992 | 2 | 2.3 × 10−7 | 1.0085 | 0.000001261854 | 0.001478154 | 0.0004139992 |
| 61 | 0.00620 | 0.0003957132 | 2 | 2.1 × 10−7 | 1.0087 | 0.000001225908 | 0.001478231 | 0.0003957132 |
| 62 | 0.00630 | 0.0003785198 | 2 | 2 × 10−7 | 1.0088 | 0.000001191572 | 0.001478304 | 0.0003785198 |
| 63 | 0.00640 | 0.0003623365 | 2 | 1.9 × 10−7 | 1.0089 | 0.000001158747 | 0.001478373 | 0.0003623365 |
| 64 | 0.00650 | 0.0003677663 | 1 | 9.6 × 10−6 | 1.0091 | 0.000001128049 | 0.001478439 | 0.0003677663 |
| 65 | 0.00660 | 0.0003524283 | 1 | 9.2 × 10−6 | 1.0092 | 0.000001097949 | 0.001478503 | 0.0003524283 |
| 66 | 0.00670 | 0.0003377493 | 1 | 8.9 × 10−6 | 1.0093 | 0.000001069101 | 0.001478565 | 0.0003377493 |
| 67 | 0.00680 | 0.0003238947 | 1 | 8.5 × 10−6 | 1.0094 | 0.000001041441 | 0.001478623 | 0.0003238947 |
| 68 | 0.00690 | 0.0003108076 | 1 | 8.2 × 10−6 | 1.0094 | 0.000001014898 | 0.00147868 | 0.0003108076 |
| 69 | 0.00700 | 0.000298434 | 1 | 7.9 × 10−6 | 1.0095 | 0.0000009894115 | 0.001478734 | 0.000298434 |
| 70 | 0.00710 | 0.0002867248 | 1 | 7.6 × 10−6 | 1.0095 | 0.0000009649225 | 0.001478786 | 0.0002867248 |
| 71 | 0.00720 | 0.0002756351 | 1 | 7.4 × 10−6 | 1.0095 | 0.0000009413773 | 0.001478837 | 0.0002756351 |
| 72 | 0.00730 | 0.0002651233 | 1 | 7.1 × 10−6 | 1.0096 | 0.0000009187257 | 0.001478885 | 0.0002651233 |
| 73 | 0.00740 | 0.0002551516 | 1 | 6.9 × 10−6 | 1.0096 | 0.0000008969209 | 0.001478931 | 0.0002551516 |
| 74 | 0.00750 | 0.0002456849 | 1 | 6.7 × 10−6 | 1.0096 | 0.0000008759191 | 0.001478976 | 0.0002456849 |
| 75 | 0.00760 | 0.000236691 | 1 | 6.4 × 10−6 | 1.0096 | 0.0000008556795 | 0.001479019 | 0.000236691 |
| 76 | 0.00770 | 0.00022814 | 1 | 6.2 × 10−6 | 1.0096 | 0.0000008361641 | 0.001479061 | 0.00022814 |
| 77 | 0.00780 | 0.0002200045 | 1 | 6 × 10−6 | 1.0096 | 0.000000817337 | 0.001479101 | 0.0002200045 |
| 78 | 0.00790 | 0.000212259 | 1 | 5.8 × 10−6 | 1.0095 | 0.0000007991648 | 0.00147914 | 0.000212259 |
Comparison with the paper
Compared with the author's Python reference outputs at commit 61037c6 and the 1D AT2 bar solution. The plots show our solver's results; the force plot also includes the Python reference. These comparisons do not establish agreement with figures printed in the article.
Limitations
- Agreement with a reference code is not validation against experiments, and none of this is an engineering certification.
- The reference refines a small box around the notch tip. Outside it the element width exceeds three length scales and the height exceeds two; the horizontal crack band is under-resolved.
- The unconstrained reference discretization can overshoot intact and broken damage limits. Negative damage gives degradation above intact stiffness. Assembly uses interpolated damage at quadrature points; nodal extremes alone do not measure the assembled stiffness error. The solver retains these values; the replay field and colour scale clamp them for display.
- The alternating scheme is not accelerated; at unstable crack growth it can take hundreds of iterations in one step.
- Browser runs are limited in mesh size and parameter range.
Code and references
- Implementation, tests and reference outputs: shauer-2025 (mesh generators and loop adapted from the MIT reference, credited in the source).
- Reference code: github.com/nathanshauer/phasefield-jr-py, MIT, © 2025 Nathan Shauer.
Cite this
Stabileo Research, “Phase-field fracture of a notched plate”, reproduction of Nathan Shauer (2025), doi:10.1016/j.advengsoft.2025.104013. Implementation: research/fracture/shauer-2025 at commit fb241aa04936. Engine: the Stabileo engine at the same commit.