StandardWell: move connectionRatePolymer to Connections class

This commit is contained in:
Arne Morten Kvarving 2023-05-22 11:10:02 +02:00
parent bf5108d09f
commit 56014ccff9
4 changed files with 39 additions and 32 deletions

View File

@ -443,11 +443,6 @@ namespace Opm
const IntensiveQuantities& intQuants,
DeferredLogger& deferred_logger) const;
std::tuple<Eval,EvalWell>
connectionRatePolymer(double& rate,
const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const;
std::tuple<Eval,EvalWell>
connectionRatezFraction(double& rate,
const double dis_gas_rate,

View File

@ -615,6 +615,30 @@ connectionRatesMICP(const std::vector<EvalWell>& cq_s,
well_.restrictEval(cq_s_urea)};
}
template<class FluidSystem, class Indices, class Scalar>
std::tuple<typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::EvalWell>
StandardWellConnections<FluidSystem,Indices,Scalar>::
connectionRatePolymer(double& rate,
const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& polymerConcentration) const
{
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell cq_s_poly = cq_s[waterCompIdx];
if (well_.isInjector()) {
cq_s_poly *= std::get<Scalar>(polymerConcentration);
} else {
cq_s_poly *= std::get<EvalWell>(polymerConcentration);
}
// Note. Efficiency factor is handled in the output layer
rate = cq_s_poly.value();
cq_s_poly *= well_.wellEfficiencyFactor();
return {well_.restrictEval(cq_s_poly), cq_s_poly};
}
#define INSTANCE(...) \
template class StandardWellConnections<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, \
__VA_ARGS__,double>;

View File

@ -93,6 +93,11 @@ public:
const Phase transportPhase,
DeferredLogger& deferred_logger) const;
std::tuple<Eval,EvalWell>
connectionRatePolymer(double& rate,
const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& polymerConcentration) const;
std::tuple<Eval,Eval,Eval>
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& microbialConcentration,

View File

@ -524,11 +524,19 @@ namespace Opm
}
if constexpr (has_polymer) {
std::variant<Scalar,EvalWell> polymerConcentration;
if (this->isInjector()) {
polymerConcentration = this->wpolymer();
} else {
polymerConcentration = this->extendEval(intQuants.polymerConcentration() *
intQuants.polymerViscosityCorrection());
}
[[maybe_unused]] EvalWell cq_s_poly;
std::tie(connectionRates[perf][Indices::contiPolymerEqIdx],
cq_s_poly) =
connectionRatePolymer(perf_data.polymer_rates[perf],
cq_s, intQuants);
this->connections_.connectionRatePolymer(perf_data.polymer_rates[perf],
cq_s, polymerConcentration);
if constexpr (Base::has_polymermw) {
updateConnectionRatePolyMW(cq_s_poly, intQuants, well_state,
@ -2248,31 +2256,6 @@ namespace Opm
}
template <typename TypeTag>
std::tuple<typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::EvalWell>
StandardWell<TypeTag>::
connectionRatePolymer(double& rate,
const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const
{
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell cq_s_poly = cq_s[waterCompIdx];
if (this->isInjector()) {
cq_s_poly *= this->wpolymer();
} else {
cq_s_poly *= this->extendEval(intQuants.polymerConcentration() * intQuants.polymerViscosityCorrection());
}
// Note. Efficiency factor is handled in the output layer
rate = cq_s_poly.value();
cq_s_poly *= this->well_efficiency_factor_;
return {Base::restrictEval(cq_s_poly), cq_s_poly};
}
template <typename TypeTag>
std::tuple<typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::EvalWell>