Merge pull request #1019 from qilicun/log-more-messages

Write more messages into OpmLog.
This commit is contained in:
Atgeirr Flø Rasmussen 2016-05-26 11:20:49 +02:00
commit 2faff12696
7 changed files with 115 additions and 22 deletions

View File

@ -22,6 +22,7 @@
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/core/utility/Units.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/core/utility/linearInterpolation.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/RocktabTable.hpp>
@ -64,14 +65,16 @@ namespace Opm
if (rockKeyword.size() != 1) {
// here it would be better not to use std::cout directly but to add the
// warning to some "warning list"...
std::cout << "Can only handle a single region in ROCK ("<<rockKeyword.size()<<" regions specified)."
<< " Ignoring all except for the first.\n";
OpmLog::warning("Can only handle a single region in ROCK ("
+ std::to_string(rockKeyword.size())
+ " regions specified)."
+ " Ignoring all except for the first.");
}
pref_ = rockKeyword.getRecord(0).getItem("PREF").getSIDouble(0);
rock_comp_ = rockKeyword.getRecord(0).getItem("COMPRESSIBILITY").getSIDouble(0);
} else {
std::cout << "**** warning: no rock compressibility data found in deck (ROCK or ROCKTAB)." << std::endl;
OpmLog::warning("No rock compressibility data found in deck (ROCK or ROCKTAB).");
}
}

View File

@ -18,4 +18,40 @@ namespace Opm
}
std::string
InjectionSpecification::toString(const ControlMode& mode)
{
switch(mode) {
case ControlMode::NONE: return "NONE";
case ControlMode::RATE: return "RATE";
case ControlMode::RESV: return "RESV";
case ControlMode::BHP : return "BHP" ;
case ControlMode::THP : return "THP" ;
case ControlMode::REIN: return "REIN";
case ControlMode::VREP: return "VREP";
case ControlMode::GRUP: return "GRUP";
case ControlMode::FLD : return "FLD" ;
}
}
std::string
InjectionSpecification::toString(const InjectorType& type)
{
switch(type) {
case InjectorType::WATER: return "WATER";
case InjectorType::OIL : return "OIL" ;
case InjectorType::GAS : return "GAS" ;
}
}
std::string
InjectionSpecification::toString(const GuideRateType& type)
{
switch(type) {
case GuideRateType::RAT : return "RAT" ;
case GuideRateType::NONE_GRT: return "NONE_GRT";
}
}
} // namespace Opm

View File

@ -2,6 +2,7 @@
#define OPM_INJECTORSPECIFICATION_HPP
#include <opm/core/wells.h>
#include <string>
namespace Opm
{
@ -25,7 +26,9 @@ namespace Opm
};
InjectionSpecification();
static std::string toString(const ControlMode& mode);
static std::string toString(const InjectorType& type);
static std::string toString(const GuideRateType& type);
InjectorType injector_type_;
ControlMode control_mode_;
double surface_flow_max_rate_;

View File

@ -19,4 +19,48 @@ namespace Opm
{
}
std::string
ProductionSpecification::toString(const ControlMode& mode)
{
switch(mode) {
case ControlMode::NONE: return "NONE";
case ControlMode::ORAT: return "ORAT";
case ControlMode::WRAT: return "WRAT";
case ControlMode::GRAT: return "GRAT";
case ControlMode::LRAT: return "LRAT";
case ControlMode::CRAT: return "CRAT";
case ControlMode::RESV: return "RESV";
case ControlMode::PRBL: return "RPBL";
case ControlMode::BHP : return "BHP" ;
case ControlMode::THP : return "THP" ;
case ControlMode::GRUP: return "GRUP";
case ControlMode::FLD : return "FLD" ;
}
}
std::string
ProductionSpecification::toString(const Procedure& type)
{
switch(type) {
case Procedure::NONE_P: return "NONE_P";
case Procedure::RATE : return "RATE" ;
case Procedure::WELL : return "WELL" ;
}
}
std::string
ProductionSpecification::toString(const GuideRateType& type)
{
switch(type) {
case GuideRateType::OIL : return "OIL" ;
case GuideRateType::GAS : return "GAS" ;
case GuideRateType::WATER : return "WATER" ;
case GuideRateType::NONE_GRT: return "NONE_GRT";
}
}
}

View File

