mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
BlackoilWellModelConstraints: use fmt::format
This commit is contained in:
parent
86bbd38a55
commit
de13e5018a
@ -29,7 +29,8 @@
|
|||||||
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
||||||
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
@ -384,17 +385,17 @@ actionOnBrokenConstraints(const Group& group,
|
|||||||
{
|
{
|
||||||
auto oldControl = wellModel_.groupState().injection_control(group.name(), controlPhase);
|
auto oldControl = wellModel_.groupState().injection_control(group.name(), controlPhase);
|
||||||
|
|
||||||
std::ostringstream ss;
|
|
||||||
if (oldControl != newControl) {
|
if (oldControl != newControl) {
|
||||||
const std::string from = Group::InjectionCMode2String(oldControl);
|
const std::string from = Group::InjectionCMode2String(oldControl);
|
||||||
ss << "Switching injection control mode for group "<< group.name()
|
|
||||||
<< " from " << Group::InjectionCMode2String(oldControl)
|
|
||||||
<< " to " << Group::InjectionCMode2String(newControl);
|
|
||||||
group_state.injection_control(group.name(), controlPhase, newControl);
|
group_state.injection_control(group.name(), controlPhase, newControl);
|
||||||
|
if (wellModel_.comm().rank() == 0) {
|
||||||
|
auto msg = fmt::format("Switching injection control mode for group {} from {} to {}",
|
||||||
|
group.name(),
|
||||||
|
Group::InjectionCMode2String(oldControl),
|
||||||
|
Group::InjectionCMode2String(newControl));
|
||||||
|
deferred_logger.info(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ss.str().empty() && wellModel_.comm().rank() == 0)
|
|
||||||
deferred_logger.info(ss.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackoilWellModelConstraints::
|
void BlackoilWellModelConstraints::
|
||||||
@ -406,12 +407,12 @@ actionOnBrokenConstraints(const Group& group,
|
|||||||
{
|
{
|
||||||
const Group::ProductionCMode oldControl = wellModel_.groupState().production_control(group.name());
|
const Group::ProductionCMode oldControl = wellModel_.groupState().production_control(group.name());
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::string ss;
|
||||||
|
|
||||||
switch(exceed_action) {
|
switch(exceed_action) {
|
||||||
case Group::ExceedAction::NONE: {
|
case Group::ExceedAction::NONE: {
|
||||||
if (oldControl != newControl && oldControl != Group::ProductionCMode::NONE) {
|
if (oldControl != newControl && oldControl != Group::ProductionCMode::NONE) {
|
||||||
ss << "Group production exceed action is NONE for group " + group.name() + ". Nothing happens.";
|
ss = fmt::format("Group production exceed action is NONE for group {}. Nothing happens.",
|
||||||
|
group.name());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -434,9 +435,10 @@ actionOnBrokenConstraints(const Group& group,
|
|||||||
case Group::ExceedAction::RATE: {
|
case Group::ExceedAction::RATE: {
|
||||||
if (oldControl != newControl) {
|
if (oldControl != newControl) {
|
||||||
group_state.production_control(group.name(), newControl);
|
group_state.production_control(group.name(), newControl);
|
||||||
ss << "Switching production control mode for group "<< group.name()
|
ss = fmt::format("Switching production control mode for group {} from {} to {}",
|
||||||
<< " from " << Group::ProductionCMode2String(oldControl)
|
group.name(),
|
||||||
<< " to " << Group::ProductionCMode2String(newControl);
|
Group::ProductionCMode2String(oldControl),
|
||||||
|
Group::ProductionCMode2String(newControl));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -444,8 +446,8 @@ actionOnBrokenConstraints(const Group& group,
|
|||||||
throw("Invalid procedure for maximum rate limit selected for group" + group.name());
|
throw("Invalid procedure for maximum rate limit selected for group" + group.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ss.str().empty() && wellModel_.comm().rank() == 0)
|
if (!ss.empty() && wellModel_.comm().rank() == 0)
|
||||||
deferred_logger.debug(ss.str());
|
deferred_logger.debug(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackoilWellModelConstraints::
|
bool BlackoilWellModelConstraints::
|
||||||
|
Loading…
Reference in New Issue
Block a user