All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
IncompTpfa.hpp
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_INCOMPTPFA_HEADER_INCLUDED
21 #define OPM_INCOMPTPFA_HEADER_INCLUDED
22 
24 #include <vector>
25 
26 struct UnstructuredGrid;
27 struct Wells;
29 
30 namespace Opm
31 {
32 
33  class IncompPropertiesInterface;
34  class RockCompressibility;
35  class LinearSolverInterface;
36  class WellState;
37  class SimulationDataContainer;
38 
39 
47  class IncompTpfa
48  {
49  public:
65  IncompTpfa(const UnstructuredGrid& grid,
66  const IncompPropertiesInterface& props,
67  LinearSolverInterface& linsolver,
68  const double* gravity,
69  const Wells* wells,
70  const std::vector<double>& src,
71  const FlowBoundaryConditions* bcs);
72 
92  IncompTpfa(const UnstructuredGrid& grid,
93  const IncompPropertiesInterface& props,
94  const RockCompressibility* rock_comp_props,
95  LinearSolverInterface& linsolver,
96  const double residual_tol,
97  const double change_tol,
98  const int maxiter,
99  const double* gravity,
100  const Wells* wells,
101  const std::vector<double>& src,
102  const FlowBoundaryConditions* bcs);
103 
105  virtual ~IncompTpfa();
106 
114  void solve(const double dt,
115  SimulationDataContainer& state,
116  WellState& well_state);
117 
118 
120  const std::vector<double>& getHalfTrans() const { return htrans_; }
121 
122  protected:
123  // Solve with no rock compressibility (linear eqn).
124  void solveIncomp(const double dt,
125  SimulationDataContainer& state,
126  WellState& well_state);
127  // Solve with rock compressibility (nonlinear eqn).
128  void solveRockComp(const double dt,
129  SimulationDataContainer& state,
130  WellState& well_state);
131  private:
132  // Helper functions.
133  void computeStaticData();
134  virtual void computePerSolveDynamicData(const double dt,
135  const SimulationDataContainer& state,
136  const WellState& well_state);
137  void computePerIterationDynamicData(const double dt,
138  const SimulationDataContainer& state,
139  const WellState& well_state);
140  void assemble(const double dt,
141  const SimulationDataContainer& state,
142  const WellState& well_state);
143  void solveIncrement();
144  double residualNorm() const;
145  double incrementNorm() const;
146  void computeResults(SimulationDataContainer& state,
147  WellState& well_state) const;
148 
149  protected:
150  // ------ Data that will remain unmodified after construction. ------
151  const UnstructuredGrid& grid_;
152  const IncompPropertiesInterface& props_;
153  const RockCompressibility* rock_comp_props_;
154  const LinearSolverInterface& linsolver_;
155  const double residual_tol_;
156  const double change_tol_;
157  const int maxiter_;
158  const double* gravity_; // May be NULL
159  const Wells* wells_; // May be NULL, outside may modify controls (only) between calls to solve().
160  const std::vector<double>& src_;
161  const FlowBoundaryConditions* bcs_;
162  std::vector<double> htrans_;
163  std::vector<double> gpress_;
164  std::vector<int> allcells_;
165 
166  // ------ Data that will be modified for every solve. ------
167  std::vector<double> trans_ ;
168  std::vector<double> wdp_;
169  std::vector<double> totmob_;
170  std::vector<double> omega_;
171  std::vector<double> gpress_omegaweighted_;
172  std::vector<double> initial_porevol_;
173  struct ifs_tpfa_forces forces_;
174 
175  // ------ Data that will be modified for every solver iteration. ------
176  std::vector<double> porevol_;
177  std::vector<double> rock_comp_;
178  std::vector<double> pressures_;
179 
180  // ------ Internal data for the ifs_tpfa solver. ------
181  struct ifs_tpfa_data* h_;
182  };
183 
184 } // namespace Opm
185 
186 #endif // OPM_INCOMPTPFA_HEADER_INCLUDED
Encapsulating a tpfa pressure solver for the incompressible-fluid case.
Definition: IncompTpfa.hpp:47
Abstract interface for linear solvers.
Definition: LinearSolverInterface.hpp:32
const std::vector< double > & getHalfTrans() const
Expose read-only reference to internal half-transmissibility.
Definition: IncompTpfa.hpp:120
Definition: flow_bc.h:39
Interfaces and data structures to assemble a system of simultaneous linear equations discretising a f...
Data structure aggregating static information about all wells in a scenario.
Definition: wells.h:50
Definition: RockCompressibility.hpp:32
Main data structure presenting a view of an assembled system of simultaneous linear equations which m...
Definition: ifs_tpfa.h:48
IncompTpfa(const UnstructuredGrid &grid, const IncompPropertiesInterface &props, LinearSolverInterface &linsolver, const double *gravity, const Wells *wells, const std::vector< double > &src, const FlowBoundaryConditions *bcs)
Construct solver for incompressible case.
Definition: IncompTpfa.cpp:62
Driving forces pertaining to a particular model setup.
Definition: ifs_tpfa.h:70
void solve(const double dt, SimulationDataContainer &state, WellState &well_state)
Solve the pressure equation.
Definition: IncompTpfa.cpp:158
virtual ~IncompTpfa()
Destructor.
Definition: IncompTpfa.cpp:143
The state of a set of wells.
Definition: WellState.hpp:39
Abstract base class for incompressible fluid and reservoir properties.
Definition: IncompPropertiesInterface.hpp:35