CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   L1,L2, .. L_infinity Errors ?? (https://www.cfd-online.com/Forums/main/81978-l1-l2-l_infinity-errors.html)

phy4me November 12, 2010 05:44

L1,L2, .. L_infinity Errors ??
 
Hello,

Can you tell me how can calculate the L1,L2 .. Errors, I used a Roe solver with triangular mesh.

Thanks in advance.

walli November 12, 2010 12:25

You have to (numerically) integrate over all elements in the mesh and sum up the computed contributions from each element, e.g. $\sum_T \int_T (u-u_h)^2 dx$ for the L^2 error. What you do on each element of the mesh is iterating over integration points. At each integration point you have to evaluate shape functions, compute u_h using the coefficients from your solution vector, evaluate (u-u_h)^2, add this to err with the proper weight and integration element and so on and so forth... This is standard and should be described in all books used for teaching.

Some pseudocode
Code:

errl2 = 0;
for T in mesh
  for q in quad(T)
    eval(phi, q); // shape functions
    u_h=dot_product(phi, coeff(T));
    x = T.local_to_global(q.position);
    eval(u, x);
    errl2loc = u-u_h;
    errl2 = errl2 + (errl2loc^2)*q.weight*T.det;
  end
end



All times are GMT -4. The time now is 07:32.