Update WellState::thp()

This commit is contained in:
Joakim Hove 2021-05-14 08:12:42 +02:00
parent 3ec7feba75
commit 6af03f4a6a
6 changed files with 12 additions and 12 deletions

View File

@ -1839,7 +1839,7 @@ namespace Opm
{
// When there is no vaild VFP table provided, we set the thp to be zero.
if (!this->isVFPActive(deferred_logger) || this->wellIsStopped()) {
well_state.thp()[index_of_well_] = 0.;
well_state.update_thp(index_of_well_, 0.);
return;
}
@ -1859,7 +1859,7 @@ namespace Opm
const double bhp = well_state.bhp(index_of_well_);
well_state.thp()[index_of_well_] = calculateThpFromBhp(rates, bhp, deferred_logger);
well_state.update_thp(index_of_well_, calculateThpFromBhp(rates, bhp, deferred_logger));
}

View File

@ -1301,7 +1301,7 @@ namespace Opm
{
// When there is no vaild VFP table provided, we set the thp to be zero.
if (!this->isVFPActive(deferred_logger) || this->wellIsStopped()) {
well_state.thp()[index_of_well_] = 0.;
well_state.update_thp(index_of_well_, 0);
return;
}
@ -1321,7 +1321,7 @@ namespace Opm
const double bhp = well_state.bhp(index_of_well_);
well_state.thp()[index_of_well_] = calculateThpFromBhp(well_state, rates, bhp, deferred_logger);
well_state.update_thp(index_of_well_, calculateThpFromBhp(well_state, rates, bhp, deferred_logger));
}

View File

@ -1667,7 +1667,7 @@ namespace Opm
for (int p = 0; p<np; ++p) {
well_state.wellRates()[well_index*np + p] = 0.0;
}
well_state.thp()[well_index] = 0.0;
well_state.update_thp(well_index, 0.0);
return;
}
@ -2112,7 +2112,7 @@ namespace Opm
if (controls.hasControl(Well::InjectorCMode::THP) && currentControl != Well::InjectorCMode::THP)
{
const auto& thp = this->getTHPConstraint(summaryState);
double current_thp = well_state.thp()[well_index];
double current_thp = well_state.thp(well_index);
if (thp < current_thp) {
currentControl = Well::InjectorCMode::THP;
return true;
@ -2214,7 +2214,7 @@ namespace Opm
if (controls.hasControl(Well::ProducerCMode::THP) && currentControl != Well::ProducerCMode::THP)
{
const auto& thp = this->getTHPConstraint(summaryState);
double current_thp = well_state.thp()[well_index];
double current_thp = well_state.thp(well_index);
if (thp > current_thp) {
currentControl = Well::ProducerCMode::THP;
return true;

View File

@ -193,7 +193,7 @@ data::Wells WellState::report(const int* globalCellIdxMap,
WellT dummyWell; // dummy if we are not owner
auto& well = pwinfo.isOwner() ? dw[ itr.first ] : dummyWell;
well.bhp = this->bhp(well_index);
well.thp = this->thp().at( well_index );
well.thp = this->thp( well_index );
well.temperature = this->temperature().at( well_index );
const auto wellrate_index = well_index * pu.num_phases;

View File

@ -84,8 +84,8 @@ public:
double bhp(std::size_t well_index) const { return bhp_[well_index]; }
/// One thp pressure per well.
std::vector<double>& thp() { return thp_; }
const std::vector<double>& thp() const { return thp_; }
void update_thp(std::size_t well_index, double value) { thp_[well_index] = value; }
double thp(std::size_t well_index) const { return thp_[well_index]; }
/// One temperature per well.
std::vector<double>& temperature() { return temperature_; }

View File

@ -190,7 +190,7 @@ void WellStateFullyImplicitBlackoil::init(const std::vector<double>& cellPressur
this->update_bhp( newIndex, prevState->bhp( oldIndex ));
// thp
thp()[ newIndex ] = prevState->thp()[ oldIndex ];
this->update_thp( newIndex, prevState->thp( oldIndex ));
// If new target is set using WCONPROD, WCONINJE etc. we use the new control
if (!this->events_[w].hasEvent(WellStateFullyImplicitBlackoil::event_mask)) {
@ -318,7 +318,7 @@ void WellStateFullyImplicitBlackoil::init(const std::vector<double>& cellPressur
: well.productionControls(summary_state).hasControl(Well::ProducerCMode::THP);
if (!has_thp) {
thp()[w] = 0.0;
this->update_thp(w, 0.0);
}
}
}