All Classes Namespaces Files Functions Variables Typedefs Enumerator Pages
TransportSolverTwophaseAd.hpp
1 /*
2  Copyright 2013 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_TRANSPORTSOLVERTWOPHASEAD_HEADER_INCLUDED
21 #define OPM_TRANSPORTSOLVERTWOPHASEAD_HEADER_INCLUDED
22 
23 #include <opm/autodiff/AutoDiffBlock.hpp>
24 #include <opm/autodiff/AutoDiffHelpers.hpp>
25 #include <opm/core/transport/TransportSolverTwophaseInterface.hpp>
26 #include <vector>
27 
28 struct UnstructuredGrid;
29 
30 namespace Opm
31 {
32 
33  class IncompPropertiesInterface;
34  class LinearSolverInterface;
35  class ParameterGroup;
36 
39  class TransportSolverTwophaseAd : public TransportSolverTwophaseInterface
40  {
41  public:
48  TransportSolverTwophaseAd(const UnstructuredGrid& grid,
49  const IncompPropertiesInterface& props,
50  const LinearSolverInterface& linsolver,
51  const double* gravity,
52  const ParameterGroup& param);
53 
54  // Virtual destructor.
55  virtual ~TransportSolverTwophaseAd();
56 
65  virtual void solve(const double* porevolume,
66  const double* source,
67  const double dt,
68  TwophaseState& state);
69 
70  private:
71  typedef AutoDiffBlock<double> ADB;
72  typedef ADB::V V;
73  typedef ADB::M M;
74 
75  private:
76  const UnstructuredGrid& grid_;
77  const IncompPropertiesInterface& props_;
78  const LinearSolverInterface& linsolver_;
79  const HelperOps ops_;
80  double gravity_;
81  double tol_;
82  int maxit_;
83  std::vector<int> allcells_;
84  V transi_;
85  };
86 
87 } // namespace Opm
88 
89 #endif // OPM_TRANSPORTSOLVERTWOPHASEAD_HEADER_INCLUDED
Contains vectors and sparse matrices that represent subsets or operations on (AD or regular) vectors ...
Definition: AutoDiffHelpers.hpp:44
AutoDiffMatrix is a wrapper class that optimizes matrix operations.
Definition: AutoDiffMatrix.hpp:43
TransportSolverTwophaseAd(const UnstructuredGrid &grid, const IncompPropertiesInterface &props, const LinearSolverInterface &linsolver, const double *gravity, const ParameterGroup &param)
Construct solver.
Definition: TransportSolverTwophaseAd.cpp:43
Implements an implicit transport solver for incompressible two-phase flow, using automatic differenti...
Definition: TransportSolverTwophaseAd.hpp:39
Eigen::Array< Scalar, Eigen::Dynamic, 1 > V
Underlying type for values.
Definition: AutoDiffBlock.hpp:99
virtual void solve(const double *porevolume, const double *source, const double dt, TwophaseState &state)
Solve for saturation at next timestep.
Definition: TransportSolverTwophaseAd.cpp:163