My Project
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
25#include <opm/output/data/Aquifer.hpp>
26
27namespace Opm
28{
29
30template <typename TypeTag>
32{
33public:
34 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
35 using RateVector = GetPropType<TypeTag, Properties::RateVector>;
36 using Simulator = GetPropType<TypeTag, Properties::Simulator>;
37
38 // Constructor
39 AquiferInterface(int aqID,
40 const Simulator& ebosSimulator)
41 : aquiferID_(aqID)
42 , ebos_simulator_(ebosSimulator)
43 {
44 }
45
46 // Destructor
47 virtual ~AquiferInterface() = default;
48
49 virtual void initFromRestart(const data::Aquifers& aquiferSoln) = 0;
50
51 virtual void initialSolutionApplied() = 0;
52
53 virtual void beginTimeStep() = 0;
54 virtual void endTimeStep() = 0;
55
56 virtual data::AquiferData aquiferData() const = 0;
57
58 template <class Context>
59 void addToSource(RateVector& rates,
60 const Context& context,
61 const unsigned spaceIdx,
62 const unsigned timeIdx)
63 {
64 const unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
65 addToSource(rates, cellIdx, timeIdx);
66 }
67
68 virtual void addToSource(RateVector& rates,
69 const unsigned cellIdx,
70 const unsigned timeIdx) = 0;
71
72 int aquiferID() const { return this->aquiferID_; }
73
74protected:
75 bool co2store_() const
76 {
77 return ebos_simulator_.vanguard().eclState().runspec().co2Storage();
78 }
79
80 int phaseIdx_() const
81 {
82 if (co2store_())
83 return FluidSystem::oilPhaseIdx;
84
85 return FluidSystem::waterPhaseIdx;
86 }
87
88 const int aquiferID_{};
89 const Simulator& ebos_simulator_;
90};
91
92} // namespace Opm
93
94#endif
Definition: AquiferInterface.hpp:32
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27