Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should not use phase index for canonicalToActiveComponentIndex() #5825

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions opm/simulators/wells/MultisegmentWellAssemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ assemblePressureEq(const int seg,
const int outlet_segment_index,
const EvalWell& pressure_equation,
const EvalWell& outlet_pressure,
Equations& eqns1,
bool wfrac,
bool gfrac) const
Equations& eqns1) const
{
/*
This method does *not* need communication.
Expand All @@ -290,10 +288,10 @@ assemblePressureEq(const int seg,
eqns.residual()[seg][SPres] += pressure_equation.value();
eqns.D()[seg][seg][SPres][SPres] += pressure_equation.derivative(SPres + Indices::numEq);
eqns.D()[seg][seg][SPres][WQTotal] += pressure_equation.derivative(WQTotal + Indices::numEq);
if (wfrac) {
if (has_wfrac_variable) {
eqns.D()[seg][seg_upwind][SPres][WFrac] += pressure_equation.derivative(WFrac + Indices::numEq);
}
if (gfrac) {
if (has_gfrac_variable) {
eqns.D()[seg][seg_upwind][SPres][GFrac] += pressure_equation.derivative(GFrac + Indices::numEq);
}

Expand Down
4 changes: 1 addition & 3 deletions opm/simulators/wells/MultisegmentWellAssemble.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ class MultisegmentWellAssemble
const int outlet_segment_index,
const EvalWell& pressure_equation,
const EvalWell& outlet_pressure,
Equations& eqns,
bool wfrac = has_wfrac_variable,
bool gfrac = has_gfrac_variable) const;
Equations& eqns) const;

//! \brief Assembles a trivial equation.
void assembleTrivialEq(const int seg,
Expand Down
4 changes: 1 addition & 3 deletions opm/simulators/wells/MultisegmentWellEval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,7 @@ assembleICDPressureEq(const int seg,
MultisegmentWellAssemble(baseif_).
assemblePressureEq(seg, seg_upwind, outlet_segment_index,
pressure_equation, outlet_pressure,
linSys_,
FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx),
FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx));
linSys_);

assembleAccelerationAndHydroPressureLosses(seg, well_state, use_average_density);
}
Expand Down
8 changes: 4 additions & 4 deletions opm/simulators/wells/MultisegmentWellSegments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,10 @@ mixtureDensity(const int seg) const
continue;
}

const auto compIdx = Indices::
canonicalToActiveComponentIndex(phIdx);
const auto active_comp_index = Indices::
canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(phIdx));

mixDens += q[compIdx].value() * rho[compIdx].value();
mixDens += q[active_comp_index].value() * rho[active_comp_index].value();
}

return mixDens;
Expand Down Expand Up @@ -977,7 +977,7 @@ mixtureDensityWithExponents(const AutoICD& aicd, const int seg) const
for (const auto& [fsPhaseIdx, densityExponent] : densityExponents) {
if (FluidSystem::phaseIsActive(fsPhaseIdx)) {
const auto compIdx = Indices::
canonicalToActiveComponentIndex(fsPhaseIdx);
canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(fsPhaseIdx));

// exp = (aicd.*densityExponent)() in native syntax.
const auto exp = std::invoke(densityExponent, aicd);
Expand Down