mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
@@ -273,7 +273,7 @@ try
|
||||
if (wells.c_wells() == 0) {
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow.reset(new PolymerInflowFromDeck(deck, eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
|
||||
polymer_inflow.reset(new PolymerInflowFromDeck(eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
|
||||
} else {
|
||||
polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
|
||||
param.getDefault("poly_end_days", 800.0)*Opm::unit::day,
|
||||
|
||||
@@ -310,7 +310,7 @@ try
|
||||
if (wells.c_wells() == 0) {
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow.reset(new PolymerInflowFromDeck(deck, eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
|
||||
polymer_inflow.reset(new PolymerInflowFromDeck(eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
|
||||
} else {
|
||||
polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
|
||||
param.getDefault("poly_end_days", 800.0)*Opm::unit::day,
|
||||
|
||||
@@ -100,41 +100,28 @@ namespace Opm
|
||||
const int nw = wells->number_of_wells;
|
||||
std::vector<double> perfcells_fraction(wells->well_connpos[nw], 0.0);
|
||||
|
||||
if (deck_->hasKeyword("WSOLVENT")) {
|
||||
size_t currentStep = timer.currentStepNum();
|
||||
ScheduleConstPtr schedule = BaseType::eclipse_state_->getSchedule();
|
||||
|
||||
size_t currentStep = timer.currentStepNum();
|
||||
ScheduleConstPtr schedule = BaseType::eclipse_state_->getSchedule();
|
||||
Opm::DeckKeywordConstPtr keyword = deck_->getKeyword("WSOLVENT");
|
||||
const int num_keywords = keyword->size();
|
||||
|
||||
for (int recordNr = 0; recordNr < num_keywords; ++recordNr) {
|
||||
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
||||
const std::string& wellNamesPattern = record->getItem("WELL")->getTrimmedString(0);
|
||||
std::vector<WellPtr> wells_solvent = schedule->getWells(wellNamesPattern);
|
||||
for (auto wellIter = wells_solvent.begin(); wellIter != wells_solvent.end(); ++wellIter) {
|
||||
WellPtr well_solvent = *wellIter;
|
||||
WellInjectionProperties injection = well_solvent->getInjectionProperties(currentStep);
|
||||
if (injection.injectorType == WellInjector::GAS) {
|
||||
double solventFraction = well_solvent->getSolventFraction(currentStep);
|
||||
// Find the solvent well in the well list and add properties to it
|
||||
int wix = 0;
|
||||
for (; wix < nw; ++wix) {
|
||||
if (wellNamesPattern == wells->name[wix]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wix == wells->number_of_wells) {
|
||||
OPM_THROW(std::runtime_error, "Could not find a match for well "
|
||||
<< wellNamesPattern
|
||||
<< " from WSOLVENT.");
|
||||
}
|
||||
for (int j = wells->well_connpos[wix]; j < wells->well_connpos[wix+1]; ++j) {
|
||||
perfcells_fraction[j] = solventFraction;
|
||||
}
|
||||
} else {
|
||||
OPM_THROW(std::logic_error, "For solvent injector you must have a gas injector");
|
||||
for (const auto& well_solvent : schedule->getWells( currentStep )) {
|
||||
WellInjectionProperties injection = well_solvent->getInjectionProperties(currentStep);
|
||||
if (injection.injectorType == WellInjector::GAS) {
|
||||
double solventFraction = well_solvent->getSolventFraction(currentStep);
|
||||
// Find the solvent well in the well list and add properties to it
|
||||
int wix = 0;
|
||||
for (; wix < nw; ++wix) {
|
||||
if (well_solvent->name() == wells->name[wix]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wix == wells->number_of_wells) {
|
||||
OPM_THROW(std::runtime_error, "Could not find a match for well "
|
||||
<< well_solvent->name()
|
||||
<< " from WSOLVENT.");
|
||||
}
|
||||
for (int j = wells->well_connpos[wix]; j < wells->well_connpos[wix+1]; ++j) {
|
||||
perfcells_fraction[j] = solventFraction;
|
||||
}
|
||||
}
|
||||
}
|
||||
well_state.solventFraction() = perfcells_fraction;
|
||||
|
||||
@@ -68,22 +68,19 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
|
||||
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
|
||||
const Opm::PvdsTable& pvdsTable = pvdsTables.getTable<PvdsTable>(regionIdx);
|
||||
|
||||
// Copy data
|
||||
const std::vector<double>& press = pvdsTable.getPressureColumn();
|
||||
const std::vector<double>& b = pvdsTable.getFormationFactorColumn();
|
||||
const std::vector<double>& visc = pvdsTable.getViscosityColumn();
|
||||
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];
|
||||
}
|
||||
|
||||
std::vector<double> inverseBmu(sz);
|
||||
for (int i = 0; i < sz; ++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);
|
||||
@@ -108,9 +105,9 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
|
||||
const Opm::SsfnTable& ssfnTable = ssfnTables.getTable<SsfnTable>(regionIdx);
|
||||
|
||||
// Copy data
|
||||
const std::vector<double>& solventFraction = ssfnTable.getSolventFractionColumn();
|
||||
const std::vector<double>& krg = ssfnTable.getGasRelPermMultiplierColumn();
|
||||
const std::vector<double>& krs = ssfnTable.getSolventRelPermMultiplierColumn();
|
||||
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);
|
||||
|
||||
@@ -66,94 +66,31 @@ namespace Opm
|
||||
// ---------- Methods of PolymerInflowFromDeck ----------
|
||||
|
||||
|
||||
|
||||
/// Constructor.
|
||||
/// @param[in] deck Input deck expected to contain WPOLYMER.
|
||||
PolymerInflowFromDeck::PolymerInflowFromDeck(Opm::DeckConstPtr deck,
|
||||
const Wells& wells,
|
||||
const int num_cells)
|
||||
: sparse_inflow_(num_cells)
|
||||
{
|
||||
if (!deck->hasKeyword("WPOLYMER")) {
|
||||
OPM_MESSAGE("PolymerInflowFromDeck initialized without WPOLYMER in current epoch.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract concentrations and put into cell->concentration map.
|
||||
Opm::DeckKeywordConstPtr wpolymerKeyword = deck->getKeyword("WPOLYMER");
|
||||
const int num_wpl = wpolymerKeyword->size();
|
||||
std::map<int, double> perfcell_conc;
|
||||
for (int i = 0; i < num_wpl; ++i) {
|
||||
// Only use well name and polymer concentration.
|
||||
// That is, we ignore salt concentration and group
|
||||
// names.
|
||||
int wix = 0;
|
||||
for (; wix < wells.number_of_wells; ++wix) {
|
||||
if (wpolymerKeyword->getRecord(i)->getItem("WELL")->getString(0) == wells.name[wix]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wix == wells.number_of_wells) {
|
||||
OPM_THROW(std::runtime_error, "Could not find a match for well "
|
||||
<< wpolymerKeyword->getRecord(i)->getItem("WELL")->getString(0)
|
||||
<< " from WPOLYMER.");
|
||||
}
|
||||
for (int j = wells.well_connpos[wix]; j < wells.well_connpos[wix+1]; ++j) {
|
||||
const int perf_cell = wells.well_cells[j];
|
||||
perfcell_conc[perf_cell] =
|
||||
wpolymerKeyword->getRecord(i)->getItem("POLYMER_CONCENTRATION")->getSIDouble(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Build sparse vector from map.
|
||||
std::map<int, double>::const_iterator it = perfcell_conc.begin();
|
||||
for (; it != perfcell_conc.end(); ++it) {
|
||||
sparse_inflow_.addElement(it->second, it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PolymerInflowFromDeck::setInflowValues(Opm::DeckConstPtr deck,
|
||||
Opm::EclipseStateConstPtr eclipseState,
|
||||
PolymerInflowFromDeck::setInflowValues(Opm::EclipseStateConstPtr eclipseState,
|
||||
size_t currentStep)
|
||||
{
|
||||
Opm::DeckKeywordConstPtr keyword = deck->getKeyword("WPOLYMER");
|
||||
|
||||
// Schedule schedule(deck);
|
||||
ScheduleConstPtr schedule = eclipseState->getSchedule();
|
||||
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
|
||||
DeckRecordConstPtr record = keyword->getRecord(recordNr);
|
||||
|
||||
const std::string& wellNamesPattern = record->getItem("WELL")->getTrimmedString(0);
|
||||
std::string wellName = record->getItem("WELL")->getTrimmedString(0);
|
||||
std::vector<WellPtr> wells = schedule->getWells(wellNamesPattern);
|
||||
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter) {
|
||||
WellPtr well = *wellIter;
|
||||
WellInjectionProperties injection = well->getInjectionProperties(currentStep);
|
||||
if (injection.injectorType == WellInjector::WATER) {
|
||||
WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
|
||||
wellPolymerRate_.insert(std::make_pair(wellName, polymer.m_polymerConcentration));
|
||||
} else {
|
||||
OPM_THROW(std::logic_error, "For polymer injector you must have a water injector");
|
||||
}
|
||||
for (const auto& well : schedule->getWells(currentStep)) {
|
||||
WellInjectionProperties injection = well->getInjectionProperties(currentStep);
|
||||
if (injection.injectorType == WellInjector::WATER) {
|
||||
WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
|
||||
wellPolymerRate_.insert(std::make_pair(well->name(), polymer.m_polymerConcentration));
|
||||
} else {
|
||||
OPM_THROW(std::logic_error, "For polymer injector you must have a water injector");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructor.
|
||||
/// @param[in] deck Input deck expected to contain WPOLYMER.
|
||||
PolymerInflowFromDeck::PolymerInflowFromDeck(Opm::DeckConstPtr deck,
|
||||
Opm::EclipseStateConstPtr eclipseState,
|
||||
PolymerInflowFromDeck::PolymerInflowFromDeck(Opm::EclipseStateConstPtr eclipseState,
|
||||
const Wells& wells,
|
||||
const int num_cells,
|
||||
size_t currentStep)
|
||||
: sparse_inflow_(num_cells)
|
||||
{
|
||||
if (!deck->hasKeyword("WPOLYMER")) {
|
||||
OPM_MESSAGE("PolymerInflowFromDeck initialized without WPOLYMER in current epoch.");
|
||||
return;
|
||||
}
|
||||
setInflowValues(deck, eclipseState, currentStep);
|
||||
setInflowValues(eclipseState, currentStep);
|
||||
|
||||
std::unordered_map<std::string, double>::const_iterator map_it;
|
||||
// Extract concentrations and put into cell->concentration map.
|
||||
|
||||
@@ -88,21 +88,12 @@ namespace Opm
|
||||
class PolymerInflowFromDeck : public PolymerInflowInterface
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
/// \param[in] deck Input deck expected to contain WPOLYMER.
|
||||
/// \param[in] wells Wells structure.
|
||||
/// \param[in] num_cells Number of cells in grid.
|
||||
PolymerInflowFromDeck(Opm::DeckConstPtr deck,
|
||||
const Wells& wells,
|
||||
const int num_cells);
|
||||
|
||||
/// Constructor.
|
||||
/// \param[in] deck Input deck expected to contain WPOLYMER.
|
||||
/// \param[in] wells Wells structure.
|
||||
/// \param[in] num_cells Number of cells in grid.
|
||||
/// \param[in] currentStep Number of current simulation step.
|
||||
PolymerInflowFromDeck(Opm::DeckConstPtr deck,
|
||||
Opm::EclipseStateConstPtr eclipseState,
|
||||
PolymerInflowFromDeck(Opm::EclipseStateConstPtr eclipseState,
|
||||
const Wells& wells,
|
||||
const int num_cells,
|
||||
size_t currentStep);
|
||||
@@ -119,8 +110,7 @@ namespace Opm
|
||||
SparseVector<double> sparse_inflow_;
|
||||
|
||||
std::unordered_map<std::string, double> wellPolymerRate_;
|
||||
void setInflowValues(Opm::DeckConstPtr deck,
|
||||
Opm::EclipseStateConstPtr eclipseState,
|
||||
void setInflowValues(Opm::EclipseStateConstPtr eclipseState,
|
||||
size_t currentStep);
|
||||
};
|
||||
|
||||
|
||||
@@ -147,14 +147,14 @@ namespace Opm
|
||||
const auto& plyviscTable = tables->getPlyviscTables().getTable<PlyviscTable>(0);
|
||||
|
||||
|
||||
c_vals_visc_ = plyviscTable.getPolymerConcentrationColumn();
|
||||
visc_mult_vals_ = plyviscTable.getViscosityMultiplierColumn();
|
||||
c_vals_visc_ = plyviscTable.getPolymerConcentrationColumn().vectorCopy( );
|
||||
visc_mult_vals_ = plyviscTable.getViscosityMultiplierColumn().vectorCopy( );
|
||||
|
||||
// We assume NTSFUN=1
|
||||
const auto& plyadsTable = tables->getPlyadsTables().getTable<PlyadsTable>(0);
|
||||
|
||||
c_vals_ads_ = plyadsTable.getPolymerConcentrationColumn();
|
||||
ads_vals_ = plyadsTable.getAdsorbedPolymerColumn();
|
||||
c_vals_ads_ = plyadsTable.getPolymerConcentrationColumn().vectorCopy( );
|
||||
ads_vals_ = plyadsTable.getAdsorbedPolymerColumn().vectorCopy( );
|
||||
|
||||
has_plyshlog_ = deck->hasKeyword("PLYSHLOG");
|
||||
has_shrate_ = deck->hasKeyword("SHRATE");
|
||||
@@ -163,8 +163,8 @@ namespace Opm
|
||||
// Assuming NTPVT == 1 always
|
||||
const auto& plyshlogTable = tables->getPlyshlogTables().getTable<PlyshlogTable>(0);
|
||||
|
||||
water_vel_vals_ = plyshlogTable.getWaterVelocityColumn();
|
||||
shear_vrf_vals_ = plyshlogTable.getShearMultiplierColumn();
|
||||
water_vel_vals_ = plyshlogTable.getWaterVelocityColumn().vectorCopy( );
|
||||
shear_vrf_vals_ = plyshlogTable.getShearMultiplierColumn().vectorCopy( );
|
||||
|
||||
// do the unit version here for the water_vel_vals_
|
||||
Opm::UnitSystem unitSystem = *deck->getActiveUnitSystem();
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Opm
|
||||
if (wells_manager.c_wells() == 0) {
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(deck_, BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
|
||||
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
|
||||
} else {
|
||||
OPM_MESSAGE("Warning: simulating with no WPOLYMER in deck (no polymer will be injected).");
|
||||
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
|
||||
|
||||
@@ -82,7 +82,7 @@ handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||
if (wells_manager.c_wells() == 0) {
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(deck_, BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
|
||||
polymer_inflow_ptr.reset(new PolymerInflowFromDeck( BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
|
||||
} else {
|
||||
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
|
||||
1.0*Opm::unit::day,
|
||||
|
||||
Reference in New Issue
Block a user