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:
- Choose the form of the governing equations
- Chose the form of the manufactured solution
- Apply the governing equations to the manufactured solution to generate analytical source terms
- Solve the equations on multiple computational grids with different resolutions using the source terms
- Evaluate the global discretization error in the numerical solutions
- 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:
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
Or, browse the other topics from the
Innovative CFD home page.