My Project
Loading...
Searching...
No Matches
CompositionalConfig.hpp
1/*
2 Copyright (C) 2024 SINTEF Digital, Mathematics and Cybernetics.
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
20#ifndef OPM_COMPOSITIONALCONFIG_HPP
21#define OPM_COMPOSITIONALCONFIG_HPP
22
23#include <opm/input/eclipse/Units/Units.hpp>
24
25#include <cstddef>
26#include <string>
27#include <vector>
28
29namespace Opm {
30
31class Deck;
32class Runspec;
33
35public:
36 enum class EOSType {
37 PR, // Peng-Robinson
38 PRCORR, // Peng-Robinson modified
39 RK, // Redlich-Kwong
40 SRK, // Soave-Redlich-Kwong
41 ZJ // Zudkevitch-Joffe-Redlich-Kwong
42 };
43
44 static EOSType eosTypeFromString(const std::string& str);
45
46 static std::string eosTypeToString(EOSType eos);
47
48 CompositionalConfig() = default;
49
50 CompositionalConfig(const Deck& deck, const Runspec& runspec);
51
52 static CompositionalConfig serializationTestObject();
53
54 bool operator==(const CompositionalConfig& other) const;
55
56 // accessing functions
57 double standardTemperature() const;
58 double standardPressure() const;
59 const std::vector<std::string>& compName() const;
60 EOSType eosType(size_t eos_region) const;
61 const std::vector<double>& molecularWeights(std::size_t eos_region) const;
62 const std::vector<double>& acentricFactors(std::size_t eos_region) const;
63 const std::vector<double>& criticalPressure(std::size_t eos_region) const;
64 const std::vector<double>& criticalTemperature(std::size_t eos_region) const;
65 const std::vector<double>& criticalVolume(std::size_t eos_region) const;
66 const std::vector<double>& binaryInteractionCoefficient(size_t eos_region) const;
67 std::size_t numComps() const;
68
69 template<class Serializer>
70 void serializeOp(Serializer& serializer)
71 {
72 serializer(num_comps);
73 serializer(standard_temperature);
74 serializer(standard_pressure);
75 serializer(comp_names);
76 serializer(eos_types);
77 serializer(molecular_weights);
78 serializer(acentric_factors);
79 serializer(critical_pressure);
80 serializer(critical_temperature);
81 serializer(critical_volume);
82 serializer(binary_interaction_coefficient);
83 }
84
85private:
86 // TODO: num_comps might not be totally necessary, while might be convenient.
87 // We can check the number of components without accessing Runspec
88 std::size_t num_comps = 0;
89 double standard_temperature = 288.71; // Kelvin
90 double standard_pressure = 1.0 * unit::atm; // 1 atm
91 std::vector<std::string> comp_names;
92 std::vector<EOSType> eos_types;
93 std::vector<std::vector<double>> molecular_weights;
94 std::vector<std::vector<double>> acentric_factors;
95 std::vector<std::vector<double>> critical_pressure;
96 std::vector<std::vector<double>> critical_temperature;
97 std::vector<std::vector<double>> critical_volume;
98 std::vector<std::vector<double>> binary_interaction_coefficient;
99};
100
101}
102#endif // OPM_COMPOSITIONALCONFIG_HPP
Definition CompositionalConfig.hpp:34
Definition Deck.hpp:46
Definition Runspec.hpp:480
Class for (de-)serializing.
Definition Serializer.hpp:94
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30