My Project
Loading...
Searching...
No Matches
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:
40
41 // Constructor
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 virtual void computeFaceAreaFraction(const std::vector<double>& total_face_area) = 0;
62 virtual double totalFaceArea() const = 0;
63
64 template <class Context>
65 void addToSource(RateVector& rates,
66 const Context& context,
67 const unsigned spaceIdx,
68 const unsigned timeIdx)
69 {
70 const unsigned cellIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
71 addToSource(rates, cellIdx, timeIdx);
72 }
73
74 virtual void addToSource(RateVector& rates,
75 const unsigned cellIdx,
76 const unsigned timeIdx) = 0;
77
78 int aquiferID() const { return this->aquiferID_; }
79
80protected:
81 bool co2store_or_h2store_() const
82 {
83 const auto& rspec = ebos_simulator_.vanguard().eclState().runspec();
84 return rspec.co2Storage() || rspec.h2Storage();
85 }
86
87 int phaseIdx_() const
88 {
89 // If OIL is used to model brine the aquifer should do the same
90 if (co2store_or_h2store_() && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx))
91 return FluidSystem::oilPhaseIdx;
92
93 return FluidSystem::waterPhaseIdx;
94 }
95
96 const int aquiferID_{};
97 const Simulator& ebos_simulator_;
98};
99
100} // namespace Opm
101
102#endif
Definition AquiferInterface.hpp:35
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27