Method of Manufactured Solutions
Scrollable formula. Use Left and Right arrow keys to reveal hidden content.
Scrollable table. Use Left and Right arrow keys to reveal additional columns.
Scrollable figure. Use Left and Right arrow keys to inspect hidden content.
The method of manufactured solutions chooses a smooth field first, substitutes it into the continuum equations, and treats the resulting nonzero forcing as part of a new exact problem. Because the manufactured field can activate every derivative, coupling, coordinate term, boundary closure, and mesh interface, it can expose implementation defects that a symmetric physical solution never excites.
Required background. Probability and Inference for Gravity supplies residual and convergence summaries.
Helpful background. Formulations of General Relativity supplies the coupled continuum systems to be exercised; Differential Equations for Relativity supplies consistency and boundary-value concepts; Computational Relativity supplies the volume-wide workflow; and Mathematical Relativity supplies regularity and domain hypotheses.
Manufacture the continuum problem
Section titled “Manufacture the continuum problem”Write the target equations schematically as
Choose a sufficiently smooth, nontrivial field on the full spacetime domain and define
The verified code then solves with initial and boundary data obtained from . The numerical solution should approach at the designed order. This verifies implementation of the forced equations; it does not validate the unforced physical model.
For a simple scalar wave,
on the periodic interval for , choose
Direct substitution gives
The initial data are and , with periodic matching for the field and derivatives. This example has nonzero time and space derivatives, but it does not test curved geometry, nonlinear coupling, or physical boundary closures. A production verification family must be designed around the actual operators.
A variable coefficient that exposes a missing derivative
Section titled “A variable coefficient that exposes a missing derivative”Consider instead the dimensionless problem
Choose . The product rule gives
Use , , the left Dirichlet condition , and the right Robin condition . These data match the manufactured field at the initial corners. The coefficient is positive, so the continuum wave speed is and the time-step restriction must account for its maximum .
A code that replaces by misses . This term does not vanish under refinement. Evaluating the incorrect continuum operator on the exact field leaves precisely that residual, making the fixture sensitive to a defect that a constant-coefficient test cannot detect. This is still a scalar test; it makes no claim to exercise Einstein constraints or curved-spacetime tensor couplings.
Excite every implemented path
Section titled “Excite every implemented path”Use fields whose components and derivatives do not vanish accidentally. In a tensor system, assign distinct analytic functions to independent components so an index swap cannot survive by symmetry. In curvilinear coordinates, avoid choices that cancel connection terms. For coupled matter–geometry equations, make every source and flux component nonzero while preserving required algebraic constraints.
Boundary conditions are part of the implementation. Derive Dirichlet, Neumann, Robin, constraint-preserving, or characteristic boundary data from the manufactured field and forcing. Test corners and patch boundaries. For adaptive mesh refinement, place smooth structure across refinement interfaces and move it through regridding so prolongation, restriction, synchronization, and reflux operations are exercised.
The manufactured solution must possess enough derivatives for the formal order being tested. A discontinuous or barely differentiable fixture cannot demonstrate high-order convergence. Conversely, a single low-frequency trigonometric mode may be too easy and can hide dispersion or aliasing. Sweep wavelength relative to grid spacing without leaving the resolved regime.
Salari and Knupp give practical construction and boundary guidance in Salari and Knupp 2000, Chapter 3, §§3.3–3.4, Chapter 4, and Chapter 5, §5.2. Roache emphasizes the logical role of manufactured solutions in Roache 2002, pp. 4–10.
Keep the oracle independent
Section titled “Keep the oracle independent”Generating with the same symbolic expressions or helper functions used in the solver can reproduce the same sign or index error. Derive the forcing in an independent algebra system or hand calculation, export a simplified expression, and test sample values against a second evaluator. Keep conventions—metric signature, curvature sign, index positions, and units—explicit at the interface.
Compare numerical and exact fields in , , and norms on at least three resolutions. Monitor constraints and boundary residuals separately. The global rate can look correct while a lower-order boundary defect remains localized; and region-restricted norms reveal it.
Mutation is a decisive check. Reverse one forcing sign, interchange two indices, omit one source term, change a stencil coefficient, or corrupt an AMR prolongation weight in an isolated implementation. The manufactured test should fail with the expected norm pattern. Restore the term and recover convergence. A test that survives a relevant mutation has not verified that path.
Benchmark and reproduction steps
Section titled “Benchmark and reproduction steps”The scalar-wave fixture above supplies a transparent benchmark, augmented by the Apples-with-Apples linear and gauge waves for a relativistic system and an independent physical benchmark for the final observable. Run at no fewer than three grids, make the estimated iterative solution error smaller than discretization differences, and add a finer grid to confirm the observed order. Establish that error through conditioning estimates or tolerance refinement, as explained in solution verification; a raw residual is not a solution-error bound. Refine boundary and AMR components with the interior rather than holding one error source fixed.
The environment record should pin the continuum equations, manufactured fields and forcing generator, independent evaluator, code and dependency revisions, compiler, precision, meshes, time step, boundary data, AMR schedule, tolerances, norms, and analysis scripts. Outputs include exact and numerical fields, forcing samples, residual histories, regional norms, orders, and mutation outcomes.
A clean rerun would regenerate the forcing from versioned symbolic input, compare it at fixed sample points with the independent evaluator, solve the benchmark over the refinement sequence, and repeat after each deliberate mutation. This page specifies the sequence without claiming an absent executable ran it.
Reject the code-verification claim if important terms vanish for every fixture, forcing and solver share an unchecked implementation, boundary or AMR regions are excluded, convergence misses the designed order without explanation, or a consequential mutation survives. The central limitation is scope: manufactured smooth solutions verify exercised code paths, not the physical validity or shock behavior of a different regime.
Check your understanding
Section titled “Check your understanding”A fourth-order evolution code achieves fourth-order convergence for a periodic manufactured wave, but its production problem uses mesh refinement and an outer Robin boundary. Has the production implementation been verified?
Solution
Only the periodic interior path has been verified. Construct a smooth manufactured field whose derived Robin data are nonzero and whose structure crosses refinement interfaces and regridding events. Measure boundary, interface, and global norms separately, then mutate the boundary sign and one prolongation coefficient. The production claim remains incomplete until those paths fail under mutation and recover the expected convergence after restoration.