1 function s = output_functional_boundary_integral(model,model_data,u)
2 %
function s = output_functional_boundary_integral(model,model_data,u)
4 %
function computing an output functional from the
5 %
function U. Grid is needed to have the space discretization
6 % information about U. A linear output
function of the form of a
7 % boundary integral is computed:
9 % output(u) = int_{boundary(Omega)} f u dx
11 % required fields of model:
12 % output_function : pointer to
function f,
13 % e.g. constant 1 or 1/boundary_length, etc.
14 % computing the weight
function f of the integral
15 % output_integral_qdeg : degree of output integral computation
17 % u is assumed to be a
function allowing a local evaluation
18 % u.evaluate(eindices, lcoord, grid,model)
20 % Bernard Haasdonk 27.2.2011
22 qdeg = model.output_integral_qdeg;
23 % find boundary edges and element indices
24 i = find(model_data.grid.NBI(:)<0)
25 [elind,edgeind] = ind2sub(size(model_data.grid.NBI),i);
26 % define integral kernel, here x is a 1-d coordinate in [0,1]
27 f = @(x) bnd_intkernel(x,elind,edgeind,model,model_data,u);
32 %%%%%%%%%%%%%%% auxiliary
function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 % integral kernel
for boundary integral
34 function res = bnd_intkernel(x,elind,edgeind,model,model_data,u)
36 for local_edge_ind = 1:3;
37 % determine edgelengths for transformation formula
38 ind = find(edgeind==local_edge_ind);
39 EL = model_data.grid.EL(elind(ind),local_edge_ind);
40 lcoord = llocal2local(model_data.grid,local_edge_ind,x); % local coord for x on edge 1
41 glob = local2global(model_data.grid,elind(ind),lcoord);
42 uval = u.evaluate(elind(ind), lcoord, model_data.grid, model);
43 weightval = model.output_function(glob,model);
44 res = [res;uval.*weightval.*EL]