PRT file updates

* Arrays genarated from RPTSOL + FIP is now strictly following Eclipse format
* Adding reservoir volume array also for custom FIP regions
This commit is contained in:
Torbjørn Skille 2023-12-15 12:18:34 +01:00
parent 3856421a88
commit 72892f0c4b
10 changed files with 283 additions and 190 deletions

View File

@ -350,6 +350,10 @@ if (HAVE_OPM_TESTS)
endif() endif()
target_sources(test_outputdir PRIVATE $<TARGET_OBJECTS:moduleVersion>) target_sources(test_outputdir PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_LogOutputHelper PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_equil PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_RestartSerialization PRIVATE $<TARGET_OBJECTS:moduleVersion>)
target_sources(test_glift1 PRIVATE $<TARGET_OBJECTS:moduleVersion>)
opm_set_test_driver(${CMAKE_CURRENT_SOURCE_DIR}/tests/run-parallel-unitTest.sh "") opm_set_test_driver(${CMAKE_CURRENT_SOURCE_DIR}/tests/run-parallel-unitTest.sh "")

View File

@ -224,6 +224,13 @@ template<class FluidSystem, class Scalar>
EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
~EclGenericOutputBlackoilModule() = default; ~EclGenericOutputBlackoilModule() = default;
template<class FluidSystem, class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputTimeStamp(const std::string& lbl, double elapsed, int rstep, boost::posix_time::ptime currentDate)
{
logOutput_.timeStamp(lbl, elapsed, rstep, currentDate);
}
template<class FluidSystem, class Scalar> template<class FluidSystem, class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputCumLog(std::size_t reportStepNum) outputCumLog(std::size_t reportStepNum)
@ -251,15 +258,15 @@ outputInjLog(std::size_t reportStepNum)
{ return this->isDefunctParallelWell(name); }); { return this->isDefunctParallelWell(name); });
} }
template<class FluidSystem,class Scalar> template<class FluidSystem,class Scalar>
Inplace EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: Inplace EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputFipLog(std::map<std::string, double>& miscSummaryData, calc_inplace(std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData, std::map<std::string, std::vector<double>>& regionData,
const std::size_t reportStepNum,
const bool substep,
const Parallel::Communication& comm) const Parallel::Communication& comm)
{ {
auto inplace = this->accumulateRegionSums(comm); auto inplace = this->accumulateRegionSums(comm);
if (comm.rank() != 0) if (comm.rank() != 0)
return inplace; return inplace;
@ -267,6 +274,25 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
miscSummaryData, miscSummaryData,
regionData); regionData);
return inplace;
}
template<class FluidSystem,class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputFipAndResvLog(const Inplace& inplace,
const std::size_t reportStepNum,
double elapsed,
boost::posix_time::ptime currentDate,
const bool substep,
const Parallel::Communication& comm)
{
if (comm.rank() != 0)
return;
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED // For report step 0 we use the RPTSOL config, else derive from RPTSCHED
std::unique_ptr<FIPConfig> fipSched; std::unique_ptr<FIPConfig> fipSched;
if (reportStepNum != 0) { if (reportStepNum != 0) {
@ -277,53 +303,34 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
: *fipSched; : *fipSched;
if (!substep && !forceDisableFipOutput_ && fipc.output(FIPConfig::OutputField::FIELD)) { if (!substep && !forceDisableFipOutput_ && fipc.output(FIPConfig::OutputField::FIELD)) {
logOutput_.fip(inplace, this->initialInplace(), "");
if (fipc.output(FIPConfig::OutputField::FIPNUM)) { logOutput_.timeStamp("BALANCE", elapsed, reportStepNum, currentDate);
logOutput_.fip(inplace, this->initialInplace(), "FIPNUM");
logOutput_.fip(inplace, this->initialInplace(), "");
if (fipc.output(FIPConfig::OutputField::FIPNUM)) {
logOutput_.fip(inplace, this->initialInplace(), "FIPNUM");
if (fipc.output(FIPConfig::OutputField::RESV))
logOutput_.fipResv(inplace, "FIPNUM");
} }
if (fipc.output(FIPConfig::OutputField::FIP)) { if (fipc.output(FIPConfig::OutputField::FIP)) {
for (const auto& reg : this->regions_) { for (const auto& reg : this->regions_) {
if (reg.first != "FIPNUM") { if (reg.first != "FIPNUM") {
std::ostringstream ss;
ss << "BAL" << reg.first.substr(3);
logOutput_.timeStamp(ss.str(), elapsed, reportStepNum, currentDate);
logOutput_.fip(inplace, this->initialInplace(), reg.first); logOutput_.fip(inplace, this->initialInplace(), reg.first);
if (fipc.output(FIPConfig::OutputField::RESV))
logOutput_.fipResv(inplace, reg.first);
} }
} }
} }
} }
return inplace;
} }
template<class FluidSystem,class Scalar>
Inplace EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputFipresvLog(std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData,
const std::size_t reportStepNum,
const bool substep,
const Parallel::Communication& comm)
{
auto inplace = this->accumulateRegionSums(comm);
if (comm.rank() != 0)
return inplace;
updateSummaryRegionValues(inplace,
miscSummaryData,
regionData);
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED
std::unique_ptr<FIPConfig> fipSched;
if (reportStepNum != 0) {
const auto& rpt = this->schedule_[reportStepNum].rpt_config.get();
fipSched = std::make_unique<FIPConfig>(rpt);
}
const FIPConfig& fipc = reportStepNum == 0 ? this->eclState_.getEclipseConfig().fip()
: *fipSched;
if (!substep && !forceDisableFipresvOutput_ && fipc.output(FIPConfig::OutputField::RESV)) {
logOutput_.fipResv(inplace);
}
return inplace;
}
template<class FluidSystem,class Scalar> template<class FluidSystem,class Scalar>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>:: void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::

View File

@ -62,6 +62,8 @@ public:
return (this->fluidPressure_.size()) ; return (this->fluidPressure_.size()) ;
}; };
void outputTimeStamp(const std::string& lbl, double elapsed, int rstep, boost::posix_time::ptime currentDate);
// write cumulative production and injection reports to output // write cumulative production and injection reports to output
void outputCumLog(std::size_t reportStepNum); void outputCumLog(std::size_t reportStepNum);
@ -71,19 +73,18 @@ public:
// write injection report to output // write injection report to output
void outputInjLog(std::size_t reportStepNum); void outputInjLog(std::size_t reportStepNum);
// write Fluid In Place to output log // calculate Fluid In Place
Inplace outputFipLog(std::map<std::string, double>& miscSummaryData, Inplace calc_inplace(std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData, std::map<std::string, std::vector<double>>& regionData,
const Parallel::Communication& comm);
void outputFipAndResvLog(const Inplace& inplace,
const std::size_t reportStepNum, const std::size_t reportStepNum,
double elapsed,
boost::posix_time::ptime currentDate,
const bool substep, const bool substep,
const Parallel::Communication& comm); const Parallel::Communication& comm);
// write Reservoir Volumes to output log
Inplace outputFipresvLog(std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData,
const std::size_t reportStepNum,
const bool substep,
const Parallel::Communication& comm);
void outputErrorLog(const Parallel::Communication& comm) const; void outputErrorLog(const Parallel::Communication& comm) const;

