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_I_diff, bdirU_I_diff] = fv_operators_diff_implicit_gradient(tmpmodel, ...
45 model_data, U, NU_ind);
47 [n,m] = size(LU_I_diff);
48 % Note: This only works when diffusivity is averaged on edge points by
49 % arithmetic mean, adapt the next two lines, if you want to use geometric
50 % or harmonic mean functions.
52 L_I_diff = sparse([1:n,2:n,1:(n-1)],...
53 [tmpNU(1:n), tmpNU(1:(n-1)), tmpNU(2:n)],...
54 [1/4 * tmp', 1/2 * tmp(2:n)
', 1/4*tmp(1:(n-1))'],...
56 %L_I_diff = spdiags(LU_I_diff * U,0,n,n);
57 bdir_I_diff = bdirU_I_diff;
59 tmpmodel.diffusivity_ptr = model.diffusivity_ptr;
62 model_data, U, NU_ind);
65 bdir_I_diff_jac = bdir_I_diff + bdirV_I_diff;
66 L_I_diff_jac = L_I_diff + LV_I_diff;
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 [ L_I_diff_jac , bdir_I_diff_jac ] = fv_frechet_operators_diff_implicit_gradient(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...