changed: put calculation of foam connection rate in separate method

This commit is contained in:
Arne Morten Kvarving 2023-05-05 09:55:26 +02:00
parent c239cbd14f
commit 4041644171
2 changed files with 43 additions and 27 deletions

View File

@ -443,6 +443,10 @@ namespace Opm
const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const;
Eval connectionRateFoam(const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants,
DeferredLogger& deferred_logger) const;
std::tuple<Eval,Eval,Eval>
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const;

View File

@ -715,33 +715,8 @@ namespace Opm
}
if constexpr (has_foam) {
// TODO: the application of well efficiency factor has not been tested with an example yet
auto getFoamTransportIdx = [&deferred_logger] {
switch (FoamModule::transportPhase()) {
case Phase::WATER: {
return Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
}
case Phase::GAS: {
return Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
}
case Phase::SOLVENT: {
if constexpr (has_solvent)
return (unsigned)Indices::contiSolventEqIdx;
else
OPM_DEFLOG_THROW(std::runtime_error, "Foam transport phase is SOLVENT but SOLVENT is not activated.", deferred_logger);
}
default: {
OPM_DEFLOG_THROW(std::runtime_error, "Foam transport phase must be GAS/WATER/SOLVENT.", deferred_logger);
}
}
};
EvalWell cq_s_foam = cq_s[getFoamTransportIdx()] * this->well_efficiency_factor_;
if (this->isInjector()) {
cq_s_foam *= this->wfoam();
} else {
cq_s_foam *= this->extendEval(intQuants.foamConcentration());
}
connectionRates[perf][Indices::contiFoamEqIdx] = Base::restrictEval(cq_s_foam);
connectionRates[perf][Indices::contiFoamEqIdx] =
connectionRateFoam(cq_s, intQuants, deferred_logger);
}
if constexpr (has_zFraction) {
@ -2365,6 +2340,43 @@ namespace Opm
}
template <typename TypeTag>
typename StandardWell<TypeTag>::Eval
StandardWell<TypeTag>::
connectionRateFoam(const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants,
DeferredLogger& deferred_logger) const
{
// TODO: the application of well efficiency factor has not been tested with an example yet
auto getFoamTransportIdx = [&deferred_logger] {
switch (FoamModule::transportPhase()) {
case Phase::WATER: {
return Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
}
case Phase::GAS: {
return Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx);
}
case Phase::SOLVENT: {
if constexpr (has_solvent)
return static_cast<unsigned>(Indices::contiSolventEqIdx);
else
OPM_DEFLOG_THROW(std::runtime_error, "Foam transport phase is SOLVENT but SOLVENT is not activated.", deferred_logger);
}
default: {
OPM_DEFLOG_THROW(std::runtime_error, "Foam transport phase must be GAS/WATER/SOLVENT.", deferred_logger);
}
}
};
EvalWell cq_s_foam = cq_s[getFoamTransportIdx()] * this->well_efficiency_factor_;
if (this->isInjector()) {
cq_s_foam *= this->wfoam();
} else {
cq_s_foam *= this->extendEval(intQuants.foamConcentration());
}
return Base::restrictEval(cq_s_foam);
}
template <typename TypeTag>
std::tuple<typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::Eval,