mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Write vtk (if enabled) for dry runs
This commit is contained in:
parent
ad595fed5e
commit
d4890d18f7
@ -73,6 +73,10 @@ template<class TypeTag>
|
||||
struct EclDeckFileName<TypeTag, Properties::TTag::FlowBaseVanguard>
|
||||
{ static constexpr auto value = ""; };
|
||||
|
||||
// TODO: enumeration parameters. we use strings for now.
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableDryRun { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableOpmRstFile { using type = Properties::UndefinedProperty; };
|
||||
|
||||
@ -139,6 +143,11 @@ template<class TypeTag>
|
||||
struct EclOutputInterval<TypeTag, Properties::TTag::FlowBaseVanguard>
|
||||
{ static constexpr int value = -1; };
|
||||
|
||||
// TODO: enumeration parameters. we use strings for now.
|
||||
template<class TypeTag>
|
||||
struct EnableDryRun<TypeTag, Properties::TTag::FlowBaseVanguard>
|
||||
{ static constexpr auto value = "auto"; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct EnableOpmRstFile<TypeTag, Properties::TTag::FlowBaseVanguard>
|
||||
{ static constexpr bool value = false; };
|
||||
@ -242,6 +251,8 @@ public:
|
||||
("The name of the file which contains the ECL deck to be simulated");
|
||||
Parameters::registerParam<TypeTag, Parameters::EclOutputInterval>
|
||||
("The number of report steps that ought to be skipped between two writes of ECL results");
|
||||
Parameters::registerParam<TypeTag, Parameters::EnableDryRun>
|
||||
("Specify if the simulation ought to be actually run, or just pretended to be");
|
||||
Parameters::registerParam<TypeTag, Parameters::EnableOpmRstFile>
|
||||
("Include OPM-specific keywords in the ECL restart file to "
|
||||
"enable restart of OPM simulators from these files");
|
||||
@ -543,6 +554,8 @@ protected:
|
||||
std::string outputDir = Parameters::get<TypeTag, Parameters::OutputDir>();
|
||||
bool enableEclCompatFile = !Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
|
||||
asImp_().updateOutputDir_(outputDir, enableEclCompatFile);
|
||||
const std::string& dryRunString = Parameters::get<TypeTag, Parameters::EnableDryRun>();
|
||||
asImp_().updateNOSIM_(dryRunString);
|
||||
asImp_().finalizeInit_();
|
||||
}
|
||||
|
||||
|
@ -175,6 +175,34 @@ std::string FlowGenericVanguard::canonicalDeckPath(const std::string& caseName)
|
||||
throw std::invalid_argument("Cannot find input case '"+caseName+"'");
|
||||
}
|
||||
|
||||
void FlowGenericVanguard::updateNOSIM_(std::string_view dryRunString)
|
||||
{
|
||||
try {
|
||||
// Possible to force initialization only behavior (NOSIM).
|
||||
if (dryRunString != "" && dryRunString != "auto") {
|
||||
bool enableDryRun;
|
||||
if (dryRunString == "true"
|
||||
|| dryRunString == "t"
|
||||
|| dryRunString == "1")
|
||||
enableDryRun = true;
|
||||
else if (dryRunString == "false"
|
||||
|| dryRunString == "f"
|
||||
|| dryRunString == "0")
|
||||
enableDryRun = false;
|
||||
else
|
||||
throw std::invalid_argument("Invalid value for parameter EnableDryRun: '"
|
||||
+ std::string(dryRunString) + "'");
|
||||
auto& ioConfig = eclState().getIOConfig();
|
||||
ioConfig.overrideNOSIM(enableDryRun);
|
||||
}
|
||||
}
|
||||
catch (const std::invalid_argument& e) {
|
||||
std::cerr << "Failed to create valid EclipseState object" << std::endl;
|
||||
std::cerr << "Exception caught: " << e.what() << std::endl;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void FlowGenericVanguard::updateOutputDir_(std::string outputDir,
|
||||
bool enableEclCompatFile)
|
||||
{
|
||||
|
@ -284,6 +284,8 @@ protected:
|
||||
void updateOutputDir_(std::string outputDir,
|
||||
bool enableEclCompatFile);
|
||||
|
||||
void updateNOSIM_(std::string_view enableDryRun);
|
||||
|
||||
bool drsdtconEnabled() const;
|
||||
|
||||
std::unordered_map<std::size_t, const NumericalAquiferCell*> allAquiferCells() const;
|
||||
|
@ -44,20 +44,12 @@
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableDryRun { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct OutputInterval { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableLoggingFalloutWarning { using type = Properties::UndefinedProperty; };
|
||||
|
||||
// TODO: enumeration parameters. we use strings for now.
|
||||
template<class TypeTag>
|
||||
struct EnableDryRun<TypeTag, Properties::TTag::FlowProblem>
|
||||
{ static constexpr auto value = "auto"; };
|
||||
|
||||
// Do not merge parallel output files or warn about them
|
||||
template<class TypeTag>
|
||||
struct EnableLoggingFalloutWarning<TypeTag, Properties::TTag::FlowProblem>
|
||||
@ -110,8 +102,6 @@ namespace Opm {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
// register the flow specific parameters
|
||||
Parameters::registerParam<TypeTag, Parameters::EnableDryRun>
|
||||
("Specify if the simulation ought to be actually run, or just pretended to be");
|
||||
Parameters::registerParam<TypeTag, Parameters::OutputInterval>
|
||||
("Specify the number of report steps between two consecutive writes of restart data");
|
||||
Parameters::registerParam<TypeTag, Parameters::EnableLoggingFalloutWarning>
|
||||
@ -421,32 +411,6 @@ namespace Opm {
|
||||
modelSimulator_ = std::make_unique<ModelSimulator>(FlowGenericVanguard::comm(), /*verbose=*/false);
|
||||
modelSimulator_->executionTimer().start();
|
||||
modelSimulator_->model().applyInitialSolution();
|
||||
|
||||
try {
|
||||
// Possible to force initialization only behavior (NOSIM).
|
||||
const std::string& dryRunString = Parameters::get<TypeTag, Parameters::EnableDryRun>();
|
||||
if (dryRunString != "" && dryRunString != "auto") {
|
||||
bool yesno;
|
||||
if (dryRunString == "true"
|
||||
|| dryRunString == "t"
|
||||
|| dryRunString == "1")
|
||||
yesno = true;
|
||||
else if (dryRunString == "false"
|
||||
|| dryRunString == "f"
|
||||
|| dryRunString == "0")
|
||||
yesno = false;
|
||||
else
|
||||
throw std::invalid_argument("Invalid value for parameter EnableDryRun: '"
|
||||
+dryRunString+"'");
|
||||
auto& ioConfig = eclState().getIOConfig();
|
||||
ioConfig.overrideNOSIM(yesno);
|
||||
}
|
||||
}
|
||||
catch (const std::invalid_argument& e) {
|
||||
std::cerr << "Failed to create valid EclipseState object" << std::endl;
|
||||
std::cerr << "Exception caught: " << e.what() << std::endl;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
const EclipseState& eclState() const
|
||||
|
@ -314,6 +314,7 @@ public:
|
||||
enableDriftCompensation_ = Parameters::get<TypeTag, Parameters::EnableDriftCompensation>();
|
||||
|
||||
enableEclOutput_ = Parameters::get<TypeTag, Parameters::EnableEclOutput>();
|
||||
enableVtkOutput_ = Parameters::get<TypeTag, Parameters::EnableVtkOutput>();
|
||||
|
||||
this->enableTuning_ = Parameters::get<TypeTag, Parameters::EnableTuning>();
|
||||
this->initialTimeStepSize_ = Parameters::get<TypeTag, Parameters::InitialTimeStepSize>();
|
||||
@ -465,6 +466,11 @@ public:
|
||||
drift_ = 0.0;
|
||||
}
|
||||
|
||||
if (enableVtkOutput_ && eclState.getIOConfig().initOnly()) {
|
||||
simulator.setTimeStepSize(0.0);
|
||||
ParentType::writeOutput(true);
|
||||
}
|
||||
|
||||
// after finishing the initialization and writing the initial solution, we move
|
||||
// to the first "real" episode/report step
|
||||
// for restart the episode index and start is already set
|
||||
@ -2839,6 +2845,7 @@ private:
|
||||
AquiferModel aquiferModel_;
|
||||
|
||||
bool enableEclOutput_;
|
||||
bool enableVtkOutput_;
|
||||
std::unique_ptr<EclWriterType> eclWriter_;
|
||||
|
||||
#if HAVE_DAMARIS
|
||||
|
Loading…
Reference in New Issue
Block a user