changed: move isPressureControlled to WellInterfaceGeneric

no typetag dependence. also no need for this to be virtual
This commit is contained in:
Arne Morten Kvarving 2022-11-04 14:20:14 +01:00
parent c8813a4dd0
commit 26d9f18687
4 changed files with 16 additions and 30 deletions

View File

@ -225,8 +225,6 @@ public:
// Add well contributions to matrix
virtual void addWellContributions(SparseMatrixAdapter&) const = 0;
virtual bool isPressureControlled(const WellState& well_state) const;
virtual void addWellPressureEquations(PressureMatrix& mat,
const BVector& x,
const int pressureVarIndex,

View File

@ -416,4 +416,18 @@ void WellInterfaceGeneric::reportWellSwitching(const SingleWellState& ws, Deferr
}
}
bool WellInterfaceGeneric::isPressureControlled(const WellState& well_state) const
{
const auto& ws = well_state.well(this->index_of_well_);
if (this->isInjector()) {
const Well::InjectorCMode& current = ws.injection_cmode;
return current == Well::InjectorCMode::THP ||
current == Well::InjectorCMode::BHP;
} else {
const Well::ProducerCMode& current = ws.production_cmode;
return current == Well::ProducerCMode::THP ||
current == Well::ProducerCMode::BHP;
}
}
} // namespace Opm

View File

@ -193,6 +193,8 @@ public:
WellTestState& wellTestState,
DeferredLogger& deferred_logger) const;
bool isPressureControlled(const WellState& well_state) const;
protected:
bool getAllowCrossFlow() const;

View File

@ -571,34 +571,6 @@ namespace Opm
assembleWellEqWithoutIteration(ebosSimulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
}
template<typename TypeTag>
bool
WellInterface<TypeTag>::isPressureControlled(const WellState& well_state) const
{
bool thp_controlled_well = false;
bool bhp_controlled_well = false;
const auto& ws = well_state.well(this->index_of_well_);
if (this->isInjector()) {
const Well::InjectorCMode& current = ws.injection_cmode;
if (current == Well::InjectorCMode::THP) {
thp_controlled_well = true;
}
if (current == Well::InjectorCMode::BHP) {
bhp_controlled_well = true;
}
} else {
const Well::ProducerCMode& current = ws.production_cmode;
if (current == Well::ProducerCMode::THP) {
thp_controlled_well = true;
}
if (current == Well::ProducerCMode::BHP) {
bhp_controlled_well = true;
}
}
bool ispressureControlled = (bhp_controlled_well || thp_controlled_well);
return ispressureControlled;
}
template<typename TypeTag>
void
WellInterface<TypeTag>::addCellRates(RateVector& rates, int cellIdx) const