@ -2,6 +2,7 @@
#define OPM_PRODUCTIONSPECIFICATION_HPP
#include <opm/core/wells.h>
#include <string>
namespace Opm
{
@ -25,6 +26,9 @@ namespace Opm
};
ProductionSpecification();
static std::string toString(const ControlMode& mode);
static std::string toString(const Procedure& type);
static std::string toString(const GuideRateType& type);
ControlMode control_mode_;
Procedure procedure_;

View File

@ -345,9 +345,10 @@ namespace Opm
mode);
if (my_rate > target_rate) {
std::cout << "Group " << mode<<" target not met for group " << name() << std::endl;
std::cout << "target = " << target_rate << '\n'
<< "rate = " << my_rate << std::endl;
OpmLog::warning("Group " + InjectionSpecification::toString(mode)
+ " target not met for group " + name() + "\n"
+ "target = " + std::to_string(target_rate) + "\n"
+ "rate = " + std::to_string(my_rate));
applyInjGroupControl(mode, target_rate, true);
injSpec().control_mode_ = mode;
return false;
@ -377,9 +378,10 @@ namespace Opm
child_phases_summed.surf_prod_rates,
mode);
if (std::fabs(my_rate) > target_rate) {
std::cout << "Group" << mode << " target not met for group " << name() << std::endl;
std::cout << "target = " << target_rate << '\n'
<< "rate = " << my_rate << std::endl;
OpmLog::warning("Group" + ProductionSpecification::toString(mode)
+ " target not met for group " + name() + "\n"
+ "target = " + std::to_string(target_rate) + '\n'
+ "rate = " + std::to_string(my_rate));
production_violated = true;
production_mode_violated = mode;
break;
@ -677,9 +679,9 @@ namespace Opm
ctrl_violated = is_producer ? (my_target_bhp > my_well_bhp)
: (my_target_bhp < my_well_bhp);
if (ctrl_violated) {
std::cout << "BHP limit violated for well " << name() << ":\n";
std::cout << "BHP limit = " << my_target_bhp << std::endl;
std::cout << "BHP = " << my_well_bhp << std::endl;
OpmLog::info("BHP limit violated for well " + name() + ":\n"
+ "BHP limit = " + std::to_string(my_target_bhp)
+ "BHP = " + std::to_string(my_well_bhp));
}
break;
}
@ -698,9 +700,9 @@ namespace Opm
const double my_rate_target = well_controls_iget_target(ctrls , ctrl_index);
ctrl_violated = std::fabs(my_rate) - std::fabs(my_rate_target)> std::max(std::abs(my_rate), std::abs(my_rate_target))*1e-6;
if (ctrl_violated) {
std::cout << "RESERVOIR_RATE limit violated for well " << name() << ":\n";
std::cout << "rate limit = " << my_rate_target << std::endl;
std::cout << "rate = " << my_rate << std::endl;
OpmLog::info("RESERVOIR_RATE limit violated for well " + name() + ":\n"
+ "rate limit = " + std::to_string(my_rate_target)
+ "rate = " + std::to_string(my_rate));
}
break;
}
@ -714,9 +716,9 @@ namespace Opm
const double my_rate_target = well_controls_iget_target(ctrls , ctrl_index);
ctrl_violated = std::fabs(my_rate) > std::fabs(my_rate_target);
if (ctrl_violated) {
std::cout << "SURFACE_RATE limit violated for well " << name() << ":\n";
std::cout << "rate limit = " << my_rate_target << std::endl;
std::cout << "rate = " << my_rate << std::endl;
OpmLog::info("SURFACE_RATE limit violated for well " + name() + ":\n"
+ "rate limit = " + std::to_string(my_rate_target)
+ "rate = " + std::to_string(my_rate));
}
break;
}

View File

@ -2,6 +2,7 @@
#include <opm/core/grid/GridHelpers.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/core/utility/compressedToCartesian.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
@ -233,9 +234,9 @@ void WellsManager::createWellsFromSpecs(std::vector<WellConstPtr>& wells, size_t
// Check that the complete well is on this process
if ( sum_completions_on_proc < completionSet->size() )
{
std::cout<< "Well "<< well->name() << " does not seem to be"
<< "completely in the disjoint partition of "
<< "process. Therefore we deactivate it here." << std::endl;
OpmLog::warning("Well " + well->name() + " does not seem to be"
+ "completely in the disjoint partition of "
+ "process. Therefore we deactivate it here.");
// Mark well as not existent on this process
wells_on_proc[wellIter-wells.begin()] = 0;
wellperf_data[well_index_on_proc].clear();