View File

@ -738,7 +738,7 @@ public:
* \brief Write the requested quantities of the current solution into the output * \brief Write the requested quantities of the current solution into the output
* files. * files.
*/ */
void writeOutput(bool verbose = true) void writeOutput(const SimulatorTimer& timer, bool verbose = true)
{ {
OPM_TIMEBLOCK(problemWriteOutput); OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to // use the generic code to prepare the output fields and to
@ -758,7 +758,7 @@ public:
} }
#endif #endif
if (enableEclOutput_){ if (enableEclOutput_){
eclWriter_->writeOutput(std::move(localCellData), isSubStep); eclWriter_->writeOutput(std::move(localCellData), timer, isSubStep);
} }
} }

View File

@ -42,7 +42,7 @@
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp> #include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/utils/ParallelRestart.hpp> #include <opm/simulators/utils/ParallelRestart.hpp>
#include <opm/simulators/flow/countGlobalCells.hpp> #include <opm/simulators/flow/countGlobalCells.hpp>
#include <opm/simulators/timestepping/SimulatorTimer.hpp>
#include <opm/common/OpmLog/OpmLog.hpp> #include <opm/common/OpmLog/OpmLog.hpp>
@ -123,6 +123,7 @@ class EclWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::Grid>
enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() }; enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
public: public:
static void registerParameters() static void registerParameters()
{ {
EclOutputBlackOilModule<TypeTag>::registerParameters(); EclOutputBlackOilModule<TypeTag>::registerParameters();
@ -176,6 +177,7 @@ public:
{ {
OPM_TIMEBLOCK(evalSummaryState); OPM_TIMEBLOCK(evalSummaryState);
const int reportStepNum = simulator_.episodeIndex() + 1; const int reportStepNum = simulator_.episodeIndex() + 1;
/* /*
The summary data is not evaluated for timestep 0, that is The summary data is not evaluated for timestep 0, that is
implemented with a: implemented with a:
@ -193,6 +195,7 @@ public:
"Correct" in this context means unchanged behavior, might very "Correct" in this context means unchanged behavior, might very
well be more correct to actually remove this if test. well be more correct to actually remove this if test.
*/ */
if (reportStepNum == 0) if (reportStepNum == 0)
return; return;
@ -245,18 +248,22 @@ public:
OPM_END_PARALLEL_TRY_CATCH("Collect to I/O rank: ", OPM_END_PARALLEL_TRY_CATCH("Collect to I/O rank: ",
this->simulator_.vanguard().grid().comm()); this->simulator_.vanguard().grid().comm());
} }
std::map<std::string, double> miscSummaryData; std::map<std::string, double> miscSummaryData;
std::map<std::string, std::vector<double>> regionData; std::map<std::string, std::vector<double>> regionData;
Inplace inplace; Inplace inplace;
{ {
OPM_TIMEBLOCK(outputFipLogAndFipresvLog); OPM_TIMEBLOCK(outputFipLogAndFipresvLog);
inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, reportStepNum,
isSubStep, simulator_.gridView().comm());
eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, reportStepNum,
isSubStep, simulator_.gridView().comm());
}
inplace = eclOutputModule_->calc_inplace(miscSummaryData, regionData, simulator_.gridView().comm());
if (this->collectToIORank_.isIORank()){
inplace_ = inplace;
}
}
// Add TCPU // Add TCPU
if (totalCpuTime != 0.0) { if (totalCpuTime != 0.0) {
miscSummaryData["TCPU"] = totalCpuTime; miscSummaryData["TCPU"] = totalCpuTime;
@ -309,16 +316,6 @@ public:
this->summaryState(), this->summaryState(),
this->udqState()); this->udqState());
} }
if (! isSubStep) {
OPM_TIMEBLOCK(outputProdInjLogs);
eclOutputModule_->outputProdLog(reportStepNum);
eclOutputModule_->outputInjLog(reportStepNum);
eclOutputModule_->outputCumLog(reportStepNum);
OpmLog::note(""); // Blank line after all reports.
}
} }
//! \brief Writes the initial FIP report as configured in RPTSOL. //! \brief Writes the initial FIP report as configured in RPTSOL.
@ -352,14 +349,21 @@ public:
Inplace inplace; Inplace inplace;
{ {
OPM_TIMEBLOCK(outputFipLogAndFipresvLog); OPM_TIMEBLOCK(outputFipLogAndFipresvLog);
inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, 0,
boost::posix_time::ptime start_time = boost::posix_time::from_time_t(simulator_.vanguard().schedule().getStartTime());
inplace = eclOutputModule_->calc_inplace(miscSummaryData, regionData, simulator_.gridView().comm());
if (this->collectToIORank_.isIORank()){
inplace_ = inplace;
eclOutputModule_->outputFipAndResvLog(inplace_, 0, 0.0, start_time,
false, simulator_.gridView().comm()); false, simulator_.gridView().comm());
eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, 0, }
false, simulator_.gridView().comm());
} }
} }
void writeOutput(data::Solution&& localCellData, bool isSubStep) void writeOutput(data::Solution&& localCellData, const SimulatorTimer& timer, bool isSubStep)
{ {
OPM_TIMEBLOCK(writeOutput); OPM_TIMEBLOCK(writeOutput);
@ -384,6 +388,23 @@ public:
// data::Solution localCellData = {}; // data::Solution localCellData = {};
if (! isSubStep) { if (! isSubStep) {
auto rstep = timer.reportStepNum();
if ((rstep > 0) && (this->collectToIORank_.isIORank())){
eclOutputModule_->outputFipAndResvLog(inplace_, rstep, timer.simulationTimeElapsed(),
timer.currentDateTime(), false, simulator_.gridView().comm());
eclOutputModule_->outputTimeStamp("WELLS", timer.simulationTimeElapsed(), rstep, timer.currentDateTime());
eclOutputModule_->outputProdLog(reportStepNum);
eclOutputModule_->outputInjLog(reportStepNum);
eclOutputModule_->outputCumLog(reportStepNum);
OpmLog::note(""); // Blank line after all reports.
}
if (localCellData.empty()) { if (localCellData.empty()) {
this->eclOutputModule_->assignToSolution(localCellData); this->eclOutputModule_->assignToSolution(localCellData);
} }
@ -675,6 +696,7 @@ private:
std::unique_ptr<EclOutputBlackOilModule<TypeTag> > eclOutputModule_; std::unique_ptr<EclOutputBlackOilModule<TypeTag> > eclOutputModule_;
Scalar restartTimeStepSize_; Scalar restartTimeStepSize_;
int rank_ ; int rank_ ;
Inplace inplace_;
}; };
} // namespace Opm } // namespace Opm

View File

@ -18,6 +18,7 @@
*/ */
#include <config.h> #include <config.h>
#include <opm/simulators/utils/moduleVersion.hpp>
#include <opm/simulators/flow/LogOutputHelper.hpp> #include <opm/simulators/flow/LogOutputHelper.hpp>
#include <opm/common/OpmLog/OpmLog.hpp> #include <opm/common/OpmLog/OpmLog.hpp>
@ -28,6 +29,7 @@
#include <opm/input/eclipse/Schedule/Well/Well.hpp> #include <opm/input/eclipse/Schedule/Well/Well.hpp>
#include <opm/simulators/utils/PressureAverage.hpp> #include <opm/simulators/utils/PressureAverage.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <fmt/format.h> #include <fmt/format.h>
@ -87,7 +89,9 @@ LogOutputHelper<Scalar>::LogOutputHelper(const EclipseState& eclState,
: eclState_(eclState) : eclState_(eclState)
, schedule_(schedule) , schedule_(schedule)
, summaryState_(summaryState) , summaryState_(summaryState)
{} {
flowVersionName_ = moduleVersionName();
}
template<class Scalar> template<class Scalar>
void LogOutputHelper<Scalar>:: void LogOutputHelper<Scalar>::
@ -306,34 +310,75 @@ fip(const Inplace& inplace,
} }
} }
template<class Scalar> template<class Scalar>
void LogOutputHelper<Scalar>:: void LogOutputHelper<Scalar>::
fipResv(const Inplace& inplace) const fipResv(const Inplace& inplace, const std::string& name) const
{ {
{ {
std::unordered_map<Inplace::Phase, Scalar> current_values; std::unordered_map<Inplace::Phase, Scalar> current_values;
for (const auto& phase : Inplace::phases()) { for (const auto& phase : Inplace::phases())
current_values[phase] = inplace.get(phase); current_values[phase] = inplace.get(phase);
}
Scalar field_dyn_pv = 0.0;
for (auto nreg = inplace.max_region(name), reg = 0*nreg + 1; reg <= nreg; ++reg)
field_dyn_pv = field_dyn_pv + inplace.get(name, Inplace::Phase::DynamicPoreVolume, reg);
current_values[Inplace::Phase::DynamicPoreVolume] = field_dyn_pv;
this->fipUnitConvert_(current_values); this->fipUnitConvert_(current_values);
this->outputResvFluidInPlace_(current_values, 0); this->outputResvFluidInPlace_(current_values, 0);
} }
for (std::size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) { for (auto nreg = inplace.max_region(), reg = 0*nreg + 1; reg <= nreg; ++reg) {
std::unordered_map<Inplace::Phase, Scalar> current_values; std::unordered_map<Inplace::Phase, Scalar> current_values;
for (const auto& phase : Inplace::phases()) { for (const auto& phase : Inplace::phases()) {
current_values[phase] = inplace.get("FIPNUM", phase, reg); if (reg <= inplace.max_region(name))
current_values[phase] = inplace.get(name, phase, reg);
else
current_values[phase] = 0.0;
} }
current_values[Inplace::Phase::DynamicPoreVolume] =
inplace.get("FIPNUM", Inplace::Phase::DynamicPoreVolume, reg); if (reg <= inplace.max_region(name))
current_values[Inplace::Phase::DynamicPoreVolume] =
inplace.get(name, Inplace::Phase::DynamicPoreVolume, reg);
else
current_values[Inplace::Phase::DynamicPoreVolume] = 0.0;
this->fipUnitConvert_(current_values); this->fipUnitConvert_(current_values);
this->outputResvFluidInPlace_(current_values, reg); this->outputResvFluidInPlace_(current_values, reg);
} }
std::ostringstream ss;
ss << " ===========================================================================================";
OpmLog::note(ss.str());
} }
template<class Scalar>
void LogOutputHelper<Scalar>::
timeStamp(const std::string& lbl, double elapsed, int rstep, boost::posix_time::ptime currentDate) const
{
std::ostringstream ss;
boost::posix_time::time_facet* facet = new boost::posix_time::time_facet("%d %b %Y");
ss.imbue(std::locale(std::locale::classic(), facet));
ss << "\n **************************************************************************\n"
<< " " << std::left << std::setw(9) << lbl << "AT" << std::right << std::setw(10)
<< (double)unit::convert::to(elapsed, unit::day) << " DAYS" << " *" << std::setw(30) << eclState_.getTitle() << " *\n"
<< " REPORT " << std::setw(4) << rstep << " " << currentDate
<< " * Flow version " << std::setw(11) << flowVersionName_ << " *\n"
<< " **************************************************************************\n";
OpmLog::note(ss.str());
}
template<class Scalar> template<class Scalar>
void LogOutputHelper<Scalar>:: void LogOutputHelper<Scalar>::
injection(const std::size_t reportStepNum, injection(const std::size_t reportStepNum,
@ -817,63 +862,62 @@ outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
std::ostringstream ss; std::ostringstream ss;
ss << '\n'; ss << '\n';
if (reg == 0) {
ss << "Field total";
} else {
ss << name << " report region " << reg;
}
ss << " pressure dependent pore volume = "
<< std::fixed << std::setprecision(0)
<< cip[Inplace::Phase::DynamicPoreVolume] << ' '
<< units.name(UnitSystem::measure::volume) << "\n\n";
if (reg == 0) { if (reg == 0) {
ss << " ===================================================\n" ss << " ==================================================\n"
<< " : Field Totals :\n"; << " : FIELD TOTALS :\n";
} }
else { else {
ss << " ===================================================\n" ss << " ==================================================\n"
<< " : " << name << " report region " << " : " << name << " REPORT REGION "
<< std::setw(8 - name.size()) << reg << " :\n"; << std::setw(8 - name.size()) << reg << " :\n";
} }
if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) {
ss << " : PAV =" << std::setw(14) << pav << " BARSA :\n" ss << " : PAV = " << std::setw(14) << pav << " BARSA :\n"
<< std::fixed << std::setprecision(0) << std::fixed << std::setprecision(0)
<< " : PORV =" << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RM3 :\n"; << " : PORV= " << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RM3 :\n";
if (!reg) { if (!reg) {
ss << " : Pressure is weighted by hydrocarbon pore volume :\n" ss << " : Pressure is weighted by hydrocarbon pore volume:\n"
<< " : Porv volumes are taken at reference conditions :\n"; << " : Porv volumes are taken at reference conditions :\n";
} }
ss << " :--------------- Oil SM3 ---------------:-- Wat SM3 --:--------------- Gas SM3 ---------------:\n"; ss << " :--------------- OIL SM3 ----------------:-- WAT SM3 --:--------------- GAS SM3 ---------------:\n";
} else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) { } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) {
ss << " : PAV =" << std::setw(14) << pav << " PSIA :\n" ss << std::fixed << std::setprecision(0)
<< " : PAV =" << std::setw(14) << pav << " PSIA :\n"
<< std::fixed << std::setprecision(0) << std::fixed << std::setprecision(0)
<< " : PORV =" << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RB :\n"; << " : PORV=" << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RB :\n";
if (!reg) { if (!reg) {
ss << " : Pressure is weighted by hydrocarbon pore volume :\n" ss << " : Pressure is weighted by hydrocarbon pore volume:\n"
<< " : Pore volumes are taken at reference conditions :\n"; << " : Pore volumes are taken at reference conditions :\n";
} }
ss << " :--------------- Oil STB ---------------:-- Wat STB --:--------------- Gas MSCF ---------------:\n"; ss << " :--------------- OIL STB ----------------:-- WAT STB --:--------------- GAS MSCF ----------------:\n";
} }
ss << " : Liquid Vapour Total : Total : Free Dissolved Total :" << "\n" ss << " : LIQUID VAPOUR TOTAL : TOTAL : FREE DISSOLVED TOTAL :" << "\n"
<< ":------------------------:------------------------------------------:----------------:------------------------------------------:" << "\n" << " :-------------------------:-------------------------------------------:----------------:-------------------------------------------:" << "\n"
<< ":Currently in place :" << std::setw(14) << cip[Inplace::Phase::OilInLiquidPhase] << " :CURRENTLY IN PLACE :" << std::setw(14) << cip[Inplace::Phase::OilInLiquidPhase]
<< std::setw(14) << cip[Inplace::Phase::OilInGasPhase] << std::setw(14) << cip[Inplace::Phase::OilInGasPhase]
<< std::setw(14) << cip[Inplace::Phase::OIL] << ":" << std::setw(15) << cip[Inplace::Phase::OIL] << ":"
<< std::setw(13) << cip[Inplace::Phase::WATER] << " :" << std::setw(14) << cip[Inplace::Phase::WATER] << " :"
<< std::setw(14) << (cip[Inplace::Phase::GasInGasPhase]) << std::setw(14) << (cip[Inplace::Phase::GasInGasPhase])
<< std::setw(14) << cip[Inplace::Phase::GasInLiquidPhase] << std::setw(14) << cip[Inplace::Phase::GasInLiquidPhase]
<< std::setw(14) << cip[Inplace::Phase::GAS] << ":\n" << std::setw(15) << cip[Inplace::Phase::GAS] << ":\n"
<< ":------------------------:------------------------------------------:----------------:------------------------------------------:\n" << " :-------------------------:-------------------------------------------:----------------:-------------------------------------------:\n"
<< ":Originally in place :" << std::setw(14) << oip[Inplace::Phase::OilInLiquidPhase] << " :ORIGINALLY IN PLACE :" << std::setw(14) << oip[Inplace::Phase::OilInLiquidPhase]
<< std::setw(14) << oip[Inplace::Phase::OilInGasPhase] << std::setw(14) << oip[Inplace::Phase::OilInGasPhase]
<< std::setw(14) << oip[Inplace::Phase::OIL] << ":" << std::setw(15) << oip[Inplace::Phase::OIL] << ":"
<< std::setw(13) << oip[Inplace::Phase::WATER] << " :" << std::setw(14) << oip[Inplace::Phase::WATER] << " :"
<< 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(15) << oip[Inplace::Phase::GAS] << ":\n";
<< ":========================:==========================================:================:==========================================:";
if (reg == 0){
ss << " ====================================================================================================================================\n\n";
} else {
ss << " :-------------------------:-------------------------------------------:----------------:-------------------------------------------:\n";
ss << " ====================================================================================================================================\n\n";
}
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }
@ -882,37 +926,37 @@ void LogOutputHelper<Scalar>::
outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr, outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
const int reg) const const int reg) const
{ {
// don't output FIPNUM report if the region has no porv.
if (cipr[Inplace::Phase::PoreVolume] == 0) {
return;
}
const UnitSystem& units = eclState_.getUnits(); const UnitSystem& units = eclState_.getUnits();
std::ostringstream ss; std::ostringstream ss;
if (reg == 0) { if (reg == 0) {
ss << "\n ===================================\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 RM3 :\n";
} else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) { } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) {
ss << " : RESERVOIR VOLUMES RB :\n"; ss << " : RESERVOIR VOLUMES RB :\n";
} }
ss << ":---------:---------------:---------------:---------------:---------------:---------------:\n" ss << " :---------:---------------:---------------:---------------:---------------:---------------:\n"
<< ": 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 { ss << std::right << std::fixed << std::setprecision(0) << " :"
ss << std::right << std::fixed << std::setprecision(0) << ":" << std::setw (8) << "FIELD" << " :";
<< std::setw (9) << reg << ":"
<< std::setw(15) << cipr[Inplace::Phase::DynamicPoreVolume] << ":" } else {
<< std::setw(15) << cipr[Inplace::Phase::OilResVolume] << ":" ss << std::right << std::fixed << std::setprecision(0) << " :"
<< std::setw(15) << cipr[Inplace::Phase::WaterResVolume] << ":" << std::setw (8) << reg << " :";
<< std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":" }
<< std::setw(15) << cipr[Inplace::Phase::OilResVolume] +
cipr[Inplace::Phase::GasResVolume] << ":\n" ss << std::setw(15) << cipr[Inplace::Phase::DynamicPoreVolume] << ":"
<< ":---------:---------------:---------------:---------------:---------------:---------------:"; << std::setw(15) << cipr[Inplace::Phase::OilResVolume] << ":"
} << std::setw(15) << cipr[Inplace::Phase::WaterResVolume] << ":"
<< std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":"
<< std::setw(15) << cipr[Inplace::Phase::OilResVolume] +
cipr[Inplace::Phase::GasResVolume] << ":";
OpmLog::note(ss.str()); OpmLog::note(ss.str());
} }

