www.mooseframework.org
PorousFlowBrooksCorey.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "PorousFlowBrooksCorey.h"
11 
12 namespace PorousFlowBrooksCorey
13 {
14 Real
15 effectiveSaturation(Real pc, Real pe, Real lambda)
16 {
17  if (pc < pe)
18  return 1.0;
19  else
20  return std::pow(pc / pe, -lambda);
21 }
22 
23 Real
24 dEffectiveSaturation(Real pc, Real pe, Real lambda)
25 {
26  if (pc < pe)
27  return 0.0;
28  else
29  return -lambda * std::pow(pc / pe, -lambda - 1.0) / pe;
30 }
31 
32 Real
33 d2EffectiveSaturation(Real pc, Real pe, Real lambda)
34 {
35  if (pc < pe)
36  return 0.0;
37  else
38  return lambda * (lambda + 1.0) * std::pow(pc / pe, -lambda - 2.0) / pe / pe;
39 }
40 
41 Real
42 capillaryPressure(Real seff, Real pe, Real lambda, Real pc_max)
43 {
44  if (seff >= 1.0)
45  return pe;
46  else if (seff <= 0.0)
47  return pc_max;
48  else
49  return std::min(pe * std::pow(seff, -1.0 / lambda), pc_max);
50 }
51 
52 Real
53 dCapillaryPressure(Real seff, Real pe, Real lambda, Real pc_max)
54 {
55  if (seff <= 0.0 || seff > 1.0)
56  return 0.0;
57  else
58  {
59  // Return 0 if pc > pc_max
60  if (capillaryPressure(seff, pe, lambda, pc_max) >= pc_max)
61  return 0.0;
62  else
63  return -pe * std::pow(seff, -1.0 / lambda - 1.0) / lambda;
64  }
65 }
66 
67 Real
68 d2CapillaryPressure(Real seff, Real pe, Real lambda, Real pc_max)
69 {
70  if (seff <= 0.0 || seff > 1.0)
71  return 0.0;
72  else
73  {
74  // Return 0 if pc > pc_max
75  if (capillaryPressure(seff, pe, lambda, pc_max) >= pc_max)
76  return 0.0;
77  else
78  return (lambda + 1.0) * pe * std::pow(seff, -1.0 / lambda - 2.0) / lambda / lambda;
79  }
80 }
81 
82 Real
83 dRelativePermeabilityW(Real seff, Real lambda)
84 {
85  // Guard against division by zero
86  if (seff <= 0.0 || seff >= 1.0)
87  return 0.0;
88 
89  return (2.0 + 3.0 * lambda) * std::pow(seff, (2.0 + 2.0 * lambda) / lambda) / lambda;
90 }
91 
92 Real
93 dRelativePermeabilityNW(Real seff, Real lambda)
94 {
95  // Guard against division by zero
96  if (seff <= 0.0 || seff >= 1.0)
97  return 0.0;
98 
99  return seff * (2.0 + (seff * (2.0 + 3.0 * lambda) - 2.0 * lambda) *
100  std::pow(1.0 - seff, 2.0 / lambda) / lambda);
101 }
102 } // namespace PorousFlowBrooksCorey
Real capillaryPressure(Real seff, Real pe, Real lambda, Real pc_max)
Capillary pressure as a function of effective saturation.
Real dRelativePermeabilityNW(Real seff, Real lambda)
Derivative of relative permeability of the non-wetting phase wrt to effective saturation.
Real effectiveSaturation(Real pc, Real pe, Real lambda)
Effective saturation as a function of capillary pressure Note: seff = 1 for p >= 0.
Real dCapillaryPressure(Real seff, Real pe, Real lambda, Real pc_max)
Derivative of capillary pressure wrt effective saturation.
Real d2CapillaryPressure(Real seff, Real pe, Real lambda, Real pc_max)
Second derivative of capillary pressure wrt effective saturation.
Real dEffectiveSaturation(Real pc, Real pe, Real lambda)
Derivative of effective saturation wrt porepressure.
Real dRelativePermeabilityW(Real seff, Real lambda)
Derivative of relative permeability of the wetting phase wrt to effective saturation.
Real d2EffectiveSaturation(Real pc, Real pe, Real lambda)
Second derivative of effective saturation wrt porepressure.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseUnits pow(const MooseUnits &, int)
Brooks-Corey effective saturation, capillary pressure and relative permeability functions.