From cf7c8552a5f51afecb17ade98dd6d0a4af74fcc1 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 18 Oct 2019 09:07:06 +0200 Subject: [PATCH] Always allocate buffers when restarting --- ebos/ecloutputblackoilmodule.hh | 9 ++++++--- ebos/eclwriter.hh | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index e963ee957..bad6a76a1 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -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 >::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 diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index 096532841..3146b6ea1 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -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(); @@ -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(); @@ -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();