mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4101 from GitPaean/fix_wells_active
Fix wells active determination
This commit is contained in:
@@ -386,13 +386,6 @@ wellsActive() const
|
||||
return wells_active_;
|
||||
}
|
||||
|
||||
bool
|
||||
BlackoilWellModelGeneric::
|
||||
localWellsActive() const
|
||||
{
|
||||
return numLocalWells() > 0;
|
||||
}
|
||||
|
||||
bool
|
||||
BlackoilWellModelGeneric::
|
||||
anyMSWellOpenLocal() const
|
||||
@@ -670,13 +663,6 @@ initFromRestartFile(const RestartValue& restartValues,
|
||||
initial_step_ = false;
|
||||
}
|
||||
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
setWellsActive(const bool wells_active)
|
||||
{
|
||||
wells_active_ = wells_active;
|
||||
}
|
||||
|
||||
std::vector<Well>
|
||||
BlackoilWellModelGeneric::
|
||||
getLocalWells(const int timeStepIdx) const
|
||||
@@ -2142,10 +2128,6 @@ void
|
||||
BlackoilWellModelGeneric::
|
||||
calculateEfficiencyFactors(const int reportStepIdx)
|
||||
{
|
||||
if ( !localWellsActive() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& well : well_container_generic_) {
|
||||
const Well& wellEcl = well->wellEcl();
|
||||
double well_efficiency_factor = wellEcl.getEfficiencyFactor();
|
||||
|
||||
@@ -90,8 +90,7 @@ public:
|
||||
/// return true if wells are available in the reservoir
|
||||
bool wellsActive() const;
|
||||
bool hasWell(const std::string& wname);
|
||||
/// return true if wells are available on this process
|
||||
bool localWellsActive() const;
|
||||
|
||||
// whether there exists any multisegment well open on this process
|
||||
bool anyMSWellOpenLocal() const;
|
||||
|
||||
@@ -143,8 +142,6 @@ public:
|
||||
const size_t numCells,
|
||||
bool handle_ms_well);
|
||||
|
||||
void setWellsActive(const bool wells_active);
|
||||
|
||||
/*
|
||||
Will assign the internal member last_valid_well_state_ to the
|
||||
current value of the this->active_well_state_. The state stored
|
||||
|
||||
@@ -202,11 +202,6 @@ namespace Opm {
|
||||
this->initializeWellPerfData();
|
||||
this->initializeWellState(timeStepIdx, summaryState);
|
||||
|
||||
// Wells are active if they are active wells on at least
|
||||
// one process.
|
||||
wells_active_ = localWellsActive() ? 1 : 0;
|
||||
wells_active_ = grid.comm().max(wells_active_);
|
||||
|
||||
// handling MS well related
|
||||
if (param_.use_multisegment_well_&& anyMSWellOpenLocal()) { // if we use MultisegmentWell model
|
||||
this->wellState().initWellStateMSWell(wells_ecl_, &this->prevWellState());
|
||||
@@ -270,6 +265,11 @@ namespace Opm {
|
||||
// create the well container
|
||||
createWellContainer(reportStepIdx);
|
||||
|
||||
// Wells are active if they are active wells on at least one process.
|
||||
const Grid& grid = ebosSimulator_.vanguard().grid();
|
||||
wells_active_ = !this->well_container_.empty();
|
||||
wells_active_ = grid.comm().max(wells_active_);
|
||||
|
||||
// do the initialization for all the wells
|
||||
// TODO: to see whether we can postpone of the intialization of the well containers to
|
||||
// optimize the usage of the following several member variables
|
||||
@@ -1142,10 +1142,6 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
apply( BVector& r) const
|
||||
{
|
||||
if ( ! localWellsActive() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& well : well_container_) {
|
||||
well->apply(r);
|
||||
}
|
||||
@@ -1158,11 +1154,6 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
apply(const BVector& x, BVector& Ax) const
|
||||
{
|
||||
// TODO: do we still need localWellsActive()?
|
||||
if ( ! localWellsActive() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& well : well_container_) {
|
||||
well->apply(x, Ax);
|
||||
}
|
||||
@@ -1214,7 +1205,7 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
applyScaleAdd(const Scalar alpha, const BVector& x, BVector& Ax) const
|
||||
{
|
||||
if ( ! localWellsActive() ) {
|
||||
if (this->well_container_.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1342,10 +1333,8 @@ namespace Opm {
|
||||
DeferredLogger local_deferredLogger;
|
||||
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
||||
{
|
||||
if (localWellsActive()) {
|
||||
for (auto& well : well_container_) {
|
||||
well->recoverWellSolutionAndUpdateWellState(x, this->wellState(), local_deferredLogger);
|
||||
}
|
||||
for (auto& well : well_container_) {
|
||||
well->recoverWellSolutionAndUpdateWellState(x, this->wellState(), local_deferredLogger);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1753,7 +1742,13 @@ namespace Opm {
|
||||
int
|
||||
BlackoilWellModel<TypeTag>::numComponents() const
|
||||
{
|
||||
if (wellsActive() && numPhases() < 3) {
|
||||
// The numComponents here does not reflect the actual number of the components in the system.
|
||||
// It more or less reflects the number of mass conservation equations for the well equations.
|
||||
// For example, in the current formulation, we do not have the polymer conservation equation
|
||||
// in the well equations. As a result, for an oil-water-polymer system, this function will return 2.
|
||||
// In some way, it makes this function appear to be confusing from its name, and we need
|
||||
// to revisit/revise this function again when extending the variants of system that flow can simulate.
|
||||
if (numPhases() < 3) {
|
||||
return numPhases();
|
||||
}
|
||||
int numComp = FluidSystem::numComponents;
|
||||
|
||||
Reference in New Issue
Block a user