Skip to content

Commit 2f1a52c

Browse files
committed
adding a context to StandardWellPrimaryVariables::checkFinite
so we can give some more information about where the non-finite primary variable is generated.
1 parent 53a2f30 commit 2f1a52c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

opm/simulators/wells/StandardWellPrimaryVariables.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,16 @@ relaxationFactorFractionsProducer(const BVectorWell& dwells,
750750

751751
template<class FluidSystem, class Indices>
752752
void StandardWellPrimaryVariables<FluidSystem,Indices>::
753-
checkFinite(DeferredLogger& deferred_logger) const
753+
checkFinite(DeferredLogger& deferred_logger, std::string_view context) const
754754
{
755755
for (const Scalar v : value_) {
756-
if (!isfinite(v))
756+
if (!isfinite(v)) {
757+
const std::string msg =
758+
fmt::format("Non-finite primary variable for well {} after {}", well_.name(), context);
757759
OPM_DEFLOG_PROBLEM(NumericalProblem,
758-
"Infinite primary variable after update from wellState, well: " + well_.name(),
760+
msg,
759761
deferred_logger);
762+
}
760763
}
761764
}
762765

opm/simulators/wells/StandardWellPrimaryVariables.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <opm/simulators/wells/StandardWellEquations.hpp>
2929

30+
#include <string_view>
3031
#include <vector>
3132

3233
namespace Opm
@@ -118,7 +119,7 @@ class StandardWellPrimaryVariables {
118119
void updateNewtonPolyMW(const BVectorWell& dwells);
119120

120121
//! \brief Check that all values are finite.
121-
void checkFinite(DeferredLogger& deferred_logger) const;
122+
void checkFinite(DeferredLogger& deferred_logger, std::string_view context) const;
122123

123124
//! \brief Copy values to well state.
124125
void copyToWellState(WellState<Scalar, IndexTraits>& well_state,

opm/simulators/wells/StandardWell_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ namespace Opm
782782
this->primary_variables_.updateNewtonPolyMW(dwells);
783783
}
784784

785-
this->primary_variables_.checkFinite(deferred_logger);
785+
this->primary_variables_.checkFinite(deferred_logger, "Newton update");
786786
}
787787

788788

@@ -1871,7 +1871,7 @@ namespace Opm
18711871
this->primary_variables_.updatePolyMW(well_state);
18721872
}
18731873

1874-
this->primary_variables_.checkFinite(deferred_logger);
1874+
this->primary_variables_.checkFinite(deferred_logger, "updating from well state");
18751875
}
18761876

18771877

0 commit comments

Comments
 (0)