1 function s = output_functional(model,model_data,U)
2 %
function s = output_functional(model,model_data,U)
4 %
function computing an output functional from the discrete
5 %
function U. Grid is needed to have the space discretization
7 %
return values are s.value and s.l2norm the induced functional
8 % l2-norm of the output functional.
10 %
'box_mean': s = mean(U) over box specified by
12 % required fields of model:
13 % name_output_functional : 'box_mean'
14 % name_discfunc_element_mean : name of function, that computes the
15 % mean values of a discrete function on a given
16 % set of grid elements
18 % if name_init_values == 'box_mean'
19 % sbox_xmin, sbox_xmax sbox_ymin, sbox_ymax: coordinates of the
20 % box over which averaging is performed.
22 % The implementation is a bit inprecise: The function U is only
23 % evaluated in the cell-centroids and weighted by the cell
24 % volume. This is summed for all cells with centroid in the specified box...
26 % these parameters should not be under parameter variation control,
27 % but be constant throughout the parameter variation.
29 % Bernard Haasdonk 16.5.2008
31 disp('deprecated, please use pointer to suitable output_functional_*')
33 grid = model_data.grid;
35 if isequal(model.name_output_functional,'box_mean')
36 % definition of the box
37 xmin = model.sbox_xmin;
38 xmax = model.sbox_xmax;
39 ymin = model.sbox_ymin;
40 ymax = model.sbox_ymax;
42 I = find((grid.CX<=xmax) & (grid.CX>=ymin) & (grid.CY>=ymin) ...
45 U_means = model.name_discfunc_element_mean(model,model_data,U,I);
47 Apart = sum(grid.A(I));
48 s.value = sum(U_means.*grid.A(I))/Apart;
50 % l2norm of output functional: sup_|u|=1 s(u), i.e.
51 % the discrete function u that has constant value c in the sensor
52 % domain => l2norm(u)=sqrt(Apart * c^2) == 1
53 % hence c = sqrt(1/Apart) and s(u) = ||s|| = c
54 s.l2norm = sqrt(1/Apart);
57 error('unknown name_output_functional');