Go to the documentation of this file.
19#ifndef OPM_THERMAL_GAS_PVT_WRAPPER_HPP
20#define OPM_THERMAL_GAS_PVT_WRAPPER_HPP
22#include <opm/core/props/pvt/PvtInterface.hpp>
23#include <opm/common/ErrorMacros.hpp>
25#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
26#include <opm/parser/eclipse/EclipseState/Tables/GasvisctTable.hpp>
43 void initFromDeck(std::shared_ptr<const PvtInterface> isothermalPvt,
44 const Opm::Deck& deck,
45 const Opm::EclipseState& eclipseState)
47 isothermalPvt_ = isothermalPvt;
48 auto tables = eclipseState->getTableManager();
50 if (deck->hasKeyword( "PVTG"))
51 numRegions = tables->getPvtgTables().size();
52 else if (deck->hasKeyword( "PVDG"))
53 numRegions = tables->getPvdgTables().size();
55 OPM_THROW(std::runtime_error, "Gas phase was not initialized using a known way");
58 if (deck->hasKeyword( "GASVISCT")) {
59 gasvisctTables_ = &tables->getGasvisctTables();
60 assert( int(gasvisctTables_->size()) == numRegions);
61 static_cast<void>(numRegions);
63 gasCompIdx_ = deck->getKeyword( "GCOMPIDX").getRecord(0).getItem( "GAS_COMPONENT_INDEX").get< int >(0) - 1;
64 gasvisctColumnName_ = "Viscosity"+std::to_string( static_cast<long long>(gasCompIdx_));
68 if (deck->hasKeyword( "TREF")) {
69 tref_ = deck->getKeyword( "TREF").getRecord(0).getItem( "TEMPERATURE").getSIDouble(0);
73 virtual void mu( const int n,
74 const int* pvtRegionIdx,
78 double* output_mu) const
82 OPM_THROW(std::runtime_error,
83 "temperature dependent viscosity as a function of z "
84 "is not yet implemented!");
87 isothermalPvt_->mu(n, pvtRegionIdx, p, T, z, output_mu);
90 virtual void mu( const int n,
91 const int* pvtRegionIdx,
97 double* output_dmudr) const
99 if (gasvisctTables_ != 0) {
100 for ( int i = 0; i < n; ++i) {
108 int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
111 const GasvisctTable& gasvisctTable = gasvisctTables_->getTable<GasvisctTable>(regionIdx);
112 muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]);
115 output_mu[i] = muGasvisct;
116 output_dmudp[i] = 0.0;
117 output_dmudr[i] = 0.0;
124 isothermalPvt_->mu(n, pvtRegionIdx, p, T, r, output_mu, output_dmudp, output_dmudr);
128 virtual void mu( const int n,
129 const int* pvtRegionIdx,
135 double* output_dmudp,
136 double* output_dmudr) const
138 if (gasvisctTables_ != 0) {
139 for ( int i = 0; i < n; ++i) {
145 int regionIdx = getPvtRegionIndex_(pvtRegionIdx, i);
148 const GasvisctTable& gasvisctTable = gasvisctTables_->getTable<GasvisctTable>(regionIdx);
149 muGasvisct = gasvisctTable.evaluate(gasvisctColumnName_, T[i]);
152 output_mu[i] = muGasvisct;
153 output_dmudp[i] = 0.0;
154 output_dmudr[i] = 0.0;
161 isothermalPvt_->mu(n, pvtRegionIdx, p, T, r, cond, output_mu, output_dmudp, output_dmudr);
165 virtual void B( const int n,
166 const int* pvtRegionIdx,
170 double* output_B) const
173 isothermalPvt_->B(n, pvtRegionIdx, p, T, z, output_B);
180 for ( int i = 0; i < n; ++i) {
181 double alpha = tref_/T[i];
182 output_B[i] *= alpha;
188 const int* pvtRegionIdx,
193 double* output_dBdp) const
195 isothermalPvt_->dBdp(n, pvtRegionIdx, p, T, z, output_B, output_dBdp);
202 for ( int i = 0; i < n; ++i) {
203 double alpha = tref_/T[i];
204 output_B[i] *= alpha;
205 output_dBdp[i] *= alpha;
210 virtual void b( const int n,
211 const int* pvtRegionIdx,
217 double* output_dbdr) const
219 isothermalPvt_->b(n, pvtRegionIdx, p, T, r, output_b, output_dbdp, output_dbdr);
226 for ( int i = 0; i < n; ++i) {
227 double alpha = T[i]/tref_;
228 output_b[i] *= alpha;
229 output_dbdp[i] *= alpha;
230 output_dbdr[i] *= alpha;
235 virtual void b( const int n,
236 const int* pvtRegionIdx,
243 double* output_dbdr) const
245 isothermalPvt_->b(n, pvtRegionIdx, p, T, r, cond, output_b, output_dbdp, output_dbdr);
252 for ( int i = 0; i < n; ++i) {
253 double alpha = T[i]/tref_;
254 output_b[i] *= alpha;
255 output_dbdp[i] *= alpha;
256 output_dbdr[i] *= alpha;
262 const int* pvtRegionIdx,
264 double* output_rsSat,
265 double* output_drsSatdp) const
267 isothermalPvt_->rsSat(n, pvtRegionIdx, p, output_rsSat, output_drsSatdp);
271 const int* pvtRegionIdx,
273 double* output_rvSat,
274 double* output_drvSatdp) const
276 isothermalPvt_->rvSat(n, pvtRegionIdx, p, output_rvSat, output_drvSatdp);
279 virtual void R( const int n,
280 const int* pvtRegionIdx,
283 double* output_R) const
285 isothermalPvt_->R(n, pvtRegionIdx, p, z, output_R);
289 const int* pvtRegionIdx,
293 double* output_dRdp) const
295 isothermalPvt_->dRdp(n, pvtRegionIdx, p, z, output_R, output_dRdp);
299 int getPvtRegionIndex_( const int* pvtRegionIdx, int cellIdx) const
303 return pvtRegionIdx[cellIdx];
307 std::shared_ptr<const PvtInterface> isothermalPvt_;
311 const TableContainer* gasvisctTables_;
312 std::string gasvisctColumnName_;
Definition: BlackoilPhases.hpp:59
Definition: ThermalGasPvtWrapper.hpp:35
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:90
virtual void R(const int n, const int *pvtRegionIdx, const double *p, const double *z, double *output_R) const Definition: ThermalGasPvtWrapper.hpp:279
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 Definition: ThermalGasPvtWrapper.hpp:187
virtual void rvSat(const int n, const int *pvtRegionIdx, const double *p, double *output_rvSat, double *output_drvSatdp) const Definition: ThermalGasPvtWrapper.hpp:270
virtual void dRdp(const int n, const int *pvtRegionIdx, const double *p, const double *z, double *output_R, double *output_dRdp) const Definition: ThermalGasPvtWrapper.hpp:288
void initFromDeck(std::shared_ptr< const PvtInterface > isothermalPvt, const Opm::Deck &deck, const Opm::EclipseState &eclipseState) Definition: ThermalGasPvtWrapper.hpp:43
virtual void rsSat(const int n, const int *pvtRegionIdx, const double *p, double *output_rsSat, double *output_drsSatdp) const Definition: ThermalGasPvtWrapper.hpp:261
virtual void B(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *z, double *output_B) const Definition: ThermalGasPvtWrapper.hpp:165
ThermalGasPvtWrapper() Definition: ThermalGasPvtWrapper.hpp:37
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:128
virtual void mu(const int n, const int *pvtRegionIdx, const double *p, const double *T, const double *z, double *output_mu) const Definition: ThermalGasPvtWrapper.hpp:73
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:210
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:235
Definition: AnisotropicEikonal.hpp:44
|