MMS: 2D Elasticity

Category: V&V – Method of Manufactured Solutions | Revised 2026-10-01
CAE visualization for mms elasticity 2d theory - technical simulation diagram
MMS: 2D Elastic Body

Theory: fix the answer first, then test the code

Overview

🙋

How can I check my own finite element code? Few problems have exact solutions.

🎓

That's what the method of manufactured solutions (MMS) is for. Pick any displacement field as the answer and back-calculate the body force that makes it satisfy the equations — now you have an exactly solvable problem of any shape. Then check that error falls at the theoretical rate as the mesh is refined. If even the rate (convergence order) matches, nearly everything in the code — assembly, integration, boundary conditions — is right. Let's try it on our own code and plant bugs to see how they show up.

Manufactured solution and body force

$$ u_x = 0.1\sin(\pi x)\sin(2\pi y),\qquad u_y = 0.1\cos(\pi x)\sin(\pi y),\qquad \mathbf{b} = -\nabla\cdot\boldsymbol{\sigma}(\mathbf{u}) $$

Unit square, plane stress, Young's modulus 1, Poisson's ratio 0.3. The body force $\mathbf{b}$ was derived symbolically (sympy); all boundaries prescribe the manufactured displacement.

Theoretical orders

$$ \|\mathbf{u}-\mathbf{u}_h\|_{L^2} = O(h^{p+1}),\qquad |\mathbf{u}-\mathbf{u}_h|_{H^1} = O(h^{p}),\qquad p_{obs} = \log_2\frac{e_{2h}}{e_h} $$

$p$ is the element order (1 for Q4, 2 for Q8). $p_{obs}$ is the observed order from the error ratio when divisions double.

Coffee Break Trivia

The reversal: manufacture the answer

The manufactured-solution idea was in use from the 1980s, but it was popularised as a code-verification method by Roache and by Salari and Knupp at Sandia National Laboratories. Around 2000 their reports and papers organised the procedure of checking convergence order with manufactured solutions, arguing that matching the order rules out every error that affects it. Manufacturing exact solutions rather than searching for them made the method usable for any equation and code.

Worked example: convergence of our code

Correct code

Element, divisionsDisplacement error L2OrderGradient error H1Order
Q4, 82.25e-32.047.74e-20.99
Q4, 165.58e-42.013.88e-21.00
Q4, 321.39e-42.001.94e-21.00
Q4, 643.48e-52.009.70e-31.00
Q8, 81.41e-42.937.37e-32.00
Q8, 161.78e-52.991.85e-32.00
Q8, 322.23e-63.004.62e-42.00

Code with planted bugs

Element, divisionsDisplacement error L2Order
Q4, wrong ν, 82.55e-31.88
Q4, wrong ν, 161.22e-31.06
Q4, wrong ν, 321.07e-30.19
Q4, wrong ν, 641.06e-30.02
Q8, mid-side error, 84.42e-42.23
Q8, mid-side error, 161.05e-42.08
Q8, mid-side error, 322.56e-52.03
🙋

The Poisson's-ratio bug shows order 1.9 up to 8 divisions — it looks normal.

🎓

On coarse meshes discretisation error dominates, hiding the small shift from the bug. As refinement shrinks discretisation error, the bug's 1.1×10⁻³ offset remains and the order drops to zero. So check that the order settles at the theoretical value over at least four mesh levels. The Q8 mid-side bug is subtler: error stays small, but the order falls from 3 to 2 because linear boundary values waste the quadratic elements' capability at the boundary. It's a bug found precisely because MMS looks at order, not error size.

How to apply MMS

  1. Choose a smooth, non-trivial manufactured solution that exercises every term (all strain components, boundaries).
  2. Derive the body force symbolically to avoid hand errors.
  3. Refine by factors of two over four or more levels and tabulate observed orders.
  4. Check orders for both displacement (L2) and gradient (H1).
  5. Integrate error with enough Gauss points so quadrature error doesn't contaminate results.
Coffee Break Trivia

“It passed the benchmarks”

A research group's code matched several benchmarks within 1% and was assumed correct. MMS showed the stress error's order was about 0.5 below theory. The cause was too few integration points for loads on curved boundaries. Comparing with benchmark references only says whether error is below some level, while the MMS order sensitively reveals that something is wrong somewhere.

Common mistakes

Mistakes and fixes

MistakeEffectFix
Only two or three meshesBugs hiddenFour or more levels
Looking only at error sizeOrder drop missedCompute observed order
Too simple a solutionSome terms untestedExercise all components
Hand-derived body forceDerivation errorsUse symbolic tools
Too few error-integration pointsWrong ordersHigher-order quadrature
🙋

I'd like to learn related topics.

Related Simulators

Experience the theory firsthand with the interactive simulator for this field

All Simulators

Related fields

Structural AnalysisFluid Analysis (CFD)Thermal Analysis
Rate this article
Thank you for your feedback!
Helpful
More details
Report error
Helpful
0
More details
0
Report error
0