The method of manufactured solutions is a way to test numerical code. It considers a PDE, takes an analytical solution, and computes the source term by plugging the solution into the PDE. Then, using the source term, a numerical solution is computed and compared against the analytical. See this SANDIA report for a thorough introduction.
We consider the time dependent heat equation. This module provides a class that has the mass and stiffness matrix as attributes and that comes with methods that provides the source term, the analytical solution projected to the discrete space, and the error between a discrete and the analytical solution.
It uses sympy for symbolic representations of the solution and the source term.
It uses FEniCS for the spatial discretization, for the projections, and for the computation of the errors.
The attributes, the scipy sparse matrices M, A, represent the mass and the stiffness matrix of the problem on the inner nodes, i.e. that the boundary values are resolved in the source term. Thus, the time discretization is ready for the implementation of, e.g., Runge-Kutta methods for the time integration.
Get started with run test_impeul_int in a python shell to plot some error of the Implicit Euler method for various time resolutions.
Contents: