IncompTpfa.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_INCOMPTPFA_HEADER_INCLUDED
21 #define OPM_INCOMPTPFA_HEADER_INCLUDED
22 
23 
25 #include <vector>
26 
27 struct UnstructuredGrid;
28 struct Wells;
30 
31 namespace Opm
32 {
33 
34  class IncompPropertiesInterface;
35  class RockCompressibility;
36  class LinearSolverInterface;
37  class TwophaseState;
38  class WellState;
39 
47  class IncompTpfa
48  {
49  public:
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  TwophaseState& 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  TwophaseState& state,
126  WellState& well_state);
127  // Solve with rock compressibility (nonlinear eqn).
128  void solveRockComp(const double dt,
129  TwophaseState& state,
130  WellState& well_state);
131  private:
132  // Helper functions.
133  void computeStaticData();
134  virtual void computePerSolveDynamicData(const double dt,
135  const TwophaseState& state,
136  const WellState& well_state);
137  void computePerIterationDynamicData(const double dt,
138  const TwophaseState& state,
139  const WellState& well_state);
140  void assemble(const double dt,
141  const TwophaseState& state,
142  const WellState& well_state);
143  void solveIncrement();
144  double residualNorm() const;
145  double incrementNorm() const;
146  void computeResults(TwophaseState& state,
147  WellState& well_state) const;
148 
149  protected:
150  // ------ Data that will remain unmodified after construction. ------
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_;
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_;
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
Definition: wells.h:50
Definition: IncompPropertiesInterface.hpp:35
Definition: grid.h:98
Definition: flow_bc.h:39
Definition: AnisotropicEikonal.hpp:43
std::vector< double > porevol_
Definition: IncompTpfa.hpp:176
struct ifs_tpfa_forces forces_
Definition: IncompTpfa.hpp:173
std::vector< double > pressures_
Definition: IncompTpfa.hpp:178
Definition: ifs_tpfa.h:48
std::vector< double > htrans_
Definition: IncompTpfa.hpp:162
const RockCompressibility * rock_comp_props_
Definition: IncompTpfa.hpp:153
const std::vector< double > & src_
Definition: IncompTpfa.hpp:160
const double residual_tol_
Definition: IncompTpfa.hpp:155
const UnstructuredGrid & grid_
Definition: IncompTpfa.hpp:151
std::vector< double > omega_
Definition: IncompTpfa.hpp:170
const int maxiter_
Definition: IncompTpfa.hpp:157
std::vector< int > allcells_
Definition: IncompTpfa.hpp:164
const Wells * wells_
Definition: IncompTpfa.hpp:159
std::vector< double > gpress_omegaweighted_
Definition: IncompTpfa.hpp:171
std::vector< double > initial_porevol_
Definition: IncompTpfa.hpp:172
Simulator state for a two-phase simulator.
Definition: TwophaseState.hpp:30
Definition: RockCompressibility.hpp:33
std::vector< double > wdp_
Definition: IncompTpfa.hpp:168
Definition: IncompTpfa.hpp:47
struct ifs_tpfa_data * h_
Definition: IncompTpfa.hpp:181
std::vector< double > totmob_
Definition: IncompTpfa.hpp:169
const std::vector< double > & getHalfTrans() const
Expose read-only reference to internal half-transmissibility.
Definition: IncompTpfa.hpp:120
std::vector< double > rock_comp_
Definition: IncompTpfa.hpp:177
The state of a set of wells.
Definition: WellState.hpp:36
const double gravity
Definition: Units.hpp:120
std::vector< double > trans_
Definition: IncompTpfa.hpp:167
const FlowBoundaryConditions * bcs_
Definition: IncompTpfa.hpp:161
const UnstructuredGrid & grid
Definition: ColumnExtract.hpp:31
Definition: ifs_tpfa.h:70
const IncompPropertiesInterface & props_
Definition: IncompTpfa.hpp:152
std::vector< double > gpress_
Definition: IncompTpfa.hpp:163
void solveIncomp(const double dt, TwophaseState &state, WellState &well_state)
Abstract interface for linear solvers.
Definition: LinearSolverInterface.hpp:32
const double * gravity_
Definition: IncompTpfa.hpp:158
void solve(const double dt, TwophaseState &state, WellState &well_state)
IncompTpfa(const UnstructuredGrid &grid, const IncompPropertiesInterface &props, LinearSolverInterface &linsolver, const double *gravity, const Wells *wells, const std::vector< double > &src, const FlowBoundaryConditions *bcs)
virtual ~IncompTpfa()
Destructor.
const LinearSolverInterface & linsolver_
Definition: IncompTpfa.hpp:154
const double change_tol_
Definition: IncompTpfa.hpp:156
void solveRockComp(const double dt, TwophaseState &state, WellState &well_state)