FEM Stress Tensor Solver — Von Mises & Principal Stress
Solve 2D elasticity with CST finite elements. Get the stress tensor, principal stresses, von Mises stress and patch-test check in plane stress or plane strain.
Element-wise von Mises contour + deformed overlay
Local stress matrix
Accuracy summary
Solver summary block
{
"problem": "PATCH_TEST",
"plane": "planeStress",
"mesh": "12x6",
"material": {
"E": 210000000000,
"nu": 0.3,
"thickness": 0.02,
"yieldStrength": 250000000
},
"maxVonMises": 283468322.640872,
"maxPrincipal": 268272597.986311,
"maxDisplacement": 0.0028935,
"reactionImbalance": -3.5623e-8,
"benchmark": "Closed-form constant strain/stress benchmark",
"exact": true,
"solveMs": 22.8
}A clear path from inputs to results.
Solve a 2D linear-elasticity problem with constant-strain triangle (CST) finite elements and read the full stress tensor: the direct stresses, shear, principal stresses, their orientation, and the von Mises equivalent. A built-in manufactured patch test lets you confirm the solver reproduces an exact closed-form stress field to machine precision before you trust it on bending or shear demos.
How to use
- Choose a problem: the Patch Test (an exact manufactured field for verification), the Cantilever (left edge fixed, downward traction on the right), or the Shear Block (bottom fixed, horizontal traction on top).
- Select plane stress (thin plate) or plane strain (thick/constrained body), which sets the constitutive matrix D.
- Enter the material: elastic modulus E, Poisson’s ratio ν, plate thickness t, and a yield strength for the factor-of-safety check.
- Set the plate dimensions (width, height) and the mesh density nx × ny; each rectangular cell is split into two CST triangles.
- For the patch test, set the exact strain components εx, εy, γxy that define the manufactured linear displacement field imposed on all boundaries.
- Read the element stress tensor, principal stresses σ₁/σ₂ and angle θp, peak von Mises stress, maximum displacement, and — for the patch test — the L2 and L∞ stress errors that should be near machine zero.
The formula
Reference: Constant-strain triangle plane elasticity and the finite-element patch test; Zienkiewicz & Taylor, The Finite Element Method; Cook, Malkus & Plesha, Concepts and Applications of Finite Element Analysis; MIT OCW / solidmechanics.org linear-elasticity notes.
Worked example
Patch test — exact constant-stress field (plane stress)
- Patch Test problem; plane stress; E = 210 GPa; ν = 0.3; exact strain field εx = 1.2×10⁻³, εy = −4.0×10⁻⁴, γxy = 9.0×10⁻⁴ imposed on all boundary nodes.
- 1
The plane-stress constitutive constant is c = E/(1−ν²) = 210×10⁹ / (1 − 0.09) = 230.769×10⁹ Pa, giving D = c·[[1, ν, 0],[ν, 1, 0],[0, 0, (1−ν)/2]]. Applying σ = Dε: σxx = c(εx + νεy) = 230.769×10⁹×(1.2×10⁻³ + 0.3×(−4.0×10⁻⁴)) = 249.23 MPa; σyy = c(νεx + εy) = 230.769×10⁹×(0.3×1.2×10⁻³ − 4.0×10⁻⁴) = −9.23 MPa; τxy = c·(1−ν)/2·γxy = 230.769×10⁹×0.35×9.0×10⁻⁴ = 72.69 MPa. The von Mises value is √(σxx² − σxxσyy + σyy² + 3τxy²) = 283.47 MPa. Because the imposed field is linear, every CST element returns exactly these stresses.
Every element recovers σxx = 249.23 MPa, σyy = −9.23 MPa, τxy = 72.69 MPa, with principal stresses σ₁ = 268.27 MPa and σ₂ = −28.27 MPa oriented at θp = 14.68°, and von Mises 283.47 MPa — constant across the mesh to numerical round-off (L2 and L∞ stress errors near machine epsilon), confirming the solver passes the patch test.
Interpreting the result
Passing the patch test means the CST element can reproduce a state of constant strain exactly, which is the minimum condition for the mesh to converge to the correct answer as it is refined. The principal stresses σ₁ and σ₂ are the extreme normal stresses on planes where shear vanishes, and θp is the angle to those planes; von Mises combines the full tensor into a single number to compare against the yield strength. For the cantilever and shear-block demos there is no exact 2D closed form, so treat those as qualitative stress-gradient illustrations that improve with mesh refinement, not benchmark-exact results.
Assumptions & limitations
- The material is linear-elastic, homogeneous and isotropic, described entirely by E and ν through the plane-stress or plane-strain constitutive matrix.
- Elements are three-node constant-strain triangles, so strain and stress are uniform within each element and the solution is piecewise constant across the mesh.
- Plane stress assumes a thin plate free to contract through the thickness (σz = 0); plane strain assumes no out-of-plane strain (εz = 0, with σz = ν(σx + σy)).
- Displacements and strains are small, so geometry is not updated and the stiffness matrix is constant (linear static analysis).
- Edge tractions are lumped to the two end nodes of each boundary segment; the patch test instead imposes exact nodal displacements on every boundary node.
- Only the patch test is a closed-form benchmark; the cantilever and shear-block presets have no exact analytic field and are illustrative.
Frequently asked questions
What is a finite-element patch test and why does it matter?
A patch test imposes a known exact solution — here a linear displacement field giving constant strain — on the boundary of a small mesh and checks that the elements reproduce it exactly. If they do, the element can represent constant-strain states, which is the necessary condition for convergence under mesh refinement. The solver reports L2 and L∞ stress errors that should be at the level of floating-point round-off.
How is the von Mises stress computed here?
In plane stress the tool uses σvM = √(σxx² − σxxσyy + σyy² + 3τxy²). In plane strain it first forms σz = ν(σx + σy) and evaluates the full 3D von Mises expression. Comparing σvM against the entered yield strength gives the factor of safety reported in the summary.
Are the cantilever and shear-block results exact?
No. Only the patch test has an exact closed-form field. The cantilever shows a realistic bending-stress gradient that trends toward Euler-Bernoulli beam theory, and the shear block shows a clean shear field with principal-stress rotation, but neither is benchmark-exact. Their accuracy improves as you increase the mesh density nx × ny.
What is the difference between plane stress and plane strain?
Plane stress models a thin plate loaded in its plane, where the out-of-plane stress σz is zero and the material is free to thin; it uses D = E/(1−ν²)·[...]. Plane strain models a long or constrained body where out-of-plane strain is zero and σz = ν(σx + σy); it uses D = E/((1+ν)(1−2ν))·[...]. The same loads give different stresses and von Mises values in each.
What are principal stresses and the angle θp?
Principal stresses σ₁ and σ₂ are the maximum and minimum normal stresses at a point, acting on planes where the shear stress is zero. The angle θp = ½·atan2(2τxy, σxx − σyy) gives the orientation of those planes. In the worked example σ₁ = 268.27 MPa and σ₂ = −28.27 MPa at θp = 14.68°.
Methodology last reviewed 2026-10-06. Results are informational and not financial or engineering advice — see our disclaimer.