View File

@ -29,6 +29,8 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/date_time.hpp>
namespace Opm { namespace Opm {
@ -58,7 +60,7 @@ public:
const std::string& name) const; const std::string& name) const;
//! \brief Write fluid-in-place reservoir reports to output. //! \brief Write fluid-in-place reservoir reports to output.
void fipResv(const Inplace& inplace) const; void fipResv(const Inplace& inplace, const std::string& name) const;
//! \brief Write injection report to output. //! \brief Write injection report to output.
void injection(const std::size_t reportStepNum, void injection(const std::size_t reportStepNum,
@ -68,6 +70,8 @@ public:
void production(const std::size_t reportStepNum, void production(const std::size_t reportStepNum,
std::function<bool(const std::string&)> isDefunct) const; std::function<bool(const std::string&)> isDefunct) const;
void timeStamp(const std::string& lbl, double elapsed, int rstep, boost::posix_time::ptime currentDate) const;
private: private:
void beginCumulativeReport_() const; void beginCumulativeReport_() const;
void endCumulativeReport_() const; void endCumulativeReport_() const;
@ -167,6 +171,7 @@ private:
const EclipseState& eclState_; const EclipseState& eclState_;
const Schedule& schedule_; const Schedule& schedule_;
const SummaryState& summaryState_; const SummaryState& summaryState_;
std::string flowVersionName_;
}; };
} // namespace Opm } // namespace Opm

