ImpesTPFAAD.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2013 SINTEF ICT, Applied Mathematics.
3  Copyright 2013 Statoil ASA.
4 
5  This file is part of the Open Porous Media Project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef OPM_IMPESTPFAAD_HEADER_INCLUDED
22 #define OPM_IMPESTPFAAD_HEADER_INCLUDED
23 
27 
28 struct UnstructuredGrid;
29 struct Wells;
30 
31 namespace Opm {
32 
33  class DerivedGeology;
34  class LinearSolverInterface;
35  class BlackoilState;
36  class WellState;
37 
44  {
45  public:
47  ImpesTPFAAD(const UnstructuredGrid& grid,
48  const BlackoilPropsAdInterface& fluid,
49  const DerivedGeology& geo,
50  const Wells& wells,
51  const LinearSolverInterface& linsolver);
52 
57  void solve(const double dt,
58  BlackoilState& state,
59  WellState& well_state);
60  private:
61  // Disallow copying and assignment
62  ImpesTPFAAD(const ImpesTPFAAD& rhs);
63  ImpesTPFAAD& operator=(const ImpesTPFAAD& rhs);
64 
65  // Types
66  typedef AutoDiffBlock<double> ADB;
67  typedef ADB::V V;
68  typedef ADB::M M;
69  typedef Eigen::Array<double,
70  Eigen::Dynamic,
71  Eigen::Dynamic,
72  Eigen::RowMajor> DataBlock;
73  enum { Water = BlackoilPropsAdInterface::Water,
76 
77  // Data
78  const UnstructuredGrid& grid_;
79  const BlackoilPropsAdInterface& fluid_;
80  const DerivedGeology& geo_ ;
81  const Wells& wells_;
82  const LinearSolverInterface& linsolver_;
83  HelperOps ops_;
84  const M grav_;
85  ADB cell_residual_;
86  std::vector<ADB> well_flow_residual_;
87  ADB well_residual_;
88  ADB total_residual_;
89  std::vector<V> kr_;
90  std::vector<V> well_kr_;
91  ADB qs_;
92  V well_perf_dp_;
93 
94  // Methods for assembling and solving.
95  void computeExplicitData(const double dt,
96  const BlackoilState& state,
97  const WellState& well_state);
98  void assemble(const double dt,
99  const BlackoilState& state,
100  const WellState& well_state);
101  void solveJacobianSystem(BlackoilState& state,
102  WellState& well_state) const;
103  double residualNorm() const;
104  void computeFluxes(BlackoilState& state, WellState& well_state) const;
105 
106  // Fluid interface forwarding calls to correct methods of fluid_.
107  V fluidMu(const int phase, const V& p, const V& T, const std::vector<int>& cells) const;
108  ADB fluidMu(const int phase, const ADB& p, const ADB& T, const std::vector<int>& cells) const;
109  V fluidFvf(const int phase, const V& p, const V& T, const std::vector<int>& cells) const;
110  ADB fluidFvf(const int phase, const ADB& p, const ADB& T, const std::vector<int>& cells) const;
111  V fluidRho(const int phase, const V& p, const V& T, const std::vector<int>& cells) const;
112  ADB fluidRho(const int phase, const ADB& p, const ADB& T, const std::vector<int>& cells) const;
113  std::vector<V> fluidRelperm(const V& sw, const V& so, const V& sg, const std::vector<int>& cells) const;
114  V fluidKr(const int phase) const;
115  V fluidKrWell(const int phase) const;
116  };
117 
118 
119 } // namespace Opm
120 
121 #endif /* OPM_IMPESTPFAAD_HEADER_INCLUDED */
Definition: GeoProps.hpp:53
Definition: BlackoilPropsAdInterface.hpp:38
Definition: BlackoilPropsAdInterface.hpp:81
Eigen::Array< Scalar, Eigen::Dynamic, 1 > V
Underlying type for values.
Definition: AutoDiffBlock.hpp:98
Definition: AdditionalObjectDeleter.hpp:22
Definition: BlackoilPropsAdInterface.hpp:81
Definition: BlackoilPropsAdInterface.hpp:82
void solve(const double dt, BlackoilState &state, WellState &well_state)
Definition: AutoDiffMatrix.hpp:43
ImpesTPFAAD(const UnstructuredGrid &grid, const BlackoilPropsAdInterface &fluid, const DerivedGeology &geo, const Wells &wells, const LinearSolverInterface &linsolver)
Construct impes solver.
Definition: AutoDiffHelpers.hpp:40
Definition: ImpesTPFAAD.hpp:43