opm-simulators
BlackoilAquiferModel.hpp
1 /*
2  File adapted from BlackoilWellModel.hpp
3 
4  Copyright 2017 TNO - Heat Transfer & Fluid Dynamics, Modelling & Optimization of the Subsurface
5  Copyright 2017 Statoil ASA.
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef OPM_BLACKOILAQUIFERMODEL_HEADER_INCLUDED
24 #define OPM_BLACKOILAQUIFERMODEL_HEADER_INCLUDED
25 
26 #include <opm/input/eclipse/EclipseState/Aquifer/Aquancon.hpp>
27 #include <opm/input/eclipse/EclipseState/Aquifer/AquiferCT.hpp>
28 #include <opm/input/eclipse/EclipseState/Aquifer/Aquifetp.hpp>
29 
30 #include <opm/output/data/Aquifer.hpp>
31 
32 #include <opm/simulators/aquifers/AquiferCarterTracy.hpp>
33 #include <opm/simulators/aquifers/AquiferFetkovich.hpp>
34 #include <opm/simulators/aquifers/AquiferNumerical.hpp>
35 #include <opm/simulators/aquifers/SupportsFaceTag.hpp>
36 
38 
39 #include <opm/material/densead/Math.hpp>
40 
41 #include <vector>
42 #include <type_traits>
43 #include <string_view>
44 
45 namespace Opm {
46 
48 template <typename TypeTag>
50 {
53 
54 
55 public:
56  explicit BlackoilAquiferModel(Simulator& simulator);
57 
58  void initialSolutionApplied();
59  void initFromRestart(const data::Aquifers& aquiferSoln);
60 
61  void beginEpisode();
62  void beginTimeStep();
63  void beginIteration();
64  // add the water rate due to aquifers to the source term.
65  template <class Context>
66  void addToSource(RateVector& rates, const Context& context, unsigned spaceIdx, unsigned timeIdx) const;
67  void addToSource(RateVector& rates, unsigned globalSpaceIdx, unsigned timeIdx) const;
68  void endIteration();
69  void endTimeStep();
70  void endEpisode();
71 
72  data::Aquifers aquiferData() const;
73 
74  template <class Restarter>
75  void serialize(Restarter& res);
76 
77  template <class Restarter>
78  void deserialize(Restarter& res);
79 
80  template<class Serializer>
81  void serializeOp(Serializer& serializer);
82 
83 protected:
84  // --------- Types ---------
87 
88  Simulator& simulator_;
89 
90  // TODO: possibly better to use unorder_map here for aquifers
91  std::vector<std::unique_ptr<AquiferInterface<TypeTag>>> aquifers;
92 
93  // This initialization function is used to connect the parser objects
94  // with the ones needed by AquiferCarterTracy
95  void init();
96 
97 private:
98  void createDynamicAquifers(const int episode_index);
99 
100  void initializeStaticAquifers();
101  void initializeRestartDynamicAquifers();
102 
103  bool needRestartDynamicAquifers() const;
104 
105  template <typename AquiferType, typename AquiferData>
106  std::unique_ptr<AquiferType>
107  createAnalyticAquiferPointer(const AquiferData& aqData,
108  const int aquiferID,
109  std::string_view aqType) const;
110 
111  void computeConnectionAreaFraction() const;
112 };
113 
114 } // namespace Opm
115 
116 #include "BlackoilAquiferModel_impl.hpp"
117 
118 #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
Class for handling the blackoil aquifer model.
Definition: BlackoilAquiferModel.hpp:49
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
The base class which specifies the API of aquifer models.