adding function isVFPActive() for WellInterface

Even the well does not have a THP target/constraint, but if it is
specified with a valid VFP table, we are supposed to update the thp
value for output purposes.
This commit is contained in:
Kai Bao 2018-11-13 11:19:53 +01:00
parent 49a7773b30
commit 0d1a4b2d13
2 changed files with 47 additions and 0 deletions

View File

@ -334,6 +334,9 @@ namespace Opm
double scalingFactor(const int comp_idx) const;
// whether a well is specified with a non-zero and valid VFP table number
bool isVFPActive() const;
void wellTestingEconomic(Simulator& simulator, const std::vector<double>& B_avg,
const double simulation_time, const int report_step, const bool terminal_output,
const WellState& well_state, WellTestState& welltest_state);

View File

@ -979,6 +979,50 @@ namespace Opm
template<typename TypeTag>
bool
WellInterface<TypeTag>::isVFPActive() const
{
// since the well_controls only handles the VFP number when THP constraint/target is there.
// 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.
if (well_type_ == PRODUCER) { // producer
const int table_id = well_ecl_->getProductionProperties(current_step_).VFPTableNumber;
if (table_id <= 0) {
return false;
} else {
if (vfp_properties_->getProd()->getTable(table_id)) {
return true;
} else {
OPM_THROW(std::runtime_error, "VFPPROD table " << std::to_string(table_id) << " is specfied,"
<< " for well " << name() << ", while we could not access it during simulation");
return false;
}
}
} else { // injector
const int table_id = well_ecl_->getInjectionProperties(current_step_).VFPTableNumber;
if (table_id <= 0) {
return false;
} else {
if (vfp_properties_->getInj()->getTable(table_id)) {
return true;
} else {
OPM_THROW(std::runtime_error, "VFPINJ table " << std::to_string(table_id) << " is specfied,"
<< " for well " << name() << ", while we could not access it during simulation");
return false;
}
}
}
}
template<typename TypeTag>
void
WellInterface<TypeTag>::calculateReservoirRates(WellState& well_state) const