# How can I compare errors in PDE solvers with non-uniform grids?

Is there a standard approach to testing codes with refined regions? Specifically, I am interested in testing whether the refinement is working correctly.

For the sake of simplicity, let's consider a (time-independent) boundary value problem in a domain with only one refined area, and a case with a known exact solution. Let's consider a finite difference method with a uniform grid size. Assume I've already verified that the code obtains the correct convergence rate for a uniform grid with the exact solution I have.

Now consider a uniform grid of size $h$ in the fine region and $H$ in the coarse region. I can compare the error (however it might be defined) between that case and the case where the grid is uniform with resolution $h$. Hopefully, the accuracy degradation is not "too bad". I don't know precisely what "too bad" in this case might mean, however, and hence my question. There may be a better approach altogether than what I am thinking here.

It is difficult to assess the correctness of a code for only a single value of the mesh sizes $h$, $H$. Rather, one typically evaluates the accuracy for a sequence of mesh sizes $h,H \rightarrow 0$ by comparing against the exact solution to which your numerical approximations have to converge.
• Thanks for the answer. I have done this for a set value of $H / h$, say, 2. The code converges at the same rate as a mesh which is coarse everywhere (though the magnitude of the error is usually lower depending on the test case, as I recall; I should check). I'm not sure if this is comprehensive enough. Perhaps I should edit my question to state that. May 8, 2015 at 16:12
• I've had a nagging feeling that I'm missing something. But now I don't think I am. A few tests are probably necessary: 1. convergence for fixed $H / h$, 2. checking the behavior of the error and computational cost in the previous case (The error should be lower than solely a coarse grid, and higher than solely a fine grid; and hopefully the cost is reduced compared against a fine grid), and testing that any connections between different domains works correctly (if relevant). May 8, 2015 at 19:42