added: StandardWellAssemble::assemblePerforationEq

extracted from StandardWell::assembleWellEqWithoutIterationImpl
This commit is contained in:
Arne Morten Kvarving 2022-11-18 12:09:43 +01:00
parent 57ecd2a5e9
commit f720cc6dde
3 changed files with 45 additions and 13 deletions

View File

@ -164,6 +164,30 @@ assembleInjectivityEq(const EvalWell& eq_pskin,
} }
} }
template<class FluidSystem, class Indices, class Scalar>
template<class EvalWell>
void StandardWellAssemble<FluidSystem,Indices,Scalar>::
assemblePerforationEq(const EvalWell& cq_s_effective,
const int componentIdx,
const int cell_idx,
const int numWellEq,
StandardWellEquations<Scalar,Indices::numEq>& eqns) const
{
// subtract sum of phase fluxes in the well equations.
eqns.resWell_[0][componentIdx] += cq_s_effective.value();
// assemble the jacobians
for (int pvIdx = 0; pvIdx < numWellEq; ++pvIdx) {
// also need to consider the efficiency factor when manipulating the jacobians.
eqns.duneC_[0][cell_idx][pvIdx][componentIdx] -= cq_s_effective.derivative(pvIdx+Indices::numEq); // intput in transformed matrix
eqns.duneD_[0][0][componentIdx][pvIdx] += cq_s_effective.derivative(pvIdx+Indices::numEq);
}
for (int pvIdx = 0; pvIdx < Indices::numEq; ++pvIdx) {
eqns.duneB_[0][cell_idx][componentIdx][pvIdx] += cq_s_effective.derivative(pvIdx);
}
}
#define INSTANCE(Dim,...) \ #define INSTANCE(Dim,...) \
template class StandardWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>; \ template class StandardWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>; \
template void \ template void \
@ -185,6 +209,13 @@ StandardWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA
assembleInjectivityEq(const DenseAd::Evaluation<double,-1,Dim>&, \ assembleInjectivityEq(const DenseAd::Evaluation<double,-1,Dim>&, \
const DenseAd::Evaluation<double,-1,Dim>&, \ const DenseAd::Evaluation<double,-1,Dim>&, \
const int, \ const int, \
const int, \
const int, \
const int, \
StandardWellEquations<double,__VA_ARGS__::numEq>&) const; \
template void \
StandardWellAssemble<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>:: \
assemblePerforationEq(const DenseAd::Evaluation<double,-1,Dim>&, \
const int, \ const int, \
const int, \ const int, \
const int, \ const int, \

View File

@ -71,6 +71,14 @@ public:
const int numWellEq, const int numWellEq,
StandardWellEquations<Scalar,Indices::numEq>& eqns) const; StandardWellEquations<Scalar,Indices::numEq>& eqns) const;
//! \brief Assemble equation for a perforation.
template<class EvalWell>
void assemblePerforationEq(const EvalWell& cq_s_effective,
const int componentIdx,
const int cell_idx,
const int numWellEq,
StandardWellEquations<Scalar,Indices::numEq>& eqns) const;
private: private:
const WellInterfaceFluidSystem<FluidSystem>& well_; //!< Reference to well const WellInterfaceFluidSystem<FluidSystem>& well_; //!< Reference to well
}; };

View File

@ -483,19 +483,12 @@ namespace Opm
connectionRates[perf][componentIdx] = Base::restrictEval(cq_s_effective); connectionRates[perf][componentIdx] = Base::restrictEval(cq_s_effective);
// subtract sum of phase fluxes in the well equations. StandardWellAssemble<FluidSystem,Indices,Scalar>(*this).
this->linSys_.resWell_[0][componentIdx] += cq_s_effective.value(); assemblePerforationEq(cq_s_effective,
componentIdx,
// assemble the jacobians cell_idx,
for (int pvIdx = 0; pvIdx < this->numWellEq_; ++pvIdx) { this->numWellEq_,
// also need to consider the efficiency factor when manipulating the jacobians. this->linSys_);
this->linSys_.duneC_[0][cell_idx][pvIdx][componentIdx] -= cq_s_effective.derivative(pvIdx+Indices::numEq); // intput in transformed matrix
this->linSys_.duneD_[0][0][componentIdx][pvIdx] += cq_s_effective.derivative(pvIdx+Indices::numEq);
}
for (int pvIdx = 0; pvIdx < Indices::numEq; ++pvIdx) {
this->linSys_.duneB_[0][cell_idx][componentIdx][pvIdx] += cq_s_effective.derivative(pvIdx);
}
// Store the perforation phase flux for later usage. // Store the perforation phase flux for later usage.
if (has_solvent && componentIdx == Indices::contiSolventEqIdx) { if (has_solvent && componentIdx == Indices::contiSolventEqIdx) {