TransportSolverTwophaseReorder.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_TRANSPORTSOLVERTWOPHASEREORDER_HEADER_INCLUDED
21 #define OPM_TRANSPORTSOLVERTWOPHASEREORDER_HEADER_INCLUDED
22 
25 #include <vector>
26 #include <map>
27 #include <ostream>
28 struct UnstructuredGrid;
29 
30 namespace Opm
31 {
32 
33  class IncompPropertiesInterface;
34 
37  {
38  public:
46  const Opm::IncompPropertiesInterface& props,
47  const double* gravity,
48  const double tol,
49  const int maxit);
50 
51  // Virtual destructor.
53 
62  virtual void solve(const double* porevolume,
63  const double* source,
64  const double dt,
65  TwophaseState& state);
66 
75  void solveGravity(const double* porevolume,
76  const double dt,
77  TwophaseState& state);
78 
81  const std::vector<int>& getReorderIterations() const;
82 
83  private:
84  void initGravity(const double* grav);
85  void initColumns();
86  virtual void solveSingleCell(const int cell);
87  virtual void solveMultiCell(const int num_cells, const int* cells);
88 
89  void solveSingleCellGravity(const std::vector<int>& cells,
90  const int pos,
91  const double* gravflux);
92  int solveGravityColumn(const std::vector<int>& cells);
93  private:
94  const UnstructuredGrid& grid_;
95  const IncompPropertiesInterface& props_;
96  const double* visc_;
97  std::vector<double> smin_;
98  std::vector<double> smax_;
99  double tol_;
100  int maxit_;
101 
102  const double* darcyflux_; // one flux per grid face
103  const double* porevolume_; // one volume per cell
104  const double* source_; // one source per cell
105  double dt_;
106  std::vector<double> saturation_; // one per cell, only water saturation!
107  std::vector<double> fractionalflow_; // = m[0]/(m[0] + m[1]) per cell
108  std::vector<int> reorder_iterations_;
109  //std::vector<double> reorder_fval_;
110  // For gravity segregation.
111  std::vector<double> gravflux_;
112  std::vector<double> mob_;
113  std::vector<double> s0_;
114  std::vector<std::vector<int> > columns_;
115 
116  // Storing the upwind and downwind graphs for experiments.
117  std::vector<int> ia_upw_;
118  std::vector<int> ja_upw_;
119  std::vector<int> ia_downw_;
120  std::vector<int> ja_downw_;
121 
122  struct Residual;
123  double fracFlow(double s, int cell) const;
124 
125  struct GravityResidual;
126  void mobility(double s, int cell, double* mob) const;
127  };
128 
129 } // namespace Opm
130 
131 #endif // OPM_TRANSPORTMODELTWOPHASE_HEADER_INCLUDED
Definition: IncompPropertiesInterface.hpp:35
Definition: grid.h:98
Definition: AnisotropicEikonal.hpp:43
const std::vector< int > & getReorderIterations() const
TransportSolverTwophaseReorder(const UnstructuredGrid &grid, const Opm::IncompPropertiesInterface &props, const double *gravity, const double tol, const int maxit)
Definition: ReorderSolverInterface.hpp:38
Simulator state for a two-phase simulator.
Definition: TwophaseState.hpp:30
Base class for two-phase incompressible transport solvers.
Definition: TransportSolverTwophaseInterface.hpp:30
const double gravity
Definition: Units.hpp:120
const UnstructuredGrid & grid
Definition: ColumnExtract.hpp:31
virtual void solve(const double *porevolume, const double *source, const double dt, TwophaseState &state)
Implements a reordering transport solver for incompressible two-phase flow.
Definition: TransportSolverTwophaseReorder.hpp:36
void solveGravity(const double *porevolume, const double dt, TwophaseState &state)