2 model, model_data, U, NU_ind)
3 %
function [L_I_diff, bdir_I_diff] = ...
6 % computes a jacobian of implicit non-linear diffusion contributions to time
7 % evolution matrices at a point
'U'.
9 %
function computing the jacobian in
'U' of the implicit diffusion contribution
10 % of `L_I` and `b_I` to the time evolution matrices
for a finite volume time
12 % `L_I U^{k+1} = L_E U^k + b_E + b_I`.
13 % With the help of the returned Jacobian
'L_I_diff_jac' the Frechet derivative
14 % `DL_I ({U})` is approximated.
16 % \note The *_implicit functions perform a
'dt' increase in
'model' \em before
17 % evaluating the data functions.
20 % L_I_diff_jac : a sparse matrix with jacobian of diffusion contributions to
22 % bdir_I_diff_jac: and offset vector containing the Dirichlet value
23 % contributions of the diffusion parts.
25 % Note: This only works when diffusivity is averaged on edge points by
26 % arithmetic mean, adapt the
function,
if you want to use geometric
27 % or harmonic mean functions.
41 tmpmodel.diffusivity_ptr = model.diffusivity_derivative_ptr;
44 LU_diff_sm = fv_operators_diff_implicit_gradient2(tmpmodel, ...
45 model_data, U, NU_ind);
49 LU_I_diff = sparse(LU_diff_sm.si, LU_diff_sm.sj, LU_diff_sm.svals, n, m);
50 % Note: This only works when diffusivity is averaged on edge points by
51 % arithmetic mean, adapt the next two lines, if you want to use geometric
52 % or harmonic mean functions.
54 %L_I_diff = sparse([1:n,2:n,1:(n-1)],...
55 % [tmpNU(1:n), tmpNU(1:(n-1)), tmpNU(2:n)],...
56 % [1/4 * tmp', 1/2 * tmp(2:n)
', 1/4*tmp(1:(n-1))'],...
58 %L_I_diff = spdiags(LU_I_diff * U,0,n,n);
60 tmpmodel.diffusivity_ptr = model.diffusivity_ptr;
63 model_data, U, NU_ind);
68 sm.si = [1:n, 2:n, 1:(n-1), LV_sm.si];
69 sm.sj = [tmpNU(1:n), tmpNU(1:(n-1)), tmpNU(2:n), LV_sm.sj];
70 sm.svals = [1/4*tmp
', 1/2*tmp(2:n)', 1/4*tmp(1:(n-1))
', LV_sm.svals(:)'];
function [ L_I_diff , bdir_I_diff ] = fv_operators_diff_implicit_gradient(model, model_data, U, NU_ind)
computes diffusion contributions to finite volume time evolution matrices, or their Frechet derivati...
function spm = fv_operators_diff_implicit_gradient2(model, model_data, U, NU_ind)
computes diffusion contributions to finite volume time evolution matrices, or their Frechet derivati...
function sm = fv_frechet_operators_diff_implicit_gradient2(model, model_data, U, NU_ind)
computes a jacobian of implicit non-linear diffusion contributions to time evolution matrices at a po...
function clear_all_caches()
This function clears the caches generated for caching of gradient data in evolution schemes...