mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
fix option for output every timestep
This commit is contained in:
parent
fcad25e26a
commit
366f3a2944
@ -116,6 +116,7 @@ protected:
|
||||
unsigned int gridEquilIdxToGridIdx(unsigned int elemIndex) const;
|
||||
|
||||
void doWriteOutput(const int reportStepNum,
|
||||
const std::optional<int> timeStepNum,
|
||||
const bool isSubStep,
|
||||
data::Solution&& localCellData,
|
||||
data::Wells&& localWellData,
|
||||
|
@ -142,6 +142,7 @@ struct EclWriteTasklet : public Opm::TaskletInterface
|
||||
Opm::UDQState udqState_;
|
||||
Opm::EclipseIO& eclIO_;
|
||||
int reportStepNum_;
|
||||
std::optional<int> timeStepNum_;
|
||||
bool isSubStep_;
|
||||
double secondsElapsed_;
|
||||
Opm::RestartValue restartValue_;
|
||||
@ -153,6 +154,7 @@ struct EclWriteTasklet : public Opm::TaskletInterface
|
||||
const Opm::UDQState& udqState,
|
||||
Opm::EclipseIO& eclIO,
|
||||
int reportStepNum,
|
||||
std::optional<int> timeStepNum,
|
||||
bool isSubStep,
|
||||
double secondsElapsed,
|
||||
Opm::RestartValue restartValue,
|
||||
@ -163,6 +165,7 @@ struct EclWriteTasklet : public Opm::TaskletInterface
|
||||
, udqState_(udqState)
|
||||
, eclIO_(eclIO)
|
||||
, reportStepNum_(reportStepNum)
|
||||
, timeStepNum_(timeStepNum)
|
||||
, isSubStep_(isSubStep)
|
||||
, secondsElapsed_(secondsElapsed)
|
||||
, restartValue_(std::move(restartValue))
|
||||
@ -180,7 +183,9 @@ struct EclWriteTasklet : public Opm::TaskletInterface
|
||||
this->isSubStep_,
|
||||
this->secondsElapsed_,
|
||||
std::move(this->restartValue_),
|
||||
this->writeDoublePrecision_);
|
||||
this->writeDoublePrecision_,
|
||||
this->timeStepNum_
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -508,6 +513,7 @@ exportNncStructure_(const std::unordered_map<int,int>& cartesianToActive,
|
||||
template<class Grid, class EquilGrid, class GridView, class ElementMapper, class Scalar>
|
||||
void EclGenericWriter<Grid,EquilGrid,GridView,ElementMapper,Scalar>::
|
||||
doWriteOutput(const int reportStepNum,
|
||||
const std::optional<int> timeStepNum,
|
||||
const bool isSubStep,
|
||||
data::Solution&& localCellData,
|
||||
data::Wells&& localWellData,
|
||||
@ -583,7 +589,7 @@ doWriteOutput(const int reportStepNum,
|
||||
actionState,
|
||||
isParallel ? this->collectOnIORank_.globalWellTestState() : std::move(localWTestState),
|
||||
summaryState, udqState, *this->eclIO_,
|
||||
reportStepNum, isSubStep, curTime, std::move(restartValue), doublePrecision);
|
||||
reportStepNum, timeStepNum, isSubStep, curTime, std::move(restartValue), doublePrecision);
|
||||
|
||||
// then, make sure that the previous I/O request has been completed
|
||||
// and the number of incomplete tasklets does not increase between
|
||||
|
@ -64,6 +64,12 @@ template<class TypeTag, class MyTypeTag>
|
||||
struct EclOutputDoublePrecision {
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
// Write all solutions for visualization, not just the ones for the
|
||||
// report steps...
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableWriteAllSolutions {
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableEsmry {
|
||||
using type = UndefinedProperty;
|
||||
@ -398,7 +404,7 @@ public:
|
||||
auto floresn = this->outputModule_->getFloresn();
|
||||
|
||||
// data::Solution localCellData = {};
|
||||
if (! isSubStep) {
|
||||
if (! isSubStep || Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>()) {
|
||||
|
||||
auto rstep = timer.reportStepNum();
|
||||
|
||||
@ -453,8 +459,11 @@ public:
|
||||
if (this->collectOnIORank_.isIORank()) {
|
||||
const Scalar curTime = simulator_.time() + simulator_.timeStepSize();
|
||||
const Scalar nextStepSize = simulator_.problem().nextTimeStepSize();
|
||||
|
||||
this->doWriteOutput(reportStepNum, isSubStep,
|
||||
std::optional<int> timeStepIdx;
|
||||
if (Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>()) {
|
||||
timeStepIdx = simulator_.timeStepIndex();
|
||||
}
|
||||
this->doWriteOutput(reportStepNum, timeStepIdx, isSubStep,
|
||||
std::move(localCellData),
|
||||
std::move(localWellData),
|
||||
std::move(localGroupAndNetworkData),
|
||||
@ -604,7 +613,7 @@ private:
|
||||
countLocalInteriorCellsGridView(gridView);
|
||||
this->outputModule_->
|
||||
allocBuffers(num_interior, reportStepNum,
|
||||
isSubStep, log, /*isRestart*/ false);
|
||||
isSubStep && !Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>(), log, /*isRestart*/ false);
|
||||
|
||||
ElementContext elemCtx(simulator_);
|
||||
|
||||
|
@ -458,6 +458,7 @@ public:
|
||||
if (!initconfig.restartRequested()) {
|
||||
simulator.startNextEpisode(schedule.seconds(1));
|
||||
simulator.setEpisodeIndex(0);
|
||||
simulator.setTimeStepIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,6 +655,7 @@ public:
|
||||
#endif // NDEBUG
|
||||
|
||||
auto& simulator = this->simulator();
|
||||
simulator.setTimeStepIndex(simulator.timeStepIndex()+1);
|
||||
|
||||
this->wellModel_.endTimeStep();
|
||||
this->aquiferModel_.endTimeStep();
|
||||
@ -679,8 +681,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const bool isSubStep = !Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>()
|
||||
&& !this->simulator().episodeWillBeOver();
|
||||
const bool isSubStep = !this->simulator().episodeWillBeOver();
|
||||
|
||||
// For CpGrid with LGRs, ecl/vtk output is not supported yet.
|
||||
const auto& grid = this->simulator().vanguard().gridView().grid();
|
||||
@ -774,8 +775,7 @@ public:
|
||||
ParentType::writeOutput(verbose);
|
||||
}
|
||||
|
||||
bool isSubStep = !Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>() &&
|
||||
!this->simulator().episodeWillBeOver();
|
||||
bool isSubStep = !this->simulator().episodeWillBeOver();
|
||||
|
||||
data::Solution localCellData = {};
|
||||
#if HAVE_DAMARIS
|
||||
|
@ -71,13 +71,6 @@ struct WellModel {
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
|
||||
// Write all solutions for visualization, not just the ones for the
|
||||
// report steps...
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableWriteAllSolutions {
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
|
||||
// The number of time steps skipped between writing two consequtive restart files
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct RestartWritingInterval {
|
||||
|
Loading…
Reference in New Issue
Block a user