Merge pull request #5068 from tskille/rptsol

PRT file updates
This commit is contained in:
Bård Skaflestad 2024-01-04 00:22:41 +01:00 committed by GitHub
commit 2ab40522ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 283 additions and 190 deletions

View File

@ -350,6 +350,10 @@ if (HAVE_OPM_TESTS)
endif()
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 "")

View File

@ -224,6 +224,13 @@ template<class FluidSystem, class Scalar>
EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
~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>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::
outputCumLog(std::size_t reportStepNum)
@ -251,15 +258,15 @@ outputInjLog(std::size_t reportStepNum)
{ return this->isDefunctParallelWell(name); });
}
template<class FluidSystem,class 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,
const std::size_t reportStepNum,
const bool substep,
const Parallel::Communication& comm)
{
auto inplace = this->accumulateRegionSums(comm);
if (comm.rank() != 0)
return inplace;
@ -267,6 +274,25 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
miscSummaryData,
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
std::unique_ptr<FIPConfig> fipSched;
if (reportStepNum != 0) {
@ -277,53 +303,34 @@ outputFipLog(std::map<std::string, double>& miscSummaryData,
: *fipSched;
if (!substep && !forceDisableFipOutput_ && fipc.output(FIPConfig::OutputField::FIELD)) {
logOutput_.timeStamp("BALANCE", elapsed, reportStepNum, currentDate);
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)) {
for (const auto& reg : this->regions_) {
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);
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>
void EclGenericOutputBlackoilModule<FluidSystem,Scalar>::

View File

@ -62,6 +62,8 @@ public:
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
void outputCumLog(std::size_t reportStepNum);
@ -71,19 +73,18 @@ public:
// write injection report to output
void outputInjLog(std::size_t reportStepNum);
// write Fluid In Place to output log
Inplace outputFipLog(std::map<std::string, double>& miscSummaryData,
// calculate Fluid In Place
Inplace calc_inplace(std::map<std::string, double>& miscSummaryData,
std::map<std::string, std::vector<double>>& regionData,
const Parallel::Communication& comm);
void outputFipAndResvLog(const Inplace& inplace,
const std::size_t reportStepNum,
double elapsed,
boost::posix_time::ptime currentDate,
const bool substep,
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;

View File

@ -738,7 +738,7 @@ public:
* \brief Write the requested quantities of the current solution into the output
* files.
*/
void writeOutput(bool verbose = true)
void writeOutput(const SimulatorTimer& timer, bool verbose = true)
{
OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to
@ -758,7 +758,7 @@ public:
}
#endif
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/ParallelRestart.hpp>
#include <opm/simulators/flow/countGlobalCells.hpp>
#include <opm/simulators/timestepping/SimulatorTimer.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>() };
public:
static void registerParameters()
{
EclOutputBlackOilModule<TypeTag>::registerParameters();
@ -176,6 +177,7 @@ public:
{
OPM_TIMEBLOCK(evalSummaryState);
const int reportStepNum = simulator_.episodeIndex() + 1;
/*
The summary data is not evaluated for timestep 0, that is
implemented with a:
@ -193,6 +195,7 @@ public:
"Correct" in this context means unchanged behavior, might very
well be more correct to actually remove this if test.
*/
if (reportStepNum == 0)
return;
@ -246,15 +249,19 @@ public:
this->simulator_.vanguard().grid().comm());
}
std::map<std::string, double> miscSummaryData;
std::map<std::string, std::vector<double>> regionData;
Inplace inplace;
{
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
@ -309,16 +316,6 @@ public:
this->summaryState(),
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.
@ -352,14 +349,21 @@ public:
Inplace inplace;
{
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());
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);
@ -384,6 +388,23 @@ public:
// data::Solution localCellData = {};
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()) {
this->eclOutputModule_->assignToSolution(localCellData);
}
@ -675,6 +696,7 @@ private:
std::unique_ptr<EclOutputBlackOilModule<TypeTag> > eclOutputModule_;
Scalar restartTimeStepSize_;
int rank_ ;
Inplace inplace_;
};
} // namespace Opm

View File

@ -18,6 +18,7 @@
*/
#include <config.h>
#include <opm/simulators/utils/moduleVersion.hpp>
#include <opm/simulators/flow/LogOutputHelper.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
@ -28,6 +29,7 @@
#include <opm/input/eclipse/Schedule/Well/Well.hpp>
#include <opm/simulators/utils/PressureAverage.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <fmt/format.h>
@ -87,7 +89,9 @@ LogOutputHelper<Scalar>::LogOutputHelper(const EclipseState& eclState,
: eclState_(eclState)
, schedule_(schedule)
, summaryState_(summaryState)
{}
{
flowVersionName_ = moduleVersionName();
}
template<class Scalar>
void LogOutputHelper<Scalar>::
@ -306,34 +310,75 @@ fip(const Inplace& inplace,
}
}
template<class 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;
for (const auto& phase : Inplace::phases()) {
for (const auto& phase : Inplace::phases())
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->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;
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->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>
void LogOutputHelper<Scalar>::
injection(const std::size_t reportStepNum,
@ -817,63 +862,62 @@ outputRegionFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> oip,
std::ostringstream ss;
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) {
ss << " ===================================================\n"
<< " : Field Totals :\n";
ss << " ==================================================\n"
<< " : FIELD TOTALS :\n";
}
else {
ss << " ===================================================\n"
<< " : " << name << " report region "
<< std::setw(8 - name.size()) << reg << " :\n";
ss << " ==================================================\n"
<< " : " << name << " REPORT REGION "
<< std::setw(8 - name.size()) << reg << " :\n";
}
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)
<< " : PORV =" << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RM3 :\n";
<< " : PORV= " << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RM3 :\n";
if (!reg) {
ss << " : Pressure is weighted by hydrocarbon pore volume :\n"
<< " : Porv volumes are taken at reference conditions :\n";
ss << " : Pressure is weighted by hydrocarbon pore volume:\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) {
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)
<< " : PORV =" << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RB :\n";
<< " : PORV=" << std::setw(14) << cip[Inplace::Phase::PoreVolume] << " RB :\n";
if (!reg) {
ss << " : Pressure is weighted by hydrocarbon pore volume :\n"
<< " : Pore volumes are taken at reference conditions :\n";
ss << " : Pressure is weighted by hydrocarbon pore volume:\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"
<< ":------------------------:------------------------------------------:----------------:------------------------------------------:" << "\n"
<< ":Currently in place :" << std::setw(14) << cip[Inplace::Phase::OilInLiquidPhase]
ss << " : LIQUID VAPOUR TOTAL : TOTAL : FREE DISSOLVED TOTAL :" << "\n"
<< " :-------------------------:-------------------------------------------:----------------:-------------------------------------------:" << "\n"
<< " :CURRENTLY IN PLACE :" << std::setw(14) << cip[Inplace::Phase::OilInLiquidPhase]
<< std::setw(14) << cip[Inplace::Phase::OilInGasPhase]
<< std::setw(14) << cip[Inplace::Phase::OIL] << ":"
<< std::setw(13) << cip[Inplace::Phase::WATER] << " :"
<< std::setw(15) << cip[Inplace::Phase::OIL] << ":"
<< std::setw(14) << cip[Inplace::Phase::WATER] << " :"
<< std::setw(14) << (cip[Inplace::Phase::GasInGasPhase])
<< std::setw(14) << cip[Inplace::Phase::GasInLiquidPhase]
<< std::setw(14) << cip[Inplace::Phase::GAS] << ":\n"
<< ":------------------------:------------------------------------------:----------------:------------------------------------------:\n"
<< ":Originally in place :" << std::setw(14) << oip[Inplace::Phase::OilInLiquidPhase]
<< std::setw(15) << cip[Inplace::Phase::GAS] << ":\n"
<< " :-------------------------:-------------------------------------------:----------------:-------------------------------------------:\n"
<< " :ORIGINALLY IN PLACE :" << std::setw(14) << oip[Inplace::Phase::OilInLiquidPhase]
<< std::setw(14) << oip[Inplace::Phase::OilInGasPhase]
<< std::setw(14) << oip[Inplace::Phase::OIL] << ":"
<< std::setw(13) << oip[Inplace::Phase::WATER] << " :"
<< std::setw(15) << oip[Inplace::Phase::OIL] << ":"
<< std::setw(14) << oip[Inplace::Phase::WATER] << " :"
<< std::setw(14) << oip[Inplace::Phase::GasInGasPhase]
<< 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());
}
@ -882,37 +926,37 @@ void LogOutputHelper<Scalar>::
outputResvFluidInPlace_(std::unordered_map<Inplace::Phase, Scalar> cipr,
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();
std::ostringstream ss;
if (reg == 0) {
ss << "\n ===================================\n";
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) {
ss << " : RESERVOIR VOLUMES RB :\n";
}
ss << ":---------:---------------:---------------:---------------:---------------:---------------:\n"
<< ": REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :\n"
<< ": : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :\n"
<< ": : : OIL : WATER : GAS : HYDRO-CARBON :\n"
<< ":---------:---------------:---------------:---------------:---------------:---------------";
}
else {
ss << std::right << std::fixed << std::setprecision(0) << ":"
<< std::setw (9) << reg << ":"
<< 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] << ":\n"
<< ":---------:---------------:---------------:---------------:---------------:---------------:";
ss << " :---------:---------------:---------------:---------------:---------------:---------------:\n"
<< " : 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";
ss << std::right << std::fixed << std::setprecision(0) << " :"
<< std::setw (8) << "FIELD" << " :";
} else {
ss << std::right << std::fixed << std::setprecision(0) << " :"
<< std::setw (8) << reg << " :";
}
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());
}

