add checkFinite to StandardWellPrimaryVariables

This commit is contained in:
Arne Morten Kvarving 2022-11-09 12:18:28 +01:00
parent 999d4c6be9
commit 4bbcdf0646
3 changed files with 16 additions and 9 deletions

View File

@ -689,6 +689,16 @@ relaxationFactorFractionsProducer(const BVectorWell& dwells) const
return relaxation_factor;
}
template<class FluidSystem, class Indices, class Scalar>
void StandardWellPrimaryVariables<FluidSystem,Indices,Scalar>::
checkFinite(DeferredLogger& deferred_logger) const
{
for (const Scalar v : value_) {
if (!isfinite(v))
OPM_DEFLOG_THROW(NumericalIssue, "Infinite primary variable after update from wellState well: " << well_.name(), deferred_logger);
}
}
#define INSTANCE(...) \
template class StandardWellPrimaryVariables<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>,__VA_ARGS__,double>;

View File

@ -122,6 +122,9 @@ public:
//! \brief Update polymer molecular weight values from newton update vector.
void updateNewtonPolyMW(const BVectorWell& dwells);
//! \brief Check that all values are finite.
void checkFinite(DeferredLogger& deferred_logger) const;
//! \brief Copy values to well state.
void copyToWellState(WellState& well_state, DeferredLogger& deferred_logger) const;

View File

@ -961,11 +961,7 @@ namespace Opm
updateExtraPrimaryVariables(dwells);
for (double v : this->primary_variables_.value_) {
if(!isfinite(v))
OPM_DEFLOG_THROW(NumericalIssue, "Infinite primary variable after newton update well: " << this->name(), deferred_logger);
}
this->primary_variables_.checkFinite(deferred_logger);
}
@ -2038,10 +2034,8 @@ namespace Opm
if constexpr (Base::has_polymermw) {
this->primary_variables_.updatePolyMW(well_state);
}
for (double v : this->primary_variables_.value_) {
if(!isfinite(v))
OPM_DEFLOG_THROW(NumericalIssue, "Infinite primary variable after update from wellState well: " << this->name(), deferred_logger);
}
this->primary_variables_.checkFinite(deferred_logger);
}