AquiferInterface.hpp
Go to the documentation of this file.
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 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
41
42 // Constructor
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>
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
81protected:
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_{};
99};
100
101} // namespace Opm
102
103#endif
Definition: AquiferInterface.hpp:35
const int aquiferID_
Definition: AquiferInterface.hpp:97
const Simulator & simulator_
Definition: AquiferInterface.hpp:98
virtual void beginTimeStep()=0
virtual void computeFaceAreaFraction(const std::vector< Scalar > &total_face_area)=0
virtual void initialSolutionApplied()=0
virtual void initFromRestart(const data::Aquifers &aquiferSoln)=0
AquiferInterface(int aqID, const Simulator &simulator)
Definition: AquiferInterface.hpp:43
virtual Scalar totalFaceArea() const =0
virtual data::AquiferData aquiferData() const =0
void addToSource(RateVector &rates, const Context &context, const unsigned spaceIdx, const unsigned timeIdx)
Definition: AquiferInterface.hpp:66
virtual ~AquiferInterface()=default
int phaseIdx_() const
Definition: AquiferInterface.hpp:88
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: AquiferInterface.hpp:40
virtual void endTimeStep()=0
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: AquiferInterface.hpp:39
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: AquiferInterface.hpp:37
bool co2store_or_h2store_() const
Definition: AquiferInterface.hpp:82
virtual void addToSource(RateVector &rates, const unsigned cellIdx, const unsigned timeIdx)=0
int aquiferID() const
Definition: AquiferInterface.hpp:79
GetPropType< TypeTag, Properties::RateVector > RateVector
Definition: AquiferInterface.hpp:38
Definition: BlackoilPhases.hpp:27