OPM-218: Write restart files at same interval as eclipse

This commit is contained in:
chflo 2015-08-02 22:26:45 +02:00 committed by Joakim Hove
parent 5e9e472613
commit a949d5a736
10 changed files with 17 additions and 12 deletions

View File

@ -34,9 +34,10 @@ struct MultiWriter : public OutputWriter {
virtual void writeTimeStep(const SimulatorTimerInterface& timer, virtual void writeTimeStep(const SimulatorTimerInterface& timer,
const SimulatorState& reservoirState, const SimulatorState& reservoirState,
const WellState& wellState) { const WellState& wellState,
bool isSubstep) {
for (it_t it = writers_->begin (); it != writers_->end(); ++it) { for (it_t it = writers_->begin (); it != writers_->end(); ++it) {
(*it)->writeTimeStep (timer, reservoirState, wellState); (*it)->writeTimeStep (timer, reservoirState, wellState, isSubstep);
} }
} }

View File

@ -88,7 +88,8 @@ public:
*/ */
virtual void writeTimeStep(const SimulatorTimerInterface& timer, virtual void writeTimeStep(const SimulatorTimerInterface& timer,
const SimulatorState& reservoirState, const SimulatorState& reservoirState,
const WellState& wellState) = 0; const WellState& wellState,
bool isSubstep) = 0;
/*! /*!
* Create a suitable set of output formats based on configuration. * Create a suitable set of output formats based on configuration.

View File

@ -1219,8 +1219,10 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
// implementation of the writeTimeStep method // implementation of the writeTimeStep method
void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer, void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
const SimulatorState& reservoirState, const SimulatorState& reservoirState,
const WellState& wellState) const WellState& wellState,
bool isSubstep)
{ {
// if we don't want to write anything, this method becomes a // if we don't want to write anything, this method becomes a
// no-op... // no-op...
if (!enableOutput_) { if (!enableOutput_) {
@ -1258,7 +1260,7 @@ void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
// Write restart file // Write restart file
if(ioConfig->getWriteRestartFile(timer.reportStepNum())) if(!isSubstep && ioConfig->getWriteRestartFile(timer.reportStepNum()))
{ {
const size_t ncwmax = eclipseState_->getSchedule()->getMaxNumCompletionsForWells(timer.reportStepNum()); const size_t ncwmax = eclipseState_->getSchedule()->getMaxNumCompletionsForWells(timer.reportStepNum());
const size_t numWells = eclipseState_->getSchedule()->numWells(timer.reportStepNum()); const size_t numWells = eclipseState_->getSchedule()->numWells(timer.reportStepNum());

View File

@ -98,7 +98,7 @@ public:
*/ */
virtual void writeTimeStep(const SimulatorTimerInterface& timer, virtual void writeTimeStep(const SimulatorTimerInterface& timer,
const SimulatorState& reservoirState, const SimulatorState& reservoirState,
const WellState& wellState); const WellState& wellState, bool isSubstep );
static int eclipseWellTypeMask(WellType wellType, WellInjector::TypeEnum injectorType); static int eclipseWellTypeMask(WellType wellType, WellInjector::TypeEnum injectorType);

View File

@ -180,7 +180,8 @@ namespace Opm {
// write data if outputWriter was provided // write data if outputWriter was provided
if( outputWriter ) { if( outputWriter ) {
outputWriter->writeTimeStep( substepTimer, state, well_state ); bool substep = true;
outputWriter->writeTimeStep( substepTimer, state, well_state, substep);
} }
// set new time step length // set new time step length

View File

@ -88,7 +88,7 @@ SimulatorOutputBase::writeOutput () {
// relay the request to the handlers (setup in the constructor // relay the request to the handlers (setup in the constructor
// from parameters) // from parameters)
writer_->writeTimeStep (*timer_, *reservoirState_, *wellState_); writer_->writeTimeStep (*timer_, *reservoirState_, *wellState_ , false);
// advance to the next reporting time // advance to the next reporting time
++next_; ++next_;

View File

@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE(test_EclipseWriterRFTHandler)
for (; simulatorTimer->currentStepNum() < simulatorTimer->numSteps(); ++ (*simulatorTimer)) { for (; simulatorTimer->currentStepNum() < simulatorTimer->numSteps(); ++ (*simulatorTimer)) {
std::shared_ptr<Opm::BlackoilState> blackoilState2 = createBlackoilState(simulatorTimer->currentStepNum(),ourFineGridManagerPtr); std::shared_ptr<Opm::BlackoilState> blackoilState2 = createBlackoilState(simulatorTimer->currentStepNum(),ourFineGridManagerPtr);
std::shared_ptr<Opm::WellState> wellState = createWellState(blackoilState2); std::shared_ptr<Opm::WellState> wellState = createWellState(blackoilState2);
eclipseWriter->writeTimeStep(*simulatorTimer, *blackoilState2, *wellState); eclipseWriter->writeTimeStep(*simulatorTimer, *blackoilState2, *wellState, false);
} }
std::string cwd(test_work_area_get_cwd(test_area.get())); std::string cwd(test_work_area_get_cwd(test_area.get()));

View File

@ -408,7 +408,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriterIntegration)
for (; simTimer->currentStepNum() < simTimer->numSteps(); ++ (*simTimer)) { for (; simTimer->currentStepNum() < simTimer->numSteps(); ++ (*simTimer)) {
createBlackoilState(simTimer->currentStepNum()); createBlackoilState(simTimer->currentStepNum());
createWellState(simTimer->currentStepNum()); createWellState(simTimer->currentStepNum());
eclWriter->writeTimeStep(*simTimer, *blackoilState, *wellState); eclWriter->writeTimeStep(*simTimer, *blackoilState, *wellState, false);
checkRestartFile(simTimer->currentStepNum()); checkRestartFile(simTimer->currentStepNum());
checkSummaryFile(simTimer->currentStepNum()); checkSummaryFile(simTimer->currentStepNum());
} }

View File

@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
setValuesInWellState(wellState); setValuesInWellState(wellState);
simTimer->setCurrentStepNum(1); simTimer->setCurrentStepNum(1);
eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState); eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState , false);
const char * test_area_path = test_work_area_get_cwd(test_area); const char * test_area_path = test_work_area_get_cwd(test_area);
std::string slash = "/"; std::string slash = "/";

View File

@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo)
for(int timestep=0; timestep <= countTimeStep; ++timestep){ for(int timestep=0; timestep <= countTimeStep; ++timestep){
simTimer->setCurrentStepNum(timestep); simTimer->setCurrentStepNum(timestep);
eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState); eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState, false);
} }
verifyWellState(eclipse_restart_filename, eclipseState->getEclipseGrid(), eclipseState->getSchedule()); verifyWellState(eclipse_restart_filename, eclipseState->getEclipseGrid(), eclipseState->getSchedule());