View File

@ -362,7 +362,7 @@ public:
ebosSimulator_.setEpisodeLength(0.0); ebosSimulator_.setEpisodeLength(0.0);
ebosSimulator_.setTimeStepSize(0.0); ebosSimulator_.setTimeStepSize(0.0);
wellModel_().beginReportStep(timer.currentStepNum()); wellModel_().beginReportStep(timer.currentStepNum());
ebosSimulator_.problem().writeOutput(); ebosSimulator_.problem().writeOutput(timer);
report_.success.output_write_time += perfTimer.stop(); report_.success.output_write_time += perfTimer.stop();
} }
@ -432,7 +432,7 @@ public:
perfTimer.start(); perfTimer.start();
const double nextstep = adaptiveTimeStepping_ ? adaptiveTimeStepping_->suggestedNextStep() : -1.0; const double nextstep = adaptiveTimeStepping_ ? adaptiveTimeStepping_->suggestedNextStep() : -1.0;
ebosSimulator_.problem().setNextTimeStepSize(nextstep); ebosSimulator_.problem().setNextTimeStepSize(nextstep);
ebosSimulator_.problem().writeOutput(); ebosSimulator_.problem().writeOutput(timer);
report_.success.output_write_time += perfTimer.stop(); report_.success.output_write_time += perfTimer.stop();
solver_->model().endReportStep(); solver_->model().endReportStep();
@ -452,13 +452,8 @@ public:
// Increment timer, remember well state. // Increment timer, remember well state.
++timer; ++timer;
if (terminalOutput_) { if (terminalOutput_) {
if (!timer.initialStep()) {
const std::string version = moduleVersionName();
outputTimestampFIP(timer, eclState().getTitle(), version);
}
std::string msg = std::string msg =
"Time step took " + std::to_string(solverTimer_->secsSinceStart()) + " seconds; " "Time step took " + std::to_string(solverTimer_->secsSinceStart()) + " seconds; "
"total solver time " + std::to_string(report_.success.solver_time) + " seconds."; "total solver time " + std::to_string(report_.success.solver_time) + " seconds.";

View File

@ -497,7 +497,7 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
time::StopWatch perfTimer; time::StopWatch perfTimer;
perfTimer.start(); perfTimer.start();
ebosProblem.writeOutput(); ebosProblem.writeOutput(simulatorTimer);
report.success.output_write_time += perfTimer.secsSinceStart(); report.success.output_write_time += perfTimer.secsSinceStart();
} }

