0
$\begingroup$

Say for heat equation or Burgers equation with nonlinear boundary condition. Exact solution is unknown. So I am taking for small mesh size the discrete solution as exact solution. Then how to write the coding part for $L^2$ and $H^1$ error in Matlab?

$\endgroup$
1
  • $\begingroup$ Welcome to SciComp.SE. If your question is about how to code something, this might be the wrong place to ask. If not, then I think that you can rephrase your question. $\endgroup$
    – nicoguaro
    Aug 12 '16 at 13:33
1
$\begingroup$

If the exact solution is unknown, then yes you have to take the smaller grid as reference. Then you run your simulation with different mesh size, each one varying by a factor 2 and you compute the norm $L^2$ as : $$ \vert \vert u-u_{ref}\vert \vert_{L^2} = \sum_{i=1}^n \sqrt{(u(i)-u_{ref}(i))^2} $$ with $n$ the number of grid nodes for the considered mesh. Finally, you plot this quantity in respect to the factor size in a log-log plot and the slope of the curve will give you the order. I can suggest you to look at this NASA website : http://www.grc.nasa.gov/WWW/wind/valid/tutorial/spatconv.html

Don't remember for $H^1$.

An applied mathematician tolds me once that the order of convergence for a specific method is dependent on the choice of the norm, it may be more relevant for a specific case to compute the order with the $L^{\infty}$ norm or the $L^1$ norm or whatever norm you decide to define. If anyone has an expertise here, it would be great to have a detailed explanation.

EDIT : see also https://www.kth.se/social/upload/52ea4f1ff2765454c236fe79/ConvRate.pdf

$\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.