mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #4337 from akva2/deferred_logger_no_sstream
Avoid use of sstream in deferred logger header / macros
This commit is contained in:
commit
2bc065fce6
@ -29,7 +29,6 @@
|
|||||||
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@ -42,13 +41,14 @@
|
|||||||
// exception class derived from either std::logic_error or
|
// exception class derived from either std::logic_error or
|
||||||
// std::runtime_error.
|
// std::runtime_error.
|
||||||
//
|
//
|
||||||
// Usage: OPM_DEFLOG_THROW(ExceptionClass, "Error message " << value, DeferredLogger);
|
// Usage: OPM_DEFLOG_THROW(ExceptionClass, "Error message", DeferredLogger);
|
||||||
#define OPM_DEFLOG_THROW(Exception, message, deferred_logger) \
|
#define OPM_DEFLOG_THROW(Exception, message, deferred_logger) \
|
||||||
do { \
|
do { \
|
||||||
std::ostringstream oss__; \
|
std::string oss__ = std::string{"["} + __FILE__ + ":" + \
|
||||||
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
|
std::to_string(__LINE__) + "] " + \
|
||||||
deferred_logger.error(oss__.str()); \
|
message; \
|
||||||
throw Exception(oss__.str()); \
|
deferred_logger.error(oss__); \
|
||||||
|
throw Exception(oss__); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -834,7 +834,9 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
// It should be able to find in wells_ecl.
|
// It should be able to find in wells_ecl.
|
||||||
if (index_well_ecl == nw_wells_ecl) {
|
if (index_well_ecl == nw_wells_ecl) {
|
||||||
OPM_DEFLOG_THROW(std::logic_error, "Could not find well " << well_name << " in wells_ecl ", deferred_logger);
|
OPM_DEFLOG_THROW(std::logic_error,
|
||||||
|
fmt::format("Could not find well {} in wells_ecl ", well_name),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->createWellPointer(index_well_ecl, report_step);
|
return this->createWellPointer(index_well_ecl, report_step);
|
||||||
@ -877,8 +879,9 @@ namespace Opm {
|
|||||||
calculateExplicitQuantities(local_deferredLogger);
|
calculateExplicitQuantities(local_deferredLogger);
|
||||||
prepareTimeStep(local_deferredLogger);
|
prepareTimeStep(local_deferredLogger);
|
||||||
}
|
}
|
||||||
OPM_END_PARALLEL_TRY_CATCH_LOG(local_deferredLogger, "assemble() failed (It=0): ",
|
OPM_END_PARALLEL_TRY_CATCH_LOG(local_deferredLogger,
|
||||||
terminal_output_, grid().comm());
|
"assemble() failed (It=0): ",
|
||||||
|
terminal_output_, grid().comm());
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool well_group_control_changed = assembleImpl(iterationIdx, dt, 0, local_deferredLogger);
|
const bool well_group_control_changed = assembleImpl(iterationIdx, dt, 0, local_deferredLogger);
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <opm/simulators/wells/GasLiftCommon.hpp>
|
#include <opm/simulators/wells/GasLiftCommon.hpp>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
GasLiftCommon::
|
GasLiftCommon::
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <opm/simulators/wells/GroupState.hpp>
|
#include <opm/simulators/wells/GroupState.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#include <opm/simulators/wells/MultisegmentWellEval.hpp>
|
#include <opm/simulators/wells/MultisegmentWellEval.hpp>
|
||||||
|
|
||||||
#include <dune/istl/umfpack.hh>
|
|
||||||
|
|
||||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
|
|
||||||
#include <opm/models/blackoil/blackoilindices.hh>
|
#include <opm/models/blackoil/blackoilindices.hh>
|
||||||
@ -32,13 +30,14 @@
|
|||||||
|
|
||||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||||
#include <opm/simulators/wells/MSWellHelpers.hpp>
|
|
||||||
#include <opm/simulators/wells/MultisegmentWellAssemble.hpp>
|
#include <opm/simulators/wells/MultisegmentWellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/WellAssemble.hpp>
|
#include <opm/simulators/wells/WellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/WellConvergence.hpp>
|
#include <opm/simulators/wells/WellConvergence.hpp>
|
||||||
#include <opm/simulators/wells/WellInterfaceIndices.hpp>
|
#include <opm/simulators/wells/WellInterfaceIndices.hpp>
|
||||||
#include <opm/simulators/wells/WellState.hpp>
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -278,8 +277,11 @@ assembleICDPressureEq(const int seg,
|
|||||||
icd_pressure_drop = segments_.pressureDropValve(seg);
|
icd_pressure_drop = segments_.pressureDropValve(seg);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Segment " + std::to_string(this->segmentSet()[seg].segmentNumber())
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
+ " for well " + baseif_.name() + " is not of ICD type", deferred_logger);
|
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;
|
pressure_equation = pressure_equation - icd_pressure_drop;
|
||||||
@ -339,8 +341,8 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (std::isnan(residual) || std::isinf(residual)) {
|
if (std::isnan(residual) || std::isinf(residual)) {
|
||||||
deferred_logger.debug("nan or inf value for residal get for well " + baseif_.name()
|
deferred_logger.debug(fmt::format("nan or inf value for residual for well {} segment {} eq_idx {}",
|
||||||
+ " segment " + std::to_string(seg) + " eq_idx " + std::to_string(eq_idx));
|
baseif_.name(), seg, eq_idx));
|
||||||
return {false, residuals};
|
return {false, residuals};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +356,7 @@ getFiniteWellResiduals(const std::vector<Scalar>& B_avg,
|
|||||||
{
|
{
|
||||||
const double control_residual = std::abs(linSys_.residual()[0][numWellEq - 1]);
|
const double control_residual = std::abs(linSys_.residual()[0][numWellEq - 1]);
|
||||||
if (std::isnan(control_residual) || std::isinf(control_residual)) {
|
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};
|
return {false, residuals};
|
||||||
}
|
}
|
||||||
residuals[numWellEq] = control_residual;
|
residuals[numWellEq] = control_residual;
|
||||||
@ -393,7 +395,9 @@ getControlTolerance(const WellState& well_state,
|
|||||||
control_tolerance = tolerance_wells;
|
control_tolerance = tolerance_wells;
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +423,9 @@ getControlTolerance(const WellState& well_state,
|
|||||||
control_tolerance = tolerance_wells; // smaller tolerance for rate control
|
control_tolerance = tolerance_wells; // smaller tolerance for rate control
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <opm/input/eclipse/Schedule/MSW/Valve.hpp>
|
#include <opm/input/eclipse/Schedule/MSW/Valve.hpp>
|
||||||
|
|
||||||
|
#include <opm/material/densead/EvaluationFormat.hpp>
|
||||||
|
|
||||||
#include <opm/simulators/wells/MultisegmentWellAssemble.hpp>
|
#include <opm/simulators/wells/MultisegmentWellAssemble.hpp>
|
||||||
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
||||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||||
@ -841,9 +843,11 @@ namespace Opm
|
|||||||
const Value d = 1.0 - rv * rs;
|
const Value d = 1.0 - rv * rs;
|
||||||
|
|
||||||
if (getValue(d) == 0.0) {
|
if (getValue(d) == 0.0) {
|
||||||
OPM_DEFLOG_THROW(NumericalProblem, "Zero d value obtained for well " << this->name()
|
OPM_DEFLOG_THROW(NumericalProblem,
|
||||||
<< " during flux calculation"
|
fmt::format("Zero d value obtained for well {} "
|
||||||
<< " with rs " << rs << " and rv " << rv, deferred_logger);
|
"during flux calculation with rs {} and rv {}",
|
||||||
|
this->name(), rs, rv),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Value tmp_oil = (cmix_s[oilCompIdx] - rv * cmix_s[gasCompIdx]) / d;
|
const Value tmp_oil = (cmix_s[oilCompIdx] - rv * cmix_s[gasCompIdx]) / d;
|
||||||
@ -2012,10 +2016,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
OPM_DEFLOG_THROW(NotImplemented,
|
OPM_DEFLOG_THROW(NotImplemented,
|
||||||
"Unsupported Injector Type ("
|
fmt::format("Unsupported Injector Type ({}) "
|
||||||
<< static_cast<int>(preferred_phase)
|
"for well {} during connection I.I. calculation",
|
||||||
<< ") for well " << this->name()
|
static_cast<int>(preferred_phase), this->name()),
|
||||||
<< " during connection I.I. calculation",
|
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
@ -696,7 +696,9 @@ checkFinite(DeferredLogger& deferred_logger) const
|
|||||||
{
|
{
|
||||||
for (const Scalar v : value_) {
|
for (const Scalar v : value_) {
|
||||||
if (!isfinite(v))
|
if (!isfinite(v))
|
||||||
OPM_DEFLOG_THROW(NumericalProblem, "Infinite primary variable after update from wellState well: " << well_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(NumericalProblem,
|
||||||
|
"Infinite primary variable after update from wellState, well: " + well_.name(),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
#include <opm/simulators/wells/WellBhpThpCalculator.hpp>
|
||||||
#include <opm/simulators/wells/WellConvergence.hpp>
|
#include <opm/simulators/wells/WellConvergence.hpp>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
@ -2050,7 +2052,9 @@ namespace Opm
|
|||||||
if constexpr (Base::has_polymermw) {
|
if constexpr (Base::has_polymermw) {
|
||||||
const int water_table_id = this->well_ecl_.getPolymerProperties().m_skprwattable;
|
const int water_table_id = this->well_ecl_.getPolymerProperties().m_skprwattable;
|
||||||
if (water_table_id <= 0) {
|
if (water_table_id <= 0) {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Unused SKPRWAT table id used for well " << name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
fmt::format("Unused SKPRWAT table id used for well {}", name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
const auto& water_table_func = PolymerModule::getSkprwatTable(water_table_id);
|
const auto& water_table_func = PolymerModule::getSkprwatTable(water_table_id);
|
||||||
const EvalWell throughput_eval(this->primary_variables_.numWellEq() + Indices::numEq, throughput);
|
const EvalWell throughput_eval(this->primary_variables_.numWellEq() + Indices::numEq, throughput);
|
||||||
@ -2059,8 +2063,10 @@ namespace Opm
|
|||||||
pskin_water = water_table_func.eval(throughput_eval, water_velocity);
|
pskin_water = water_table_func.eval(throughput_eval, water_velocity);
|
||||||
return pskin_water;
|
return pskin_water;
|
||||||
} else {
|
} else {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, "
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
"while injecting skin pressure is requested for well " << name(), deferred_logger);
|
fmt::format("Polymermw is not activated, while injecting "
|
||||||
|
"skin pressure is requested for well {}", name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2084,7 +2090,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
const int polymer_table_id = this->well_ecl_.getPolymerProperties().m_skprpolytable;
|
const int polymer_table_id = this->well_ecl_.getPolymerProperties().m_skprpolytable;
|
||||||
if (polymer_table_id <= 0) {
|
if (polymer_table_id <= 0) {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Unavailable SKPRPOLY table id used for well " << name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
fmt::format("Unavailable SKPRPOLY table id used for well {}", name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
const auto& skprpolytable = PolymerModule::getSkprpolyTable(polymer_table_id);
|
const auto& skprpolytable = PolymerModule::getSkprpolyTable(polymer_table_id);
|
||||||
const double reference_concentration = skprpolytable.refConcentration;
|
const double reference_concentration = skprpolytable.refConcentration;
|
||||||
@ -2100,8 +2108,10 @@ namespace Opm
|
|||||||
const EvalWell pskin = pskin_water + (pskin_poly - pskin_water) / reference_concentration * poly_inj_conc;
|
const EvalWell pskin = pskin_water + (pskin_poly - pskin_water) / reference_concentration * poly_inj_conc;
|
||||||
return sign * pskin;
|
return sign * pskin;
|
||||||
} else {
|
} else {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, "
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
"while injecting skin pressure is requested for well " << name(), deferred_logger);
|
fmt::format("Polymermw is not activated, while injecting "
|
||||||
|
"skin pressure is requested for well {}", name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2127,8 +2137,10 @@ namespace Opm
|
|||||||
molecular_weight = table_func.eval(throughput_eval, abs(water_velocity));
|
molecular_weight = table_func.eval(throughput_eval, abs(water_velocity));
|
||||||
return molecular_weight;
|
return molecular_weight;
|
||||||
} else {
|
} else {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Polymermw is not activated, "
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
"while injecting polymer molecular weight is requested for well " << name(), deferred_logger);
|
fmt::format("Polymermw is not activated, while injecting "
|
||||||
|
"polymer molecular weight is requested for well {}", name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2551,10 +2563,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
OPM_DEFLOG_THROW(NotImplemented,
|
OPM_DEFLOG_THROW(NotImplemented,
|
||||||
"Unsupported Injector Type ("
|
fmt::format("Unsupported Injector Type ({}) "
|
||||||
<< static_cast<int>(preferred_phase)
|
"for well {} during connection I.I. calculation",
|
||||||
<< ") for well " << this->name()
|
static_cast<int>(preferred_phase), this->name()),
|
||||||
<< " during connection I.I. calculation",
|
|
||||||
deferred_logger);
|
deferred_logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,9 @@ assembleControlEqProd(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::CRAT: {
|
case Well::ProducerCMode::CRAT: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << well_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
"CRAT control not supported, well " + well_.name(),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::RESV: {
|
case Well::ProducerCMode::RESV: {
|
||||||
auto total_rate = rates[0]; // To get the correct type only.
|
auto total_rate = rates[0]; // To get the correct type only.
|
||||||
@ -166,10 +168,14 @@ assembleControlEqProd(const WellState& well_state,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::CMODE_UNDEFINED: {
|
case Well::ProducerCMode::CMODE_UNDEFINED: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + well_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
"Well control must be specified for well " + well_.name(),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::NONE: {
|
case Well::ProducerCMode::NONE: {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Well control must be specified for well " + well_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
"Well control must be specified for well " + well_.name(),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,9 @@ checkConvergenceControlEq(const WellState& well_state,
|
|||||||
control_tolerance = tolerances.grup;
|
control_tolerance = tolerances.grup;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Unknown well control control types for well " << well_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
"Unknown well control control types for well " + well_.name(),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (well_.isProducer() )
|
else if (well_.isProducer() )
|
||||||
@ -101,7 +103,9 @@ checkConvergenceControlEq(const WellState& well_state,
|
|||||||
control_tolerance = tolerances.grup;
|
control_tolerance = tolerances.grup;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "Unknown well control control types for well " << well_.name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
"Unknown well control control types for well " + well_.name(),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#include <opm/simulators/wells/WellHelpers.hpp>
|
#include <opm/simulators/wells/WellHelpers.hpp>
|
||||||
#include <opm/simulators/wells/WellState.hpp>
|
#include <opm/simulators/wells/WellState.hpp>
|
||||||
#include <opm/simulators/wells/WellTest.hpp>
|
#include <opm/simulators/wells/WellTest.hpp>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -65,7 +68,7 @@ WellInterfaceGeneric::WellInterfaceGeneric(const Well& well,
|
|||||||
return perf1.ecl_index < perf2.ecl_index;
|
return perf1.ecl_index < perf2.ecl_index;
|
||||||
}));
|
}));
|
||||||
if (time_step < 0) {
|
if (time_step < 0) {
|
||||||
OPM_THROW(std::invalid_argument, "Negtive time step is used to construct WellInterface");
|
OPM_THROW(std::invalid_argument, "Negative time step is used to construct WellInterface");
|
||||||
}
|
}
|
||||||
|
|
||||||
ref_depth_ = well.getRefDepth();
|
ref_depth_ = well.getRefDepth();
|
||||||
@ -355,8 +358,11 @@ bool WellInterfaceGeneric::isVFPActive(DeferredLogger& deferred_logger) const
|
|||||||
if (vfp_properties_->getProd()->hasTable(table_id)) {
|
if (vfp_properties_->getProd()->hasTable(table_id)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "VFPPROD table " << std::to_string(table_id) << " is specified,"
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
<< " for well " << name() << ", while we could not access it during simulation", deferred_logger);
|
fmt::format("VFPPROD table {} is specified "
|
||||||
|
"for well {}, while we could not access it during simulation",
|
||||||
|
table_id, name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +374,11 @@ bool WellInterfaceGeneric::isVFPActive(DeferredLogger& deferred_logger) const
|
|||||||
if (vfp_properties_->getInj()->hasTable(table_id)) {
|
if (vfp_properties_->getInj()->hasTable(table_id)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "VFPINJ table " << std::to_string(table_id) << " is specified,"
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
<< " for well " << name() << ", while we could not access it during simulation", deferred_logger);
|
fmt::format("VFPINJ table {} is specified "
|
||||||
|
"for well {}, while we could not access it during simulation",
|
||||||
|
table_id, name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,9 +419,8 @@ void WellInterfaceGeneric::reportWellSwitching(const SingleWellState& ws, Deferr
|
|||||||
}
|
}
|
||||||
// only report the final switching
|
// only report the final switching
|
||||||
if (from != to) {
|
if (from != to) {
|
||||||
std::string msg = " Well " + name()
|
deferred_logger.info(fmt::format(" Well {} control mode changed from {} to {}",
|
||||||
+ " control mode changed from " + from + " to " + to;
|
name(), from, to));
|
||||||
deferred_logger.info(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include <dune/common/version.hh>
|
#include <dune/common/version.hh>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -941,7 +943,9 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
case Well::ProducerCMode::CRAT:
|
case Well::ProducerCMode::CRAT:
|
||||||
{
|
{
|
||||||
OPM_DEFLOG_THROW(std::runtime_error, "CRAT control not supported " << this->name(), deferred_logger);
|
OPM_DEFLOG_THROW(std::runtime_error,
|
||||||
|
fmt::format("CRAT control not supported, well {}", this->name()),
|
||||||
|
deferred_logger);
|
||||||
}
|
}
|
||||||
case Well::ProducerCMode::RESV:
|
case Well::ProducerCMode::RESV:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user