1 function flux_lin_mat = fv_conv_flux_linearization_matrix(model,model_data,U)
2 %
function flux_lin_mat = fv_conv_flux_linearization_matrix(model,model_data,[U])
4 %
function computing the linearized flux matrix of a convection problem.
5 % simply reformatting the grid data suitably
for pointwise evaluation
6 % by conv_flux_linearization. As evaluation points the points of suitable
7 % gauss-quadratures are chosen. The degree can be chosen in the
10 % required fields of model as required by conv_flux
12 % Function supports affine decomposition, i.e. different operation modes
13 % guided by optional field decomp_mode in model. See also the
14 % contents.txt
for general explanation
16 % optional fields of model:
17 % mu_names : names of fields to be regarded as parameters in vector mu
18 % flux_quad_degree: degree of quadrature to be used
for face-integrals.
20 % in
'coefficient' mode, U and the grid are empty.
22 % Bernard Haasdonk 11.4.2006
24 % determine affine_decomposition_mode as integer
25 decomp_mode = model.decomp_mode;
27 grid = model_data.grid;
32 error(
'dont know how to handle decompositions in fv_conv_flux_linearization_matrix')
33 % nfaces = size(grid.ECX,2);
34 % UU = repmat(U,1,nfaces);
38 nfaces = size(grid.ECX,2);
39 UU = repmat(U,1,nfaces);
42 if ~isempty(model.flux_quad_degree)
43 model.flux_quad_degree = 1;
47 % f = conv_flux(model, UU(:),grid.ECX(:), grid.ECY(:) );
48 % compute f by quadratures
49 [elids, edgeids] = ind2sub(size(grid.VI),1:length(grid.VI(:)));
50 PP = edge_quad_points(grid,elids, edgeids,model.flux_quad_degree);
51 [ff_lin, lambda] = ...
52 model.conv_flux_derivative_ptr(PP, ...
53 repmat(UU(:),model.flux_quad_degree,1), ...
55 f.Vx = edge_quad_eval_mean(grid,elids,edgeids,...
56 model.flux_quad_degree,ff_lin(:,1));
57 f.Vy = edge_quad_eval_mean(grid,elids,edgeids,...
58 model.flux_quad_degree,ff_lin(:,2));
59 %f.lambda = ff_lin.lambda;
60 flux_lin_mat.Vx = reshape(f.Vx,size(UU));
61 flux_lin_mat.Vy = reshape(f.Vy,size(UU));
62 %elseif decomp_mode == 1
63 % % f = conv_flux(model, UU(:),grid.ECX(:), grid.ECY(:) );
64 % [elids, edgeids] = ind2sub(size(grid.VI),1:length(grid.VI(:)));
65 % PP = edge_quad_points(grid,elids, edgeids,model.flux_quad_degree);
66 % ff_lin = conv_flux_linearization(model, repmat(UU(:),model.flux_quad_degree,1), ...
68 % f = cell(length(ff_lin),1);
69 % for q = 1:length(ff);
70 % f{q}.Fx = edge_quad_eval_mean(grid,elids,edgeids,...
71 % model.flux_quad_degree,ff{q}.Fx);
72 % f{q}.Fy = edge_quad_eval_mean(grid,elids,edgeids,...
73 % model.flux_quad_degree,ff{q}.Fy);
74 % flux_lin_mat{q}.Fx = reshape(f{q}.Fx,size(UU));
75 % flux_lin_mat{q}.Fy = reshape(f{q}.Fy,size(UU));
77 %
else % simply
get coefficients from conv_flux and forward
78 % % flux_lin_mat = conv_flux(model, UU(:),grid.ECX(:), grid.ECY(:) );
79 % flux_lin_mat = conv_flux(model, [],[],[] );
83 % error(
'other modes than ''complete'' are currently not implemented! ');
84 % flux_lin_mat.lambda = f.lambda;