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