mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-02 05:49:09 -06:00
MultisegmentWellEval: use {fmt} to format error messages
This commit is contained in:
parent
9e789fc144
commit
3083525e8e
@ -36,6 +36,8 @@
|
||||
#include <opm/simulators/wells/WellInterfaceIndices.hpp>
|
||||
#include <opm/simulators/wells/WellState.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
@ -275,8 +277,11 @@ assembleICDPressureEq(const int seg,
|
||||
icd_pressure_drop = segments_.pressureDropValve(seg);
|
||||
break;
|
||||
default: {
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Segment " + std::to_string(this->segmentSet()[seg].segmentNumber())
|
||||
+ " for well " + baseif_.name() + " is not of ICD type", deferred_logger);
|
||||
OPM_DEFLOG_THROW(std::runtime_error,
|
||||
fmt::format("Segment {} for well {} is not of ICD type",
|
||||
this->segmentSet()[seg].segmentNumber(),
|
||||
baseif_.name()),
|
||||
deferred_logger);
|
||||
}
|
||||
}
|
||||
pressure_equation = pressure_equation - icd_pressure_drop;
|
||||
@ -336,8 +341,8 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||
}
|
||||
}
|
||||
if (std::isnan(residual) || std::isinf(residual)) {
|
||||
deferred_logger.debug("nan or inf value for residal get for well " + baseif_.name()
|
||||
+ " segment " + std::to_string(seg) + " eq_idx " + std::to_string(eq_idx));
|
||||
deferred_logger.debug(fmt::format("nan or inf value for residual for well {} segment {} eq_idx {}",
|
||||
baseif_.name(), seg, eq_idx));
|
||||
return {false, residuals};
|
||||
}
|
||||
|
||||
@ -351,7 +356,7 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
||||
{
|
||||
const double control_residual = std::abs(linSys_.residual()[0][numWellEq - 1]);
|
||||
if (std::isnan(control_residual) || std::isinf(control_residual)) {
|
||||
deferred_logger.debug("nan or inf value for control residal get for well " + baseif_.name());
|
||||
deferred_logger.debug(fmt::format("nan or inf value for control residual for well {}", baseif_.name()));
|
||||
return {false, residuals};
|
||||
}
|
||||
residuals[numWellEq] = control_residual;
|
||||
@ -390,7 +395,9 @@ getControlTolerance(const WellState& well_state,
|
||||
control_tolerance = tolerance_wells;
|
||||
break;
|
||||
default:
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Unknown well control control types for well " << baseif_.name(), deferred_logger);
|
||||
OPM_DEFLOG_THROW(std::runtime_error,
|
||||
fmt::format("Unknown well control control types for well {}", baseif_.name()),
|
||||
deferred_logger);
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,7 +423,9 @@ getControlTolerance(const WellState& well_state,
|
||||
control_tolerance = tolerance_wells; // smaller tolerance for rate control
|
||||
break;
|
||||
default:
|
||||
OPM_DEFLOG_THROW(std::runtime_error, "Unknown well control control types for well " << baseif_.name(), deferred_logger);
|
||||
OPM_DEFLOG_THROW(std::runtime_error,
|
||||
fmt::format("Unknown well control control types for well {}", baseif_.name()),
|
||||
deferred_logger);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user