rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_l2l2_error.m
1 function l2l2_error = fv_l2l2_error(U1,U2,W,model)
2 %function l2l2_error = fv_l2l2_error(U1,U2,W,model)
3 %
4 % function computing the l2-error between the two fv-functions or function
5 % sequences in U1,U2. Result is a single value or sequence of values
6 % corresponding to the column-differences between U1 and U2
7 % correct Omega-integrals are computed by respecting the cell-areas
8 % defined in grid,model. Params defines the time-spacing for
9 % correct time integration
10 %
11 % note, that the last snapshot does not contribute to the l2 error,
12 % as FV functions are assumed to be piecewise constant on a forward
13 % time-intervall.
14 
15 % Bernard Haasdonk 7.11.2008
16 
17 % l2_error = sqrt(sum(((U1-U2).^2).*repmat(grid.A(:),1,size(U1,2))));
18 %linf_l2_error_sqr = sqrt(sum(A * ((U1-U2).^2)));
19 linf_l2_error_sqr = sum(W * ((U1-U2).^2));
20 l2l2_error = sqrt(cumsum(linf_l2_error_sqr * model.T/model.nt));
21 l2l2_error = [0,l2l2_error(1:end-1)];
22