How to test the convergence of a scheme of a PDE without knowing the exact solution?

2.1k Views Asked by At

I am now solving a Schrodinger equation with a magnetic field. I don't know its exact solution. I am trying to test the convergence of the scheme by comparing the difference of numerical solution when using different mesh-sizes.

However, in the 2D case, the solution is stored in a matrix; when I change the number of nodal points $n$ ($dx=(x_{max}-x_{min})/(n-1)$), the size of the matrix changes.

Both the $L^2$ norm and $\sup{}$-norm require the same dimensions.

In this case, how can I measure the difference of the solutions?

2

There are 2 best solutions below

8
On BEST ANSWER

Your simplest course of action is to directly obtain approximations for the solution of the PDE at exactly the same grid points.

This can be done be repeatedly refining an existing grid. The simplest method is to systematically cut the step size in half.

To be specific, suppose your 2D domain is the unit square and the initial step size is $h_0 = \frac{1}{2}$ in either direction. Your approximation can be stored in a matrix $A_0$ of dimension 3. Now reduce the step size to $h_1 = \frac{1}{2}h_0 = \frac{1}{4}$. You now require a matrix $A_1$ of dimension $5$. However, the submatrix $B_1$ of dimension $3$ obtained by deleting the second and fourth columns of $A_1$ contains approximations for the same grid points, as $A_0$. In short, it is meaningful to examine $B_1 - A_0$.

If you are working with MATLAB, then you can construct $B_1$ using as $$B_1 = A_1(1:2:5,1:2:5).$$

0
On

When we want to test the convergence of a numerical scheme without knowledge of an exact solution, we can use the method of manufactured solutions.

Say that the PDE we want to solve can be written as follows: $$ u_t + P(u) = F(x,t), \\ u(x,0) = f(x), \\ u(0,t) = g(t), $$ where $P$ is some differential operator, and $F(x,t)$, $f(x)$ and $g(t)$ are known functions (data). For the purpose of testing convergence of a numerical scheme, simply choose any (appropriately differentiable) function $v$ that you want to be your solution, and operate on it with $\partial_t + P$. In general, the result will be $$ v_t + P(v) = G(x,t) \neq F(x,t). $$ However, this doesn't matter if the goal is to study the convergence of the numerical scheme, which will be the same whether we use $F$ or $G$ (so long as both $F$ and $G$ are sufficiently smooth). We may therefore replace our original PDE with $$ u_t + P(u) = G(x,t), \\ u(x,0) = \tilde{f}(x) ,\\ u(0,t) = \tilde{g}(t), $$ where $\tilde{f}(x) = v(x,0)$ and $\tilde{g}(t) = v(0,t)$. Since $v$ is known (after all, we have chosen it to be anything we want), we have access to the exact solution to this new PDE, hence we may test the convergence of the numerical scheme as usual.