View File

@ -29,6 +29,8 @@
#include <string>
#include <unordered_map>
#include <vector>
#include <boost/date_time.hpp>
namespace Opm {
@ -58,7 +60,7 @@ public:
const std::string& name) const;
//! \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.
void injection(const std::size_t reportStepNum,
@ -68,6 +70,8 @@ public:
void production(const std::size_t reportStepNum,
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:
void beginCumulativeReport_() const;
void endCumulativeReport_() const;
@ -167,6 +171,7 @@ private:
const EclipseState& eclState_;
const Schedule& schedule_;
const SummaryState& summaryState_;
std::string flowVersionName_;
};
} // namespace Opm

View File

@ -362,7 +362,7 @@ public:
ebosSimulator_.setEpisodeLength(0.0);
ebosSimulator_.setTimeStepSize(0.0);
wellModel_().beginReportStep(timer.currentStepNum());
ebosSimulator_.problem().writeOutput();
ebosSimulator_.problem().writeOutput(timer);
report_.success.output_write_time += perfTimer.stop();
}
@ -432,7 +432,7 @@ public:
perfTimer.start();
const double nextstep = adaptiveTimeStepping_ ? adaptiveTimeStepping_->suggestedNextStep() : -1.0;
ebosSimulator_.problem().setNextTimeStepSize(nextstep);
ebosSimulator_.problem().writeOutput();
ebosSimulator_.problem().writeOutput(timer);
report_.success.output_write_time += perfTimer.stop();
solver_->model().endReportStep();
@ -454,11 +454,6 @@ public:
++timer;
if (terminalOutput_) {
if (!timer.initialStep()) {
const std::string version = moduleVersionName();
outputTimestampFIP(timer, eclState().getTitle(), version);
}
std::string msg =
"Time step took " + std::to_string(solverTimer_->secsSinceStart()) + " 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;
perfTimer.start();
ebosProblem.writeOutput();
ebosProblem.writeOutput(simulatorTimer);
report.success.output_write_time += perfTimer.secsSinceStart();
}

View File

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