Go to the documentation of this file.
19 #ifndef OPM_THERMAL_GAS_PVT_WRAPPER_HPP
20 #define OPM_THERMAL_GAS_PVT_WRAPPER_HPP
23 #include <opm/common/ErrorMacros.hpp>
25 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
42 void initFromDeck(std::shared_ptr<const PvtInterface> isothermalPvt,
43 Opm::DeckConstPtr deck,
44 Opm::EclipseStateConstPtr eclipseState)
46 isothermalPvt_ = isothermalPvt;
47 auto tables = eclipseState->getTableManager();
49 if (deck->hasKeyword( "PVTG"))
50 numRegions = tables->getPvtgTables().size();
51 else if (deck->hasKeyword( "PVDG"))
52 numRegions = tables->getPvdgTables().size();
54 OPM_THROW(std::runtime_error, "Gas phase was not initialized using a known way");
57 if (deck->hasKeyword( "GASVISCT")) {
58 gasvisctTables_ = &tables->getGasvisctTables();
59 assert( int(gasvisctTables_->size()) == numRegions);
60 static_cast<void>(numRegions);
62 gasCompIdx_ = deck->getKeyword( "GCOMPIDX")->getRecord(0)->getItem( "GAS_COMPONENT_INDEX")->getInt(0) - 1;
63 gasvisctColumnName_ = "Viscosity"+std::to_string(static_cast<long long>(gasCompIdx_));
67 if (deck->hasKeyword( "TREF")) {
68 tref_ = deck->getKeyword( "TREF")->getRecord(0)->getItem( "TEMPERATURE")->getSIDouble(0);
72 virtual void mu( const int n,
73 const int* pvtRegionIdx,
77 double* output_mu) const
81 OPM_THROW(std::runtime_error,
82 "temperature dependent viscosity as a function of z "
83 "is not yet implemented!");
86 isothermalPvt_->mu(n, pvtRegionIdx, p, T, z, output_mu);
89 virtual void mu( const int n,
90 const int* pvtRegionIdx,
96 double* output_dmudr) const
98 if (gasvisctTables_ != 0) {
99 for ( int i = 0; i < n; ++i) {
107 int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
110 const GasvisctTable& gasvisctTable = gasvisctTables_->getTable<GasvisctTable>(regionIdx);
111 muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]);
114 output_mu[i] = muGasvisct;
115 output_dmudp[i] = 0.0;
116 output_dmudr[i] = 0.0;
123 isothermalPvt_->mu(n, pvtRegionIdx, p, T, r, output_mu, output_dmudp, output_dmudr);
127 virtual void mu( const int n,
128 const int* pvtRegionIdx,
134 double* output_dmudp,
135 double* output_dmudr) const
137 if (gasvisctTables_ != 0) {
138 for ( int i = 0; i < n; ++i) {
144 int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
147 const GasvisctTable& gasvisctTable = gasvisctTables_->getTable<GasvisctTable>(regionIdx);
148 muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]);
151 output_mu[i] = muGasvisct;
152 output_dmudp[i] = 0.0;
153 output_dmudr[i] = 0.0;
160 isothermalPvt_->mu(n, pvtRegionIdx, p, T, r, cond, output_mu, output_dmudp, output_dmudr);
164 virtual void B( const int n,
165 const int* pvtRegionIdx,
169 double* output_B) const
172 isothermalPvt_->B(n, pvtRegionIdx, p, T, z, output_B);
179 for ( int i = 0; i < n; ++i) {
180 double alpha = tref_/T[i];
181 output_B[i] *= alpha;
187 const int* pvtRegionIdx,
192 double* output_dBdp) const
194 isothermalPvt_->dBdp(n, pvtRegionIdx, p, T, z, output_B, output_dBdp);
201 for ( int i = 0; i < n; ++i) {
202 double alpha = tref_/T[i];
203 output_B[i] *= alpha;
204 output_dBdp[i] *= alpha;
209 virtual void b( const int n,
210 const int* pvtRegionIdx,
216 double* output_dbdr) const
218 isothermalPvt_->b(n, pvtRegionIdx, p, T, r, output_b, output_dbdp, output_dbdr);
225 for ( int i = 0; i < n; ++i) {
226 double alpha = T[i]/tref_;
227 output_b[i] *= alpha;
228 output_dbdp[i] *= alpha;
229 output_dbdr[i] *= alpha;
234 virtual void b( const int n,
235 const int* pvtRegionIdx,
242 double* output_dbdr) const
244 isothermalPvt_->b(n, pvtRegionIdx, p, T, r, cond, output_b, output_dbdp, output_dbdr);
251 for ( int i = 0; i < n; ++i) {
252 double alpha = T[i]/tref_;
253 output_b[i] *= alpha;
254 output_dbdp[i] *= alpha;
255 output_dbdr[i] *= alpha;
261 const int* pvtRegionIdx,
263 double* output_rsSat,
264 double* output_drsSatdp) const
266 isothermalPvt_->rsSat(n, pvtRegionIdx, p, output_rsSat, output_drsSatdp);
270 const int* pvtRegionIdx,
272 double* output_rvSat,
273 double* output_drvSatdp) const
275 isothermalPvt_->rvSat(n, pvtRegionIdx, p, output_rvSat, output_drvSatdp);
278 virtual void R( const int n,
279 const int* pvtRegionIdx,
282 double* output_R) const
284 isothermalPvt_->R(n, pvtRegionIdx, p, z, output_R);
288 const int* pvtRegionIdx,
292 double* output_dRdp) const
294 isothermalPvt_->dRdp(n, pvtRegionIdx, p, z, output_R, output_dRdp);
298 int getPvtRegionIndex_( const int* pvtRegionIdx, int cellIdx) const
302 return pvtRegionIdx[cellIdx];
306 std::shared_ptr<const PvtInterface> isothermalPvt_;
310 const TableContainer* gasvisctTables_;
311 std::string gasvisctColumnName_;
Definition: BlackoilPhases.hpp:48
virtual void b(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *r, const PhasePresence *cond, double *output_b, double *output_dbdp, double *output_dbdr) const Definition: ThermalGasPvtWrapper.hpp:234
virtual void dBdp(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *z, double *output_B, double *output_dBdp) const Formation volume factor and p-derivative as functions of p and z. Definition: ThermalGasPvtWrapper.hpp:186
Definition: AnisotropicEikonal.hpp:43
virtual void mu(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *r, double *output_mu, double *output_dmudp, double *output_dmudr) const Definition: ThermalGasPvtWrapper.hpp:89
virtual void b(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *r, double *output_b, double *output_dbdp, double *output_dbdr) const Definition: ThermalGasPvtWrapper.hpp:209
virtual void dRdp(const int n, const int *pvtRegionIdx, const double *p, const double *z, double *output_R, double *output_dRdp) const Solution factor and p-derivative as functions of p and z. Definition: ThermalGasPvtWrapper.hpp:287
void initFromDeck(std::shared_ptr< const PvtInterface > isothermalPvt, Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclipseState) Definition: ThermalGasPvtWrapper.hpp:42
virtual void rvSat(const int n, const int *pvtRegionIdx, const double *p, double *output_rvSat, double *output_drvSatdp) const Vapor oil/gas ratio and its derivatives at saturated conditions as a function of p. Definition: ThermalGasPvtWrapper.hpp:269
virtual void mu(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *z, double *output_mu) const Viscosity as a function of p, T and z. Definition: ThermalGasPvtWrapper.hpp:72
virtual void R(const int n, const int *pvtRegionIdx, const double *p, const double *z, double *output_R) const Solution factor as a function of p and z. Definition: ThermalGasPvtWrapper.hpp:278
virtual void rsSat(const int n, const int *pvtRegionIdx, const double *p, double *output_rsSat, double *output_drsSatdp) const Solution gas/oil ratio and its derivatives at saturated conditions as a function of p... Definition: ThermalGasPvtWrapper.hpp:260
Definition: PvtInterface.hpp:30
ThermalGasPvtWrapper() Definition: ThermalGasPvtWrapper.hpp:36
Definition: ThermalGasPvtWrapper.hpp:33
virtual void mu(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *r, const PhasePresence *cond, double *output_mu, double *output_dmudp, double *output_dmudr) const Definition: ThermalGasPvtWrapper.hpp:127
virtual void B(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *z, double *output_B) const Formation volume factor as a function of p, T and z. Definition: ThermalGasPvtWrapper.hpp:164
|