opm-simulators
AquiferInterface.hpp
1 /*
2  Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3  Copyright 2017 Statoil ASA.
4  Copyright 2017 IRIS
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef OPM_AQUIFERINTERFACE_HEADER_INCLUDED
23 #define OPM_AQUIFERINTERFACE_HEADER_INCLUDED
24 
27 
28 #include <opm/output/data/Aquifer.hpp>
29 
30 namespace Opm
31 {
32 
33 template <typename TypeTag>
35 {
36 public:
41 
42  // Constructor
43  AquiferInterface(int aqID,
44  const Simulator& simulator)
45  : aquiferID_(aqID)
46  , simulator_(simulator)
47  {
48  }
49 
50  // Destructor
51  virtual ~AquiferInterface() = default;
52 
53  virtual void initFromRestart(const data::Aquifers& aquiferSoln) = 0;
54 
55  virtual void initialSolutionApplied() = 0;
56 
57  virtual void beginTimeStep() = 0;
58  virtual void endTimeStep() = 0;
59 
60  virtual data::AquiferData aquiferData() const = 0;
61 
62  virtual void computeFaceAreaFraction(const std::vector<Scalar>& total_face_area) = 0;
63  virtual Scalar totalFaceArea() const = 0;
64 
65  template <class Context>
66  void addToSource(RateVector& rates,
67  const Context& context,
68  const unsigned spaceIdx,
69  const unsigned timeIdx)
70  {
71  const unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
72  addToSource(rates, cellIdx, timeIdx);
73  }
74 
75  virtual void addToSource(RateVector& rates,
76  const unsigned cellIdx,
77  const unsigned timeIdx) = 0;
78 
79  int aquiferID() const { return this->aquiferID_; }
80 
81 protected:
82  bool co2store_or_h2store_() const
83  {
84  const auto& rspec = simulator_.vanguard().eclState().runspec();
85  return rspec.co2Storage() || rspec.h2Storage();
86  }
87 
88  int phaseIdx_() const
89  {
90  // If OIL is used to model brine the aquifer should do the same
91  if (co2store_or_h2store_() && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx))
92  return FluidSystem::oilPhaseIdx;
93 
94  return FluidSystem::waterPhaseIdx;
95  }
96 
97  const int aquiferID_{};
98  const Simulator& simulator_;
99 };
100 
101 } // namespace Opm
102 
103 #endif
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(...))
Definition: propertysystem.hh:233
Defines the common properties required by the porous medium multi-phase models.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Declare the properties used by the infrastructure code of the finite volume discretizations.
Definition: AquiferInterface.hpp:34