added: MultisegmentWellAssemble::assembleInflowTerm

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

View File

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

View File

@ -116,6 +116,14 @@ public:
const EvalWell& segment_rate,
Equations& eqns1) const;
//! \brief Assemble inflow term.
void assembleInflowTerm(const int seg,
const int inlet,
const int inlet_upwind,
const int comp_idx,
const EvalWell& inlet_rate,
Equations& eqns) const;
private:
const WellInterfaceIndices<FluidSystem,Indices,Scalar>& well_; //!< Reference to well
};

View File

@ -1583,19 +1583,9 @@ namespace Opm
for (const int inlet : this->segment_inlets_[seg]) {
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
const EvalWell inlet_rate = this->getSegmentRateUpwinding(inlet, comp_idx) * this->well_efficiency_factor_;
const int inlet_upwind = this->upwinding_segments_[inlet];
// inlet_rate contains the derivatives with respect to WQTotal in inlet,
// and WFrac and GFrac in inlet_upwind
this->linSys_.resWell_[seg][comp_idx] += inlet_rate.value();
this->linSys_.duneD_[seg][inlet][comp_idx][WQTotal] += inlet_rate.derivative(WQTotal + Indices::numEq);
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) {
this->linSys_.duneD_[seg][inlet_upwind][comp_idx][WFrac] += inlet_rate.derivative(WFrac + Indices::numEq);
}
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) {
this->linSys_.duneD_[seg][inlet_upwind][comp_idx][GFrac] += inlet_rate.derivative(GFrac + Indices::numEq);
}
// pressure derivative should be zero
MultisegmentWellAssemble<FluidSystem,Indices,Scalar>(*this).
assembleInflowTerm(seg, inlet, inlet_upwind, comp_idx, inlet_rate, this->linSys_);
}
}
}