rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
fv_operators_conv_flux_waterflow_upwind.m
Go to the documentation of this file.
1 function [L_E_conv, bdir_E_conv] = fv_frechet_operators_conv_flux_waterflow_upwind(...
2  model,model_data, S, U, S_ind, U_ind)
3 %function [L_E_conv,bdir_E_conv] = fv_frechet_operators_conv_flux_waterflow_upwind(...
4 % model,model_data, P, S, P_ind, S_ind)
5 % computes convection contribution to finite volume time evolution matrices,
6 % <b> or their Frechet derivative </b>
7 %
8 
9 
10 grid = [];
11 if ~isempty(model_data)
12  grid = model_data.grid;
13 end
14 
15 real_NB_ind = find(grid.NBI>0);
16 NBIind = grid.NBI(real_NB_ind);
17 INBind = grid.INB(real_NB_ind);
18 % NB_real_ind comprises comprises some kind of inverse cell-neighbour
19 % relation that leads back to the original cell from where we started
20 % Falls
21 % [i,j]=ind2sub(size(grid.NBI),NB_real_NB_ind(sub2ind(size(grid.NBI),k,l)))
22 % dann ist
23 % grid.NBI(i,j) == k
24 NB_real_NB_ind = sub2ind(size(grid.NBI),NBIind,INBind);
25 
26 dir_NB_ind = find(grid.NBI == -1);
27 
28 
29 spm.sn = length(S);
30 spm.si;
31 spm.sj;
32 spm.snz;
33 spm.svals;
34 
35 spm.un = length(U);
36 spm.ui;
37 spm.uj;
38 spm.unz;
39 spm.uvals;
40 
41 
42 % matrix evaluating the flux by quadratures over all edges
43 Sn = repmat(S, 1, size(grid.ECX,2));
44 [elids, edgeids] = ind2sub(size(grid.VI),1:length(grid.VI(:)));
45 PP = edge_quad_points(grid,elids, edgeids, model.flux_quad_degree);
46 fs = model.two_phase.waterflow(PP,repmat(Sn(:), model.flux_quad_degree, 1)', model);
47 dfs = model.two_phase.waterflow_derivative(PP,repmat(Sn(:), model.flux_quad_degree, 1)', model);
48 FS = reshape(fs,size(grid.NBI));
49 DFS = reshape(dfs, size(grid.NBI));
50 
51 
52 spm.snz =
53 
54