40 namespace dataPhysical
53 const Real barS_w = (S_w - S_wr) / (1. - S_wr - S_nr);
55 return std::pow ( barS_w, (2. + 3.*lambda) / lambda );
62 const Real barS_w = (S_w - S_wr) / (1. - S_wr - S_nr);
64 return (2. + 3.*lambda) / lambda * std::pow (barS_w, (2. + 3.*lambda) / lambda - 1.) / (1. - S_wr - S_nr);
71 const Real barS_n = (S_n - S_nr) / (1. - S_wr - S_nr);
73 return std::pow ( barS_n, 2.) * (1 - std::pow ( 1 - barS_n, (2. + lambda) / lambda) );
80 const Real barS_n = (S_n - S_nr) / (1. - S_wr - S_nr);
82 return ( 2.*barS_n * (1 - std::pow ( 1 - barS_n, (2. + lambda) / lambda) ) -
83 std::pow ( barS_n, 2.) * (2. + lambda) / lambda * std::pow (1 - barS_n, (2. + lambda) / lambda - 1.) ) /
91 const Real barS_w = (S_w - S_wr) / (1. - S_wr - S_nr);
93 return pd * std::pow (barS_w, -1. / lambda);
100 const Real barS_w = (S_w - S_wr) / (1. - S_wr - S_nr);
102 return pd / lambda * std::pow (barS_w, -1. / lambda - 1.) / (1. - S_wr - S_nr);
108 Matrix inversePermeabilityMatrix (
static_cast<UInt> (3),
static_cast<UInt> (3) );
110 const Real highInvPermeability = 1e5;
111 const Real lowInvPermeability = 1.;
113 Real Entry00, Entry01, Entry02, Entry11, Entry12, Entry22;
115 if ( ( (x > 1000) && (x < 1250) && (y > 0) && (y < 1250) )
116 || ( (x > 2250) && (x < 2500) && (y > 1000) && (y < 3000) )
117 || ( (x > 3500) && (x < 3750) && (y > 500) && (y < 3000) ) )
120 Entry00 = highInvPermeability;
125 Entry11 = highInvPermeability;
129 Entry22 = highInvPermeability;
135 Entry00 = lowInvPermeability;
140 Entry11 = lowInvPermeability;
144 Entry22 = lowInvPermeability;
148 inversePermeabilityMatrix (
static_cast<UInt> (0),
static_cast<UInt> (0) ) = Entry00;
149 inversePermeabilityMatrix (
static_cast<UInt> (0),
static_cast<UInt> (1) ) = Entry01;
150 inversePermeabilityMatrix (
static_cast<UInt> (0),
static_cast<UInt> (2) ) = Entry02;
151 inversePermeabilityMatrix (
static_cast<UInt> (1),
static_cast<UInt> (0) ) = Entry01;
152 inversePermeabilityMatrix (
static_cast<UInt> (1),
static_cast<UInt> (1) ) = Entry11;
153 inversePermeabilityMatrix (
static_cast<UInt> (1),
static_cast<UInt> (2) ) = Entry12;
154 inversePermeabilityMatrix (
static_cast<UInt> (2),
static_cast<UInt> (0) ) = Entry02;
155 inversePermeabilityMatrix (
static_cast<UInt> (2),
static_cast<UInt> (1) ) = Entry12;
156 inversePermeabilityMatrix (
static_cast<UInt> (2),
static_cast<UInt> (2) ) = Entry22;
158 return inversePermeabilityMatrix;
172 Matrix pressurePermeability (
const Real& t,
176 const std::vector<Real>& u )
180 const Real& S_n = u[0];
183 const Real lambda_w = dataPhysical::k_rw ( 1. - S_n ) / dataPhysical::mu_w;
184 const Real lambda_n = dataPhysical::k_rn ( S_n ) / dataPhysical::mu_n;
186 return - dataPhysical::invK (t, x, y, z) / ( lambda_n + lambda_w );
241 return -1.* (4.*x * y * y + 2.*x * x * y + 12.);
275 Matrix saturationPermeability (
const Real& t,
279 const std::vector<Real>& u )
282 const Real& S_n = u[0];
285 const Real lambda_w = dataPhysical::k_rw ( 1. - S_n ) / dataPhysical::mu_w;
286 const Real lambda_n = dataPhysical::k_rn ( S_n ) / dataPhysical::mu_n;
289 const Real f_n = lambda_n / ( lambda_w + lambda_n );
291 return - dataPhysical::invK (t, x, y, z) / ( lambda_w * f_n * dataPhysical::Dpc ( 1. - S_n ) ) ;
295 Vector saturationPhysicalFlux (
const Real& t,
299 const std::vector<Real>& u )
301 Vector physicalFluxVector (
static_cast<
UInt> (3) );
304 const Real& S_n = u[0];
307 const Real lambda_w = dataPhysical::k_rw ( 1. - S_n ) / dataPhysical::mu_w;
308 const Real lambda_n = dataPhysical::k_rn ( S_n ) / dataPhysical::mu_n;
311 const Real f_n = lambda_n / ( lambda_w + lambda_n );
314 const Matrix invK = dataPhysical::invK ( t, x, y, z );
317 const Real denominator = invK (0, 0) * invK (1, 1) * invK (2, 2)
318 - invK (0, 0) * invK (1, 2) * invK (1, 2)
319 - invK (0, 1) * invK (0, 1) * invK (2, 2)
320 + 2. * invK (0, 1) * invK (0, 2) * invK (1, 2)
321 - invK (0, 2) * invK (0, 2) * invK (1, 1);
324 const Real K02 = ( invK (0, 1) * invK (1, 2) - invK (0, 2) * invK (1, 1) ) / denominator;
327 const Real K12 = ( invK (0, 0) * invK (1, 2) - invK (0, 1) * invK (0, 2) ) / denominator;
330 const Real K22 = ( invK (0, 0) * invK (1, 1) - invK (0, 1) * invK (0, 1) ) / denominator;
333 const Real lfrg = lambda_w * f_n * (dataPhysical::rho_w - dataPhysical::rho_n) * dataPhysical::g;
336 const Real Entry0 = f_n * u[1] - lfrg * K02;
339 const Real Entry1 = f_n * u[2] - lfrg * K12;
342 const Real Entry2 = f_n * u[3] - lfrg * K22;
344 physicalFluxVector (
static_cast<UInt> (0) ) = Entry0;
345 physicalFluxVector (
static_cast<UInt> (1) ) = Entry1;
346 physicalFluxVector (
static_cast<UInt> (2) ) = Entry2;
348 return physicalFluxVector;
352 Vector saturationFirstDerivativePhysicalFlux (
const Real& t,
356 const std::vector<Real>& u )
358 Vector firstDerivativePhysicalFluxVector (
static_cast<
UInt> (3) );
361 const Real& S_n = u[0];
364 const Real lambda_w = dataPhysical::k_rw ( 1. - S_n ) / dataPhysical::mu_w;
365 const Real lambda_n = dataPhysical::k_rn ( S_n ) / dataPhysical::mu_n;
368 const Real Dlambda_w = dataPhysical::Dk_rw ( 1. - S_n ) / dataPhysical::mu_w;
369 const Real Dlambda_n = dataPhysical::Dk_rn ( S_n ) / dataPhysical::mu_n;
372 const Real f_n = lambda_n / ( lambda_w + lambda_n );
375 const Real Df_n = (Dlambda_w * (lambda_w + lambda_n) - lambda_w * (Dlambda_w + Dlambda_n) ) /
376 std::pow (lambda_w + lambda_n, 2);
379 const Matrix invK = dataPhysical::invK ( t, x, y, z );
382 const Real denominator = invK (0, 0) * invK (1, 1) * invK (2, 2)
383 - invK (0, 0) * invK (1, 2) * invK (1, 2)
384 - invK (0, 1) * invK (0, 1) * invK (2, 2)
385 + 2. * invK (0, 1) * invK (0, 2) * invK (1, 2)
386 - invK (0, 2) * invK (0, 2) * invK (1, 1);
389 const Real K02 = ( invK (0, 1) * invK (1, 2) - invK (0, 2) * invK (1, 1) ) / denominator;
392 const Real K12 = ( invK (0, 0) * invK (1, 2) - invK (0, 1) * invK (0, 2) ) / denominator;
395 const Real K22 = ( invK (0, 0) * invK (1, 1) - invK (0, 1) * invK (0, 1) ) / denominator;
398 const Real lfrg = (Dlambda_w * f_n + lambda_w * Df_n) * (dataPhysical::rho_w - dataPhysical::rho_n) * dataPhysical::g;
401 Real Entry0 = u[1] * Df_n - lfrg * K02;
404 Real Entry1 = u[2] * Df_n - lfrg * K12;
407 Real Entry2 = u[3] * Df_n - lfrg * K22;
409 firstDerivativePhysicalFluxVector (
static_cast<UInt> (0) ) = Entry0;
410 firstDerivativePhysicalFluxVector (
static_cast<UInt> (1) ) = Entry1;
411 firstDerivativePhysicalFluxVector (
static_cast<UInt> (2) ) = Entry2;
413 return firstDerivativePhysicalFluxVector;
443 return dataPhysical::Phi ( x, y, z );
double Real
Generic real data.
uint32_type UInt
generic unsigned integer (used mainly for addressing)