opm-common
FieldSep.hpp
1 /*
2  Copyright 2026 Equinor 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 
20 #ifndef OPM_FIELDSEP_HPP
21 #define OPM_FIELDSEP_HPP
22 
23 #include <cstddef>
24 #include <optional>
25 #include <vector>
26 
27 namespace Opm {
28  class DeckKeyword;
29  class DeckRecord;
30  class KeywordLocation;
31 } // namespace Opm
32 
33 namespace Opm {
34 
37  public:
38  FieldSepRecord() = default;
39  FieldSepRecord(const DeckRecord& record, const KeywordLocation& location);
40 
41  static FieldSepRecord serializationTestObject();
42 
44  int stage() const;
46  double temperature() const;
48  double pressure() const;
51  int liquidDestination() const;
53  int vaporDestination() const;
55  int kvalueTableNumber() const;
57  int gasPlantTableNumber() const;
60  std::optional<int> surfaceEosNumber() const;
62  std::optional<double> nglDensityTemperature() const;
64  std::optional<double> nglDensityPressure() const;
65 
66  bool operator==(const FieldSepRecord& data) const;
67 
68  template<class Serializer>
69  void serializeOp(Serializer& serializer)
70  {
71  serializer(m_stage);
72  serializer(m_temperature);
73  serializer(m_pressure);
74  serializer(m_liquid_destination);
75  serializer(m_vapor_destination);
76  serializer(m_kvalue_table_number);
77  serializer(m_gas_plant_table_number);
78  serializer(m_surface_eos_number);
79  serializer(m_ngl_density_temperature);
80  serializer(m_ngl_density_pressure);
81  }
82 
83  private:
84  int m_stage = 0;
85  double m_temperature = 0.0;
86  double m_pressure = 0.0;
87  int m_liquid_destination = 0;
88  int m_vapor_destination = 0;
89  int m_kvalue_table_number = 0;
90  int m_gas_plant_table_number = 0;
91  std::optional<int> m_surface_eos_number{};
92  std::optional<double> m_ngl_density_temperature{};
93  std::optional<double> m_ngl_density_pressure{};
94  };
95 
100  class FieldSep {
101  public:
102  FieldSep() = default;
103  explicit FieldSep(const DeckKeyword& keyword);
104 
105  static FieldSep serializationTestObject();
106 
107  const FieldSepRecord& getRecord(std::size_t id) const;
108 
109  std::size_t size() const { return this->m_records.size(); }
110  bool empty() const { return this->m_records.empty(); }
111 
112  auto begin() const { return this->m_records.begin(); }
113  auto end() const { return this->m_records.end(); }
114 
115  bool operator==(const FieldSep& data) const;
116 
117  template<class Serializer>
118  void serializeOp(Serializer& serializer)
119  {
120  serializer(m_records);
121  }
122 
123  private:
124  std::vector<FieldSepRecord> m_records;
125  };
126 
127 } // namespace Opm
128 
129 #endif // OPM_FIELDSEP_HPP
double temperature() const
Stage temperature (SI).
Definition: FieldSep.cpp:107
Definition: KeywordLocation.hpp:27
std::optional< double > nglDensityPressure() const
NGL-density-evaluation pressure (SI). Nullopt if defaulted.
Definition: FieldSep.cpp:139
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
std::optional< int > surfaceEosNumber() const
Surface equation-of-state region number.
Definition: FieldSep.cpp:131
double pressure() const
Stage pressure (SI).
Definition: FieldSep.cpp:111
int gasPlantTableNumber() const
Gas-plant table number, references a GPTABLE (0 => use the EoS).
Definition: FieldSep.cpp:127
A multi-stage field separator (the FIELDSEP keyword).
Definition: FieldSep.hpp:100
int vaporDestination() const
Vapour destination: 0 => stock tank / surface gas.
Definition: FieldSep.cpp:119
std::optional< double > nglDensityTemperature() const
NGL-density-evaluation temperature (SI). Nullopt if defaulted.
Definition: FieldSep.cpp:135
int liquidDestination() const
Liquid destination: 0 => next stage (stock tank for the last stage); -1 => add to stock-tank oil...
Definition: FieldSep.cpp:115
int stage() const
Stage index (FIELDSEP records are given in increasing order).
Definition: FieldSep.cpp:103
One stage of a field separator (a single FIELDSEP record).
Definition: FieldSep.hpp:36
Definition: DeckRecord.hpp:33
Class for (de-)serializing.
Definition: Serializer.hpp:95
int kvalueTableNumber() const
K-value table number (0 => use the equation of state).
Definition: FieldSep.cpp:123
Definition: DeckKeyword.hpp:38