Always allocate buffers when restarting

This commit is contained in:
Tor Harald Sandve 2019-10-18 09:07:06 +02:00
parent 337f36bac1
commit cf7c8552a5
2 changed files with 9 additions and 6 deletions

View File

@ -145,7 +145,7 @@ public:
* \brief Allocate memory for the scalar fields we would like to
* write to ECL output files
*/
void allocBuffers(unsigned bufferSize, unsigned reportStepNum, const bool substep, const bool log)
void allocBuffers(unsigned bufferSize, unsigned reportStepNum, const bool substep, const bool log, const bool isRestart)
{
if (!std::is_same<Discretization, Opm::EcfvDiscretization<TypeTag> >::value)
return;
@ -219,8 +219,11 @@ public:
// always allocate memory for temperature
temperature_.resize(bufferSize, 0.0);
// Only provide restart on restart steps
if (!restartConfig.getWriteRestartFile(reportStepNum, log) || substep)
// field data should be allocated
// 1) when we want to restart
// 2) when it is ask for by the user via restartConfig
// 3) when it is not a substep
if (!isRestart && (!restartConfig.getWriteRestartFile(reportStepNum, log) || substep))
return;
// always output saturation of active phases

View File

@ -251,7 +251,7 @@ public:
const auto& gridView = simulator_.vanguard().gridView();
int numElements = gridView.size(/*codim=*/0);
bool log = collectToIORank_.isIORank();
eclOutputModule_.allocBuffers(numElements, reportStepNum, isSubStep, log);
eclOutputModule_.allocBuffers(numElements, reportStepNum, isSubStep, log, /*isRestart*/ false);
ElementContext elemCtx(simulator_);
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
@ -326,7 +326,7 @@ public:
const auto& gridView = simulator_.vanguard().gridView();
int numElements = gridView.size(/*codim=*/0);
bool log = collectToIORank_.isIORank();
eclOutputModule_.allocBuffers(numElements, reportStepNum, isSubStep, log);
eclOutputModule_.allocBuffers(numElements, reportStepNum, isSubStep, log, /*isRestart*/ false);
ElementContext elemCtx(simulator_);
ElementIterator elemIt = gridView.template begin</*codim=*/0>();
@ -419,7 +419,7 @@ public:
const auto& gridView = simulator_.vanguard().gridView();
unsigned numElements = gridView.size(/*codim=*/0);
eclOutputModule_.allocBuffers(numElements, restartStepIdx, /*isSubStep=*/false, /*log=*/false);
eclOutputModule_.allocBuffers(numElements, restartStepIdx, /*isSubStep=*/false, /*log=*/false, /*isRestart*/ true);
{
Opm::SummaryState& summaryState = simulator_.vanguard().summaryState();