WellInterfaceIndices: rename ebosCompIdxToFlowCompIdx to modelCompIdxToFlowCompIdx

This commit is contained in:
Arne Morten Kvarving 2024-02-06 12:12:13 +01:00
parent c029a57c72
commit c4c7d2e4f5
7 changed files with 18 additions and 18 deletions

View File

@ -523,7 +523,7 @@ volumeFractionScaled(const int seg,
// For reservoir rate control, the distr in well control is used for the // For reservoir rate control, the distr in well control is used for the
// rate conversion coefficients. For the injection well, only the distr of the injection // rate conversion coefficients. For the injection well, only the distr of the injection
// phase is not zero. // phase is not zero.
const double scale = well_.scalingFactor(well_.ebosCompIdxToFlowCompIdx(comp_idx)); const double scale = well_.scalingFactor(well_.modelCompIdxToFlowCompIdx(comp_idx));
if (scale > 0.) { if (scale > 0.) {
return this->volumeFraction(seg, comp_idx) / scale; return this->volumeFraction(seg, comp_idx) / scale;
} }
@ -564,17 +564,17 @@ getSegmentRateUpwinding(const int seg,
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == comp_idx && Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == comp_idx
&& phase == InjectorType::WATER) && phase == InjectorType::WATER)
return evaluation_[seg][WQTotal] / well_.scalingFactor(well_.ebosCompIdxToFlowCompIdx(comp_idx)); return evaluation_[seg][WQTotal] / well_.scalingFactor(well_.modelCompIdxToFlowCompIdx(comp_idx));
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx) == comp_idx && Indices::canonicalToActiveComponentIndex(FluidSystem::oilCompIdx) == comp_idx
&& phase == InjectorType::OIL) && phase == InjectorType::OIL)
return evaluation_[seg][WQTotal] / well_.scalingFactor(well_.ebosCompIdxToFlowCompIdx(comp_idx)); return evaluation_[seg][WQTotal] / well_.scalingFactor(well_.modelCompIdxToFlowCompIdx(comp_idx));
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx)
&& Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx) == comp_idx && Indices::canonicalToActiveComponentIndex(FluidSystem::gasCompIdx) == comp_idx
&& phase == InjectorType::GAS) && phase == InjectorType::GAS)
return evaluation_[seg][WQTotal] / well_.scalingFactor(well_.ebosCompIdxToFlowCompIdx(comp_idx)); return evaluation_[seg][WQTotal] / well_.scalingFactor(well_.modelCompIdxToFlowCompIdx(comp_idx));
return 0.0; return 0.0;
} }
@ -648,6 +648,7 @@ INSTANCE(BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,0u,0u>) INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,true,0u,0u,0u>) INSTANCE(BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,true,0u,0u,0u>)
INSTANCE(BlackOilTwoPhaseIndices<1u,0u,0u,0u,false,false,0u,0u,0u>) INSTANCE(BlackOilTwoPhaseIndices<1u,0u,0u,0u,false,false,0u,0u,0u>)
// Blackoil // Blackoil
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>) INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,false,false,0u,0u>) INSTANCE(BlackOilIndices<1u,0u,0u,0u,false,false,0u,0u>)
@ -659,7 +660,6 @@ INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>) INSTANCE(BlackOilIndices<0u,0u,0u,1u,false,true,0u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>) INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,false,1u,0u>)
INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,2u,0u>) INSTANCE(BlackOilIndices<0u,0u,0u,0u,false,true,2u,0u>)
INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>) INSTANCE(BlackOilIndices<1u,0u,0u,0u,true,false,0u,0u>)
} }

View File

