Use the shared SummaryState instance when initializing well rates

This commit is contained in:
Joakim Hove
2019-06-16 10:21:17 +02:00
parent 24e3afc544
commit 7f1970af3c
11 changed files with 39 additions and 42 deletions

View File

@@ -486,7 +486,6 @@ namespace Opm
{
// TODO: only_wells should be put back to save some computation
// for example, the matrices B C does not need to update if only_wells
SummaryState summaryState;
checkWellOperability(ebosSimulator, well_state, deferred_logger);
@@ -607,12 +606,11 @@ namespace Opm
// change temperature for injecting fluids
if (well_type_ == INJECTOR && cq_s[activeCompIdx] > 0.0){
const auto& injProps = this->well_ecl_.injectionControls(summaryState);
auto injectorType = this->well_ecl_.injectorType();
// only handles single phase injection now
assert(injProps.injector_type != WellInjector::MULTI);
fs.setTemperature(injProps.temperature);
assert(injectorType != WellInjector::MULTI);
fs.setTemperature(this->well_ecl_.temperature());
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache;
const unsigned pvtRegionIdx = intQuants.pvtRegionIndex();
@@ -2629,7 +2627,6 @@ namespace Opm
{
assert(int(rates.size()) == 3); // the vfp related only supports three phases now.
SummaryState summaryState;
const double aqua = rates[Water];
const double liquid = rates[Oil];
const double vapour = rates[Gas];
@@ -2639,16 +2636,15 @@ namespace Opm
double thp = 0.0;
if (well_type_ == INJECTOR) {
const int table_id = well_ecl_.injectionControls(summaryState).vfp_table_number;
const int table_id = well_ecl_.vfp_table_number();
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);
thp = vfp_properties_->getInj()->thp(table_id, aqua, liquid, vapour, bhp + dp);
}
else if (well_type_ == PRODUCER) {
const auto controls = well_ecl_.productionControls(summaryState);
const int table_id = controls.vfp_table_number;
const double alq = controls.alq_value;
const int table_id = well_ecl_.vfp_table_number();
const double alq = well_ecl_.alq_value();
const double vfp_ref_depth = vfp_properties_->getProd()->getTable(table_id)->getDatumDepth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth_, vfp_ref_depth, rho, gravity_);

View File

@@ -284,9 +284,8 @@ namespace Opm
return 0.0;
}
SummaryState summaryState;
const auto controls = well_ecl_.injectionControls(summaryState);
if (controls.injector_type == WellInjector::GAS) {
auto injectorType = well_ecl_.injectorType();
if (injectorType == WellInjector::GAS) {
double solvent_fraction = well_ecl_.getSolventFraction();
return solvent_fraction;
} else {
@@ -308,11 +307,10 @@ namespace Opm
return 0.0;
}
SummaryState summaryState;
const auto controls = well_ecl_.injectionControls(summaryState);
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
auto injectorType = well_ecl_.injectorType();
if (controls.injector_type == WellInjector::WATER) {
if (injectorType == WellInjector::WATER) {
WellPolymerProperties polymer = well_ecl_.getPolymerProperties();
const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration;
} else {
@@ -1119,11 +1117,8 @@ namespace Opm
// we need to get the table number through the parser, in case THP constraint/target is not there.
// When THP control/limit is not active, if available VFP table is provided, we will still need to
// update THP value. However, it will only used for output purpose.
SummaryState summaryState;
if (well_type_ == PRODUCER) { // producer
const auto controls = well_ecl_.productionControls(summaryState);
const int table_id = controls.vfp_table_number;
const int table_id = well_ecl_.vfp_table_number();
if (table_id <= 0) {
return false;
} else {
@@ -1136,8 +1131,7 @@ namespace Opm
}
} else { // injector
const auto controls = well_ecl_.injectionControls(summaryState);
const int table_id = controls.vfp_table_number;
const int table_id = well_ecl_.vfp_table_number();
if (table_id <= 0) {
return false;
} else {