Remove Spurious Blank Lines in PRT File Reports

The StreamLog::addMessageUnconditionally() member function will end
each message with a newline (std::endl) so we should not add such
newlines ourselves.  The extra newline characters produce spurious
blank lines in the report sheets, e.g., for the "PRODUCTION REPORT".

This commit removes the last newline character from each report
request, thus deferring that responsibility to OpmLog::note()
instead.  Doing so, however, means we have take a little more care
with the first line of each report lest we create report sheets
which are smushed together.
This commit is contained in:
Bård Skaflestad 2023-12-07 15:29:08 +01:00
parent 6b18cbafc6
commit ec549df37b
3 changed files with 24 additions and 20 deletions

View File

@ -318,6 +318,8 @@ public:
eclOutputModule_->outputProdLog(reportStepNum, forceDisableProdOutput); eclOutputModule_->outputProdLog(reportStepNum, forceDisableProdOutput);
eclOutputModule_->outputInjLog(reportStepNum, forceDisableInjOutput); eclOutputModule_->outputInjLog(reportStepNum, forceDisableInjOutput);
eclOutputModule_->outputCumLog(reportStepNum, forceDisableCumOutput); eclOutputModule_->outputCumLog(reportStepNum, forceDisableCumOutput);
OpmLog::note(""); // Blank line after all reports.
} }
} }

View File

