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
24#include <vector>
25
26struct UnstructuredGrid;
27struct Wells;
29
30namespace Opm
31{
32
33 class IncompPropertiesInterface;
34 class RockCompressibility;
35 class LinearSolverInterface;
36 class WellState;
37 class SimulationDataContainer;
38
39
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_;
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. ------
182 };
183
184} // namespace Opm
185
186#endif // OPM_INCOMPTPFA_HEADER_INCLUDED
Definition: IncompPropertiesInterface.hpp:36
Definition: IncompTpfa.hpp:48
const std::vector< double > & getHalfTrans() const
Expose read-only reference to internal half-transmissibility.
Definition: IncompTpfa.hpp:120
std::vector< double > totmob_
Definition: IncompTpfa.hpp:169
std::vector< double > rock_comp_
Definition: IncompTpfa.hpp:177
const RockCompressibility * rock_comp_props_
Definition: IncompTpfa.hpp:153
const double residual_tol_
Definition: IncompTpfa.hpp:155
struct ifs_tpfa_forces forces_
Definition: IncompTpfa.hpp:173
const int maxiter_
Definition: IncompTpfa.hpp:157
std::vector< double > pressures_
Definition: IncompTpfa.hpp:178
const std::vector< double > & src_
Definition: IncompTpfa.hpp:160
std::vector< double > initial_porevol_
Definition: IncompTpfa.hpp:172
IncompTpfa(const UnstructuredGrid &grid, const IncompPropertiesInterface &props, LinearSolverInterface &linsolver, const double *gravity, const Wells *wells, const std::vector< double > &src, const FlowBoundaryConditions *bcs)
IncompTpfa(const UnstructuredGrid &grid, const IncompPropertiesInterface &props, const RockCompressibility *rock_comp_props, LinearSolverInterface &linsolver, const double residual_tol, const double change_tol, const int maxiter, const double *gravity, const Wells *wells, const std::vector< double > &src, const FlowBoundaryConditions *bcs)
const LinearSolverInterface & linsolver_
Definition: IncompTpfa.hpp:154
std::vector< double > porevol_
Definition: IncompTpfa.hpp:176
const double * gravity_
Definition: IncompTpfa.hpp:158
void solveRockComp(const double dt, SimulationDataContainer &state, WellState &well_state)
std::vector< double > omega_
Definition: IncompTpfa.hpp:170
const FlowBoundaryConditions * bcs_
Definition: IncompTpfa.hpp:161
const Wells * wells_
Definition: IncompTpfa.hpp:159
std::vector< double > trans_
Definition: IncompTpfa.hpp:167
std::vector< double > htrans_
Definition: IncompTpfa.hpp:162
const UnstructuredGrid & grid_
Definition: IncompTpfa.hpp:151
const IncompPropertiesInterface & props_
Definition: IncompTpfa.hpp:152
void solveIncomp(const double dt, SimulationDataContainer &state, WellState &well_state)
virtual ~IncompTpfa()
Destructor.
struct ifs_tpfa_data * h_
Definition: IncompTpfa.hpp:181
void solve(const double dt, SimulationDataContainer &state, WellState &well_state)
std::vector< double > gpress_omegaweighted_
Definition: IncompTpfa.hpp:171
std::vector< double > gpress_
Definition: IncompTpfa.hpp:163
const double change_tol_
Definition: IncompTpfa.hpp:156
std::vector< double > wdp_
Definition: IncompTpfa.hpp:168
std::vector< int > allcells_
Definition: IncompTpfa.hpp:164
Abstract interface for linear solvers.
Definition: LinearSolverInterface.hpp:33
Definition: RockCompressibility.hpp:33
The state of a set of wells.
Definition: WellState.hpp:40
Definition: AnisotropicEikonal.hpp:44
Definition: flow_bc.h:39
Definition: wells.h:51
Definition: ifs_tpfa.h:48
Definition: ifs_tpfa.h:70