From ec549df37ba42b1378bf92e88adeef1b01b03eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 7 Dec 2023 15:29:08 +0100 Subject: [PATCH] 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. --- ebos/eclwriter.hh | 2 ++ opm/simulators/flow/LogOutputHelper.cpp | 28 +++++++++++++------------ tests/test_LogOutputHelper.cpp | 14 ++++++------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index cfe66f442..df7fd3799 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -318,6 +318,8 @@ public: eclOutputModule_->outputProdLog(reportStepNum, forceDisableProdOutput); eclOutputModule_->outputInjLog(reportStepNum, forceDisableInjOutput); eclOutputModule_->outputCumLog(reportStepNum, forceDisableCumOutput); + + OpmLog::note(""); // Blank line after all reports. } } diff --git a/opm/simulators/flow/LogOutputHelper.cpp b/opm/simulators/flow/LogOutputHelper.cpp index 9087fe40b..ef0833610 100644 --- a/opm/simulators/flow/LogOutputHelper.cpp +++ b/opm/simulators/flow/LogOutputHelper.cpp @@ -571,7 +571,7 @@ outputCumulativeReport_(const std::vector& wellCum, const UnitSystem& units = eclState_.getUnits(); std::ostringstream ss; 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" << ": 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) { @@ -580,8 +580,9 @@ outputCumulativeReport_(const std::vector& wellCum, ss << ": : : : : MSTB : MSTB : MMSCF : MRB : MSTB : MSTB : MMSCF : MRB :\n"; } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_LAB) { ss << ": : : : : MSCC : MSCC : MMSCC : MRCC : MSCC : MSCC : MMSCC : MRCC :\n"; + ss << ":--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:"; } - ss << "====================================================================================================================================\n"; + ss << "===================================================================================================================================="; } else { if (wellCum[WellCumDataType::WellLocationi] < 1) { ss << std::right << std::fixed << std::setprecision(0) << ":" << std::setw (8) @@ -613,7 +614,7 @@ outputCumulativeReport_(const std::vector& wellCum, << std::setw(11) << wellCum[WellCumDataType::GasInj] / 1000.0 << ":" << std::setw(11) << wellCum[WellCumDataType::FluidResVolInj] / 1000.0 << ": \n"; } - ss << ":--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: \n"; + ss << ":--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------:"; } OpmLog::note(ss.str()); } @@ -626,7 +627,7 @@ outputInjectionReport_(const std::vector& wellInj, const UnitSystem& units = eclState_.getUnits(); std::ostringstream ss; 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" << ": 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) { @@ -635,8 +636,9 @@ outputInjectionReport_(const std::vector& wellInj, 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) { ss << ": : : OIL : WAT : GAS : SCC/HR : SCC/HR : SCC/HR : RCC/HR : ATMA : ATMA :\n";// :\n"; + ss << ":--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:";//--------------------:"; } - ss << "==============================================================================================================\n";//===================== \n"; + ss << "==============================================================================================================";//====================="; } else { if (wellInj[WellInjDataType::WellLocationi] < 1) { ss << std::right << std::fixed << std::setprecision(0) << ":" @@ -665,7 +667,7 @@ outputInjectionReport_(const std::vector& wellInj, << std::setw(8) << wellInj[WellInjDataType::BHP] << ":" << std::setw(8)<< wellInj[WellInjDataType::THP] << ": \n";//wellInj[WellInjDataType::SteadyStateII] << std::setw(10) << "\n" } - ss << ":--------:-----------:------:------:------:------------:----------:-----------:-----------:--------:--------: \n";//--------------------:\n"; + ss << ":--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------:";//--------------------:"; } OpmLog::note(ss.str()); } @@ -678,7 +680,7 @@ outputProductionReport_(const std::vector& wellProd, const UnitSystem& units = eclState_.getUnits(); std::ostringstream ss; 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" << ": 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) { @@ -688,7 +690,7 @@ outputProductionReport_(const std::vector& wellProd, } 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 << "=================================================================================================================================\n";//=================== \n"; + ss << "=================================================================================================================================";//==================="; } else { if (wellProd[WellProdDataType::WellLocationi] < 1) { ss << std::right << std::fixed << ":" @@ -730,7 +732,7 @@ outputProductionReport_(const std::vector& wellProd, << std::setfill ('-') << std::setw (11) << ":" << std::setfill ('-') << std::setw (13) << ":" << std::setfill ('-') << std::setw (9) << ":" - << std::setfill ('-') << std::setw (9) << ":" << "\n"; + << std::setfill ('-') << std::setw (9) << ':'; } OpmLog::note(ss.str()); } @@ -808,7 +810,7 @@ outputRegionFluidInPlace_(std::unordered_map oip, << std::setw(14) << oip[Inplace::Phase::GasInGasPhase] << std::setw(14) << oip[Inplace::Phase::GasInLiquidPhase] << std::setw(14) << oip[Inplace::Phase::GAS] << ":\n" - << ":========================:==========================================:================:==========================================:\n"; + << ":========================:==========================================:================:==========================================:"; OpmLog::note(ss.str()); } @@ -825,7 +827,7 @@ outputResvFluidInPlace_(std::unordered_map cipr, const UnitSystem& units = eclState_.getUnits(); std::ostringstream ss; if (reg == 0) { - ss << " ===================================\n"; + ss << "\n ===================================\n"; if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { ss << " : RESERVOIR VOLUMES M3 :\n"; } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) { @@ -835,7 +837,7 @@ outputResvFluidInPlace_(std::unordered_map cipr, << ": REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :\n" << ": : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :\n" << ": : : OIL : WATER : GAS : HYDRO-CARBON :\n" - << ":---------:---------------:---------------:---------------:---------------:---------------\n"; + << ":---------:---------------:---------------:---------------:---------------:---------------"; } else { ss << std::right << std::fixed << std::setprecision(0) << ":" @@ -846,7 +848,7 @@ outputResvFluidInPlace_(std::unordered_map cipr, << std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":" << std::setw(15) << cipr[Inplace::Phase::OilResVolume] + cipr[Inplace::Phase::GasResVolume] << ":\n" - << ":---------:---------------:---------------:---------------:---------------:---------------:\n"; + << ":---------:---------------:---------------:---------------:---------------:---------------:"; } OpmLog::note(ss.str()); } diff --git a/tests/test_LogOutputHelper.cpp b/tests/test_LogOutputHelper.cpp index 9713c1ea8..9efda8ecf 100644 --- a/tests/test_LogOutputHelper.cpp +++ b/tests/test_LogOutputHelper.cpp @@ -99,13 +99,13 @@ BOOST_AUTO_TEST_CASE(Cumulative) : : : : : 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: -:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: +:--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------: : 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: -:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: +:--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------: : INJ: 1, 1: INJ:GRAT: 24.0: 25.0: 26.0: 27.0: 28.0: 29.0: 30.0: 31.0: -:--------:-----------:--------:----:------------:----------:-----------:-----------:------------:----------:-----------:-----------: +:--------:-----------:--------:----:-----------:-----------:-----------:-----------:------------:----------:-----------:-----------: )"; 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 : ============================================================================================================== : FIELD: : : : : 1.0: 2.0: 3.0: 4.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: -:--------:-----------:------:------:------:------------:----------:-----------:-----------:--------:--------: +:--------:-----------:------:------:------:-----------:-----------:-----------:-----------:--------:--------: )"; std::stringstream str;