@ -571,7 +571,7 @@ outputCumulativeReport_(const std::vector<Scalar>& wellCum,
const UnitSystem& units = eclState_.getUnits(); const UnitSystem& units = eclState_.getUnits();
std::ostringstream ss; std::ostringstream ss;
if (wellCumNames[WellCumDataType::WellName].empty()) { if (wellCumNames[WellCumDataType::WellName].empty()) {
ss << "=================================================== CUMULATIVE PRODUCTION/INJECTION REPORT =========================================\n" ss << "\n=================================================== CUMULATIVE PRODUCTION/INJECTION REPORT =========================================\n"
<< ": WELL : LOCATION : WELL :CTRL: OIL : WATER : GAS : Prod : OIL : WATER : GAS : INJ :\n" << ": WELL : LOCATION : WELL :CTRL: OIL : WATER : GAS : Prod : OIL : WATER : GAS : INJ :\n"
<< ": NAME : (I,J,K) : TYPE :MODE: PROD : PROD : PROD : RES.VOL. : INJ : INJ : INJ : RES.VOL. :\n"; << ": NAME : (I,J,K) : TYPE :MODE: PROD : PROD : PROD : RES.VOL. : INJ : INJ : INJ : RES.VOL. :\n";
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
@ -580,8 +580,9 @@ outputCumulativeReport_(const std::vector<Scalar>& wellCum,
ss << ": : : : : MSTB : MSTB : MMSCF : MRB : MSTB : MSTB : MMSCF : MRB :\n"; ss << ": : : : : MSTB : MSTB : MMSCF : MRB : MSTB : MSTB : MMSCF : MRB :\n";
} else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) { } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) {
ss << ": : : : : MSCC : MSCC : MMSCC : MRCC : MSCC : MSCC : MMSCC : MRCC :\n"; ss << ": : : : : MSCC : MSCC : MMSCC : MRCC : MSCC : MSCC : MMSCC : MRCC :\n";
ss << ":--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:";
} }
ss << "====================================================================================================================================\n"; ss << "====================================================================================================================================";
} else { } else {
if (wellCum[WellCumDataType::WellLocationi] < 1) { if (wellCum[WellCumDataType::WellLocationi] < 1) {
ss << std::right << std::fixed << std::setprecision(0) << ":" << std::setw (8) ss << std::right << std::fixed << std::setprecision(0) << ":" << std::setw (8)
@ -613,7 +614,7 @@ outputCumulativeReport_(const std::vector<Scalar>& wellCum,
<< std::setw(11) << wellCum[WellCumDataType::GasInj] / 1000.0 << ":" << std::setw(11) << wellCum[WellCumDataType::GasInj] / 1000.0 << ":"
<< std::setw(11) << wellCum[WellCumDataType::FluidResVolInj] / 1000.0 << ": \n"; << std::setw(11) << wellCum[WellCumDataType::FluidResVolInj] / 1000.0 << ": \n";
} }
ss << ":--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: \n"; ss << ":--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:";
} }
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }
@ -626,7 +627,7 @@ outputInjectionReport_(const std::vector<Scalar>& wellInj,
const UnitSystem& units = eclState_.getUnits(); const UnitSystem& units = eclState_.getUnits();
std::ostringstream ss; std::ostringstream ss;
if (wellInjNames[WellInjDataType::WellName].empty()) { if (wellInjNames[WellInjDataType::WellName].empty()) {
ss << "=================================================== INJECTION REPORT ========================================\n"//===================== \n" ss << "\n=================================================== INJECTION REPORT ========================================\n"//===================== \n"
<< ": WELL : LOCATION : CTRL : CTRL : CTRL : OIL : WATER : GAS : FLUID : BHP OR : THP OR :\n"// STEADY-ST II :\n" << ": WELL : LOCATION : CTRL : CTRL : CTRL : OIL : WATER : GAS : FLUID : BHP OR : THP OR :\n"// STEADY-ST II :\n"
<< ": NAME : (I,J,K) : MODE : MODE : MODE : RATE : RATE : RATE : RES.VOL. : CON.PR.: BLK.PR.:\n";// OR POTENTIAL :\n"; << ": NAME : (I,J,K) : MODE : MODE : MODE : RATE : RATE : RATE : RES.VOL. : CON.PR.: BLK.PR.:\n";// OR POTENTIAL :\n";
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
@ -635,8 +636,9 @@ outputInjectionReport_(const std::vector<Scalar>& wellInj,
ss << ": : : OIL : WAT : GAS : STB/DAY : STB/DAY : MSCF/DAY : RB/DAY : PSIA : PSIA :\n";// :\n"; ss << ": : : OIL : WAT : GAS : STB/DAY : STB/DAY : MSCF/DAY : RB/DAY : PSIA : PSIA :\n";// :\n";
} else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) { } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) {
ss << ": : : OIL : WAT : GAS : SCC/HR : SCC/HR : SCC/HR : RCC/HR : ATMA : ATMA :\n";// :\n"; ss << ": : : OIL : WAT : GAS : SCC/HR : SCC/HR : SCC/HR : RCC/HR : ATMA : ATMA :\n";// :\n";
ss << ":--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:";//--------------------:";
} }
ss << "==============================================================================================================\n";//===================== \n"; ss << "==============================================================================================================";//=====================";
} else { } else {
if (wellInj[WellInjDataType::WellLocationi] < 1) { if (wellInj[WellInjDataType::WellLocationi] < 1) {
ss << std::right << std::fixed << std::setprecision(0) << ":" ss << std::right << std::fixed << std::setprecision(0) << ":"
@ -665,7 +667,7 @@ outputInjectionReport_(const std::vector<Scalar>& wellInj,
<< std::setw(8) << wellInj[WellInjDataType::BHP] << ":" << std::setw(8) << wellInj[WellInjDataType::BHP] << ":"
<< std::setw(8)<< wellInj[WellInjDataType::THP] << ": \n";//wellInj[WellInjDataType::SteadyStateII] << std::setw(10) << "\n" << std::setw(8)<< wellInj[WellInjDataType::THP] << ": \n";//wellInj[WellInjDataType::SteadyStateII] << std::setw(10) << "\n"
} }
ss << ":--------:-----------:------:------:------:------------:----------:-----------:-----------:--------:--------: \n";//--------------------:\n"; ss << ":--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:";//--------------------:";
} }
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }
@ -678,7 +680,7 @@ outputProductionReport_(const std::vector<Scalar>& wellProd,
const UnitSystem& units = eclState_.getUnits(); const UnitSystem& units = eclState_.getUnits();
std::ostringstream ss; std::ostringstream ss;
if (wellProdNames[WellProdDataType::WellName].empty()) { if (wellProdNames[WellProdDataType::WellName].empty()) {
ss << "======================================================= PRODUCTION REPORT =======================================================\n"//=================== \n" ss << "\n======================================================= PRODUCTION REPORT =======================================================\n"//=================== \n"
<< ": WELL : LOCATION :CTRL: OIL : WATER : GAS : FLUID : WATER : GAS/OIL : WAT/GAS : BHP OR : THP OR :\n"// STEADY-ST PI :\n" << ": WELL : LOCATION :CTRL: OIL : WATER : GAS : FLUID : WATER : GAS/OIL : WAT/GAS : BHP OR : THP OR :\n"// STEADY-ST PI :\n"
<< ": NAME : (I,J,K) :MODE: RATE : RATE : RATE : RES.VOL. : CUT : RATIO : RATIO : CON.PR.: BLK.PR.:\n";// OR POTN OF PREF. PH:\n"; << ": NAME : (I,J,K) :MODE: RATE : RATE : RATE : RES.VOL. : CUT : RATIO : RATIO : CON.PR.: BLK.PR.:\n";// OR POTN OF PREF. PH:\n";
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
@ -688,7 +690,7 @@ outputProductionReport_(const std::vector<Scalar>& wellProd,
} else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) { } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) {
ss << ": : : : SCC/HR : SCC/HR : SCC/HR : RCC : SCC/SCC : SCC/SCC : SCC/SCC : ATMA : ATMA :\n";// :\n"; ss << ": : : : SCC/HR : SCC/HR : SCC/HR : RCC : SCC/SCC : SCC/SCC : SCC/SCC : ATMA : ATMA :\n";// :\n";
} }
ss << "=================================================================================================================================\n";//=================== \n"; ss << "=================================================================================================================================";//===================";
} else { } else {
if (wellProd[WellProdDataType::WellLocationi] < 1) { if (wellProd[WellProdDataType::WellLocationi] < 1) {
ss << std::right << std::fixed << ":" ss << std::right << std::fixed << ":"
@ -730,7 +732,7 @@ outputProductionReport_(const std::vector<Scalar>& wellProd,
<< std::setfill ('-') << std::setw (11) << ":" << std::setfill ('-') << std::setw (11) << ":"
<< std::setfill ('-') << std::setw (13) << ":" << std::setfill ('-') << std::setw (13) << ":"
<< std::setfill ('-') << std::setw (9) << ":" << std::setfill ('-') << std::setw (9) << ":"
<< std::setfill ('-') << std::setw (9) << ":" << "\n"; << std::setfill ('-') << std::setw (9) << ':';
} }
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }
@ -808,7 +810,7 @@ outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
<< std::setw(14) << oip[Inplace::Phase::GasInGasPhase] << std::setw(14) << oip[Inplace::Phase::GasInGasPhase]
<< std::setw(14) << oip[Inplace::Phase::GasInLiquidPhase] << std::setw(14) << oip[Inplace::Phase::GasInLiquidPhase]
<< std::setw(14) << oip[Inplace::Phase::GAS] << ":\n" << std::setw(14) << oip[Inplace::Phase::GAS] << ":\n"
<< ":========================:==========================================:================:==========================================:\n"; << ":========================:==========================================:================:==========================================:";
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }
@ -825,7 +827,7 @@ outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
const UnitSystem& units = eclState_.getUnits(); const UnitSystem& units = eclState_.getUnits();
std::ostringstream ss; std::ostringstream ss;
if (reg == 0) { if (reg == 0) {
ss << " ===================================\n"; ss << "\n ===================================\n";
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
ss << " : RESERVOIR VOLUMES M3 :\n"; ss << " : RESERVOIR VOLUMES M3 :\n";
} else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) { } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) {
@ -835,7 +837,7 @@ outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
<< ": REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :\n" << ": REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :\n"
<< ": : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :\n" << ": : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :\n"
<< ": : : OIL : WATER : GAS : HYDRO-CARBON :\n" << ": : : OIL : WATER : GAS : HYDRO-CARBON :\n"
<< ":---------:---------------:---------------:---------------:---------------:---------------\n"; << ":---------:---------------:---------------:---------------:---------------:---------------";
} }
else { else {
ss << std::right << std::fixed << std::setprecision(0) << ":" ss << std::right << std::fixed << std::setprecision(0) << ":"
@ -846,7 +848,7 @@ outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
<< std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":" << std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":"
<< std::setw(15) << cipr[Inplace::Phase::OilResVolume] + << std::setw(15) << cipr[Inplace::Phase::OilResVolume] +
cipr[Inplace::Phase::GasResVolume] << ":\n" cipr[Inplace::Phase::GasResVolume] << ":\n"
<< ":---------:---------------:---------------:---------------:---------------:---------------:\n"; << ":---------:---------------:---------------:---------------:---------------:---------------:";
} }
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }

