rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
conv_flux_brooks_corey_simple.m
Go to the documentation of this file.
1 function [flux, lambda] = conv_flux_brooks_corey_simple(glob, U, params)
2 % function [flux, lambda] = conv_flux_brooks_corey_simple(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 % ``f(x,u) = \frac{\lambda_w(u)}{\lambda_w(u)+\lambda_n(u)} \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 %
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 mu1 = params.bl_mu1;
41 mu2 = params.bl_mu2;
42 
43 lambda1 = (U(:).^3)/mu1;
44 lambda2 = ((1-U(:)).^3)/mu2;
45 
46 flux = lambda1 ./ (lambda1 + lambda2);
47 
48 
49 flux = [ flux, flux ] .* [0.3*ones(size(flux)),zeros(size(flux))];
50 
51 if max(abs(imag(flux)))> 0
52  keyboard;
53 end
54 
55 lambda = 1/max(flux(:));
56 
57 if params.debug && ( max(U)-eps > 1 || min(U)+eps < 0 )
58  error('U is outside admissable bounds [0,1]');
59 end
60 
61 if params.decomp_mode>0
62  error('function is nonlinear and does not support affine decomposition!');
63 end
64 
function [ flux , lambda ] = conv_flux_brooks_corey_simple(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions
function [ flux , lambda ] = conv_flux_brooks_corey_simple_derivative(glob, U, params)
convective flux for Buckley-Leverett problem with Brooks-Corey functions