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 RK, // Redlich-Kwong
39 SRK, // Soave-Redlich-Kwong
40 ZJ // Zudkevitch-Joffe-Redlich-Kwong
41 };
42
43 static EOSType eosTypeFromString(const std::string& str);
44
45 static std::string eosTypeToString(EOSType eos);
46
47 CompositionalConfig() = default;
48
49 CompositionalConfig(const Deck& deck, const Runspec& runspec);
50
51 static CompositionalConfig serializationTestObject();
52
53 bool operator==(const CompositionalConfig& other) const;
54
55 // accessing functions
56 double standardTemperature() const;
57 double standardPressure() const;
58 const std::vector<std::string>& compName() const;
59 EOSType eosType(size_t eos_region) const;
60 const std::vector<double>& molecularWeights(std::size_t eos_region) const;
61 const std::vector<double>& acentricFactors(std::size_t eos_region) const;
62 const std::vector<double>& criticalPressure(std::size_t eos_region) const;
63 const std::vector<double>& criticalTemperature(std::size_t eos_region) const;
64 const std::vector<double>& criticalVolume(std::size_t eos_region) const;
65 // binary_interaction_coefficient will likely need some design when we know how we use it
66 const std::vector<double>& binaryInteractionCoefficient(size_t eos_region) const;
67
68 template<class Serializer>
69 void serializeOp(Serializer& serializer)
70 {
71 serializer(num_comps);
72 serializer(standard_temperature);
73 serializer(standard_pressure);
74 serializer(comp_names);
75 serializer(eos_types);
76 serializer(molecular_weights);
77 serializer(acentric_factors);
78 serializer(critical_pressure);
79 serializer(critical_temperature);
80 serializer(critical_volume);
81 serializer(binary_interaction_coefficient);
82 }
83
84private:
85 // TODO: num_comps might not be totally necessary, while might be convenient.
86 // We can check the number of components without accessing Runspec
87 std::size_t num_comps = 0;
88 double standard_temperature = 288.71; // Kelvin
89 double standard_pressure = 1.0 * unit::atm; // 1 atm
90 std::vector<std::string> comp_names;
91 std::vector<EOSType> eos_types;
92 std::vector<std::vector<double>> molecular_weights;
93 std::vector<std::vector<double>> acentric_factors;
94 std::vector<std::vector<double>> critical_pressure;
95 std::vector<std::vector<double>> critical_temperature;
96 std::vector<std::vector<double>> critical_volume;
97 std::vector<std::vector<double>> binary_interaction_coefficient;
98};
99
100}
101#endif // OPM_COMPOSITIONALCONFIG_HPP
Definition CompositionalConfig.hpp:34
Definition Deck.hpp:49
Definition Runspec.hpp:481
Class for (de-)serializing.
Definition Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30