opm-common
OilVaporizationProperties.hpp
1 /*
2  Copyright 2016 Statoil ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef DRSDT_HPP
20 #define DRSDT_HPP
21 
22 #include <string>
23 #include <vector>
24 
25 namespace Opm
26 {
27  /*
28  * The OilVaporizationProperties class
29  * This classe is used to store the values from {VAPPARS, DRSDT, DRVDT, DRSDTCON}
30  * The VAPPARS and {DRSDT, DRVDT} are mutal exclusive and will cancel previous settings of the other keywords.
31  * The DRSDTCON implements a dissolution rate based on convective mixing.
32  * Ask for type first and the ask for the correct values for this type, asking for values not valid for the current type will throw a logic exception.
33  */
35  public:
36  enum class OilVaporization {
37  UNDEF = 0,
38  VAPPARS = 1,
39  DRDT = 2, // DRSDT or DRVDT
40  DRSDTCON = 3 // DRSDTCON
41  };
42 
43 
45  explicit OilVaporizationProperties(const size_t numPvtReginIdx);
46 
47  static OilVaporizationProperties serializationTestObject();
48 
49  static void updateDRSDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRSDT, const std::vector<std::string>& option);
50  static void updateDRSDTCON(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRSDT, const std::vector<std::string>& option,
51  const std::vector<double>& psi, const std::vector<double>& omega);
52  static void updateDRVDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRVDT);
53  static void updateVAPPARS(Opm::OilVaporizationProperties& ovp, double vap1, double vap2);
54 
55  OilVaporization getType() const;
56  double getMaxDRSDT(const size_t pvtRegionIdx) const;
57  double getMaxDRVDT(const size_t pvtRegionIdx) const;
58  bool getOption(const size_t pvtRegionIdx) const;
59  bool drsdtActive(const size_t pvtRegionIdx) const;
60  bool drvdtActive(const size_t pvtRegionIdx) const;
61  bool drsdtConvective(const size_t pvtRegionIdx) const;
62 
63  bool drsdtActive() const;
64  bool drvdtActive() const;
65  bool drsdtConvective() const;
66 
67  bool defined() const;
68  size_t numPvtRegions() const {return m_maxDRSDT.size();}
69 
70  double vap1() const;
71  double vap2() const;
72 
73  double getPsi(const size_t pvtRegionIdx) const;
74  double getOmega(const size_t pvtRegionIdx) const;
75  /*
76  * if either argument was default constructed == will always be false
77  * and != will always be true
78  */
79  bool operator==( const OilVaporizationProperties& ) const;
80  bool operator!=( const OilVaporizationProperties& ) const;
81 
82  template<class Serializer>
83  void serializeOp(Serializer& serializer)
84  {
85  serializer(m_type);
86  serializer(m_vap1);
87  serializer(m_vap2);
88  serializer(m_maxDRSDT);
89  serializer(m_maxDRSDT_allCells);
90  serializer(m_maxDRVDT);
91  serializer(m_psi);
92  serializer(m_omega);
93  }
94 
95  private:
96  OilVaporization m_type = OilVaporization::UNDEF;
97  double m_vap1;
98  double m_vap2;
99  std::vector<double> m_maxDRSDT;
100  std::vector<bool> m_maxDRSDT_allCells;
101  std::vector<double> m_maxDRVDT;
102  std::vector<double> m_psi;
103  std::vector<double> m_omega;
104  };
105 }
106 #endif // DRSDT_H
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: OilVaporizationProperties.hpp:34
Class for (de-)serializing.
Definition: Serializer.hpp:94