changed: EclWriter parameters moved to Opm::Parameters namespace

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:17:13 +02:00
parent 917fdbedfd
commit b69439aa1f
4 changed files with 54 additions and 57 deletions

View File

@ -191,7 +191,9 @@ public:
OPM_TIMEBLOCK(problemWriteOutput); OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to // use the generic code to prepare the output fields and to
// write the desired VTK files. // write the desired VTK files.
if (Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>() || this->simulator().episodeWillBeOver()) { if (Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>() ||
this->simulator().episodeWillBeOver())
{
// \Note: the SimulatorTimer does not carry any useful information, so PRT file (if it gets output) will contain wrong // \Note: the SimulatorTimer does not carry any useful information, so PRT file (if it gets output) will contain wrong
// timing information. // timing information.
BaseType::writeOutput(SimulatorTimer{}, verbose); BaseType::writeOutput(SimulatorTimer{}, verbose);

View File

@ -50,31 +50,26 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
namespace Opm::Properties { namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EnableEclOutput { struct EnableEclOutput { using type = Properties::UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EnableAsyncEclOutput { struct EnableAsyncEclOutput { using type = Properties::UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EclOutputDoublePrecision { struct EclOutputDoublePrecision { using type = Properties::UndefinedProperty; };
using type = UndefinedProperty;
};
// Write all solutions for visualization, not just the ones for the // Write all solutions for visualization, not just the ones for the
// report steps... // report steps...
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EnableWriteAllSolutions { struct EnableWriteAllSolutions { using type = Properties::UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EnableEsmry { struct EnableEsmry { using type = Properties::UndefinedProperty; };
using type = UndefinedProperty;
}; } // namespace Opm::Parameters
} // namespace Opm::Properties
namespace Opm { namespace Opm {
@ -130,10 +125,10 @@ public:
{ {
OutputBlackOilModule<TypeTag>::registerParameters(); OutputBlackOilModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Properties::EnableAsyncEclOutput> Parameters::registerParam<TypeTag, Parameters::EnableAsyncEclOutput>
("Write the ECL-formated results in a non-blocking way " ("Write the ECL-formated results in a non-blocking way "
"(i.e., using a separate thread)."); "(i.e., using a separate thread).");
Parameters::registerParam<TypeTag, Properties::EnableEsmry> Parameters::registerParam<TypeTag, Parameters::EnableEsmry>
("Write ESMRY file for fast loading of summary data."); ("Write ESMRY file for fast loading of summary data.");
} }
@ -153,8 +148,8 @@ public:
((simulator.vanguard().grid().comm().rank() == 0) ((simulator.vanguard().grid().comm().rank() == 0)
? &simulator.vanguard().equilCartesianIndexMapper() ? &simulator.vanguard().equilCartesianIndexMapper()
: nullptr), : nullptr),
Parameters::get<TypeTag, Properties::EnableAsyncEclOutput>(), Parameters::get<TypeTag, Parameters::EnableAsyncEclOutput>(),
Parameters::get<TypeTag, Properties::EnableEsmry>()) Parameters::get<TypeTag, Parameters::EnableEsmry>())
, simulator_(simulator) , simulator_(simulator)
{ {
#if HAVE_MPI #if HAVE_MPI
@ -404,7 +399,7 @@ public:
auto floresn = this->outputModule_->getFloresn(); auto floresn = this->outputModule_->getFloresn();
// data::Solution localCellData = {}; // data::Solution localCellData = {};
if (! isSubStep || Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>()) { if (! isSubStep || Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>()) {
auto rstep = timer.reportStepNum(); auto rstep = timer.reportStepNum();
@ -460,7 +455,7 @@ public:
const Scalar curTime = simulator_.time() + simulator_.timeStepSize(); const Scalar curTime = simulator_.time() + simulator_.timeStepSize();
const Scalar nextStepSize = simulator_.problem().nextTimeStepSize(); const Scalar nextStepSize = simulator_.problem().nextTimeStepSize();
std::optional<int> timeStepIdx; std::optional<int> timeStepIdx;
if (Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>()) { if (Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>()) {
timeStepIdx = simulator_.timeStepIndex(); timeStepIdx = simulator_.timeStepIndex();
} }
this->doWriteOutput(reportStepNum, timeStepIdx, isSubStep, this->doWriteOutput(reportStepNum, timeStepIdx, isSubStep,
@ -474,7 +469,7 @@ public:
this->summaryState(), this->summaryState(),
this->simulator_.problem().thresholdPressure().getRestartVector(), this->simulator_.problem().thresholdPressure().getRestartVector(),
curTime, nextStepSize, curTime, nextStepSize,
Parameters::get<TypeTag, Properties::EclOutputDoublePrecision>(), Parameters::get<TypeTag, Parameters::EclOutputDoublePrecision>(),
isFlowsn, std::move(flowsn), isFlowsn, std::move(flowsn),
isFloresn, std::move(floresn)); isFloresn, std::move(floresn));
} }
@ -609,7 +604,7 @@ public:
private: private:
static bool enableEclOutput_() static bool enableEclOutput_()
{ return Parameters::get<TypeTag, Properties::EnableEclOutput>(); } { return Parameters::get<TypeTag, Parameters::EnableEclOutput>(); }
const EclipseState& eclState() const const EclipseState& eclState() const
{ return simulator_.vanguard().eclState(); } { return simulator_.vanguard().eclState(); }
@ -642,7 +637,7 @@ private:
countLocalInteriorCellsGridView(gridView); countLocalInteriorCellsGridView(gridView);
this->outputModule_-> this->outputModule_->
allocBuffers(num_interior, reportStepNum, allocBuffers(num_interior, reportStepNum,
isSubStep && !Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>(), log, /*isRestart*/ false); isSubStep && !Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>(), log, /*isRestart*/ false);
ElementContext elemCtx(simulator_); ElementContext elemCtx(simulator_);

View File

@ -216,17 +216,17 @@ public:
VtkTracerModule<TypeTag>::registerParameters(); VtkTracerModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Properties::EnableWriteAllSolutions> Parameters::registerParam<TypeTag, Parameters::EnableWriteAllSolutions>
("Write all solutions to disk instead of only the ones for the " ("Write all solutions to disk instead of only the ones for the "
"report steps"); "report steps");
Parameters::registerParam<TypeTag, Properties::EnableEclOutput> Parameters::registerParam<TypeTag, Parameters::EnableEclOutput>
("Write binary output which is compatible with the commercial " ("Write binary output which is compatible with the commercial "
"Eclipse simulator"); "Eclipse simulator");
#if HAVE_DAMARIS #if HAVE_DAMARIS
Parameters::registerParam<TypeTag, Parameters::EnableDamarisOutput> Parameters::registerParam<TypeTag, Parameters::EnableDamarisOutput>
("Write a specific variable using Damaris in a separate core"); ("Write a specific variable using Damaris in a separate core");
#endif #endif
Parameters::registerParam<TypeTag, Properties::EclOutputDoublePrecision> Parameters::registerParam<TypeTag, Parameters::EclOutputDoublePrecision>
("Tell the output writer to use double precision. Useful for 'perfect' restarts"); ("Tell the output writer to use double precision. Useful for 'perfect' restarts");
Parameters::registerParam<TypeTag, Parameters::RestartWritingInterval> Parameters::registerParam<TypeTag, Parameters::RestartWritingInterval>
("The frequencies of which time steps are serialized to disk"); ("The frequencies of which time steps are serialized to disk");
@ -313,7 +313,7 @@ public:
#endif #endif
enableDriftCompensation_ = Parameters::get<TypeTag, Parameters::EnableDriftCompensation>(); enableDriftCompensation_ = Parameters::get<TypeTag, Parameters::EnableDriftCompensation>();
enableEclOutput_ = Parameters::get<TypeTag, Properties::EnableEclOutput>(); enableEclOutput_ = Parameters::get<TypeTag, Parameters::EnableEclOutput>();
this->enableTuning_ = Parameters::get<TypeTag, Parameters::EnableTuning>(); this->enableTuning_ = Parameters::get<TypeTag, Parameters::EnableTuning>();
this->initialTimeStepSize_ = Parameters::get<TypeTag, Parameters::InitialTimeStepSize>(); this->initialTimeStepSize_ = Parameters::get<TypeTag, Parameters::InitialTimeStepSize>();
@ -780,7 +780,7 @@ public:
OPM_TIMEBLOCK(problemWriteOutput); OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to // use the generic code to prepare the output fields and to
// write the desired VTK files. // write the desired VTK files.
if (Parameters::get<TypeTag, Properties::EnableWriteAllSolutions>() || if (Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>() ||
this->simulator().episodeWillBeOver()) { this->simulator().episodeWillBeOver()) {
ParentType::writeOutput(verbose); ParentType::writeOutput(verbose);
} }

View File

@ -198,36 +198,11 @@ template<class TypeTag>
struct EnableDispersion<TypeTag, TTag::FlowBaseProblem> struct EnableDispersion<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// only write the solutions for the report steps to disk
template<class TypeTag>
struct EnableWriteAllSolutions<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// disable API tracking // disable API tracking
template<class TypeTag> template<class TypeTag>
struct EnableApiTracking<TypeTag, TTag::FlowBaseProblem> struct EnableApiTracking<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// ... but enable the ECL output by default
template<class TypeTag>
struct EnableEclOutput<TypeTag,TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// If available, write the ECL output in a non-blocking manner
template<class TypeTag>
struct EnableAsyncEclOutput<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// Write ESMRY file for fast loading of summary data
template<class TypeTag>
struct EnableEsmry<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// By default, use single precision for the ECL formated results
template<class TypeTag>
struct EclOutputDoublePrecision<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// Use the "velocity module" which uses the Eclipse "NEWTRAN" transmissibilities // Use the "velocity module" which uses the Eclipse "NEWTRAN" transmissibilities
template<class TypeTag> template<class TypeTag>
struct FluxModule<TypeTag, TTag::FlowBaseProblem> struct FluxModule<TypeTag, TTag::FlowBaseProblem>
@ -371,6 +346,16 @@ struct DamarisLimitVariables<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = ""; }; { static constexpr auto value = ""; };
#endif #endif
// By default, use single precision for the ECL formated results
template<class TypeTag>
struct EclOutputDoublePrecision<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// If available, write the ECL output in a non-blocking manner
template<class TypeTag>
struct EnableAsyncEclOutput<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// By default, we enable the debugging checks if we're compiled in debug mode // By default, we enable the debugging checks if we're compiled in debug mode
template<class TypeTag> template<class TypeTag>
struct EnableDebuggingChecks<TypeTag, Properties::TTag::FlowBaseProblem> struct EnableDebuggingChecks<TypeTag, Properties::TTag::FlowBaseProblem>
@ -383,6 +368,16 @@ template<class TypeTag>
struct EnableDriftCompensation<TypeTag, Properties::TTag::FlowBaseProblem> struct EnableDriftCompensation<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// enable the ECL output by default
template<class TypeTag>
struct EnableEclOutput<TypeTag,Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// Write ESMRY file for fast loading of summary data
template<class TypeTag>
struct EnableEsmry<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// Enable gravity // Enable gravity
template<class TypeTag> template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::FlowBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::FlowBaseProblem>
@ -404,6 +399,11 @@ template<class TypeTag>
struct EnableVtkOutput<TypeTag, Properties::TTag::FlowBaseProblem> struct EnableVtkOutput<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// only write the solutions for the report steps to disk
template<class TypeTag>
struct EnableWriteAllSolutions<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// The default for the end time of the simulation [s] // The default for the end time of the simulation [s]
// //
// By default, stop it after the universe will probably have stopped // By default, stop it after the universe will probably have stopped