Throw if bhp is NaN in findTHP

This commit is contained in:
Tor Harald Sandve committed 2025-05-08 08:58:54 +02:00
1 parent ca92b6906c
commit 8153c2d095
2 files changed
+18 -3

No files matched your search

+14 -3
View File
@@ -262,9 +262,20 @@ namespace Opm
return;
}
BVectorWell xw(1);
this->linSys_.recoverSolutionWell(x, xw);
updateWellState(simulator, xw, well_state, deferred_logger);
try {
BVectorWell xw(1);
this->linSys_.recoverSolutionWell(x, xw);
updateWellState(simulator, xw, well_state, deferred_logger);
}
catch (const NumericalProblem& exp) {
// Add information about the well and log to deferred logger
// (Logging done inside of recoverSolutionWell() (i.e. by UMFpack) will only be seen if
// this is the process with rank zero)
deferred_logger.problem("In MultisegmentWell::recoverWellSolutionAndUpdateWellState for well "
+ this->name() +": "+exp.what());
throw;
}
}
+4
View File
@@ -21,6 +21,7 @@
#include <opm/simulators/wells/VFPHelpers.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/densead/Evaluation.hpp>
#include <opm/material/densead/Math.hpp>
@@ -368,6 +369,9 @@ findTHP(const std::vector<Scalar>& bhp_array,
{
int nthp = thp_array.size();
if (std::isnan(bhp)) {
throw NumericalProblem("findTHP: Error bhp is nan");
}
Scalar thp = -1e100;
//Check that our thp axis is sorted