TransportSolverCompressibleTwophaseReorder.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_TRANSPORTSOLVERCOMPRESSIBLETWOPHASEREORDER_HEADER_INCLUDED
21 #define OPM_TRANSPORTSOLVERCOMPRESSIBLETWOPHASEREORDER_HEADER_INCLUDED
22 
24 #include <vector>
25 
26 struct UnstructuredGrid;
27 
28 namespace Opm
29 {
30 
31  class BlackoilPropertiesInterface;
32 
36  {
37  public:
45  const double tol,
46  const int maxit);
47 
59  void solve(const double* darcyflux,
60  const double* pressure,
61  const double* temperature,
62  const double* porevolume0,
63  const double* porevolume,
64  const double* source,
65  const double dt,
66  std::vector<double>& saturation,
67  std::vector<double>& surfacevol);
68 
71  void initGravity(const double* grav);
72 
82  void solveGravity(const std::vector<std::vector<int> >& columns,
83  const double dt,
84  std::vector<double>& saturation,
85  std::vector<double>& surfacevol);
86 
87  private:
88  virtual void solveSingleCell(const int cell);
89  virtual void solveMultiCell(const int num_cells, const int* cells);
90  void solveSingleCellGravity(const std::vector<int>& cells,
91  const int pos,
92  const double* gravflux);
93  int solveGravityColumn(const std::vector<int>& cells);
94  void initGravityDynamic();
95 
96  private:
97  const UnstructuredGrid& grid_;
98  const BlackoilPropertiesInterface& props_;
99  std::vector<int> allcells_;
100  std::vector<double> visc_;
101  std::vector<double> A_;
102  std::vector<double> smin_;
103  std::vector<double> smax_;
104  double tol_;
105  int maxit_;
106 
107  const double* darcyflux_; // one flux per grid face
108  const double* surfacevol0_; // one per phase per cell
109  const double* porevolume0_; // one volume per cell
110  const double* porevolume_; // one volume per cell
111  const double* source_; // one source per cell
112  double dt_;
113  std::vector<double> saturation_; // P (= num. phases) per cell
114  std::vector<double> fractionalflow_; // = m[0]/(m[0] + m[1]) per cell
115  // For gravity segregation.
116  const double* gravity_;
117  std::vector<double> trans_;
118  std::vector<double> density_;
119  std::vector<double> gravflux_;
120  std::vector<double> mob_;
121  std::vector<double> s0_;
122 
123  // Storing the upwind and downwind graphs for experiments.
124  std::vector<int> ia_upw_;
125  std::vector<int> ja_upw_;
126  std::vector<int> ia_downw_;
127  std::vector<int> ja_downw_;
128 
129  struct Residual;
130  double fracFlow(double s, int cell) const;
131 
132  struct GravityResidual;
133  void mobility(double s, int cell, double* mob) const;
134  };
135 
136 } // namespace Opm
137 
138 #endif // OPM_TRANSPORTMODELCOMPRESSIBLETWOPHASE_HEADER_INCLUDED
Definition: grid.h:98
Definition: AnisotropicEikonal.hpp:43
void solveGravity(const std::vector< std::vector< int > > &columns, const double dt, std::vector< double > &saturation, std::vector< double > &surfacevol)
TransportSolverCompressibleTwophaseReorder(const UnstructuredGrid &grid, const Opm::BlackoilPropertiesInterface &props, const double tol, const int maxit)
Definition: ReorderSolverInterface.hpp:38
Definition: BlackoilPropertiesInterface.hpp:37
Definition: TransportSolverCompressibleTwophaseReorder.hpp:35
void solve(const double *darcyflux, const double *pressure, const double *temperature, const double *porevolume0, const double *porevolume, const double *source, const double dt, std::vector< double > &saturation, std::vector< double > &surfacevol)
const UnstructuredGrid & grid
Definition: ColumnExtract.hpp:31
std::vector< double > temperature(const Grid &, const Region &, const CellRange &cells)
Definition: initStateEquil_impl.hpp:667