View File

@ -72,6 +72,8 @@ WCONINJE
'INJ' 'GAS' 'OPEN' 'RATE' 100000 1* 9014 / 'INJ' 'GAS' 'OPEN' 'RATE' 100000 1* 9014 /
/)"; /)";
std::string trimStream(std::stringstream& str) std::string trimStream(std::stringstream& str)
{ {
char buffer[1024]; char buffer[1024];
@ -89,6 +91,7 @@ std::string trimStream(std::stringstream& str)
return data; return data;
} }
} }
BOOST_AUTO_TEST_CASE(Cumulative) BOOST_AUTO_TEST_CASE(Cumulative)
@ -169,6 +172,7 @@ BOOST_AUTO_TEST_CASE(Cumulative)
BOOST_CHECK_EQUAL(data, reference); BOOST_CHECK_EQUAL(data, reference);
} }
BOOST_AUTO_TEST_CASE(Error) BOOST_AUTO_TEST_CASE(Error)
{ {
const std::string reference = R"(Finding the bubble point pressure failed for 3 cells [(2,1,1), (1,3,1), (1,4,1)] const std::string reference = R"(Finding the bubble point pressure failed for 3 cells [(2,1,1), (1,3,1), (1,4,1)]
@ -200,34 +204,40 @@ Finding the dew point pressure failed for 3 cells [(5,1,1), (6,1,1), (7,1,1)]
BOOST_AUTO_TEST_CASE(Fip) BOOST_AUTO_TEST_CASE(Fip)
{ {
const std::string reference = R"(Field total pressure dependent pore volume = 50 RB const std::string reference = R"(
=================================================== ==================================================
: Field Totals : : FIELD TOTALS :
: PAV = 0 PSIA : : PAV = 0 PSIA :
: PORV = 157 RB : : PORV= 157 RB :
: Pressure is weighted by hydrocarbon pore volume : : Pressure is weighted by hydrocarbon pore volume:
: Pore volumes are taken at reference conditions : : Pore volumes are taken at reference conditions :
:--------------- Oil STB ---------------:-- Wat STB --:--------------- Gas MSCF ---------------: :--------------- OIL STB ----------------:-- WAT STB --:--------------- GAS MSCF ----------------:
: Liquid Vapour Total : Total : Free Dissolved Total : : LIQUID VAPOUR TOTAL : TOTAL : FREE DISSOLVED TOTAL :
:------------------------:------------------------------------------:----------------:------------------------------------------: :-------------------------:-------------------------------------------:----------------:-------------------------------------------:
:Currently in place : 132 138 120: 113 : 1 1 1: :CURRENTLY IN PLACE : 132 138 120: 113 : 1 1 1:
:------------------------:------------------------------------------:----------------:------------------------------------------: :-------------------------:-------------------------------------------:----------------:-------------------------------------------:
:Originally in place : 25 31 13: 6 : 0 0 0: :ORIGINALLY IN PLACE : 25 31 13: 6 : 0 0 0:
:========================:==========================================:================:==========================================: ====================================================================================================================================
FIPNUM report region 1 pressure dependent pore volume = 50 RB
===================================================
: FIPNUM report region 1 :
: PAV = 0 PSIA : ==================================================
: PORV = 371 RB : : FIPNUM REPORT REGION 1 :
:--------------- Oil STB ---------------:-- Wat STB --:--------------- Gas MSCF ---------------: : PAV = 0 PSIA :
: Liquid Vapour Total : Total : Free Dissolved Total : : PORV= 371 RB :
:------------------------:------------------------------------------:----------------:------------------------------------------: :--------------- OIL STB ----------------:-- WAT STB --:--------------- GAS MSCF ----------------:
:Currently in place : 346 352 333: 327 : 2 2 2: : LIQUID VAPOUR TOTAL : TOTAL : FREE DISSOLVED TOTAL :
:------------------------:------------------------------------------:----------------:------------------------------------------: :-------------------------:-------------------------------------------:----------------:-------------------------------------------:
:Originally in place : 239 245 226: 220 : 1 1 1: :CURRENTLY IN PLACE : 346 352 333: 327 : 2 2 2:
:========================:==========================================:================:==========================================: :-------------------------:-------------------------------------------:----------------:-------------------------------------------:
:ORIGINALLY IN PLACE : 239 245 226: 220 : 1 1 1:
:-------------------------:-------------------------------------------:----------------:-------------------------------------------:
====================================================================================================================================
)"; )";
std::stringstream str; std::stringstream str;
Opm::OpmLog::addBackend("stream", Opm::OpmLog::addBackend("stream",
std::make_shared<Opm::StreamLog>(str, Opm::Log::MessageType::Note)); std::make_shared<Opm::StreamLog>(str, Opm::Log::MessageType::Note));
@ -274,22 +284,25 @@ FIPNUM report region 1 pressure dependent pore volume = 50 RB
helper.fip(current, initial, ""); helper.fip(current, initial, "");
helper.fip(current, initial, "FIPNUM"); helper.fip(current, initial, "FIPNUM");
std::string data = trimStream(str);
BOOST_CHECK_EQUAL(data, reference); BOOST_CHECK_EQUAL(str.str(), reference);
} }
BOOST_AUTO_TEST_CASE(FipResv) BOOST_AUTO_TEST_CASE(FipResv)
{ {
const std::string reference = R"(=================================== const std::string reference = R"(
: RESERVOIR VOLUMES RB : ===================================
:---------:---------------:---------------:---------------:---------------:---------------: : RESERVOIR VOLUMES RB :
: REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME : :---------:---------------:---------------:---------------:---------------:---------------:
: : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING : : REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :
: : : OIL : WATER : GAS : HYDRO-CARBON : : : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :
:---------:---------------:---------------:---------------:---------------:--------------- : : : OIL : WATER : GAS : HYDRO-CARBON :
: 1: 176: 170: 164: 176: 346: :---------:---------------:---------------:---------------:---------------:---------------
:---------:---------------:---------------:---------------:---------------:---------------: : FIELD : 176: 13: 19: 25: 38:
: 1 : 176: 170: 164: 176: 346:
===========================================================================================
)"; )";
std::stringstream str; std::stringstream str;
Opm::OpmLog::addBackend("stream", Opm::OpmLog::addBackend("stream",
@ -323,11 +336,11 @@ BOOST_AUTO_TEST_CASE(FipResv)
current.add(Opm::Inplace::Phase::GasResVolume, 4.0); current.add(Opm::Inplace::Phase::GasResVolume, 4.0);
current.add("FIPNUM", Opm::Inplace::Phase::DynamicPoreVolume, 1, 11.0 + phases.size()); current.add("FIPNUM", Opm::Inplace::Phase::DynamicPoreVolume, 1, 11.0 + phases.size());
helper.fipResv(current); helper.fipResv(current, "FIPNUM");
std::string data = trimStream(str); BOOST_CHECK_EQUAL(str.str(), reference);
BOOST_CHECK_EQUAL(data, reference);
} }
BOOST_AUTO_TEST_CASE(Injection) BOOST_AUTO_TEST_CASE(Injection)
{ {
const std::string reference = R"(=================================================== INJECTION REPORT ======================================== const std::string reference = R"(=================================================== INJECTION REPORT ========================================
@ -382,6 +395,7 @@ BOOST_AUTO_TEST_CASE(Injection)
BOOST_CHECK_EQUAL(data, reference); BOOST_CHECK_EQUAL(data, reference);
} }
BOOST_AUTO_TEST_CASE(Production) BOOST_AUTO_TEST_CASE(Production)
{ {
const std::string reference = R"(======================================================= PRODUCTION REPORT ======================================================= const std::string reference = R"(======================================================= PRODUCTION REPORT =======================================================
@ -441,3 +455,4 @@ BOOST_AUTO_TEST_CASE(Production)
std::string data = trimStream(str); std::string data = trimStream(str);
BOOST_CHECK_EQUAL(data, reference); BOOST_CHECK_EQUAL(data, reference);
} }