added: MultisegmentWellAssemble::assembleOutflowTerm

extracted from MultisegmentWell::assembleWellEqWithoutIteration
This commit is contained in:
Arne Morten Kvarving 2022-11-18 12:09:43 +01:00
parent 517dd49771
commit d5bbccde65
3 changed files with 31 additions and 14 deletions

View File

@ -223,6 +223,25 @@ assembleAccumulationTerm(const int seg,
}
}
template<class FluidSystem, class Indices, class Scalar>
void MultisegmentWellAssemble<FluidSystem,Indices,Scalar>::
assembleOutflowTerm(const int seg,
const int seg_upwind,
const int comp_idx,
const EvalWell& segment_rate,
Equations& eqns) const
{
eqns.resWell_[seg][comp_idx] -= segment_rate.value();
eqns.duneD_[seg][seg][comp_idx][WQTotal] -= segment_rate.derivative(WQTotal + Indices::numEq);
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
eqns.duneD_[seg][seg_upwind][comp_idx][WFrac] -= segment_rate.derivative(WFrac + Indices::numEq);
}
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
eqns.duneD_[seg][seg_upwind][comp_idx][GFrac] -= segment_rate.derivative(GFrac + Indices::numEq);
}
// pressure derivative should be zero
}
#define INSTANCE(...) \
template class MultisegmentWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@ -109,6 +109,13 @@ public:
const EvalWell& accumulation_term,
Equations& eqns1) const;
//! \brief Assemble outflow term.
void assembleOutflowTerm(const int seg,
const int seg_upwind,
const int comp_idx,
const EvalWell& segment_rate,
Equations& eqns1) const;
private:
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well
};

View File

@ -1569,21 +1569,12 @@ namespace Opm
}
// considering the contributions due to flowing out from the segment
{
const int seg_upwind = this->upwinding_segments_[seg];
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
const EvalWell segment_rate = this->getSegmentRateUpwinding(seg, comp_idx) * this->well_efficiency_factor_;
const int seg_upwind = this->upwinding_segments_[seg];
// segment_rate contains the derivatives with respect to WQTotal in seg,
// and WFrac and GFrac in seg_upwind
this->linSys_.resWell_[seg][comp_idx] -= segment_rate.value();
this->linSys_.duneD_[seg][seg][comp_idx][WQTotal] -= segment_rate.derivative(WQTotal + Indices::numEq);
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
this->linSys_.duneD_[seg][seg_upwind][comp_idx][WFrac] -= segment_rate.derivative(WFrac + Indices::numEq);
}
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
this->linSys_.duneD_[seg][seg_upwind][comp_idx][GFrac] -= segment_rate.derivative(GFrac + Indices::numEq);
}
// pressure derivative should be zero
const EvalWell segment_rate = this->getSegmentRateUpwinding(seg, comp_idx) *
this->well_efficiency_factor_;
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(*this).
assembleOutflowTerm(seg, seg_upwind, comp_idx, segment_rate, this->linSys_);
}
}