MultisegmentWellSegments: use {fmt} to format error messages

This commit is contained in:
Arne Morten Kvarving 2022-12-20 12:41:30 +01:00
parent 3083525e8e
commit dd9e2ad66a

View File

@ -23,6 +23,8 @@
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <opm/material/densead/EvaluationFormat.hpp>
#include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp> #include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp>
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp> #include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
@ -35,7 +37,6 @@
#include <opm/simulators/wells/WellInterfaceGeneric.hpp> #include <opm/simulators/wells/WellInterfaceGeneric.hpp>
#include <fmt/format.h> #include <fmt/format.h>
#include <sstream>
namespace Opm namespace Opm
{ {
@ -238,14 +239,14 @@ computeFluidProperties(const EvalWell& temperature,
const EvalWell d = 1.0 - rs * rv; const EvalWell d = 1.0 - rs * rv;
if (d <= 0.0) { if (d <= 0.0) {
std::ostringstream sstr; const std::string str =
sstr << "Problematic d value " << d << " obtained for well " << well_.name() fmt::format("Problematic d value {} obtained for well {} "
<< " during segment density calculations with rs " << rs "during segment density calculations with rs {}, "
<< ", rv " << rv << " and pressure " << seg_pressure "rv {} and pressure {}. "
<< " obtaining d " << d "Continue as if no dissolution (rs = 0) and "
<< " Continue as if no dissolution (rs = 0) and vaporization (rv = 0) " "vaporization (rv = 0) for this connection.",
<< " for this connection."; d, well_.name(), rv, seg_pressure);
deferred_logger.debug(sstr.str()); deferred_logger.debug(str);
} else { } else {
if (rs > 0.0) { if (rs > 0.0) {
mix[gasCompIdx] = (mix_s[gasCompIdx] - mix_s[oilCompIdx] * rs) / d; mix[gasCompIdx] = (mix_s[gasCompIdx] - mix_s[oilCompIdx] * rs) / d;
@ -448,14 +449,14 @@ getSurfaceVolume(const EvalWell& temperature,
const EvalWell d = 1.0 - rs * rv; const EvalWell d = 1.0 - rs * rv;
if (d <= 0.0 || d > 1.0) { if (d <= 0.0 || d > 1.0) {
std::ostringstream sstr; const std::string str =
sstr << "Problematic d value " << d << " obtained for well " << well_.name() fmt::format("Problematic d value {} obtained for well {} "
<< " during conversion to surface volume with rs " << rs "during conversion to surface volume with rs {}, "
<< ", rv " << rv << " and pressure " << seg_pressure "rv {} and pressure {}. "
<< " obtaining d " << d "Continue as if no dissolution (rs = 0) and "
<< " Continue as if no dissolution (rs = 0) and vaporization (rv = 0) " "vaporization (rv = 0) for this connection.",
<< " for this connection."; d, well_.name(), rs, rv, seg_pressure);
OpmLog::debug(sstr.str()); OpmLog::debug(str);
} else { } else {
if (rs > 0.0) { if (rs > 0.0) {
mix[gasCompIdx] = (mix_s[gasCompIdx] - mix_s[oilCompIdx] * rs) / d; mix[gasCompIdx] = (mix_s[gasCompIdx] - mix_s[oilCompIdx] * rs) / d;