fixed: make sure we have valid indices in readInitialCondition_

quells warnings building flowexp_comp
This commit is contained in:
Arne Morten Kvarving 2024-09-12 10:55:56 +02:00
parent 5545f641e1
commit 6d8b5b204b

View File

@ -1400,11 +1400,11 @@ protected:
std::size_t numElems = this->model().numGridDof();
for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) {
const auto& fs = asImp_().initialFluidStates()[elemIdx];
if (!this->maxWaterSaturation_.empty())
if (!this->maxWaterSaturation_.empty() && waterPhaseIdx > -1)
this->maxWaterSaturation_[elemIdx] = std::max(this->maxWaterSaturation_[elemIdx], fs.saturation(waterPhaseIdx));
if (!this->maxOilSaturation_.empty())
if (!this->maxOilSaturation_.empty() && oilPhaseIdx > -1)
this->maxOilSaturation_[elemIdx] = std::max(this->maxOilSaturation_[elemIdx], fs.saturation(oilPhaseIdx));
if (!this->minRefPressure_.empty())
if (!this->minRefPressure_.empty() && refPressurePhaseIdx_() > -1)
this->minRefPressure_[elemIdx] = std::min(this->minRefPressure_[elemIdx], fs.pressure(refPressurePhaseIdx_()));
}
}