View File

@ -99,13 +99,13 @@ BOOST_AUTO_TEST_CASE(Cumulative)
: : : : : MSTB : MSTB : MMSCF : MRB : MSTB : MSTB : MMSCF : MRB : : : : : : MSTB : MSTB : MMSCF : MRB : MSTB : MSTB : MMSCF : MRB :
==================================================================================================================================== ====================================================================================================================================
: FIELD: : : : 1.0: 2.0: 3.0: 4.0: 5.0: 6.0: 7.0: 8.0: : FIELD: : : : 1.0: 2.0: 3.0: 4.0: 5.0: 6.0: 7.0: 8.0:
:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: :--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:
: G1: : : : 9.0: 10.0: 11.0: 12.0: 13.0: 14.0: 15.0: 15.0: : G1: : : : 9.0: 10.0: 11.0: 12.0: 13.0: 14.0: 15.0: 15.0:
:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: :--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:
: PROD: 10, 10: PROD:ORAT: 16.0: 17.0: 18.0: 19.0: 20.0: 21.0: 22.0: 23.0: : PROD: 10, 10: PROD:ORAT: 16.0: 17.0: 18.0: 19.0: 20.0: 21.0: 22.0: 23.0:
:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: :--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:
: INJ: 1, 1: INJ:GRAT: 24.0: 25.0: 26.0: 27.0: 28.0: 29.0: 30.0: 31.0: : INJ: 1, 1: INJ:GRAT: 24.0: 25.0: 26.0: 27.0: 28.0: 29.0: 30.0: 31.0:
:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: :--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:
)"; )";
std::stringstream str; std::stringstream str;
@ -335,11 +335,11 @@ BOOST_AUTO_TEST_CASE(Injection)
: : : OIL : WAT : GAS : STB/DAY : STB/DAY : MSCF/DAY : RB/DAY : PSIA : PSIA : : : : OIL : WAT : GAS : STB/DAY : STB/DAY : MSCF/DAY : RB/DAY : PSIA : PSIA :
============================================================================================================== ==============================================================================================================
: FIELD: : : : : 1.0: 2.0: 3.0: 4.0: : : : FIELD: : : : : 1.0: 2.0: 3.0: 4.0: : :
:--------:-----------:------:------:------:------------:----------:-----------:-----------:--------:--------: :--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:
: G1: : : : : 5.0: 6.0: 7.0: 8.0: : : : G1: : : : : 5.0: 6.0: 7.0: 8.0: : :
:--------:-----------:------:------:------:------------:----------:-----------:-----------:--------:--------: :--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:
: INJ: 1, 1: : : GRAT: 9.0: 10.0: 11.0: 12.0: 13.0: 14.0: : INJ: 1, 1: : : GRAT: 9.0: 10.0: 11.0: 12.0: 13.0: 14.0:
:--------:-----------:------:------:------:------------:----------:-----------:-----------:--------:--------: :--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:
)"; )";
std::stringstream str; std::stringstream str;