mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4656 from akva2/conn_level_ind_to_iface
Move computeConnLevel(Inj|Prod)Ind to WellInterface
This commit is contained in:
commit
4528f7800b
@ -148,18 +148,6 @@ namespace Opm
|
|||||||
virtual std::vector<double> computeCurrentWellRates(const Simulator& ebosSimulator,
|
virtual std::vector<double> computeCurrentWellRates(const Simulator& ebosSimulator,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
void computeConnLevelProdInd(const FluidState& fs,
|
|
||||||
const std::function<double(const double)>& connPICalc,
|
|
||||||
const std::vector<Scalar>& mobility,
|
|
||||||
double* connPI) const;
|
|
||||||
|
|
||||||
void computeConnLevelInjInd(const FluidState& fs,
|
|
||||||
const Phase preferred_phase,
|
|
||||||
const std::function<double(const double)>& connIICalc,
|
|
||||||
const std::vector<Scalar>& mobility,
|
|
||||||
double* connII,
|
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
std::optional<double>
|
std::optional<double>
|
||||||
computeBhpAtThpLimitProdWithAlq(const Simulator& ebos_simulator,
|
computeBhpAtThpLimitProdWithAlq(const Simulator& ebos_simulator,
|
||||||
const SummaryState& summary_state,
|
const SummaryState& summary_state,
|
||||||
|
@ -1832,84 +1832,6 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
MultisegmentWell<TypeTag>::
|
|
||||||
computeConnLevelProdInd(const typename MultisegmentWell<TypeTag>::FluidState& fs,
|
|
||||||
const std::function<double(const double)>& connPICalc,
|
|
||||||
const std::vector<Scalar>& mobility,
|
|
||||||
double* connPI) const
|
|
||||||
{
|
|
||||||
const auto& pu = this->phaseUsage();
|
|
||||||
const int np = this->number_of_phases_;
|
|
||||||
for (int p = 0; p < np; ++p) {
|
|
||||||
// Note: E100's notion of PI value phase mobility includes
|
|
||||||
// the reciprocal FVF.
|
|
||||||
const auto connMob =
|
|
||||||
mobility[ this->flowPhaseToEbosCompIdx(p) ]
|
|
||||||
* fs.invB(this->flowPhaseToEbosPhaseIdx(p)).value();
|
|
||||||
|
|
||||||
connPI[p] = connPICalc(connMob);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) &&
|
|
||||||
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))
|
|
||||||
{
|
|
||||||
const auto io = pu.phase_pos[Oil];
|
|
||||||
const auto ig = pu.phase_pos[Gas];
|
|
||||||
|
|
||||||
const auto vapoil = connPI[ig] * fs.Rv().value();
|
|
||||||
const auto disgas = connPI[io] * fs.Rs().value();
|
|
||||||
|
|
||||||
connPI[io] += vapoil;
|
|
||||||
connPI[ig] += disgas;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
void
|
|
||||||
MultisegmentWell<TypeTag>::
|
|
||||||
computeConnLevelInjInd(const typename MultisegmentWell<TypeTag>::FluidState& fs,
|
|
||||||
const Phase preferred_phase,
|
|
||||||
const std::function<double(const double)>& connIICalc,
|
|
||||||
const std::vector<Scalar>& mobility,
|
|
||||||
double* connII,
|
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
|
||||||
// Assumes single phase injection
|
|
||||||
const auto& pu = this->phaseUsage();
|
|
||||||
|
|
||||||
auto phase_pos = 0;
|
|
||||||
if (preferred_phase == Phase::GAS) {
|
|
||||||
phase_pos = pu.phase_pos[Gas];
|
|
||||||
}
|
|
||||||
else if (preferred_phase == Phase::OIL) {
|
|
||||||
phase_pos = pu.phase_pos[Oil];
|
|
||||||
}
|
|
||||||
else if (preferred_phase == Phase::WATER) {
|
|
||||||
phase_pos = pu.phase_pos[Water];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
OPM_DEFLOG_THROW(NotImplemented,
|
|
||||||
fmt::format("Unsupported Injector Type ({}) "
|
|
||||||
"for well {} during connection I.I. calculation",
|
|
||||||
static_cast<int>(preferred_phase), this->name()),
|
|
||||||
deferred_logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Scalar mt = std::accumulate(mobility.begin(), mobility.end(), 0.0);
|
|
||||||
connII[phase_pos] = connIICalc(mt * fs.invB(this->flowPhaseToEbosPhaseIdx(phase_pos)).value());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
std::vector<double>
|
std::vector<double>
|
||||||
MultisegmentWell<TypeTag>::
|
MultisegmentWell<TypeTag>::
|
||||||
|
@ -241,18 +241,6 @@ namespace Opm
|
|||||||
virtual std::vector<double> computeCurrentWellRates(const Simulator& ebosSimulator,
|
virtual std::vector<double> computeCurrentWellRates(const Simulator& ebosSimulator,
|
||||||
DeferredLogger& deferred_logger) const override;
|
DeferredLogger& deferred_logger) const override;
|
||||||
|
|
||||||
void computeConnLevelProdInd(const FluidState& fs,
|
|
||||||
const std::function<double(const double)>& connPICalc,
|
|
||||||
const std::vector<EvalWell>& mobility,
|
|
||||||
double* connPI) const;
|
|
||||||
|
|
||||||
void computeConnLevelInjInd(const typename StandardWell<TypeTag>::FluidState& fs,
|
|
||||||
const Phase preferred_phase,
|
|
||||||
const std::function<double(const double)>& connIICalc,
|
|
||||||
const std::vector<EvalWell>& mobility,
|
|
||||||
double* connII,
|
|
||||||
DeferredLogger& deferred_logger) const;
|
|
||||||
|
|
||||||
std::vector<double> getPrimaryVars() const override;
|
std::vector<double> getPrimaryVars() const override;
|
||||||
|
|
||||||
int setPrimaryVars(std::vector<double>::const_iterator it) override;
|
int setPrimaryVars(std::vector<double>::const_iterator it) override;
|
||||||
|
@ -1341,7 +1341,7 @@ namespace Opm
|
|||||||
return wellPICalc.connectionProdIndStandard(allPerfID, mobility);
|
return wellPICalc.connectionProdIndStandard(allPerfID, mobility);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<EvalWell> mob(this->num_components_, {this->primary_variables_.numWellEq() + Indices::numEq, 0.0});
|
std::vector<Scalar> mob(this->num_components_, 0.0);
|
||||||
getMobility(ebosSimulator, static_cast<int>(subsetPerfID), mob, deferred_logger);
|
getMobility(ebosSimulator, static_cast<int>(subsetPerfID), mob, deferred_logger);
|
||||||
|
|
||||||
const auto& fs = fluidState(subsetPerfID);
|
const auto& fs = fluidState(subsetPerfID);
|
||||||
@ -2397,86 +2397,6 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
|
||||||
void
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
computeConnLevelProdInd(const typename StandardWell<TypeTag>::FluidState& fs,
|
|
||||||
const std::function<double(const double)>& connPICalc,
|
|
||||||
const std::vector<EvalWell>& mobility,
|
|
||||||
double* connPI) const
|
|
||||||
{
|
|
||||||
const auto& pu = this->phaseUsage();
|
|
||||||
const int np = this->number_of_phases_;
|
|
||||||
for (int p = 0; p < np; ++p) {
|
|
||||||
// Note: E100's notion of PI value phase mobility includes
|
|
||||||
// the reciprocal FVF.
|
|
||||||
const auto connMob =
|
|
||||||
mobility[ this->flowPhaseToEbosCompIdx(p) ].value()
|
|
||||||
* fs.invB(this->flowPhaseToEbosPhaseIdx(p)).value();
|
|
||||||
|
|
||||||
connPI[p] = connPICalc(connMob);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) &&
|
|
||||||
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))
|
|
||||||
{
|
|
||||||
const auto io = pu.phase_pos[Oil];
|
|
||||||
const auto ig = pu.phase_pos[Gas];
|
|
||||||
|
|
||||||
const auto vapoil = connPI[ig] * fs.Rv().value();
|
|
||||||
const auto disgas = connPI[io] * fs.Rs().value();
|
|
||||||
|
|
||||||
connPI[io] += vapoil;
|
|
||||||
connPI[ig] += disgas;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
|
||||||
void
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
computeConnLevelInjInd(const typename StandardWell<TypeTag>::FluidState& fs,
|
|
||||||
const Phase preferred_phase,
|
|
||||||
const std::function<double(const double)>& connIICalc,
|
|
||||||
const std::vector<EvalWell>& mobility,
|
|
||||||
double* connII,
|
|
||||||
DeferredLogger& deferred_logger) const
|
|
||||||
{
|
|
||||||
// Assumes single phase injection
|
|
||||||
const auto& pu = this->phaseUsage();
|
|
||||||
|
|
||||||
auto phase_pos = 0;
|
|
||||||
if (preferred_phase == Phase::GAS) {
|
|
||||||
phase_pos = pu.phase_pos[Gas];
|
|
||||||
}
|
|
||||||
else if (preferred_phase == Phase::OIL) {
|
|
||||||
phase_pos = pu.phase_pos[Oil];
|
|
||||||
}
|
|
||||||
else if (preferred_phase == Phase::WATER) {
|
|
||||||
phase_pos = pu.phase_pos[Water];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
OPM_DEFLOG_THROW(NotImplemented,
|
|
||||||
fmt::format("Unsupported Injector Type ({}) "
|
|
||||||
"for well {} during connection I.I. calculation",
|
|
||||||
static_cast<int>(preferred_phase), this->name()),
|
|
||||||
deferred_logger);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto zero = EvalWell{this->primary_variables_.numWellEq() + Indices::numEq, 0.0};
|
|
||||||
const auto mt = std::accumulate(mobility.begin(), mobility.end(), zero);
|
|
||||||
connII[phase_pos] = connIICalc(mt.value() * fs.invB(this->flowPhaseToEbosPhaseIdx(phase_pos)).value());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
std::vector<double>
|
std::vector<double>
|
||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
|
@ -414,7 +414,17 @@ protected:
|
|||||||
Callback& extendEval,
|
Callback& extendEval,
|
||||||
[[maybe_unused]] DeferredLogger& deferred_logger) const;
|
[[maybe_unused]] DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
void computeConnLevelProdInd(const FluidState& fs,
|
||||||
|
const std::function<double(const double)>& connPICalc,
|
||||||
|
const std::vector<Scalar>& mobility,
|
||||||
|
double* connPI) const;
|
||||||
|
|
||||||
|
void computeConnLevelInjInd(const FluidState& fs,
|
||||||
|
const Phase preferred_phase,
|
||||||
|
const std::function<double(const double)>& connIICalc,
|
||||||
|
const std::vector<Scalar>& mobility,
|
||||||
|
double* connII,
|
||||||
|
DeferredLogger& deferred_logger) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1300,4 +1300,74 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TypeTag>
|
||||||
|
void
|
||||||
|
WellInterface<TypeTag>::
|
||||||
|
computeConnLevelProdInd(const FluidState& fs,
|
||||||
|
const std::function<double(const double)>& connPICalc,
|
||||||
|
const std::vector<Scalar>& mobility,
|
||||||
|
double* connPI) const
|
||||||
|
{
|
||||||
|
const auto& pu = this->phaseUsage();
|
||||||
|
const int np = this->number_of_phases_;
|
||||||
|
for (int p = 0; p < np; ++p) {
|
||||||
|
// Note: E100's notion of PI value phase mobility includes
|
||||||
|
// the reciprocal FVF.
|
||||||
|
const auto connMob =
|
||||||
|
mobility[this->flowPhaseToEbosCompIdx(p)]
|
||||||
|
* fs.invB(this->flowPhaseToEbosPhaseIdx(p)).value();
|
||||||
|
|
||||||
|
connPI[p] = connPICalc(connMob);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) &&
|
||||||
|
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))
|
||||||
|
{
|
||||||
|
const auto io = pu.phase_pos[Oil];
|
||||||
|
const auto ig = pu.phase_pos[Gas];
|
||||||
|
|
||||||
|
const auto vapoil = connPI[ig] * fs.Rv().value();
|
||||||
|
const auto disgas = connPI[io] * fs.Rs().value();
|
||||||
|
|
||||||
|
connPI[io] += vapoil;
|
||||||
|
connPI[ig] += disgas;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename TypeTag>
|
||||||
|
void
|
||||||
|
WellInterface<TypeTag>::
|
||||||
|
computeConnLevelInjInd(const FluidState& fs,
|
||||||
|
const Phase preferred_phase,
|
||||||
|
const std::function<double(const double)>& connIICalc,
|
||||||
|
const std::vector<Scalar>& mobility,
|
||||||
|
double* connII,
|
||||||
|
DeferredLogger& deferred_logger) const
|
||||||
|
{
|
||||||
|
// Assumes single phase injection
|
||||||
|
const auto& pu = this->phaseUsage();
|
||||||
|
|
||||||
|
auto phase_pos = 0;
|
||||||
|
if (preferred_phase == Phase::GAS) {
|
||||||
|
phase_pos = pu.phase_pos[Gas];
|
||||||
|
}
|
||||||
|
else if (preferred_phase == Phase::OIL) {
|
||||||
|
phase_pos = pu.phase_pos[Oil];
|
||||||
|
}
|
||||||
|
else if (preferred_phase == Phase::WATER) {
|
||||||
|
phase_pos = pu.phase_pos[Water];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OPM_DEFLOG_THROW(NotImplemented,
|
||||||
|
fmt::format("Unsupported Injector Type ({}) "
|
||||||
|
"for well {} during connection I.I. calculation",
|
||||||
|
static_cast<int>(preferred_phase), this->name()),
|
||||||
|
deferred_logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto mt = std::accumulate(mobility.begin(), mobility.end(), 0.0);
|
||||||
|
connII[phase_pos] = connIICalc(mt * fs.invB(this->flowPhaseToEbosPhaseIdx(phase_pos)).value());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
Loading…
Reference in New Issue
Block a user