3 %
function computing the derivative of a convective flux by forward
7 %
'flux_lin' : is a matrix which row entries represent the velocity vectors
8 % in the edge midpoints.
9 %
'lambda' : is a bound such that
10 % ``\lambda \cdot \sup_u n_{jl} \cdot f
'(u) \leq 1``
11 % e.g. `\lambda := \frac{1}{\sup|v(x,y)|}` for `f(u) = v \cdot u`.
12 % This is value only reasonable in 'decomp_mode==0
', otherwise an
13 % empty variable is returned.
16 % U : a vector with evaluations of a solution `u` which are passed as
17 % an argument to the flux function `f`
18 % glob : a matrix of row vectors for each coordinate dimension of the grid
19 % defining the coordinates where the flux function is evaluated, in
20 % case it is space dependent, i.e. we have something like `f(u,x)`.
21 % params : a structure with model parameters
24 epsilon = max(abs(U)) * 1e-2;
25 if epsilon < eps; % U completely 0
31 if ~isempty(glob) && size(glob,1) < size(glob,2)
32 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise
');
39 [fluxU,lambda] = params.conv_flux_ptr(glob,U,params);
40 fluxU2 = params.conv_flux_ptr(glob,U+epsilon,params);
42 flux_lin = (fluxU2-fluxU)/epsilon;
function [ flux_lin , lambda ] = conv_flux_forward_difference(glob, U, params)
function computing the derivative of a convective flux by forward difference.