move wellSurfaceVolumeFraction to StandardWellPrimaryVariables

This commit is contained in:
Arne Morten Kvarving 2022-11-08 07:09:51 +01:00
parent 2fb53a4ef6
commit 1aa74a9830
5 changed files with 25 additions and 22 deletions

View File

@ -156,7 +156,7 @@ getQs(const int comp_idx) const
// deferred_logger.warning("MULTI_PHASE_INJECTOR_NOT_SUPPORTED",
// "Multi phase injectors are not supported, requested for well " + name());
break;
}
}
return inj_frac * primary_variables_.evaluation_[WQTotal];
} else { // producers
return primary_variables_.evaluation_[WQTotal] *
@ -164,21 +164,6 @@ getQs(const int comp_idx) const
}
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellEval<FluidSystem,Indices,Scalar>::EvalWell
StandardWellEval<FluidSystem,Indices,Scalar>::
wellSurfaceVolumeFraction(const int compIdx) const
{
EvalWell sum_volume_fraction_scaled(this->primary_variables_.numWellEq() + Indices::numEq, 0.);
for (int idx = 0; idx < baseif_.numComponents(); ++idx) {
sum_volume_fraction_scaled += primary_variables_.volumeFractionScaled(idx);
}
assert(sum_volume_fraction_scaled.value() != 0.);
return this->primary_variables_.volumeFractionScaled(compIdx) / sum_volume_fraction_scaled;
}
template<class FluidSystem, class Indices, class Scalar>
void
StandardWellEval<FluidSystem,Indices,Scalar>::
@ -311,8 +296,8 @@ void
StandardWellEval<FluidSystem,Indices,Scalar>::
computeAccumWell()
{
for (int eq_idx = 0; eq_idx < numWellConservationEq; ++eq_idx) {
F0_[eq_idx] = wellSurfaceVolumeFraction(eq_idx).value();
for (size_t eq_idx = 0; eq_idx < F0_.size(); ++eq_idx) {
F0_[eq_idx] = this->primary_variables_.surfaceVolumeFraction(eq_idx).value();
}
}

View File

@ -85,7 +85,6 @@ protected:
EvalWell extendEval(const Eval& in) const;
EvalWell getQs(const int compIdx) const;
EvalWell wellSurfaceVolumeFraction(const int compIdx) const;
// calculate a relaxation factor to avoid overshoot of the fractions for producers
// which might result in negative rates

View File

@ -363,6 +363,21 @@ volumeFractionScaled(const int compIdx) const
return this->volumeFraction(compIdx);
}
template<class FluidSystem, class Indices, class Scalar>
typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
surfaceVolumeFraction(const int compIdx) const
{
EvalWell sum_volume_fraction_scaled(numWellEq_ + Indices::numEq, 0.);
for (int idx = 0; idx < well_.numComponents(); ++idx) {
sum_volume_fraction_scaled += this->volumeFractionScaled(idx);
}
assert(sum_volume_fraction_scaled.value() != 0.);
return this->volumeFractionScaled(compIdx) / sum_volume_fraction_scaled;
}
#define INSTANCE(...) \
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@ -123,6 +123,9 @@ public:
//! \brief Returns scaled volume fraction for a component.
EvalWell volumeFractionScaled(const int compIdx) const;
//! \brief Returns surface volume fraction for a component.
EvalWell surfaceVolumeFraction(const int compIdx) const;
private:
//! \brief Returns volume fraction for a component.
EvalWell volumeFraction(const unsigned compIdx) const;

View File

@ -136,7 +136,7 @@ namespace Opm
// surface volume fraction of fluids within wellbore
std::vector<EvalWell> cmix_s(this->numComponents(), EvalWell{this->primary_variables_.numWellEq() + Indices::numEq});
for (int componentIdx = 0; componentIdx < this->numComponents(); ++componentIdx) {
cmix_s[componentIdx] = this->wellSurfaceVolumeFraction(componentIdx);
cmix_s[componentIdx] = this->primary_variables_.surfaceVolumeFraction(componentIdx);
}
computePerfRate(mob,
@ -210,7 +210,7 @@ namespace Opm
// surface volume fraction of fluids within wellbore
std::vector<Scalar> cmix_s(this->numComponents(), 0.0);
for (int componentIdx = 0; componentIdx < this->numComponents(); ++componentIdx) {
cmix_s[componentIdx] = getValue(this->wellSurfaceVolumeFraction(componentIdx));
cmix_s[componentIdx] = getValue(this->primary_variables_.surfaceVolumeFraction(componentIdx));
}
computePerfRate(mob,
@ -529,7 +529,8 @@ namespace Opm
EvalWell resWell_loc(this->primary_variables_.numWellEq() + Indices::numEq, 0.0);
if (FluidSystem::numActivePhases() > 1) {
assert(dt > 0);
resWell_loc += (this->wellSurfaceVolumeFraction(componentIdx) - this->F0_[componentIdx]) * volume / dt;
resWell_loc += (this->primary_variables_.surfaceVolumeFraction(componentIdx) -
this->F0_[componentIdx]) * volume / dt;
}
resWell_loc -= this->getQs(componentIdx) * this->well_efficiency_factor_;
StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).