MultisegmentWell: move volumeFractionScaled to MultisegmentWellPrimaryVariables

This commit is contained in:
Arne Morten Kvarving
2022-12-19 09:52:48 +01:00
parent e539614fff
commit 2e2a49b935
4 changed files with 31 additions and 28 deletions

View File

@@ -171,23 +171,6 @@ getWellConvergence(const WellState& well_state,
return report;
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
volumeFractionScaled(const int seg,
const int comp_idx) const
{
// For reservoir rate control, the distr in well control is used for the
// rate conversion coefficients. For the injection well, only the distr of the injection
// phase is not zero.
const double scale = baseif_.scalingFactor(baseif_.ebosCompIdxToFlowCompIdx(comp_idx));
if (scale > 0.) {
return primary_variables_.volumeFraction(seg, comp_idx) / scale;
}
return primary_variables_.volumeFraction(seg, comp_idx);
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
@@ -196,12 +179,12 @@ surfaceVolumeFraction(const int seg,
{
EvalWell sum_volume_fraction_scaled = 0.;
for (int idx = 0; idx < baseif_.numComponents(); ++idx) {
sum_volume_fraction_scaled += volumeFractionScaled(seg, idx);
sum_volume_fraction_scaled += primary_variables_.volumeFractionScaled(seg, idx);
}
assert(sum_volume_fraction_scaled.value() != 0.);
return volumeFractionScaled(seg, comp_idx) / sum_volume_fraction_scaled;
return primary_variables_.volumeFractionScaled(seg, comp_idx) / sum_volume_fraction_scaled;
}
template<typename FluidSystem, typename Indices, typename Scalar>
@@ -237,7 +220,8 @@ getSegmentRateUpwinding(const int seg,
return 0.0;
}
const EvalWell segment_rate = primary_variables_.evaluation_[seg][WQTotal] * volumeFractionScaled(seg_upwind, comp_idx);
const EvalWell segment_rate = primary_variables_.evaluation_[seg][WQTotal] *
primary_variables_.volumeFractionScaled(seg_upwind, comp_idx);
assert(segment_rate.derivative(SPres + Indices::numEq) == 0.);
@@ -452,7 +436,8 @@ MultisegmentWellEval<FluidSystem,Indices,Scalar>::
getSegmentRate(const int seg,
const int comp_idx) const
{
return primary_variables_.evaluation_[seg][WQTotal] * volumeFractionScaled(seg, comp_idx);
return primary_variables_.evaluation_[seg][WQTotal] *
primary_variables_.volumeFractionScaled(seg, comp_idx);
}
template<typename FluidSystem, typename Indices, typename Scalar>

View File

@@ -186,10 +186,6 @@ protected:
const double rho,
DeferredLogger& deferred_logger) const;
// F_p / g_p, the basic usage of this value is because Q_p = G_t * F_p / G_p
EvalWell volumeFractionScaled(const int seg,
const int comp_idx) const;
// basically Q_p / \sigma_p Q_p
EvalWell surfaceVolumeFraction(const int seg,
const int comp_idx) const;

View File

@@ -288,6 +288,23 @@ volumeFraction(const int seg,
return oil_fraction;
}
template<class FluidSystem, class Indices, class Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
volumeFractionScaled(const int seg,
const int comp_idx) const
{
// For reservoir rate control, the distr in well control is used for the
// rate conversion coefficients. For the injection well, only the distr of the injection
// phase is not zero.
const double scale = well_.scalingFactor(well_.ebosCompIdxToFlowCompIdx(comp_idx));
if (scale > 0.) {
return this->volumeFraction(seg, comp_idx) / scale;
}
return this->volumeFraction(seg, comp_idx);
}
#define INSTANCE(...) \
template class MultisegmentWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@@ -94,9 +94,10 @@ public:
const double DFLimit,
const double max_pressure_change);
//! \brief Returns volume fraction for component in a segment.
EvalWell volumeFraction(const int seg,
const unsigned compIdx) const;
//! \brief Returns scaled volume fraction for a component in a segment.
//! \details F_p / g_p, the basic usage of this value is because Q_p = G_t * F_p / G_p
EvalWell volumeFractionScaled(const int seg,
const int compIdx) const;
// the values for the primary varibles
// based on different solutioin strategies, the wells can have different primary variables
@@ -109,6 +110,10 @@ private:
//! \brief Handle non-reasonable fractions due to numerical overshoot.
void processFractions(const int seg);
//! \brief Returns volume fraction for component in a segment.
EvalWell volumeFraction(const int seg,
const unsigned compIdx) const;
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well interface
};