MultisegmentWell: move volumeFraction to MultisegmentWellPrimaryVariables

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

View File

@ -171,35 +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>::
volumeFraction(const int seg,
const unsigned compIdx) const
{
if (has_wfrac_variable && compIdx == Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx)) {
return primary_variables_.evaluation_[seg][WFrac];
}
if (has_gfrac_variable && compIdx == Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx)) {
return primary_variables_.evaluation_[seg][GFrac];
}
// Oil fraction
EvalWell oil_fraction = 1.0;
if (has_wfrac_variable) {
oil_fraction -= primary_variables_.evaluation_[seg][WFrac];
}
if (has_gfrac_variable) {
oil_fraction -= primary_variables_.evaluation_[seg][GFrac];
}
/* if (has_solvent) {
oil_fraction -= primary_variables_evaluation_[seg][SFrac];
} */
return oil_fraction;
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellEval<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellEval<FluidSystem,Indices,Scalar>::
@ -211,10 +182,10 @@ volumeFractionScaled(const int seg,
// phase is not zero.
const double scale = baseif_.scalingFactor(baseif_.ebosCompIdxToFlowCompIdx(comp_idx));
if (scale > 0.) {
return volumeFraction(seg, comp_idx) / scale;
return primary_variables_.volumeFraction(seg, comp_idx) / scale;
}
return volumeFraction(seg, comp_idx);
return primary_variables_.volumeFraction(seg, comp_idx);
}
template<typename FluidSystem, typename Indices, typename Scalar>

View File

@ -186,11 +186,6 @@ protected:
const double rho,
DeferredLogger& deferred_logger) const;
// fraction value of the primary variables
// should we just use member variables to store them instead of calculating them again and again
EvalWell volumeFraction(const int seg,
const unsigned compIdx) 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;

View File

@ -259,6 +259,35 @@ processFractions(const int seg)
}
}
template<typename FluidSystem, typename Indices, typename Scalar>
typename MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
MultisegmentWellPrimaryVariables<FluidSystem,Indices,Scalar>::
volumeFraction(const int seg,
const unsigned compIdx) const
{
if (has_wfrac_variable && compIdx == Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx)) {
return evaluation_[seg][WFrac];
}
if (has_gfrac_variable && compIdx == Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx)) {
return evaluation_[seg][GFrac];
}
// Oil fraction
EvalWell oil_fraction = 1.0;
if (has_wfrac_variable) {
oil_fraction -= evaluation_[seg][WFrac];
}
if (has_gfrac_variable) {
oil_fraction -= evaluation_[seg][GFrac];
}
/* if (has_solvent) {
oil_fraction -= evaluation_[seg][SFrac];
} */
return oil_fraction;
}
#define INSTANCE(...) \
template class MultisegmentWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@ -94,6 +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;
// the values for the primary varibles
// based on different solutioin strategies, the wells can have different primary variables
std::vector<std::array<double, numWellEq> > value_;