My Project
Loading...
Searching...
No Matches
WDFAC.hpp
1/*
2 Copyright 2023 Equinor.
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 WDFAC_HPP_HEADER_INCLUDED
21#define WDFAC_HPP_HEADER_INCLUDED
22
23#include <stdexcept>
24
25#include <fmt/format.h>
26
27namespace Opm {
28 class Connection;
29 class DeckRecord;
30 class WellConnections;
31} // namespace Opm
32
33namespace Opm { namespace RestartIO {
34 struct RstWell;
35}} // namespace Opm::RestartIO
36
37namespace Opm {
38
39 class WDFAC
40 {
41 public:
66 {
68 double coeff_a{0.0};
69
71 double exponent_b{0.0};
72
74 double exponent_c{0.0};
75
78
82 bool operator==(const Correlation& other) const;
83
87 bool operator!=(const Correlation& other) const
88 {
89 return ! (*this == other);
90 }
91
99 template <class Serializer>
100 void serializeOp(Serializer& serializer)
101 {
102 serializer(this->coeff_a);
103 serializer(this->exponent_b);
104 serializer(this->exponent_c);
105 }
106 };
107
109 WDFAC() = default;
110
117 explicit WDFAC(const RestartIO::RstWell& rst_well);
118
121
127 void updateWDFAC(const DeckRecord& record);
128
134 void updateWDFACCOR(const DeckRecord& record);
135
144 void updateWDFACType(const WellConnections& connections);
145
151 void updateTotalCF(const WellConnections& connections);
152
177 template <typename DensityCallback, typename GasViscCallback>
178 double getDFactor(DensityCallback&& rhoGS,
179 GasViscCallback&& gas_visc,
180 const Connection& conn) const
181 {
182 switch (this->m_type) {
183 case WDFacType::NONE:
184 return 0.0;
185
186 case WDFacType::DFACTOR:
187 return this->scaledWellLevelDFactor(this->m_d, conn);
188
189 case WDFacType::DAKEMODEL:
190 return this->dakeModelDFactor(rhoGS(), gas_visc(), conn);
191
192 case WDFacType::CON_DFACTOR:
193 return this->connectionLevelDFactor(conn);
194 }
195
196 throw std::runtime_error {
197 fmt::format("Unknown D-Factor model '{}'",
198 static_cast<int>(this->m_type))
199 };
200 }
201
204 {
205 return this->m_corr;
206 }
207
210 bool useDFactor() const;
211
215 bool operator==(const WDFAC& other) const;
216
220 bool operator!=(const WDFAC& other) const
221 {
222 return ! (*this == other);
223 }
224
231 template <class Serializer>
232 void serializeOp(Serializer& serializer)
233 {
234 serializer(this->m_type);
235 serializer(this->m_d);
236 serializer(this->m_total_cf);
237 serializer(this->m_corr);
238 }
239
240 private:
242 enum class WDFacType
243 {
245 NONE = 1,
246
248 DFACTOR = 2,
249
251 DAKEMODEL = 3,
252
254 CON_DFACTOR = 4,
255 };
256
258 WDFacType m_type { WDFacType::NONE };
259
261 double m_d{0.0};
262
264 double m_total_cf{-1.0};
265
267 Correlation m_corr{};
268
277 double connectionLevelDFactor(const Connection& conn) const;
278
290 double dakeModelDFactor(const double rhoGS,
291 const double gas_visc,
292 const Connection& conn) const;
293
302 double scaledWellLevelDFactor(const double dfac,
303 const Connection& conn) const;
304 };
305
306} // namespace Opm
307
308#endif // WDFAC_HPP_HEADER_INCLUDED
Definition Connection.hpp:53
Definition DeckRecord.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition WDFAC.hpp:40
bool operator!=(const WDFAC &other) const
Inequality operator.
Definition WDFAC.hpp:220
void updateWDFACType(const WellConnections &connections)
Check if any input-level connctions have a non-trivial D-factor and update this well's D-factor categ...
Definition WDFAC.cpp:99
void updateWDFACCOR(const DeckRecord &record)
Configure D-factor calculation from Dake correlation model (keyword WDFACCOR).
Definition WDFAC.cpp:90
void updateWDFAC(const DeckRecord &record)
Configure D-factor calculation from well-level D-factor description (keyword 'WDFAC')
Definition WDFAC.cpp:83
double getDFactor(DensityCallback &&rhoGS, GasViscCallback &&gas_visc, const Connection &conn) const
Retrieve currently configured D-factor for single connection.
Definition WDFAC.hpp:178
WDFAC()=default
Default constructor.
bool operator==(const WDFAC &other) const
Equality operator.
Definition WDFAC.cpp:123
void updateTotalCF(const WellConnections &connections)
Capture sum of all CTFs for the purpose of translating well-level D-factors to connection-level D-fac...
Definition WDFAC.cpp:112
const Correlation & getDFactorCorrelationCoefficients() const
Retrieve current D-factor correlation model coefficients.
Definition WDFAC.hpp:203
static WDFAC serializationTestObject()
Serialisation test object.
Definition WDFAC.cpp:71
void serializeOp(Serializer &serializer)
Serialisation operator.
Definition WDFAC.hpp:232
bool useDFactor() const
Whether or not a flow-dependent skin factor ('D') has been configured for the current well.
Definition WDFAC.cpp:118
Definition WellConnections.hpp:48
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition well.hpp:43
Parameters for Dake's D-factor correlation model.
Definition WDFAC.hpp:66
bool operator==(const Correlation &other) const
Equality operator.
Definition WDFAC.cpp:49
bool operator!=(const Correlation &other) const
Inequality operator.
Definition WDFAC.hpp:87
double coeff_a
Multiplicative coefficient 'A'.
Definition WDFAC.hpp:68
void serializeOp(Serializer &serializer)
Serialisation operator.
Definition WDFAC.hpp:100
static Correlation serializationTestObject()
Serialisation test object.
Definition WDFAC.cpp:44
double exponent_b
Power coefficient 'B' for the effective permeability.
Definition WDFAC.hpp:71
double exponent_c
Power coefficient 'C' for the porosity term.
Definition WDFAC.hpp:74