The Method of Manufactured Solutions: An Overview

This page discusses the Method of Manufactured Solutions as applied to a CFD solver in somewhat more detail.

The basic concept arose out of a recognition that you could determine a numerical scheme's order of accuracy if you could just get an accurate measure of the errors on any particular computational grid. With the Navier-Stokes equations, of course, exact solutions are hard to find, so the idea was to choose ("manufacture") a solution and use that instead. It may sound crazy, but it really works...

Outline of the MMS procedure

The overall procedure is as follows:

  1. Choose the form of the governing equations
  2. Chose the form of the manufactured solution
  3. Apply the governing equations to the manufactured solution to generate analytical source terms
  4. Solve the equations on multiple computational grids with different resolutions using the source terms
  5. Evaluate the global discretization error in the numerical solutions
  6. Determine the order of accuracy

If the order of accuracy you compute at the end of the last step matches the nominal order of accuracy of your code, then all is well. If not, then something is wrong, and further investigation will be required.

So, what are these solutions like?

The analytical solutions can be almost anything, but to be useful, they must at least satisfy the following conditions:

  • They must be continuous. Current numerical schemes generally reduce to first-order at discontinuities--if they can handle them at all. In order to test the higher order portions of a scheme, you therefore have to avoid discontinuities.
  • Each variable in the solution must be continuously differentiable up to the order of the corresponding terms in the governing equations. One can only test the terms of the governing equations for which the solutions give non-zero contributions.
  • The Taylor series expansion of the solutions must include non-zero terms at least up to the purported order of the numerical scheme to be tested. As above, only non-zero contributions from the manufactured solutions can be tested.
  • In addition, for best effect, the contribution from each term in the governing equations should be of the same order of magnitude. This prevents the larger terms from masking errors in other terms of smaller magnitude. For example, in my previous work with MMS, when the Navier-Stokes equations were solved, the viscosity was fixed at an artificially large value in order to bring the contribution of the viscous terms up to the level of the inviscid terms.
  • In order to avoid numerical problems, the manufactured solutions should avoid negative values of quantities which should physically only be positive (e.g. pressure, density, and temperature).
  • In my own work with MMS, I always used analytical functions made up of sines and cosines designed such that each term in the governing equations to be examined (either the Euler equations or the laminar Navier-Stokes equations) would produce a non-zero value.

    Implementing MMS in a CFD Code

    The manufactured solutions are generally developed using a symbolic manipulation software package. The same package is used to analytically differentiate the general manufactured solution according to the governing equations. Since the manufactured solutions do not actually solve the governing equations (they are "manufactured" after all), plugging them into the Euler or Navier-Stokes equations results in a bunch of extra terms that don't cancel out the way a true solution would.

    These terms can, however, be added as source terms to the right hand side of the governing equations to create a modified set of governing equations for which the assumed solutions are correct. These source terms are quite complex; it would take several pages to print out just the energy equation source term, for example.

    Tips for using MMS

    One thing to keep in mind about using MMS is that it will always return the order of the lowest order algorithm active in any given problem. For example, if you are using a sixth order compact differencing scheme for the inviscid flux terms, but only a second order central difference scheme for your viscous terms, an MMS analysis of the interior scheme for the Navier-Stokes equations would show your code to be no better than second order. In order to test the inviscid flux algorithm properly, you would have to turn off the viscous terms and run the code in Euler mode.

    Likewise, if you have a second order interior scheme, but your boundary conditions are first order or lower, any MMS analysis which includes the boundaries will not generally be able to show a second order behavior.

    When you are ready, Return to the main method of manufactured solutions page .

    Or, look at some more Verification and Validation topics.

    Or, browse the other topics from the Innovative CFD home page.

    New! Comments

    Have your say about what you just read! Leave a comment in the box below.