@ -369,7 +369,7 @@ namespace Opm
allow_cf, cq_s, perf_press, perf_rates, deferred_logger); allow_cf, cq_s, perf_press, perf_rates, deferred_logger);
for(int p = 0; p < np; ++p) { for(int p = 0; p < np; ++p) {
well_flux[this->ebosCompIdxToFlowCompIdx(p)] += cq_s[p]; well_flux[this->modelCompIdxToFlowCompIdx(p)] += cq_s[p];
} }
} }
} }
@ -442,7 +442,7 @@ namespace Opm
well_flux.resize(np, 0.0); well_flux.resize(np, 0.0);
for (int compIdx = 0; compIdx < this->num_components_; ++compIdx) { for (int compIdx = 0; compIdx < this->num_components_; ++compIdx) {
const EvalWell rate = well_copy.primary_variables_.getQs(compIdx); const EvalWell rate = well_copy.primary_variables_.getQs(compIdx);
well_flux[this->ebosCompIdxToFlowCompIdx(compIdx)] = rate.value(); well_flux[this->modelCompIdxToFlowCompIdx(compIdx)] = rate.value();
} }
debug_cost_counter_ += well_copy.debug_cost_counter_; debug_cost_counter_ += well_copy.debug_cost_counter_;
} }
@ -562,7 +562,7 @@ namespace Opm
well_potentials.resize(np, 0.0); well_potentials.resize(np, 0.0);
for (int compIdx = 0; compIdx < this->num_components_; ++compIdx) { for (int compIdx = 0; compIdx < this->num_components_; ++compIdx) {
const EvalWell rate = well_copy.primary_variables_.getQs(compIdx); const EvalWell rate = well_copy.primary_variables_.getQs(compIdx);
well_potentials[this->ebosCompIdxToFlowCompIdx(compIdx)] = rate.value(); well_potentials[this->modelCompIdxToFlowCompIdx(compIdx)] = rate.value();
} }
debug_cost_counter_ += well_copy.debug_cost_counter_; debug_cost_counter_ += well_copy.debug_cost_counter_;
return converged; return converged;
@ -1361,7 +1361,7 @@ namespace Opm
constexpr int num_eq = MSWEval::numWellEq; constexpr int num_eq = MSWEval::numWellEq;
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx){ for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx){
const EvalWell comp_rate = this->primary_variables_.getQs(comp_idx); const EvalWell comp_rate = this->primary_variables_.getQs(comp_idx);
const int idx = this->ebosCompIdxToFlowCompIdx(comp_idx); const int idx = this->modelCompIdxToFlowCompIdx(comp_idx);
for (size_t pvIdx = 0; pvIdx < num_eq; ++pvIdx) { for (size_t pvIdx = 0; pvIdx < num_eq; ++pvIdx) {
// well primary variable derivatives in EvalWell start at position Indices::numEq // well primary variable derivatives in EvalWell start at position Indices::numEq
ws.implicit_ipr_b[idx] -= x_well[0][pvIdx]*comp_rate.derivative(pvIdx+Indices::numEq); ws.implicit_ipr_b[idx] -= x_well[0][pvIdx]*comp_rate.derivative(pvIdx+Indices::numEq);
@ -1875,7 +1875,7 @@ namespace Opm
// store the perf pressure and rates // store the perf pressure and rates
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) { for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
perf_rates[perf*this->number_of_phases_ + this->ebosCompIdxToFlowCompIdx(comp_idx)] = cq_s[comp_idx].value(); perf_rates[perf*this->number_of_phases_ + this->modelCompIdxToFlowCompIdx(comp_idx)] = cq_s[comp_idx].value();
} }
perf_press_state[perf] = perf_press.value(); perf_press_state[perf] = perf_press.value();

View File

@ -439,7 +439,7 @@ computeProperties(const WellState& well_state,
for (int perf = 0; perf < nperf; ++perf) { for (int perf = 0; perf < nperf; ++perf) {
for (int comp = 0; comp < np; ++comp) { for (int comp = 0; comp < np; ++comp) {
perfRates[perf * well_.numComponents() + comp] = perf_rates_state[perf * np + well_.ebosCompIdxToFlowCompIdx(comp)]; perfRates[perf * well_.numComponents() + comp] = perf_rates_state[perf * np + well_.modelCompIdxToFlowCompIdx(comp)];
} }
} }

View File

@ -485,7 +485,7 @@ typename StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::EvalWell
StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>:: StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
volumeFractionScaled(const int compIdx) const volumeFractionScaled(const int compIdx) const
{ {
const int legacyCompIdx = well_.ebosCompIdxToFlowCompIdx(compIdx); const int legacyCompIdx = well_.modelCompIdxToFlowCompIdx(compIdx);
const double scal = well_.scalingFactor(legacyCompIdx); const double scal = well_.scalingFactor(legacyCompIdx);
if (scal > 0) if (scal > 0)
return this->volumeFraction(compIdx) / scal; return this->volumeFraction(compIdx) / scal;

View File

@ -406,7 +406,7 @@ namespace Opm
auto& perf_rate_solvent = perf_data.solvent_rates; auto& perf_rate_solvent = perf_data.solvent_rates;
perf_rate_solvent[perf] = cq_s[componentIdx].value(); perf_rate_solvent[perf] = cq_s[componentIdx].value();
} else { } else {
perf_rates[perf*np + this->ebosCompIdxToFlowCompIdx(componentIdx)] = cq_s[componentIdx].value(); perf_rates[perf*np + this->modelCompIdxToFlowCompIdx(componentIdx)] = cq_s[componentIdx].value();
} }
} }
@ -897,7 +897,7 @@ namespace Opm
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx){ for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx){
EvalWell comp_rate = this->primary_variables_.getQs(comp_idx); EvalWell comp_rate = this->primary_variables_.getQs(comp_idx);
const int idx = this->ebosCompIdxToFlowCompIdx(comp_idx); const int idx = this->modelCompIdxToFlowCompIdx(comp_idx);
for (size_t pvIdx = 0; pvIdx < nEq; ++pvIdx) { for (size_t pvIdx = 0; pvIdx < nEq; ++pvIdx) {
// well primary variable derivatives in EvalWell start at position Indices::numEq // well primary variable derivatives in EvalWell start at position Indices::numEq
ws.implicit_ipr_b[idx] -= x_well[0][pvIdx]*comp_rate.derivative(pvIdx+Indices::numEq); ws.implicit_ipr_b[idx] -= x_well[0][pvIdx]*comp_rate.derivative(pvIdx+Indices::numEq);
@ -1459,7 +1459,7 @@ namespace Opm
cq_s, perf_rates, deferred_logger); cq_s, perf_rates, deferred_logger);
for(int p = 0; p < np; ++p) { for(int p = 0; p < np; ++p) {
well_flux[this->ebosCompIdxToFlowCompIdx(p)] += cq_s[p]; well_flux[this->modelCompIdxToFlowCompIdx(p)] += cq_s[p];
} }
// the solvent contribution is added to the gas potentials // the solvent contribution is added to the gas potentials
@ -1631,7 +1631,7 @@ namespace Opm
well_potentials.resize(np, 0.0); well_potentials.resize(np, 0.0);
for (int compIdx = 0; compIdx < this->num_components_; ++compIdx) { for (int compIdx = 0; compIdx < this->num_components_; ++compIdx) {
const EvalWell rate = well_copy.primary_variables_.getQs(compIdx); const EvalWell rate = well_copy.primary_variables_.getQs(compIdx);
well_potentials[this->ebosCompIdxToFlowCompIdx(compIdx)] = rate.value(); well_potentials[this->modelCompIdxToFlowCompIdx(compIdx)] = rate.value();
} }
return converged; return converged;
} }

View File

@ -76,7 +76,7 @@ flowPhaseToModelCompIdx(const int phaseIdx) const
template<class FluidSystem, class Indices, class Scalar> template<class FluidSystem, class Indices, class Scalar>
int int
WellInterfaceIndices<FluidSystem,Indices,Scalar>:: WellInterfaceIndices<FluidSystem,Indices,Scalar>::
ebosCompIdxToFlowCompIdx(const unsigned compIdx) const modelCompIdxToFlowCompIdx(const unsigned compIdx) const
{ {
const auto& pu = this->phaseUsage(); const auto& pu = this->phaseUsage();
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == compIdx) if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx) == compIdx)

View File

@ -40,7 +40,7 @@ public:
using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>; using Eval = DenseAd::Evaluation<Scalar, /*size=*/Indices::numEq>;
int flowPhaseToModelCompIdx(const int phaseIdx) const; int flowPhaseToModelCompIdx(const int phaseIdx) const;
int ebosCompIdxToFlowCompIdx(const unsigned compIdx) const; int modelCompIdxToFlowCompIdx(const unsigned compIdx) const;
double scalingFactor(const int phaseIdx) const; double scalingFactor(const int phaseIdx) const;
template <class EvalWell> template <class EvalWell>