Add comments about the need for communication to the assemble functions of MultisegmentWellAssemble

This commit is contained in:
Lisa Julia Nebel 2024-11-12 16:11:20 +01:00
parent 0ce761c5e6
commit 36f21e2e63

View File

@ -96,6 +96,10 @@ assembleControlEq(const WellState<Scalar>& well_state,
const bool stopped_or_zero_target,
DeferredLogger& deferred_logger) const
{
/*
This function assembles the control equation, similar as for StandardWells.
It does *not* need communication.
*/
static constexpr int Gas = BlackoilPhases::Vapour;
static constexpr int Oil = BlackoilPhases::Liquid;
static constexpr int Water = BlackoilPhases::Aqua;
@ -212,6 +216,12 @@ assembleAccelerationTerm(const int seg_target,
// acceleration term shold be
// * velocity head for seg_target if seg = seg_target
// * negative velocity head for seg if seg != seg_target
/*
This method is called in MultisegmentWellEval::assembleAccelerationPressureLoss.
It does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg_target][SPres] -= accelerationTerm.value();
eqns.D()[seg_target][seg][SPres][SPres] -= accelerationTerm.derivative(SPres + Indices::numEq);
@ -231,6 +241,11 @@ assembleHydroPressureLoss(const int seg,
const EvalWell& hydro_pressure_drop_seg,
Equations& eqns1) const
{
/*
This method is called in MultisegmentWellEval::assembleAccelerationAndHydroPressureLosses.
It does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg][SPres] -= hydro_pressure_drop_seg.value();
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {
@ -246,6 +261,9 @@ assemblePressureEqExtraDerivatives(const int seg,
const EvalWell& extra_derivatives,
Equations& eqns1) const
{
/*
This method does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
// disregard residual
// Frac - derivatives are zero (they belong to upwind^2)
@ -265,6 +283,9 @@ assemblePressureEq(const int seg,
bool wfrac,
bool gfrac) const
{
/*
This method does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg][SPres] += pressure_equation.value();
eqns.D()[seg][seg][SPres][SPres] += pressure_equation.derivative(SPres + Indices::numEq);
@ -289,6 +310,13 @@ assembleTrivialEq(const int seg,
const Scalar value,
Equations& eqns1) const
{
/*
This method is called from MultisegmentWellEval::assembleICDPressureEq,
which is called from MultisegmentWellEval::assemblePressureEq.
This is the counterpart to assembleControlEquation, where assembleControlEquation is responsible for the top segment
and assembleICDPressureEq is responsible for the remaining segments.
This method does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg][SPres] = value;
eqns.D()[seg][seg][SPres][WQTotal] = 1.;
@ -301,6 +329,10 @@ assembleAccumulationTerm(const int seg,
const EvalWell& accumulation_term,
Equations& eqns1) const
{
/*
This method is called from MultisegmentWell::assembleWellEqWithoutIteration.
It only assembles on the diagonal of D and it does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg][comp_idx] += accumulation_term.value();
for (int pv_idx = 0; pv_idx < numWellEq; ++pv_idx) {
@ -316,6 +348,10 @@ assembleOutflowTerm(const int seg,
const EvalWell& segment_rate,
Equations& eqns1) const
{
/*
This method is called from MultisegmentWell::assembleWellEqWithoutIteration.
It does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg][comp_idx] -= segment_rate.value();
eqns.D()[seg][seg][comp_idx][WQTotal] -= segment_rate.derivative(WQTotal + Indices::numEq);
@ -337,6 +373,10 @@ assembleInflowTerm(const int seg,
const EvalWell& inlet_rate,
Equations& eqns1) const
{
/*
This method is called from MultisegmentWell::assembleWellEqWithoutIteration.
It does *not* need communication.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
eqns.residual()[seg][comp_idx] += inlet_rate.value();
eqns.D()[seg][inlet][comp_idx][WQTotal] += inlet_rate.derivative(WQTotal + Indices::numEq);
@ -357,6 +397,12 @@ assemblePerforationEq(const int seg,
const EvalWell& cq_s_effective,
Equations& eqns1) const
{
/*
This method is called from MultisegmentWell::assembleWellEqWithoutIteration.
It *does* need communication, i.e. this method only assembles the parts of the matrix this process is responsible for
and after calling this function, the diagonal of the matrix D and the residual need to be combined by calling
the function MultisegmentWellEquations::sumDistributed.
*/
MultisegmentWellEquationAccess<Scalar,numWellEq,Indices::numEq> eqns(eqns1);
// subtract sum of phase fluxes in the well equations.
eqns.residual()[seg][comp_idx] += cq_s_effective.value();