mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fix case where wells are shut behind our back
This commit is contained in:
parent
b6c4b2e509
commit
31ac5378cf
@ -302,6 +302,11 @@ protected:
|
|||||||
if (well.getStatus() == Well::Status::SHUT)
|
if (well.getStatus() == Well::Status::SHUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!simulator_.problem().wellModel().hasWell(well.name()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const auto& wellPtr = simulator_.problem().wellModel().getWell(well.name());
|
||||||
|
|
||||||
std::vector<double> wtracer(tr.numTracer());
|
std::vector<double> wtracer(tr.numTracer());
|
||||||
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
||||||
wtracer[tIdx] = well.getTracerProperties().getConcentration(this->tracerNames_[tr.idx_[tIdx]]);
|
wtracer[tIdx] = well.getTracerProperties().getConcentration(this->tracerNames_[tr.idx_[tIdx]]);
|
||||||
@ -318,7 +323,7 @@ protected:
|
|||||||
cartesianCoordinate[2] = connection.getK();
|
cartesianCoordinate[2] = connection.getK();
|
||||||
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
||||||
const int I = this->cartToGlobal_[cartIdx];
|
const int I = this->cartToGlobal_[cartIdx];
|
||||||
Scalar rate = simulator_.problem().wellModel().well(well.name())->volumetricSurfaceRateForConnection(I, tr.phaseIdx_);
|
Scalar rate = wellPtr->volumetricSurfaceRateForConnection(I, tr.phaseIdx_);
|
||||||
if (rate > 0) {
|
if (rate > 0) {
|
||||||
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
||||||
tr.residual_[tIdx][I][0] -= rate*wtracer[tIdx];
|
tr.residual_[tIdx][I][0] -= rate*wtracer[tIdx];
|
||||||
@ -390,6 +395,11 @@ protected:
|
|||||||
if (well.getStatus() == Well::Status::SHUT)
|
if (well.getStatus() == Well::Status::SHUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!simulator_.problem().wellModel().hasWell(well.name()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const auto& wellPtr = simulator_.problem().wellModel().getWell(well.name());
|
||||||
|
|
||||||
if (!well.isProducer()) //Injection rates already reported during assembly
|
if (!well.isProducer()) //Injection rates already reported during assembly
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -406,7 +416,7 @@ protected:
|
|||||||
cartesianCoordinate[2] = connection.getK();
|
cartesianCoordinate[2] = connection.getK();
|
||||||
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
||||||
const int I = this->cartToGlobal_[cartIdx];
|
const int I = this->cartToGlobal_[cartIdx];
|
||||||
Scalar rate = simulator_.problem().wellModel().well(well.name())->volumetricSurfaceRateForConnection(I, tr.phaseIdx_);
|
Scalar rate = wellPtr->volumetricSurfaceRateForConnection(I, tr.phaseIdx_);
|
||||||
if (rate < 0) {
|
if (rate < 0) {
|
||||||
rateWellNeg += rate;
|
rateWellNeg += rate;
|
||||||
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
||||||
|
@ -210,7 +210,6 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag> >;
|
using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag> >;
|
||||||
WellInterfacePtr well(const std::string& wellName) const;
|
|
||||||
|
|
||||||
using BlackoilWellModelGeneric::initFromRestartFile;
|
using BlackoilWellModelGeneric::initFromRestartFile;
|
||||||
void initFromRestartFile(const RestartValue& restartValues)
|
void initFromRestartFile(const RestartValue& restartValues)
|
||||||
@ -279,6 +278,8 @@ namespace Opm {
|
|||||||
void initPrimaryVariablesEvaluation() const;
|
void initPrimaryVariablesEvaluation() const;
|
||||||
void updateWellControls(DeferredLogger& deferred_logger, const bool checkGroupControls);
|
void updateWellControls(DeferredLogger& deferred_logger, const bool checkGroupControls);
|
||||||
WellInterfacePtr getWell(const std::string& well_name) const;
|
WellInterfacePtr getWell(const std::string& well_name) const;
|
||||||
|
bool hasWell(const std::string& well_name) const;
|
||||||
|
|
||||||
void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
|
void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -511,22 +511,6 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
typename BlackoilWellModel<TypeTag>::WellInterfacePtr
|
|
||||||
BlackoilWellModel<TypeTag>::
|
|
||||||
well(const std::string& wellName) const
|
|
||||||
{
|
|
||||||
for (const auto& well : well_container_) {
|
|
||||||
if (well->name() == wellName) {
|
|
||||||
return well;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OPM_THROW(std::invalid_argument, "The well with name " + wellName + " is not in the well Container");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
@ -1645,6 +1629,18 @@ namespace Opm {
|
|||||||
return *well;
|
return *well;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename TypeTag>
|
||||||
|
bool
|
||||||
|
BlackoilWellModel<TypeTag>::
|
||||||
|
hasWell(const std::string& well_name) const
|
||||||
|
{
|
||||||
|
return std::any_of(well_container_.begin(), well_container_.end(),
|
||||||
|
[&well_name](const WellInterfacePtr& elem) -> bool
|
||||||
|
{
|
||||||
|
return elem->name() == well_name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user