rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_operators_implicit.m
1 function [L_I,b_I] = fv_operators_implicit(model, model_data, NU_ind)
2 %function [L_I,b_I] = fv_operators_implicit(model, model_data[ ,NU_ind])
3 %
4 % function computing the implicit space-discretization matrix and
5 % offset vector for a finite volume discretization.
6 % Result is a sparse matrix `L_I` and an offset vector `b_I`
7 % Function supports affine decomposition, i.e. different operation modes
8 % guided by optional field decomp_mode in params. See also the
9 % contents.txt for general explanation.
10 %
11 % Note that this `L_I` matrix follows the notation of the
12 % nonlinear-FV-draft, i.e. it is NOT the time-step-operator of the
13 % linear-FV-preprint in the routine fv_operators_. In the
14 % linear-paper the corresponding quantity would be `\bar L_I`.
15 % Similarly, the `b_I` has a different sign than `b` in the linear
16 % paper
17 
18 % Bernard Haasdonk 16.5.2007
19 
20 decomp_mode = model.decomp_mode;
21 
22 if nargin <3
23  if isfield(model_data, 'TM_local')
24  NU_ind = model_data.TM_local{model_data.op_ind};
25  else
26  NU_ind = [];
27  end
28 end
29 
30 % discriminate implicit treatment in the operators
31 if model.fv_impl_diff_weight ~= 0
32  [L_I_diff, bdir_I_diff] = model.operators_diff_implicit(model, model_data, NU_ind);
33 else
34  [L_I_diff, bdir_I_diff] = fv_operators_zero(model, model_data, NU_ind);
35 end
36 if model.fv_impl_conv_weight ~= 0
37  [L_I_conv, bdir_I_conv] = model.operators_conv_implicit(model, model_data, NU_ind);
38 else
39  [L_I_conv, bdir_I_conv] = fv_operators_zero(model, model_data, NU_ind);
40 end
41 [L_I_neu, bneu_I ] = model.operators_neumann_implicit(model, model_data, NU_ind);
42 
43 % note the sign change in the following, as L_I *u + b_I is the
44 % discretization in nonlin_evol papar in contrast
45 % to L_I u = ... + b_I in lin_evol case
46 
47 if decomp_mode == 2
48  L_I = [ L_I_diff(:) ; L_I_conv(:); L_I_neu(:)];
49  b_I = [ bdir_I_diff(:) ; bdir_I_conv(:); bneu_I(:)];
50 elseif decomp_mode == 0
51  L_I = L_I_diff + L_I_conv + L_I_neu;
52  b_I = bdir_I_diff + bdir_I_conv + bneu_I;
53 elseif decomp_mode == 1
54  L_I = [L_I_diff(:); L_I_conv(:); L_I_neu(:)];
55  b_I = [bdir_I_diff(:); bdir_I_conv(:); bneu_I(:)];
56 else
57  error(['decomp_mode: ', model.decomp_mode, ' is unknown.']);
58 end;
59