IncompPropertiesDefaultPolymer.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2012 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_INCOMPPROPERTIESDEFAULTPOLYMER_HEADER_INCLUDED
21 #define OPM_INCOMPPROPERTIESDEFAULTPOLYMER_HEADER_INCLUDED
22 
23 #include <opm/core/props/IncompPropertiesBasic.hpp>
24 #include <opm/core/utility/parameters/ParameterGroup.hpp>
25 #include <opm/common/ErrorMacros.hpp>
26 #include <opm/core/utility/linearInterpolation.hpp>
27 #include <vector>
28 
29 namespace Opm
30 {
31 
32  class IncompPropertiesDefaultPolymer : public Opm::IncompPropertiesBasic
33  {
34  public:
43  IncompPropertiesDefaultPolymer(const Opm::parameter::ParameterGroup& param, int dim, int num_cells)
44  : Opm::IncompPropertiesBasic(param, dim, num_cells)
45  {
46  assert(numPhases() == 2);
47  sw_.resize(3);
48  sw_[0] = 0.2;
49  sw_[1] = 0.7;
50  sw_[2] = 1.0;
51  krw_.resize(3);
52  krw_[0] = 0.0;
53  krw_[1] = 0.7;
54  krw_[2] = 1.0;
55  so_.resize(2);
56  so_[0] = 0.3;
57  so_[1] = 0.8;
58  kro_.resize(2);
59  kro_[0] = 0.0;
60  kro_[1] = 1.0;
61  }
62 
72 
73  virtual void relperm(const int n,
74  const double* s,
75  const int* /*cells*/,
76  double* kr,
77  double* dkrds) const
78  {
79  // assert(dkrds == 0);
80  // We assume two phases flow
81  for (int i = 0; i < n; ++i) {
82  kr[2*i] = krw(s[2*i]);
83  kr[2*i+1] = kro(s[2*i+1]);
84  if (dkrds != 0) {
85  dkrds[4*i + 0] = krw_dsw(s[2*i]);
86  dkrds[4*i + 3] = kro_dso(s[2*i+1]);
87  dkrds[4*i + 1] = 0.0;
88  dkrds[4*i + 2] = 0.0;
89  }
90  }
91  }
92 
100  virtual void satRange(const int n,
101  const int* /*cells*/,
102  double* smin,
103  double* smax) const
104  {
105  const int np = 2;
106  for (int i = 0; i < n; ++i) {
107  smin[np*i + 0] = sw_[0];
108  smax[np*i + 0] = sw_.back();
109  smin[np*i + 1] = 1.0 - sw_[0];
110  smax[np*i + 1] = 1.0 - sw_.back();
111  }
112  }
113 
114  private:
115  double krw(double s) const
116  {
117  return Opm::linearInterpolation(sw_, krw_, s);
118  }
119 
120  double krw_dsw(double s) const
121  {
122  return Opm::linearInterpolationDerivative(sw_, krw_, s);
123  }
124 
125 
126  double kro(double s) const
127  {
128  return Opm::linearInterpolation(so_, kro_, s);
129  }
130 
131  double kro_dso(double s) const
132  {
133  return Opm::linearInterpolationDerivative(so_, kro_, s);
134  }
135 
136  std::vector<double> sw_;
137  std::vector<double> krw_;
138  std::vector<double> so_;
139  std::vector<double> kro_;
140  };
141 
142 } // namespace Opm
143 
144 #endif // OPM_INCOMPPROPERTIESDEFAULTPOLYMER_HEADER_INCLUDED
virtual void satRange(const int n, const int *, double *smin, double *smax) const
Definition: IncompPropertiesDefaultPolymer.hpp:100
Definition: CompressibleTpfaPolymer.hpp:32
virtual void relperm(const int n, const double *s, const int *, double *kr, double *dkrds) const
Definition: IncompPropertiesDefaultPolymer.hpp:73
IncompPropertiesDefaultPolymer(const Opm::parameter::ParameterGroup &param, int dim, int num_cells)
Definition: IncompPropertiesDefaultPolymer.hpp:43
Definition: IncompPropertiesDefaultPolymer.hpp:32