Write the initial OIP values if requested.

This is when writing the first time step as is this is
the first step when OIP is available.
This commit is contained in:
Markus Blatt 2017-07-19 22:06:08 +02:00
parent 44c02a262e
commit 1939453adb
3 changed files with 25 additions and 13 deletions

View File

@ -290,7 +290,8 @@ public:
// No per cell data is written for initial step, but will be
// for subsequent steps, when we have started simulating
output_writer_.writeTimeStep( timer, state, well_state, solver->model() );
output_writer_.writeTimeStep( timer, state, well_state, solver->model(),
false, -1.0, SimulatorReport(), true);
report.output_write_time += perfTimer.stop();
}

View File

@ -188,6 +188,7 @@ namespace Opm
std::map<std::string, double> miscSummaryData_;
std::map<std::string, std::vector<double>> extraRestartData_;
const bool substep_;
const bool writeInitial_;
explicit WriterCall( BlackoilOutputWriter& writer,
const SimulatorTimerInterface& timer,
@ -196,7 +197,7 @@ namespace Opm
const data::Solution& simProps,
const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep )
bool substep, bool writeInitial)
: writer_( writer ),
timer_( timer.clone() ),
state_( state ),
@ -204,7 +205,8 @@ namespace Opm
simProps_( simProps ),
miscSummaryData_( miscSummaryData ),
extraRestartData_( extraRestartData ),
substep_( substep )
substep_( substep ),
writeInitial_( writeInitial )
{
}
@ -212,7 +214,7 @@ namespace Opm
void run ()
{
// write data
writer_.writeTimeStepSerial( *timer_, state_, wellState_, simProps_, miscSummaryData_, extraRestartData_, substep_ );
writer_.writeTimeStepSerial( *timer_, state_, wellState_, simProps_, miscSummaryData_, extraRestartData_, substep_, writeInitial_ );
}
};
}
@ -252,7 +254,7 @@ namespace Opm
const WellStateFullyImplicitBlackoil& localWellState,
const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep)
bool substep, bool writeInitial)
{
// VTK output (is parallel if grid is parallel)
if( vtkWriter_ ) {
@ -287,12 +289,12 @@ namespace Opm
{
if( asyncOutput_ ) {
// dispatch the write call to the extra thread
asyncOutput_->dispatch( detail::WriterCall( *this, timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep ) );
asyncOutput_->dispatch( detail::WriterCall( *this, timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep, writeInitial ) );
}
else {
// just write the data to disk
try {
writeTimeStepSerial( timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep );
writeTimeStepSerial( timer, state, wellState, cellData, miscSummaryData, extraRestartData, substep, writeInitial );
} catch (std::runtime_error& msg) {
err = 1;
emsg = msg.what();
@ -324,7 +326,7 @@ namespace Opm
const data::Solution& simProps,
const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep)
bool substep, bool initialWrite)
{
// Matlab output
if( matlabWriter_ ) {
@ -338,6 +340,11 @@ namespace Opm
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl;
} else {
if ( initialWrite )
{
// Set the initial OIP
eclIO_->overwriteInitialOIP(simProps);
}
// ... insert "extra" data (KR, VISC, ...)
eclIO_->writeTimeStep(timer.reportStepNum(),
substep,

View File

@ -223,6 +223,7 @@ namespace Opm
* visualization tools like ResInsight. This function will extract the
* requested output cell properties specified by the RPTRST keyword
* and write these to file.
* \param inititalWrite If true this function will set the initial OIP.
*/
template<class Model>
void writeTimeStep(const SimulatorTimerInterface& timer,
@ -231,7 +232,8 @@ namespace Opm
const Model& physicalModel,
const bool substep = false,
const double nextstep = -1.0,
const SimulatorReport& simulatorReport = SimulatorReport());
const SimulatorReport& simulatorReport = SimulatorReport(),
bool initialWrite = false);
/*!
@ -246,7 +248,7 @@ namespace Opm
const Opm::WellStateFullyImplicitBlackoil& wellState,
const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep = false);
bool substep = false, bool initialWrite = false);
/*!
* \brief Write a blackoil reservoir state to disk for later inspection with
@ -272,7 +274,8 @@ namespace Opm
const data::Solution& simProps,
const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep);
bool substep,
bool initialWrite);
/** \brief return output directory */
const std::string& outputDirectory() const { return outputDir_; }
@ -998,7 +1001,8 @@ namespace Opm
const Model& physicalModel,
const bool substep,
const double nextstep,
const SimulatorReport& simulatorReport)
const SimulatorReport& simulatorReport,
bool initialWrite)
{
data::Solution localCellData{};
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
@ -1037,7 +1041,7 @@ namespace Opm
}
}
writeTimeStepWithCellProperties(timer, localState, localCellData, localWellState, miscSummaryData, extraRestartData, substep);
writeTimeStepWithCellProperties(timer, localState, localCellData, localWellState, miscSummaryData, extraRestartData, substep, initialWrite);
}
}
#endif