change assert with throw for isfinite primary variable

This commit is contained in:
Tor Harald Sandve 2021-10-05 09:11:11 +02:00 committed by Markus Blatt
parent c599402318
commit fdf6ce9c54
2 changed files with 9 additions and 9 deletions

View File

@ -359,7 +359,8 @@ namespace Opm
DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
void updatePrimaryVariablesNewton(const BVectorWell& dwells, void updatePrimaryVariablesNewton(const BVectorWell& dwells,
const WellState& well_state) const; const WellState& well_state,
DeferredLogger& deferred_logger) const;
// update extra primary vriables if there are any // update extra primary vriables if there are any
void updateExtraPrimaryVariables(const BVectorWell& dwells) const; void updateExtraPrimaryVariables(const BVectorWell& dwells) const;

View File

@ -854,7 +854,7 @@ namespace Opm
{ {
if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return; if (!this->isOperableAndSolvable() && !this->wellIsStopped()) return;
updatePrimaryVariablesNewton(dwells, well_state); updatePrimaryVariablesNewton(dwells, well_state, deferred_logger);
updateWellStateFromPrimaryVariables(well_state, deferred_logger); updateWellStateFromPrimaryVariables(well_state, deferred_logger);
Base::calculateReservoirRates(well_state.well(this->index_of_well_)); Base::calculateReservoirRates(well_state.well(this->index_of_well_));
@ -868,7 +868,8 @@ namespace Opm
void void
StandardWell<TypeTag>:: StandardWell<TypeTag>::
updatePrimaryVariablesNewton(const BVectorWell& dwells, updatePrimaryVariablesNewton(const BVectorWell& dwells,
const WellState& /* well_state */) const const WellState& /* well_state */,
DeferredLogger& deferred_logger) const
{ {
const double dFLimit = this->param_.dwell_fraction_max_; const double dFLimit = this->param_.dwell_fraction_max_;
const double dBHPLimit = this->param_.dbhp_max_rel_; const double dBHPLimit = this->param_.dbhp_max_rel_;
@ -876,11 +877,10 @@ namespace Opm
updateExtraPrimaryVariables(dwells); updateExtraPrimaryVariables(dwells);
#ifndef NDEBUG
for (double v : this->primary_variables_) { for (double v : this->primary_variables_) {
assert(isfinite(v)); if(!isfinite(v))
OPM_DEFLOG_THROW(NumericalIssue, "Infinite primary variable after newton update well: " << this->name(), deferred_logger);
} }
#endif
} }
@ -1918,11 +1918,10 @@ namespace Opm
} }
} }
} }
#ifndef NDEBUG
for (double v : this->primary_variables_) { for (double v : this->primary_variables_) {
assert(isfinite(v)); if(!isfinite(v))
OPM_DEFLOG_THROW(NumericalIssue, "Infinite primary variable after update from wellState well: " << this->name(), deferred_logger);
} }
#endif
} }