ReservoirPropertyCapillaryAnisotropicRelperm.hpp
Go to the documentation of this file.
1 //===========================================================================
2 //
3 // File: ReservoirPropertyCapillaryAnisotropicRelperm.hpp
4 //
5 // Created: Fri Oct 23 08:12:21 2009
6 //
7 // Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8 // Bård Skaflestad <bard.skaflestad@sintef.no>
9 //
10 // $Date$
11 //
12 // $Revision$
13 //
14 //===========================================================================
15 
16 /*
17  Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
18  Copyright 2009, 2010 Statoil ASA.
19 
20  This file is part of The Open Reservoir Simulator Project (OpenRS).
21 
22  OpenRS is free software: you can redistribute it and/or modify
23  it under the terms of the GNU General Public License as published by
24  the Free Software Foundation, either version 3 of the License, or
25  (at your option) any later version.
26 
27  OpenRS is distributed in the hope that it will be useful,
28  but WITHOUT ANY WARRANTY; without even the implied warranty of
29  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  GNU General Public License for more details.
31 
32  You should have received a copy of the GNU General Public License
33  along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
34 */
35 
36 #ifndef OPENRS_RESERVOIRPROPERTYCAPILLARYANISOTROPICRELPERM_HEADER
37 #define OPENRS_RESERVOIRPROPERTYCAPILLARYANISOTROPICRELPERM_HEADER
38 
41 #include <array>
42 
43 namespace Opm
44 {
45 
46 
48  template <int dim>
50  {
52  : mob(dim, dim, tensor_storage_.data())
53  {
54  }
55 
56  // Must be implemented to set mob.data() correctly.
58  : tensor_storage_(other.tensor_storage_),
59  mob(dim, dim, tensor_storage_.data())
60  {
61  }
62 
63  void setToAverage(const TensorMobility& m1, const TensorMobility& m2)
64  {
65  for (int i = 0; i < dim*dim; ++i) {
66  tensor_storage_[i] = 0.5*(m1.tensor_storage_[i] + m2.tensor_storage_[i]);
67  }
68  }
69  void setToSum(const TensorMobility& m1, const TensorMobility& m2)
70  {
71  for (int i = 0; i < dim*dim; ++i) {
72  tensor_storage_[i] = m1.tensor_storage_[i] + m2.tensor_storage_[i];
73  }
74  }
76  {
77  tensor_storage_ = m.tensor_storage_;
78  invert(mob);
79  }
80  template <class Vec>
81  Vec multiply(const Vec& v)
82  {
83  return prod(mob, v);
84  }
86  {
87  TensorMobility duplicate(*this);
88  prod(duplicate.mob, other.mob, mob);
89  return *this;
90  }
91  private:
92  // If allowing assignment, remember to set mob.data() properly.
93  TensorMobility& operator=(const TensorMobility&);
94  std::array<double, dim*dim> tensor_storage_;
95  public:
96  FullMatrix<double, SharedData, COrdering> mob;
97 
98  };
99 
100 
103  template <int dim>
105  : public ReservoirPropertyCommon<dim, ReservoirPropertyCapillaryAnisotropicRelperm<dim>, RockAnisotropicRelperm>
106  {
107  public:
110 
116  template <class MatrixType>
117  void phaseMobility(int phase_index,
118  int cell_index,
119  double saturation,
120  MatrixType& phase_mob) const;
121 
122 
127  double fractionalFlow(int cell_index, double saturation) const;
128 
129  void computeCflFactors();
130 
131  private:
133  template <class MatrixType>
134  void phaseMobilityByRock(int phase_index,
135  int rock_index,
136  double saturation,
137  MatrixType& phase_mob) const;
138  void cflFracFlows(int rock, int direction, double s, double& ff_first, double& ff_gravity) const;
139  std::array<double, 3> computeSingleRockCflFactors(int rock) const;
140  };
141 
142 
143 } // namespace Opm
144 
146 
147 
148 #endif // OPENRS_RESERVOIRPROPERTYCAPILLARYANISOTROPICRELPERM_HEADER
void phaseMobility(int phase_index, int cell_index, double saturation, MatrixType &phase_mob) const
Anisotropic phase mobility.
Definition: ReservoirPropertyCapillaryAnisotropicRelperm_impl.hpp:46
Definition: BlackoilFluid.hpp:31
FullMatrix< double, SharedData, COrdering > mob
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:96
TensorMobility(const TensorMobility &other)
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:57
Definition: RockAnisotropicRelperm.hpp:53
double fractionalFlow(int cell_index, double saturation) const
Some approximation to a scalar fractional flow (of the first phase).
Definition: ReservoirPropertyCapillaryAnisotropicRelperm_impl.hpp:57
Dune::FieldVector< typename Matrix::value_type, rows > prod(const Matrix &A, const Dune::FieldVector< typename Matrix::value_type, rows > &x)
Matrix applied to a vector.
Definition: Matrix.hpp:669
TensorMobility()
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:51
TensorMobility< dim > Mobility
The (tensorial) mobility type.
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:109
void computeCflFactors()
Definition: ReservoirPropertyCapillaryAnisotropicRelperm_impl.hpp:154
A property class for incompressible two-phase flow.
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:104
A wrapper for a tensor.
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:49
int invert(FullMatrix< T, StoragePolicy, OrderingPolicy > &A)
Matrix inversion, .
Definition: Matrix.hpp:781
TensorMobility & operator*=(const TensorMobility &other)
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:85
Vec multiply(const Vec &v)
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:81
void setToAverage(const TensorMobility &m1, const TensorMobility &m2)
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:63
void setToSum(const TensorMobility &m1, const TensorMobility &m2)
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:69
A property class for incompressible two-phase flow.
Definition: ReservoirPropertyCommon.hpp:58
void setToInverse(const TensorMobility &m)
Definition: ReservoirPropertyCapillaryAnisotropicRelperm.hpp:75