1. use scaled_messages_ to store scaled endpoints infor.

2. format the terminal output messages.
This commit is contained in:
Liu Ming 2016-01-05 11:05:37 +08:00
parent 1f809cf3d5
commit 5e234fcd21
2 changed files with 78 additions and 67 deletions

View File

@ -42,7 +42,7 @@ namespace Opm{
Opm::DeckConstPtr deck,
const UnstructuredGrid& grid)
{
std::cout << "***************Relperm Diagnostics***************\n";
std::cout << "\n\n***************Relperm Diagnostics***************\n\n";
phaseCheck_(deck);
satFamilyCheck_(eclState);
tableCheck_(eclState, deck);
@ -52,21 +52,30 @@ namespace Opm{
std::sort(messages_.begin(), messages_.end());
auto it = std::unique(messages_.begin(), messages_.end());
messages_.erase(it, messages_.end());
int counter = 1;
std::cout << "***************\nProblem found:\n";
std::cout << std::endl;
for (const auto& x : messages_) {
std::cout << counter << ". " << x << std::endl;
counter++;
std::cout << "--" << x << std::endl;
}
} else {
std::cout << "****************\nConsistency check all passed!" << std::endl;
}
std::cout << "Error summary:" << std::endl;
int limits = 0;
if (!scaled_messages_.empty()) {
std::cout << std::endl;
for (const auto& x : scaled_messages_) {
if (limits < 10) {
std::cout << "-- " << x << std::endl;
limits++;
} else {
std::cout << "\nMore inconsistencies exist. Check saturation function input and LOGFILE!" << std::endl;
break;
}
}
}
std::cout << "\n\nError summary:" << std::endl;
std::cout << "Warnings " << counter_.warning << std::endl;
std::cout << "Problems " << counter_.problem << std::endl;
std::cout << "Errors " << counter_.error << std::endl;
std::cout << "Bugs " << counter_.bug << std::endl;
std::cout << "********************************************************\n";
}
@ -143,14 +152,14 @@ namespace Opm{
bool family2 = !swfnTables.empty() && !sgfnTables.empty() && (!sof3Tables.empty() || !sof2Tables.empty()) && !sgwfnTables.empty();
if (family1 && family2) {
std::string msg = "Error: Saturation families should not be mixed.\n Use either SGOF and SWOF or SGFN, SWFN and SOF3.";
std::string msg = "Error: Saturation families should not be mixed.\n Use either SGOF and SWOF or SGFN, SWFN and SOF3.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (!family1 && !family2) {
std::string msg = "Error, Saturations function must be specified using either \n \
std::string msg = "Error, Saturations function must be specified using either \n \
family 1 or family 2 keywords \n \
Use either SGOF and SWOF or SGFN, SWFN and SOF3.";
messages_.push_back(msg);
@ -228,7 +237,7 @@ namespace Opm{
const auto& krow = swofTables.getKrowColumn();
///Check sw column.
if (sw.front() < 0.0 || sw.back() > 1.0) {
std::string msg = "Error: In SWOF table, saturation should be in range [0,1].";
std::string msg = "Error: In SWOF table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -236,13 +245,13 @@ namespace Opm{
///TODO check endpoint sw.back() == 1. - Sor.
///Check krw column.
if (krw.front() != 0.0) {
std::string msg = "Error: In SWOF table, first value of krw should be 0.";
std::string msg = "Error: In SWOF table, first value of krw should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krw.front() < 0.0 || krw.back() > 1.0) {
std::string msg = "Error: In SWOF table, krw should be in range [0,1].";
std::string msg = "Error: In SWOF table, krw should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -250,7 +259,7 @@ namespace Opm{
///Check krow column.
if (krow.front() > 1.0 || krow.back() < 0.0) {
std::string msg = "Error: In SWOF table, krow should be in range [0, 1].";
std::string msg = "Error: In SWOF table, krow should be in range [0, 1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -270,13 +279,13 @@ namespace Opm{
///Check sw column.
if (sg.front() < 0.0 || sg.back() > 1.0) {
std::string msg = "Error: In SGOF table, saturation should be in range [0,1].";
std::string msg = "Error: In SGOF table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (sg.front() != 0.0) {
std::string msg = "Error: In SGOF table, first value of sg should be 0.";
std::string msg = "Error: In SGOF table, first value of sg should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -284,13 +293,13 @@ namespace Opm{
///TODO check endpoint sw.back() == 1. - Sor.
///Check krw column.
if (krg.front() != 0.0) {
std::string msg = "Error: In SGOF table, first value of krg should be 0.";
std::string msg = "Error: In SGOF table, first value of krg should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krg.front() < 0.0 || krg.back() > 1.0) {
std::string msg = "Error: In SGOF table, krg should be in range [0,1].";
std::string msg = "Error: In SGOF table, krg should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -298,7 +307,7 @@ namespace Opm{
///Check krow column.
if (krog.front() > 1.0 || krog.back() < 0.0) {
std::string msg = "Error: In SGOF table, krog should be in range [0, 1].";
std::string msg = "Error: In SGOF table, krog should be in range [0, 1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -315,33 +324,33 @@ namespace Opm{
///Check sl column.
///TODO first value means sl = swco + sor
if (sl.front() < 0.0 || sl.back() > 1.0) {
std::string msg = "Error: In SLGOF table, saturation should be in range [0,1].";
std::string msg = "Error: In SLGOF table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (sl.back() != 1.0) {
std::string msg = "Error: In SLGOF table, last value of sl should be 1.";
std::string msg = "Error: In SLGOF table, last value of sl should be 1.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krg.front() > 1.0 || krg.back() < 0) {
std::string msg = "Error: In SLGOF table, krg shoule be in range [0, 1].";
std::string msg = "Error: In SLGOF table, krg shoule be in range [0, 1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krg.back() != 0.0) {
std::string msg = "Error: In SLGOF table, last value of krg hould be 0.";
std::string msg = "Error: In SLGOF table, last value of krg hould be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krog.front() < 0.0 || krog.back() > 1.0) {
std::string msg = "Error: In SLGOF table, krog shoule be in range [0, 1].";
std::string msg = "Error: In SLGOF table, krog shoule be in range [0, 1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -359,7 +368,7 @@ namespace Opm{
///Check sw column.
if (sw.front() < 0.0 || sw.back() > 1.0) {
std::string msg = "Error: In SWFN table, saturation should be in range [0,1].";
std::string msg = "Error: In SWFN table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -367,14 +376,14 @@ namespace Opm{
///Check krw column.
if (krw.front() < 0.0 || krw.back() > 1.0) {
std::string msg = "Error: In SWFN table, krw should be in range [0,1].";
std::string msg = "Error: In SWFN table, krw should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krw.front() != 0.0) {
std::string msg = "Error: In SWFN table, first value of krw should be 0.";
std::string msg = "Error: In SWFN table, first value of krw should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -392,7 +401,7 @@ namespace Opm{
///Check sg column.
if (sg.front() < 0.0 || sg.back() > 1.0) {
std::string msg = "Error: In SGFN table, saturation should be in range [0,1].";
std::string msg = "Error: In SGFN table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -400,13 +409,13 @@ namespace Opm{
///Check krg column.
if (krg.front() < 0.0 || krg.back() > 1.0) {
std::string msg = "Error: In SGFN table, krg should be in range [0,1].";
std::string msg = "Error: In SGFN table, krg should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krg.front() != 0.0) {
std::string msg = "Error: In SGFN table, first value of krg should be 0.";
std::string msg = "Error: In SGFN table, first value of krg should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -426,7 +435,7 @@ namespace Opm{
///Check so column.
///TODO: The max so = 1 - Swco
if (so.front() < 0.0 || so.back() > 1.0) {
std::string msg = "Error: In SOF3 table, saturation should be in range [0,1].";
std::string msg = "Error: In SOF3 table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -434,13 +443,13 @@ namespace Opm{
///Check krow column.
if (krow.front() < 0.0 || krow.back() > 1.0) {
std::string msg = "Error: In SOF3 table, krow should be in range [0,1].";
std::string msg = "Error: In SOF3 table, krow should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krow.front() != 0.0) {
std::string msg = "Error: In SOF3 table, first value of krow should be 0.";
std::string msg = "Error: In SOF3 table, first value of krow should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -448,21 +457,21 @@ namespace Opm{
///Check krog column.
if (krog.front() < 0.0 || krog.back() > 1.0) {
std::string msg = "Error: In SOF3 table, krog should be in range [0,1].";
std::string msg = "Error: In SOF3 table, krog should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krog.front() != 0.0) {
std::string msg = "Error: In SOF3 table, first value of krog should be 0.";
std::string msg = "Error: In SOF3 table, first value of krog should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krog.back() != krow.back()) {
std::string msg = "Error: In SOF3 table, max value of krog and krow should be the same.";
std::string msg = "Error: In SOF3 table, max value of krog and krow should be the same.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -481,7 +490,7 @@ namespace Opm{
///Check so column.
///TODO: The max so = 1 - Swco
if (so.front() < 0.0 || so.back() > 1.0) {
std::string msg = "Error: In SOF2 table, saturation should be in range [0,1].";
std::string msg = "Error: In SOF2 table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -489,13 +498,13 @@ namespace Opm{
///Check krow column.
if (kro.front() < 0.0 || kro.back() > 1.0) {
std::string msg = "Error: In SOF2 table, krow should be in range [0,1].";
std::string msg = "Error: In SOF2 table, krow should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (kro.front() != 0.0) {
std::string msg = "Error: In SOF2 table, first value of krow should be 0.";
std::string msg = "Error: In SOF2 table, first value of krow should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -514,7 +523,7 @@ namespace Opm{
///Check sg column.
if (sg.front() < 0.0 || sg.back() > 1.0) {
std::string msg = "Error: In SGWFN table, saturation should be in range [0,1].";
std::string msg = "Error: In SGWFN table, saturation should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -522,13 +531,13 @@ namespace Opm{
///Check krg column.
if (krg.front() < 0.0 || krg.back() > 1.0) {
std::string msg = "Error: In SGWFN table, krg should be in range [0,1].";
std::string msg = "Error: In SGWFN table, krg should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krg.front() != 0.0) {
std::string msg = "Error: In SGWFN table, first value of krg should be 0.";
std::string msg = "Error: In SGWFN table, first value of krg should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -537,13 +546,13 @@ namespace Opm{
///Check krgw column.
///TODO check saturation sw = 1. - sg
if (krgw.front() > 1.0 || krgw.back() < 0.0) {
std::string msg = "Error: In SGWFN table, krgw should be in range [0,1].";
std::string msg = "Error: In SGWFN table, krgw should be in range [0,1].";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
}
if (krgw.back() != 0.0) {
std::string msg = "Error: In SGWFN table, last value of krgw should be 0.";
std::string msg = "Error: In SGWFN table, last value of krgw should be 0.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Error, msg);
counter_.error += 1;
@ -566,20 +575,20 @@ namespace Opm{
const TableContainer& slgofTables = tables->getSlgofTables();
const TableContainer& sof3Tables = tables->getSof3Tables();
std::cout << "***************\nEnd-Points In all the Tables\n";
// std::cout << "***************\nEnd-Points In all the Tables\n";
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
unscaledEpsInfo_[satnumIdx].extractUnscaled(deck, eclState, satnumIdx);
std::cout << "*****Region" << satnumIdx + 1 << "*****" << std::endl;
unscaledEpsInfo_[satnumIdx].print();
// std::cout << "*****Region" << satnumIdx + 1 << "*****" << std::endl;
//unscaledEpsInfo_[satnumIdx].print();
///Consistency check.
if (unscaledEpsInfo_[satnumIdx].Sgu > (1. - unscaledEpsInfo_[satnumIdx].Swl)) {
std::string msg = "Error: Sgmax should not exceed 1-Swco.";
std::string msg = "Error: Sgmax should not exceed 1-Swco.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
}
if (unscaledEpsInfo_[satnumIdx].Sgl > (1. - unscaledEpsInfo_[satnumIdx].Swu)) {
std::string msg = "Error: Sgco should not exceed 1-Swmax.";
std::string msg = "Error: Sgco should not exceed 1-Swmax.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
@ -613,7 +622,7 @@ namespace Opm{
krog_value = table.evaluate("KROG" , Sou);
}
if (krow_value != krog_value) {
std::string msg = "Error: Krow(sSomax) should equal Krog(Somax).";
std::string msg = "Error: Krow(sSomax) should equal Krog(Somax).";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
@ -622,13 +631,13 @@ namespace Opm{
///Krw(Sw=0)=Krg(Sg=0)=Krow(So=0)=Krog(So=0)=0.
///Mobile fluid requirements
if (((unscaledEpsInfo_[satnumIdx].Sowcr + unscaledEpsInfo_[satnumIdx].Swcr)-1) >= 0) {
std::string msg = "Error: Sowcr + Swcr should less than 1.";
std::string msg = "Error: Sowcr + Swcr should less than 1.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
}
if (((unscaledEpsInfo_[satnumIdx].Sogcr + unscaledEpsInfo_[satnumIdx].Sgcr + unscaledEpsInfo_[satnumIdx].Swl) - 1 ) > 0) {
std::string msg = "Error: Sogcr + Sgcr + Swco should less than 1.";
std::string msg = "Error: Sogcr + Sgcr + Swco should less than 1.";
messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
@ -672,16 +681,16 @@ namespace Opm{
// SGU <= 1.0 - SWL
if (scaledEpsInfo_[c].Sgu > (1.0 - scaledEpsInfo_[c].Swl)) {
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SGU exceed 1.0 - SWL";
messages_.push_back(msg);
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SGU exceed 1.0 - SWL";
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
}
// SGL <= 1.0 - SWU
if (scaledEpsInfo_[c].Sgl > (1.0 - scaledEpsInfo_[c].Swu)) {
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SGL exceed 1.0 - SWU";
messages_.push_back(msg);
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SGL exceed 1.0 - SWU";
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
}
@ -689,15 +698,15 @@ namespace Opm{
if (deck->hasKeyword("SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) {
// Mobilility check.
if ((scaledEpsInfo_[c].Sowcr + scaledEpsInfo_[c].Swcr) >= 1.0) {
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SOWCR + SWCR exceed 1.0";
messages_.push_back(msg);
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SOWCR + SWCR exceed 1.0";
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
}
if ((scaledEpsInfo_[c].Sogcr + scaledEpsInfo_[c].Sgcr + scaledEpsInfo_[c].Swl) >= 1.0) {
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SOGCR + SGCR + SWL exceed 1.0";
messages_.push_back(msg);
std::string msg = "Error: For scaled endpoints input, cell" + cellIdx + " SOGCR + SGCR + SWL exceed 1.0";
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.error += 1;
}
@ -706,21 +715,21 @@ namespace Opm{
if (fluidSystem_ != FluidSystem::WaterGas) {
if (scaledEpsInfo_[c].Swl > scaledEpsInfo_[c].Swcr) {
std::string msg = "Warning: For scaled endpoints input, cell" + cellIdx + " SWL > SWCR";
messages_.push_back(msg);
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.warning += 1;
}
if (scaledEpsInfo_[c].Swcr > scaledEpsInfo_[c].Sowcr) {
std::string msg = "Warning: For scaled endpoints input, cell" + cellIdx + " SWCR > SOWCR";
messages_.push_back(msg);
scaled_messages_.push_back(msg);
streamLog_->addMessage(Opm::Log::MessageType::Warning, msg);
counter_.warning += 1;
}
if (scaledEpsInfo_[c].Sowcr > scaledEpsInfo_[c].Swu) {
std::string msg = "Warning: For scaled endpoints input, cell" + cellIdx + " SOWCR > SWU";
messages_.push_back(msg);
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.warning += 1;
}
@ -729,7 +738,7 @@ namespace Opm{
if (fluidSystem_ != FluidSystem::OilWater) {
if (scaledEpsInfo_[c].Sgl > scaledEpsInfo_[c].Sgcr) {
std::string msg = "Warning: For scaled endpoints input, cell" + cellIdx + " SGL > SGCR";
messages_.push_back(msg);
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.warning += 1;
}
@ -738,14 +747,14 @@ namespace Opm{
if (fluidSystem_ != FluidSystem::BlackOil) {
if (scaledEpsInfo_[c].Sgcr > scaledEpsInfo_[c].Sogcr) {
std::string msg = "Warning: For scaled endpoints input, cell" + cellIdx + " SGCR > SOGCR";
messages_.push_back(msg);
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.warning += 1;
}
if (scaledEpsInfo_[c].Sogcr > scaledEpsInfo_[c].Sgu) {
std::string msg = "Warning: For scaled endpoints input, cell" + cellIdx + " SOGCR > SGU";
messages_.push_back(msg);
scaled_messages_.push_back(msg);
streamLog_->addMessage(Log::MessageType::Warning, msg);
counter_.warning += 1;
}

View File

@ -95,6 +95,8 @@ namespace Opm {
std::vector<Opm::EclEpsScalingPointsInfo<double> > scaledEpsInfo_;
std::vector<std::string> messages_;
///Store scaled information.
std::vector<std::string> scaled_messages_;
///Use OpmLog
std::shared_ptr<Opm::StreamLog> streamLog_;