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 <cstddef>
23 #include <string>
24 #include <vector>
25 
26 namespace Opm
27 {
28  /*
29  * The OilVaporizationProperties class
30  * This classe is used to store the values from {VAPPARS, DRSDT, DRVDT, DRSDTCON}
31  * The VAPPARS and {DRSDT, DRVDT} are mutal exclusive and will cancel previous settings of the other keywords.
32  * The DRSDTCON implements a dissolution rate based on convective mixing.
33  * 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.
34  */
36  public:
37  enum class OilVaporization {
38  UNDEF = 0,
39  VAPPARS = 1,
40  DRDT = 2, // DRSDT or DRVDT
41  DRSDTCON = 3 // DRSDTCON
42  };
43 
44 
46  explicit OilVaporizationProperties(const std::size_t numPvtReginIdx);
47 
48  static OilVaporizationProperties serializationTestObject();
49 
50  static void updateDRSDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRSDT, const std::vector<std::string>& option);
51  static void updateDRSDTCON(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRSDT, const std::vector<std::string>& option,
52  const std::vector<double>& psi, const std::vector<double>& omega);
53  static void updateDRVDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRVDT);
54  static void updateVAPPARS(Opm::OilVaporizationProperties& ovp, double vap1, double vap2);
55 
56  OilVaporization getType() const;
57  double getMaxDRSDT(const std::size_t pvtRegionIdx) const;
58  double getMaxDRVDT(const std::size_t pvtRegionIdx) const;
59  bool getOption(const std::size_t pvtRegionIdx) const;
60  bool drsdtActive(const std::size_t pvtRegionIdx) const;
61  bool drvdtActive(const std::size_t pvtRegionIdx) const;
62  bool drsdtConvective(const std::size_t pvtRegionIdx) const;
63 
64  bool drsdtActive() const;
65  bool drvdtActive() const;
66  bool drsdtConvective() const;
67 
68  bool defined() const;
69  std::size_t numPvtRegions() const {return m_maxDRSDT.size();}
70 
71  double vap1() const;
72  double vap2() const;
73 
74  double getPsi(const std::size_t pvtRegionIdx) const;
75  double getOmega(const std::size_t pvtRegionIdx) const;
76  /*
77  * if either argument was default constructed == will always be false
78  * and != will always be true
79  */
80  bool operator==( const OilVaporizationProperties& ) const;
81  bool operator!=( const OilVaporizationProperties& ) const;
82 
83  template<class Serializer>
84  void serializeOp(Serializer& serializer)
85  {
86  serializer(m_type);
87  serializer(m_vap1);
88  serializer(m_vap2);
89  serializer(m_maxDRSDT);
90  serializer(m_maxDRSDT_allCells);
91  serializer(m_maxDRVDT);
92  serializer(m_psi);
93  serializer(m_omega);
94  }
95 
96  private:
97  OilVaporization m_type = OilVaporization::UNDEF;
98  double m_vap1;
99  double m_vap2;
100  std::vector<double> m_maxDRSDT;
101  std::vector<bool> m_maxDRSDT_allCells;
102  std::vector<double> m_maxDRVDT;
103  std::vector<double> m_psi;
104  std::vector<double> m_omega;
105  };
106 }
107 #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:35
Class for (de-)serializing.
Definition: Serializer.hpp:95