inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState, int number_of_cells, const int* global_cell, const int* cart_dims, const CentroidIterator& begin_cell_centroids, int dimension, bool init_rock) { // retrieve the cell specific PVT table index from the deck // and using the grid... extractPvtTableIndex(cellPvtRegionIdx_, deck, number_of_cells, global_cell); if (init_rock){ rock_.init(eclState, number_of_cells, global_cell, cart_dims); } pvt_.init(deck, /*numSamples=*/0); SaturationPropsFromDeck<SatFuncSimpleNonuniform>* ptr = new SaturationPropsFromDeck<SatFuncSimpleNonuniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, /*numSamples=*/0); if (pvt_.numPhases() != satprops_->numPhases()) { OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data (" << pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); } }
inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState, std::shared_ptr<MaterialLawManager> materialLawManager, int number_of_cells, const int* global_cell, const int* cart_dims, bool init_rock) { // retrieve the cell specific PVT table index from the deck // and using the grid... extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell); if (init_rock){ rock_.init(eclState, number_of_cells, global_cell, cart_dims); } pvt_.init(deck, eclState, /*numSamples=*/0); SaturationPropsFromDeck* ptr = new SaturationPropsFromDeck(); ptr->init(phaseUsageFromDeck(deck), materialLawManager); satprops_.reset(ptr); if (pvt_.numPhases() != satprops_->numPhases()) { OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data (" << pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); } }
inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState, std::shared_ptr<MaterialLawManager> materialLawManager, int number_of_cells, const int* global_cell, const int* cart_dims, const parameter::ParameterGroup& param, bool init_rock) { // retrieve the cell specific PVT table index from the deck // and using the grid... extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell); if(init_rock){ rock_.init(eclState, number_of_cells, global_cell, cart_dims); } const int pvt_samples = param.getDefault("pvt_tab_size", -1); pvt_.init(deck, eclState, pvt_samples); // Unfortunate lack of pointer smartness here... std::string threephase_model = param.getDefault<std::string>("threephase_model", "gwseg"); if (deck->hasKeyword("ENDSCALE") && threephase_model != "gwseg") { OPM_THROW(std::runtime_error, "Sorry, end point scaling currently available for the 'gwseg' model only."); } SaturationPropsFromDeck* ptr = new SaturationPropsFromDeck(); ptr->init(phaseUsageFromDeck(deck), materialLawManager); satprops_.reset(ptr); if (pvt_.numPhases() != satprops_->numPhases()) { OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data (" << pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); } }
SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck, EclipseStateConstPtr eclState, const int number_of_cells, const int* global_cell) { if (deck->hasKeyword("SOLVENT")) { // retrieve the cell specific PVT table index from the deck // and using the grid... extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell); extractTableIndex("SATNUM", eclState, number_of_cells, global_cell, cellSatNumRegionIdx_); // surface densities if (deck->hasKeyword("SDENSITY")) { const auto& densityKeyword = deck->getKeyword("SDENSITY"); int numRegions = densityKeyword.size(); solvent_surface_densities_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { solvent_surface_densities_[regionIdx] = densityKeyword.getRecord(regionIdx).getItem("SOLVENT_DENSITY").getSIDouble(0); } } else { OPM_THROW(std::runtime_error, "SDENSITY must be specified in SOLVENT runs\n"); } auto tables = eclState->getTableManager(); // pvt const TableContainer& pvdsTables = tables->getPvdsTables(); if (!pvdsTables.empty()) { int numRegions = pvdsTables.size(); // resize the attributes of the object b_.resize(numRegions); viscosity_.resize(numRegions); inverseBmu_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::PvdsTable& pvdsTable = pvdsTables.getTable<PvdsTable>(regionIdx); const auto& press = pvdsTable.getPressureColumn(); const auto& b = pvdsTable.getFormationFactorColumn(); const auto& visc = pvdsTable.getViscosityColumn(); const int sz = b.size(); std::vector<double> inverseBmu(sz); std::vector<double> inverseB(sz); for (int i = 0; i < sz; ++i) { inverseB[i] = 1.0 / b[i]; inverseBmu[i] = 1.0 / (b[i] * visc[i]); } b_[regionIdx] = NonuniformTableLinear<double>(press, inverseB); viscosity_[regionIdx] = NonuniformTableLinear<double>(press, visc); inverseBmu_[regionIdx] = NonuniformTableLinear<double>(press, inverseBmu); } } else { OPM_THROW(std::runtime_error, "PVDS must be specified in SOLVENT runs\n"); } const TableContainer& ssfnTables = tables->getSsfnTables(); // relative permeabilty multiplier if (!ssfnTables.empty()) { int numRegions = ssfnTables.size(); // resize the attributes of the object krg_.resize(numRegions); krs_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::SsfnTable& ssfnTable = ssfnTables.getTable<SsfnTable>(regionIdx); // Copy data const auto& solventFraction = ssfnTable.getSolventFractionColumn(); const auto& krg = ssfnTable.getGasRelPermMultiplierColumn(); const auto& krs = ssfnTable.getSolventRelPermMultiplierColumn(); krg_[regionIdx] = NonuniformTableLinear<double>(solventFraction, krg); krs_[regionIdx] = NonuniformTableLinear<double>(solventFraction, krs); } } else { OPM_THROW(std::runtime_error, "SSFN must be specified in SOLVENT runs\n"); } if (deck->hasKeyword("MISCIBLE") ) { // retrieve the cell specific Misc table index from the deck // and using the grid... extractTableIndex("MISCNUM", eclState, number_of_cells, global_cell, cellMiscRegionIdx_); // misicible hydrocabon relative permeability wrt water const TableContainer& sof2Tables = tables->getSof2Tables(); if (!sof2Tables.empty()) { int numRegions = sof2Tables.size(); // resize the attributes of the object krn_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::Sof2Table& sof2Table = sof2Tables.getTable<Sof2Table>(regionIdx); // Copy data // Sn = So + Sg + Ss; const auto& sn = sof2Table.getSoColumn(); const auto& krn = sof2Table.getKroColumn(); krn_[regionIdx] = NonuniformTableLinear<double>(sn, krn); } } else { OPM_THROW(std::runtime_error, "SOF2 must be specified in MISCIBLE (SOLVENT) runs\n"); } const TableContainer& miscTables = tables->getMiscTables(); if (!miscTables.empty()) { int numRegions = miscTables.size(); // resize the attributes of the object misc_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::MiscTable& miscTable = miscTables.getTable<MiscTable>(regionIdx); // Copy data // solventFraction = Ss / (Ss + Sg); const auto& solventFraction = miscTable.getSolventFractionColumn(); const auto& misc = miscTable.getMiscibilityColumn(); misc_[regionIdx] = NonuniformTableLinear<double>(solventFraction, misc); } } else { OPM_THROW(std::runtime_error, "MISC must be specified in MISCIBLE (SOLVENT) runs\n"); } const TableContainer& pmiscTables = tables->getPmiscTables(); if (!pmiscTables.empty()) { int numRegions = pmiscTables.size(); // resize the attributes of the object pmisc_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::PmiscTable& pmiscTable = pmiscTables.getTable<PmiscTable>(regionIdx); // Copy data const auto& po = pmiscTable.getOilPhasePressureColumn(); const auto& pmisc = pmiscTable.getMiscibilityColumn(); pmisc_[regionIdx] = NonuniformTableLinear<double>(po, pmisc); } } // miscible relative permeability multipleiers const TableContainer& msfnTables = tables->getMsfnTables(); if (!msfnTables.empty()) { int numRegions = msfnTables.size(); // resize the attributes of the object mkrsg_.resize(numRegions); mkro_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::MsfnTable& msfnTable = msfnTables.getTable<MsfnTable>(regionIdx); // Copy data // Ssg = Ss + Sg; const auto& Ssg = msfnTable.getGasPhaseFractionColumn(); const auto& krsg = msfnTable.getGasSolventRelpermMultiplierColumn(); const auto& kro = msfnTable.getOilRelpermMultiplierColumn(); mkrsg_[regionIdx] = NonuniformTableLinear<double>(Ssg, krsg); mkro_[regionIdx] = NonuniformTableLinear<double>(Ssg, kro); } } const TableContainer& sorwmisTables = tables->getSorwmisTables(); if (!sorwmisTables.empty()) { int numRegions = sorwmisTables.size(); // resize the attributes of the object sorwmis_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::SorwmisTable& sorwmisTable = sorwmisTables.getTable<SorwmisTable>(regionIdx); // Copy data const auto& sw = sorwmisTable.getWaterSaturationColumn(); const auto& sorwmis = sorwmisTable.getMiscibleResidualOilColumn(); sorwmis_[regionIdx] = NonuniformTableLinear<double>(sw, sorwmis); } } const TableContainer& sgcwmisTables = tables->getSgcwmisTables(); if (!sgcwmisTables.empty()) { int numRegions = sgcwmisTables.size(); // resize the attributes of the object sgcwmis_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const Opm::SgcwmisTable& sgcwmisTable = sgcwmisTables.getTable<SgcwmisTable>(regionIdx); // Copy data const auto& sw = sgcwmisTable.getWaterSaturationColumn(); const auto& sgcwmis = sgcwmisTable.getMiscibleResidualGasColumn(); sgcwmis_[regionIdx] = NonuniformTableLinear<double>(sw, sgcwmis); } } if (deck->hasKeyword("TLMIXPAR")) { const int numRegions = deck->getKeyword("TLMIXPAR").size(); // resize the attributes of the object mix_param_viscosity_.resize(numRegions); mix_param_density_.resize(numRegions); for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) { const auto& tlmixparRecord = deck->getKeyword("TLMIXPAR").getRecord(regionIdx); const auto& mix_params_viscosity = tlmixparRecord.getItem("TL_VISCOSITY_PARAMETER").getSIDoubleData(); mix_param_viscosity_[regionIdx] = mix_params_viscosity[0]; const auto& mix_params_density = tlmixparRecord.getItem("TL_DENSITY_PARAMETER").getSIDoubleData(); const int numDensityItems = mix_params_density.size(); if (numDensityItems == 0) { mix_param_density_[regionIdx] = mix_param_viscosity_[regionIdx]; } else if (numDensityItems == 1) { mix_param_density_[regionIdx] = mix_params_density[0]; } else { OPM_THROW(std::runtime_error, "Only one value can be entered for the TL parameter pr MISC region."); } } } } } }
inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState, int number_of_cells, const int* global_cell, const int* cart_dims, const CentroidIterator& begin_cell_centroids, int dimension, const parameter::ParameterGroup& param, bool init_rock) { // retrieve the cell specific PVT table index from the deck // and using the grid... extractPvtTableIndex(cellPvtRegionIdx_, deck, number_of_cells, global_cell); if(init_rock){ rock_.init(eclState, number_of_cells, global_cell, cart_dims); } const int pvt_samples = param.getDefault("pvt_tab_size", 200); pvt_.init(deck, pvt_samples); // Unfortunate lack of pointer smartness here... const int sat_samples = param.getDefault("sat_tab_size", 200); std::string threephase_model = param.getDefault<std::string>("threephase_model", "simple"); if (deck->hasKeyword("ENDSCALE") && threephase_model != "gwseg") { OPM_THROW(std::runtime_error, "Sorry, end point scaling currently available for the 'gwseg' model only."); } if (sat_samples > 1) { if (threephase_model == "stone2") { SaturationPropsFromDeck<SatFuncStone2Uniform>* ptr = new SaturationPropsFromDeck<SatFuncStone2Uniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, sat_samples); } else if (threephase_model == "simple") { SaturationPropsFromDeck<SatFuncSimpleUniform>* ptr = new SaturationPropsFromDeck<SatFuncSimpleUniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, sat_samples); } else if (threephase_model == "gwseg") { SaturationPropsFromDeck<SatFuncGwsegUniform>* ptr = new SaturationPropsFromDeck<SatFuncGwsegUniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, sat_samples); } else { OPM_THROW(std::runtime_error, "Unknown threephase_model: " << threephase_model); } } else { if (threephase_model == "stone2") { SaturationPropsFromDeck<SatFuncStone2Nonuniform>* ptr = new SaturationPropsFromDeck<SatFuncStone2Nonuniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, sat_samples); } else if (threephase_model == "simple") { SaturationPropsFromDeck<SatFuncSimpleNonuniform>* ptr = new SaturationPropsFromDeck<SatFuncSimpleNonuniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, sat_samples); } else if (threephase_model == "gwseg") { SaturationPropsFromDeck<SatFuncGwsegNonuniform>* ptr = new SaturationPropsFromDeck<SatFuncGwsegNonuniform>(); satprops_.reset(ptr); ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, sat_samples); } else { OPM_THROW(std::runtime_error, "Unknown threephase_model: " << threephase_model); } } if (pvt_.numPhases() != satprops_->numPhases()) { OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data (" << pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); } }