rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
conv_flux_brooks_corey_simple_derivative.m
Go to the documentation of this file.
1 function [flux, lambda] = conv_flux_brooks_corey_simple_derivative(glob, U, params)
2 % function [flux, lambda] = conv_flux_brooks_corey_simple_derivative(glob, U, params)
3 % convective flux for Buckley-Leverett problem with Brooks-Corey functions
4 %
5 % function computing the nonlinear convective flux of a Buckley-Leverett with Brooks-Corey approximation
6 % problem.
7 % ``\partial_u f(x,u) = \frac{\lambda_w'(u)}{\lambda_w(u)+\lambda_n(u)} + \frac{\lambda_w(u)(\lambda_w'(u)+\lambda_n'(u))}{\left(\lambda_w(u)+\lambda_n(u)\right)^2} \quad 0\leq u \leq 1``.
8 %
9 % ``\lambda_w(u) = \frac{u^3}{\mu_1},``
10 % ``\lambda_n(u) = \frac{(1-u)^3}{\mu_2},``
11 %
12 % required fields of params:
13 % bl_lambda : mobility factor `\lambda`
14 % bl_mu1 : viscosity of wetting phase `\mu_1`
15 % bl_mu2 : viscosity of non-wetting phase `\mu_2`
16 % information
17 %
18 % See also conv_flux_brooks_corey_simple().
19 %
20 
21 % glob column check
22 if params.debug
23  if ~isempty(glob) && size(glob,1) < size(glob,2)
24  warning('coordinates in variable glob are given row-wise, but expected them to be column-wise');
25  if params.debug > 2
26  keyboard;
27  end
28  end
29 end
30 
31 %X = glob(:,1);
32 %Y = glob(:,2);
33 
34 if params.newton_regularisation && ( ( max(U) > 1 ) ... %&& max(U)-1e7*eps < 1 )...
35  || ( min(U) < 0 ) ) %&& min(U)+1e7*eps > 0 ) )
36  U(U>1) = 1;
37  U(U<0) = 0;
38 end
39 
40 
41 ld = params.bl_lambda;
42 mu1 = params.bl_mu1;
43 mu2 = params.bl_mu2;
44 
45 lambda1 = (U(:).^3)/mu1;
46 lambda2 = ((1-U(:)).^3)/mu2;
47 
48 mobility = lambda1 + lambda2;
49 
50 lambda1d = 3*(U(:).^2)/mu1;
51 lambda2d = -3*((1-U(:)).^2)/mu2;
52 
53 mobilityd = lambda1d + lambda2d;
54 
55 flux = lambda1d ./ mobility + lambda1.*mobilityd./mobility.^2;
56 
57 flux = [ flux, flux ] .* [ones(size(flux)), zeros(size(flux))];
58 
59 if max(abs(imag(flux)))> 0
60  keyboard;
61 end
62 
63 lambda = 1/max(flux(:));
64 
65 if params.debug && ( max(U)-eps > 1 || min(U) + eps < 0 )
66  error('U is outside admissable bounds [0,1]');
67 end
68 
69 if params.decomp_mode>0
70  error('function is nonlinear and does not support affine decomposition!');
71 end
72 
function [ flux , lambda ] = conv_flux_brooks_corey_simple_derivative(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions