Code Verification


    Modeling Domains

Code verification focuses on identifying failures of the code to correctly implement a desired numerical algorithm. When performing code verification, analytical solutions to mathematical equations are used to calculate error in a corresponding approximate solution.

There are many techniques common in the software engineering community that can assist code verification; for example, in design and construction of unit and module tests that exercise specific subsets of the software, regression tests that exercise fixes for previously discovered software errors, code coverage analysis, etc. In the realm of mathematical modeling, one should also exercise the software to ensure that exact solutions to the desired equations can be recovered when the code is given the corresponding inputs. This process was termed the “method of exact solutions”. However, one is often limited by the availability of analytical solutions; there will almost certainly be no non-trivial analytical solutions available when the physics and/or geometry become complex.

An important tool that has emerged over the past decade to assist in the code verification process is the Method of Manufactured Solutions (MMS). MMS, instead of relying upon the availability of an exact solution to the governing equations, specifies a solution. This artificial solution is then substituted into the equations. Naturally, there will be a residual term since the chosen function is unlikely to be an exact solution to the equations. This residual can then be added to the code as a source term; the MMS test then uses the code to solve the modified equations and checks that the chosen function is recovered. Although previous work has focused mainly on partial differential equations (PDE’s), this idea applies to a broad range of systems in mathematical physics including nonlinear equations, systems of algebraic equations, and ordinary differential equations.

MASA began as a centralized repository for the MMS generated across the PECOS Center for use with verification. Given that there appears to be no openly available, application-independent software package that provides generated MMS source terms, solutions, etc., it was decided to centralize the Center’s MMS efforts into one library to enhance reusability and consistency across the various software packages. The library is written in C++ (with C and Fortran90 interfaces) and provides a suite of manufactured solutions for the software verification of partial differential equation solvers in multiple dimensions.

MASA is open source and publicly available under the terms of the 2.1 GNU Lesser General Public License. A short talk introducing the library can be found here