2
$\begingroup$

I have implemented a FVM code and now I need to plot the accuracy of the method as the mesh gets refined. Having a very fine mesh, my idea is to compare what is the error between the coarser and fine mesh in the L1-norm. My problem is that having a finer mesh the solution vector has more entries than the solution with the coarse grid, therefore, how to compare the two?

$\endgroup$
  • $\begingroup$ If the meshes are nested, the easiest would be to represent the coarse solution on the fine mesh and use that to compare. $\endgroup$ – Jesse Chan Dec 14 '14 at 20:22
  • $\begingroup$ No, they are not nested, I have the values of the solution of a finer mesh, say, 1000 grid points, and then I have another solution with 300 grid points. Since both solution vectors have different number of points, how to compare both? $\endgroup$ – BRabbit27 Dec 14 '14 at 20:24
  • 1
    $\begingroup$ Have you tried using the method of manufactured solutions? $\endgroup$ – Paul Dec 15 '14 at 5:07
  • $\begingroup$ If you were using finite elements I would suggest interpolation using your elements to project the values from one mesh onto the other. I'm not well versed in finite elements, but perhaps there is a similar approach that would be valid here. $\endgroup$ – Doug Lipinski Dec 15 '14 at 14:51
  • $\begingroup$ The issue would be mostly expense and representation - FVM is akin to piecewise constant basis functions, so non-nested meshes implies that neither mesh can represent functions from the other mesh. Additionally, to find the pointwise difference between solutions on diff meshes would require searching for elements in one mesh containing elements in another. $\endgroup$ – Jesse Chan Dec 16 '14 at 21:15
1
$\begingroup$

If you interpret the $L^{1}$ norm as a function norm (i.e., an integral), then increasing the number of solution values will be offset by a decrease in the mesh width. The result should be comparable values in norm.

That is, if your solution is $f$, taking on values $f(x_{i})$ for $i = 1, \ldots, N$, then

\begin{align} \|f\|_{1} = \int_{0}^{L}|f(x)|\,\mathrm{d}x \approx h\sum_{i = 1}^{N}|f(x_{i})|, \end{align}

assuming:

  • your mesh is uniform (otherwise, put $h$ inside the summation and replace it with $x_{i+1/2} - x_{i-1/2}$, assuming the discretization points are at cell centers)
  • the domain of the PDE is $[0,L]$ (without loss of generality).
| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Yes, but this doesn't tell him how to compute the norm of a difference of functions on two different meshes for a FVM problem. $\endgroup$ – Bill Barth Dec 15 '14 at 12:50
  • $\begingroup$ To expand on what @BillBarth said, of course he can compute the norm of each solution. The difficulty is how to compute the difference between the solutions since they are on different meshes (and then compute the norm of that difference). $\endgroup$ – Doug Lipinski Dec 15 '14 at 14:40
  • $\begingroup$ If it's a finite volume method, there's normally a polynomial reconstruction on each cell associated with the method (e.g., for Godunov's first-order method, constants; for Lax-Wendroff, linear). Cell averaging is used to go from the reconstruction to the discrete representation, so one way to project the function on the coarse mesh to a function on the fine mesh is to generate the polynomial reconstruction on the coarse mesh, repartition the mesh, and calculate cell averages on the finer mesh. $\endgroup$ – Geoff Oxberry Dec 15 '14 at 19:22
  • 1
    $\begingroup$ I have usually tended to go the other way than suggested so far and average the finer grid to the coarser. This avoids the concern I usually have with interpolation adding information that really is not there in the coarser solution. $\endgroup$ – Kyle Mandli Dec 16 '14 at 0:21
1
$\begingroup$

If you believe that your mesh size is in the asymptotic regime, you might try Richardson error estimation.

Essentially, the idea is that you model your error as $O(h^p)$ for some unknown $p$ and assume that your other terms beyond that order are negligibly small. Then, for three different grid sizes you have the three approximations

$$f_{h}\approx f_* + ch^p$$ $$f_{2h}\approx f_* + c(2h)^p$$ $$f_{4h}\approx f_* + c(4h)^p$$

where here $f_h$ and $f_{2h}$ $f_{4h}$ are the solutions on the fine, medium, and coarser grids. With some algebra, you get $f_{h} - f_{2h} \approx c(h^p-(2h)^p)$ and similarly for the other difference so you can solve for $p$ and $c$.

To take the difference between functions of grids on difference sizes, just use restriction -- $f_h$ is sampled on $0,1,2,3,4,5,6$, $f_{2h}$ is sampled on $0,2,4,6$, so evaluate at every other point. Choose whatever norm you want to estimate the error for.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Per the question, the meshes are not nested. Some sort of interpolation, at least, is required. $\endgroup$ – Bill Barth Dec 16 '14 at 19:10
  • 1
    $\begingroup$ Ah thanks for the note, @Bill -- I missed that comment. So the problem is not that one mesh is more finely resolved than the other but rather that they are entirely different meshes? The original question talks about refining a coarser mesh to obtain a fine one, if that's not the case then something more complicated is needed as you said. $\endgroup$ – Victor Minden Dec 16 '14 at 19:21
1
$\begingroup$

Interpolate on the coarser grid, e.g., by tensor product splines of sufficient smoothness. Then, evaluate the interpolant over the finer grid. Now you have two same-length solution vectors: one sampled from the low resolution model, the other -- actual data solved on the higher resolution. Find their difference in a given norm.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.