3 % convective flux
for Buckley-Leverett problem
5 %
function computing the nonlinear convective flux of a Buckley-Leverett
6 % problem. ``f(x,u) = \frac{u^2}{u^2+ M (1-u^2)} \quad 0\leq u \leq 1``.
8 % required fields of params:
9 % bl_k : scaling factor
for flux
10 % bl_M : steepness factor of curve.
11 % U : DoF vector of discrete solution
12 % grid : pointer to grid structure
for neighbour
15 % See also conv_flux_buckley_leverett_derivative().
20 if ~isempty(glob) && size(glob,1) < size(glob,2)
21 warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
30 %tmpU = repmat(U, 1, grid.nneigh);
32 %real_nb_ind = grid.NBI > 0;
33 %neiU(real_nb_ind) = U(grid.NBI(real_nb_ind));
34 %U = 0.5 * (tmpU + neiU);
39 flux = params.bl_k * U(:).^2./(U(:).^2 + params.bl_M * (1-U(:).^2));
40 %vf = @(X,Y) [2*((2*X(:)-pi/2)-(4/3*Y(:)-pi/2)).^2.*cos((2*X(:)-pi/2)...
41 % +(4/3*Y(:)-pi/2))+0.1,...
42 % 2*((2*X(:)-pi/2)-(4/3*Y(:)-pi/2)).^2.*sin((2*X(:)-pi/2)...
43 % +(4/3*Y(:)-pi/2))+0.1];
46 % ((X(:)-Y(:))).^2.*cos((X(:)+Y(:))*pi/2)+0.1, ...
47 % ((X(:)-Y(:))).^2.*sin((X(:)+Y(:))*pi/2)+0.1 ...
50 %vf = @(X,Y) [abs((X(:)-Y(:))).^0.5.*cos((X(:)+Y(:))*pi/2)+0.5, ...
51 % abs((X(:)-Y(:))).^0.5.*sin((X(:)+Y(:))*pi/2)+0.5];
53 %vvf(X(:)>Y(:),[1,2])=vvf(X(:)>Y(:),[2,1]);
56 flux = [ flux, flux ] .* [ones(size(flux)), params.conv_a*X(:)];
58 lambda = 1/max(flux(:));
60 if params.debug && ( max(U)+eps > 1 || min(U) - eps < 0 )
61 error('U is outside admissable bounds [0,1]');
64 if params.decomp_mode>0
65 error('function is nonlinear and does not support affine decomposition!');
function [ flux , lambda ] = conv_flux_buckley_leverett(glob, U, params)
convective flux for Buckley-Leverett problem