SimpleHuDuanH2O: avoid use of sstream

This commit is contained in:
Arne Morten Kvarving 2022-12-23 15:22:19 +01:00
parent f94bdfda44
commit f1ecc0c7cf
2 changed files with 16 additions and 13 deletions

View File

@ -37,7 +37,6 @@
#include <opm/material/common/MathToolbox.hpp> #include <opm/material/common/MathToolbox.hpp>
#include <cmath> #include <cmath>
#include <sstream>
namespace Opm { namespace Opm {
@ -345,15 +344,16 @@ public:
bool extrapolate) bool extrapolate)
{ {
if (temperature > 570) { if (temperature > 570) {
std::ostringstream oss; const std::string msg =
oss << "Viscosity of water based on Hu et al is too different from IAPWS for T above 570K and " "Viscosity of water based on Hu et al is too "
<< "(T = " << temperature << ")"; "different from IAPWS for T above 570K and (T = " +
if(extrapolate) std::to_string(getValue(temperature)) + ")";
if (extrapolate)
{ {
OpmLog::warning(oss.str()); OpmLog::warning(msg);
} }
else else
throw NumericalProblem(oss.str()); throw NumericalProblem(msg);
} }
const Evaluation rho = liquidDensity(temperature, pressure, extrapolate); const Evaluation rho = liquidDensity(temperature, pressure, extrapolate);
@ -376,15 +376,17 @@ private:
// systems below 647 K: Assessment of experimental data and // systems below 647 K: Assessment of experimental data and
// thermodynamics models, Chemical Geology, 2007. // thermodynamics models, Chemical Geology, 2007.
if (T > 647 || pressure > 100e6) { if (T > 647 || pressure > 100e6) {
std::ostringstream oss; const std::string msg =
oss << "Density of water is only implemented for temperatures below 647K and " "Density of water is only implemented for temperatures "
<< "pressures below 100MPa. (T = " << T << ", p=" << pressure; "below 647K and pressures below 100MPa. (T = " +
if(extrapolate) std::to_string(getValue(T)) + ", p=" +
std::to_string(getValue(pressure)) + ")";
if (extrapolate)
{ {
OpmLog::warning(oss.str()); OpmLog::warning(msg);
} }
else else
throw NumericalProblem(oss.str()); throw NumericalProblem(msg);
} }
Evaluation p = pressure / 1e6; // to MPa Evaluation p = pressure / 1e6; // to MPa

View File

@ -39,6 +39,7 @@
#include <opm/material/binarycoefficients/H2O_CO2.hpp> #include <opm/material/binarycoefficients/H2O_CO2.hpp>
#include <opm/material/binarycoefficients/Brine_CO2.hpp> #include <opm/material/binarycoefficients/Brine_CO2.hpp>
#include <sstream>
#include <vector> #include <vector>
namespace Opm { namespace Opm {