incorporting reviewing comments for OPM/opm-simulators#5818

This commit is contained in:
Kai Bao 2025-01-13 10:00:31 +01:00
parent cf1b52e52f
commit 66d5a16ae1
3 changed files with 13 additions and 12 deletions

View File

@ -288,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 (has_wfrac_variable) {
if constexpr (has_wfrac_variable) {
eqns.D()[seg][seg_upwind][SPres][WFrac] += pressure_equation.derivative(WFrac + Indices::numEq);
}
if (has_gfrac_variable) {
if constexpr (has_gfrac_variable) {
eqns.D()[seg][seg_upwind][SPres][GFrac] += pressure_equation.derivative(GFrac + Indices::numEq);
}

View File

@ -315,7 +315,8 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
const auto& [Rs, Rv] = well_.rateConverter().inferDissolvedVaporisedRatio
(rsMax, rvMax, segment_rates.begin() + seg * well_.numPhases());
if (! (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx && FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx))) ) {
if ( (!FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)) ||
(!FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) ) {
vapoil[seg] = disgas[seg] = 0.0;
}
else {

View File

@ -522,12 +522,12 @@ getFrictionPressureLoss(const int seg,
visc.setDerivative(WQTotal, 0.0);
visc.setDerivative(SPres, 0.0);
} else {
if (PrimaryVariables::has_wfrac_variable) {
if constexpr (PrimaryVariables::has_wfrac_variable) {
constexpr int WFrac = Indices::numEq + PrimaryVariables::WFrac;
density.setDerivative(WFrac, 0.0);
visc.setDerivative(WFrac, 0.0);
}
if (PrimaryVariables::has_gfrac_variable) {
if constexpr (PrimaryVariables::has_gfrac_variable) {
constexpr int GFrac = Indices::numEq + PrimaryVariables::GFrac;
density.setDerivative(GFrac, 0.0);
visc.setDerivative(GFrac, 0.0);
@ -712,10 +712,10 @@ pressureDropAutoICD(const int seg,
zero_mask[PrimaryVariables::WQTotal] = true;
zero_mask[PrimaryVariables::SPres] = true;
} else {
if (PrimaryVariables::has_wfrac_variable) {
if constexpr (PrimaryVariables::has_wfrac_variable) {
zero_mask[PrimaryVariables::WFrac] = true;
}
if (PrimaryVariables::has_gfrac_variable) {
if constexpr (PrimaryVariables::has_gfrac_variable) {
zero_mask[PrimaryVariables::GFrac] = true;
}
// mass_rate has no extra derivatives (they are organized as in equations)
@ -795,12 +795,12 @@ pressureDropValve(const int seg,
visc.setDerivative(WQTotal, 0.0);
visc.setDerivative(SPres, 0.0);
} else {
if (PrimaryVariables::has_wfrac_variable) {
if constexpr (PrimaryVariables::has_wfrac_variable) {
constexpr int WFrac = Indices::numEq + PrimaryVariables::WFrac;
density.setDerivative(WFrac, 0.0);
visc.setDerivative(WFrac, 0.0);
}
if (PrimaryVariables::has_gfrac_variable) {
if constexpr (PrimaryVariables::has_gfrac_variable) {
constexpr int GFrac = Indices::numEq + PrimaryVariables::GFrac;
density.setDerivative(GFrac, 0.0);
visc.setDerivative(GFrac, 0.0);
@ -847,11 +847,11 @@ accelerationPressureLossContribution(const int seg,
density.setDerivative(WQTotal, 0.0);
density.setDerivative(SPres, 0.0);
} else {
if (PrimaryVariables::has_wfrac_variable) {
if constexpr (PrimaryVariables::has_wfrac_variable) {
constexpr int WFrac = Indices::numEq + PrimaryVariables::WFrac;
density.setDerivative(WFrac, 0.0);
}
if (PrimaryVariables::has_gfrac_variable) {
if constexpr (PrimaryVariables::has_gfrac_variable) {
constexpr int GFrac = Indices::numEq + PrimaryVariables::GFrac;
density.setDerivative(GFrac, 0.0);
}
@ -859,7 +859,7 @@ accelerationPressureLossContribution(const int seg,
}
}
const Scalar sign = mass_rate > 0 ? -1.0 : 1.0;
return sign*mswellhelpers::velocityHead(area, mass_rate, density);
return sign * mswellhelpers::velocityHead(area, mass_rate, density);
}
template <class FluidSystem, class Indices>