OPM-205: Added support for RPTSCHED RESTART, and handling of RPTRST BASIC = 0

This commit is contained in:
chflo
2015-05-29 11:24:02 +02:00
parent 24b8ca5f69
commit 8a12c3eda9
2 changed files with 44 additions and 6 deletions

View File

@@ -32,7 +32,8 @@ namespace Opm {
m_UNIFOUT(false),
m_FMTIN(false),
m_FMTOUT(false),
m_eclipse_input_path(input_path) {
m_eclipse_input_path(input_path),
m_ignore_RPTSCHED_RESTART(false){
}
bool IOConfig::getWriteEGRIDFile() const {
@@ -50,6 +51,9 @@ namespace Opm {
restartConfig ts_restart_config = m_restart_output_config->get(timestep);
switch (ts_restart_config.basic) {
case 0: //Do not write restart files
write_restart_ts = false;
break;
case 1: //Write restart file every report time
write_restart_ts = true;
break;
@@ -65,9 +69,6 @@ namespace Opm {
case 5: //First reportstep of every month, or if n > 1, n'th months
write_restart_ts = getWriteRestartFileFrequency(timestep, ts_restart_config.timestep, ts_restart_config.frequency, false, true);
break;
case 6: //Write restart file every timestep
throw std::runtime_error("OPM does not support the RPTRST BASIC=6 setting (write restart file every timestep)");
break;
default:
// do nothing
break;
@@ -113,6 +114,19 @@ namespace Opm {
void IOConfig::handleRPTRSTBasic(TimeMapConstPtr timemap, size_t timestep, size_t basic, size_t frequency, bool update_default) {
if (6 == basic )
{
throw std::runtime_error("OPM does not support the RPTRST BASIC=6 setting (write restart file every timestep)");
}
if (2 < basic) {
m_ignore_RPTSCHED_RESTART = true;
} else {
m_ignore_RPTSCHED_RESTART = false;
}
if (!m_timemap) {
initRestartOutputConfig(timemap);
}
@@ -130,6 +144,30 @@ namespace Opm {
}
void IOConfig::handleRPTSCHEDRestart(TimeMapConstPtr timemap, size_t timestep, size_t restart) {
if (6 == restart )
{
throw std::runtime_error("OPM does not support the RPTSCHED RESTART=6 setting (write restart file every timestep)");
}
if (m_ignore_RPTSCHED_RESTART) { //If previously RPTRST BASIC has been set >2, ignore RPTSCHED RESTART
return;
}
if (!m_timemap) {
initRestartOutputConfig(timemap);
}
//RPTSCHED Restart mnemonic == 0: same logic as RPTRST Basic mnemonic = 0
//RPTSCHED Restart mnemonic >= 1; same logic as RPTRST Basic mnemonic = 1
restartConfig rs;
rs.timestep = timestep;
rs.basic = (restart == 0) ? 0 : 1;
m_restart_output_config->add(timestep, rs);
}
void IOConfig::initRestartOutputConfig(TimeMapConstPtr timemap) {
restartConfig rs;
@@ -174,7 +212,6 @@ namespace Opm {
}
}
}
std::cout << "SOLUTION SECTION; BASIC FREQ IS " << basic << "," << freq << std::endl;
handleRPTRSTBasic(m_timemap, currentStep, basic, freq, true);
}
}

View File

@@ -43,9 +43,9 @@ namespace Opm {
bool getFMTOUT() const;
const std::string& getEclipseInputPath() const;
void setEclipseInputPath(const std::string& path);
void handleRPTRSTBasic(TimeMapConstPtr timemap, size_t timestep, size_t basic, size_t frequency=1, bool update_default=false);
void handleRPTSCHEDRestart(TimeMapConstPtr timemap, size_t timestep, size_t restart);
void handleSolutionSection(TimeMapConstPtr timemap, std::shared_ptr<const SOLUTIONSection> solutionSection);
void handleGridSection(std::shared_ptr<const GRIDSection> gridSection);
void handleRunspecSection(std::shared_ptr<const RUNSPECSection> runspecSection);
@@ -70,6 +70,7 @@ namespace Opm {
bool m_FMTIN;
bool m_FMTOUT;
std::string m_eclipse_input_path;
bool m_ignore_RPTSCHED_RESTART;
struct restartConfig {