StandardWell: move connectionRatesMICP to Connections class

This commit is contained in:
Arne Morten Kvarving 2023-05-22 11:10:02 +02:00
parent 2f6623993a
commit bf5108d09f
4 changed files with 59 additions and 41 deletions

View File

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

View File

@ -578,6 +578,43 @@ connectionRateFoam(const std::vector<EvalWell>& cq_s,
return well_.restrictEval(cq_s_foam);
}
template<class FluidSystem, class Indices, class Scalar>
std::tuple<typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval,
typename StandardWellConnections<FluidSystem,Indices,Scalar>::Eval>
StandardWellConnections<FluidSystem,Indices,Scalar>::
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& microbialConcentration,
const std::variant<Scalar,EvalWell>& oxygenConcentration,
const std::variant<Scalar,EvalWell>& ureaConcentration) const
{
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell cq_s_microbe = cq_s[waterCompIdx];
if (well_.isInjector()) {
cq_s_microbe *= std::get<Scalar>(microbialConcentration);
} else {
cq_s_microbe *= std::get<EvalWell>(microbialConcentration);
}
EvalWell cq_s_oxygen = cq_s[waterCompIdx];
if (well_.isInjector()) {
cq_s_oxygen *= std::get<Scalar>(oxygenConcentration);
} else {
cq_s_oxygen *= std::get<EvalWell>(oxygenConcentration);
}
EvalWell cq_s_urea = cq_s[waterCompIdx];
if (well_.isInjector()) {
cq_s_urea *= std::get<Scalar>(ureaConcentration);
} else {
cq_s_urea *= std::get<EvalWell>(ureaConcentration);
}
return {well_.restrictEval(cq_s_microbe),
well_.restrictEval(cq_s_oxygen),
well_.restrictEval(cq_s_urea)};
}
#define INSTANCE(...) \
template class StandardWellConnections<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>, \
__VA_ARGS__,double>;

View File

@ -93,6 +93,12 @@ public:
const Phase transportPhase,
DeferredLogger& deferred_logger) const;
std::tuple<Eval,Eval,Eval>
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const std::variant<Scalar,EvalWell>& microbialConcentration,
const std::variant<Scalar,EvalWell>& oxygenConcentration,
const std::variant<Scalar,EvalWell>& ureaConcentration) const;
private:
void computePressureDelta();

View File

@ -571,10 +571,25 @@ namespace Opm
}
if constexpr (has_micp) {
std::variant<Scalar,EvalWell> microbialConcentration;
std::variant<Scalar,EvalWell> oxygenConcentration;
std::variant<Scalar,EvalWell> ureaConcentration;
if (this->isInjector()) {
microbialConcentration = this->wmicrobes();
oxygenConcentration = this->woxygen();
ureaConcentration = this->wurea();
} else {
microbialConcentration = this->extendEval(intQuants.microbialConcentration());
oxygenConcentration = this->extendEval(intQuants.oxygenConcentration());
ureaConcentration = this->extendEval(intQuants.ureaConcentration());
}
std::tie(connectionRates[perf][Indices::contiMicrobialEqIdx],
connectionRates[perf][Indices::contiOxygenEqIdx],
connectionRates[perf][Indices::contiUreaEqIdx]) =
connectionRatesMICP(cq_s, intQuants);
this->connections_.connectionRatesMICP(cq_s,
microbialConcentration,
oxygenConcentration,
ureaConcentration);
}
// Store the perforation pressure for later usage.
@ -2233,42 +2248,6 @@ namespace Opm
}
template <typename TypeTag>
std::tuple<typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::Eval>
StandardWell<TypeTag>::
connectionRatesMICP(const std::vector<EvalWell>& cq_s,
const IntensiveQuantities& intQuants) const
{
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell cq_s_microbe = cq_s[waterCompIdx];
if (this->isInjector()) {
cq_s_microbe *= this->wmicrobes();
} else {
cq_s_microbe *= this->extendEval(intQuants.microbialConcentration());
}
EvalWell cq_s_oxygen = cq_s[waterCompIdx];
if (this->isInjector()) {
cq_s_oxygen *= this->woxygen();
} else {
cq_s_oxygen *= this->extendEval(intQuants.oxygenConcentration());
}
EvalWell cq_s_urea = cq_s[waterCompIdx];
if (this->isInjector()) {
cq_s_urea *= this->wurea();
} else {
cq_s_urea *= this->extendEval(intQuants.ureaConcentration());
}
return {Base::restrictEval(cq_s_microbe),
Base::restrictEval(cq_s_oxygen),
Base::restrictEval(cq_s_urea)};
}
template <typename TypeTag>
std::tuple<typename StandardWell<TypeTag>::Eval,
typename StandardWell<TypeTag>::EvalWell>