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])
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.
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
18 % Bernard Haasdonk 16.5.2007
20 decomp_mode = model.decomp_mode;
23 if isfield(model_data,
'TM_local')
24 NU_ind = model_data.TM_local{model_data.op_ind};
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);
34 [L_I_diff, bdir_I_diff] = fv_operators_zero(model, model_data, NU_ind);
36 if model.fv_impl_conv_weight ~= 0
37 [L_I_conv, bdir_I_conv] = model.operators_conv_implicit(model, model_data, NU_ind);
39 [L_I_conv, bdir_I_conv] = fv_operators_zero(model, model_data, NU_ind);
41 [L_I_neu, bneu_I ] = model.operators_neumann_implicit(model, model_data, NU_ind);
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
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(:)];
57 error([
'decomp_mode: ', model.decomp_mode,
' is unknown.']);