From 414f313d2ab54903eb53a0d4ec52f55b60c8f3e1 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Sat, 6 Jul 2024 10:22:47 +0200 Subject: [PATCH] move FlowProblem parameters to TypeTag-free parameter system --- opm/simulators/flow/BlackoilModel.hpp | 1 + opm/simulators/flow/FlowMain.hpp | 2 +- opm/simulators/flow/FlowProblem.hpp | 22 ++++++++-------- opm/simulators/flow/FlowProblemParameters.hpp | 26 +++++++++---------- opm/simulators/flow/FlowProblemProperties.hpp | 22 ---------------- opm/simulators/flow/Main.hpp | 7 +++-- 6 files changed, 28 insertions(+), 52 deletions(-) diff --git a/opm/simulators/flow/BlackoilModel.hpp b/opm/simulators/flow/BlackoilModel.hpp index 78134dd17..1d064677d 100644 --- a/opm/simulators/flow/BlackoilModel.hpp +++ b/opm/simulators/flow/BlackoilModel.hpp @@ -1310,6 +1310,7 @@ namespace Opm { public: std::vector wasSwitched_; }; + } // namespace Opm #endif // OPM_BLACKOILMODEL_HEADER_INCLUDED diff --git a/opm/simulators/flow/FlowMain.hpp b/opm/simulators/flow/FlowMain.hpp index 58bc4d16d..c8ca2ef82 100644 --- a/opm/simulators/flow/FlowMain.hpp +++ b/opm/simulators/flow/FlowMain.hpp @@ -135,7 +135,7 @@ namespace Opm { // the default eWoms checkpoint/restart mechanism does not work with flow Parameters::Hide>(); - Parameters::hideParam(); + Parameters::Hide(); // hide all vtk related it is not currently possible to do this dependet on if the vtk writing is used //if(not(Parameters::get())){ Parameters::Hide(); diff --git a/opm/simulators/flow/FlowProblem.hpp b/opm/simulators/flow/FlowProblem.hpp index 7006d12a8..76e200e1b 100644 --- a/opm/simulators/flow/FlowProblem.hpp +++ b/opm/simulators/flow/FlowProblem.hpp @@ -233,20 +233,20 @@ public: #endif Parameters::registerParam ("Tell the output writer to use double precision. Useful for 'perfect' restarts"); - Parameters::registerParam + Parameters::Register ("The frequencies of which time steps are serialized to disk"); - Parameters::registerParam + Parameters::Register ("Enable partial compensation of systematic mass losses via " "the source term of the next time step"); - Parameters::registerParam + Parameters::Register ("Specify which messages are going to be printed. " "Valid values are: none, log, all (default)"); - Parameters::registerParam + Parameters::Register ("Number of pressure points (in each direction) in tables used for equilibration"); - Parameters::hideParam(); // Users will typically not need to modify this parameter.. - Parameters::registerParam + Parameters::Hide(); // Users will typically not need to modify this parameter.. + Parameters::Register ("Use pressure from end of the last time step when evaluating rock compaction"); - Parameters::hideParam(); // Users will typically not need to modify this parameter.. + Parameters::Hide(); // Users will typically not need to modify this parameter.. // By default, stop it after the universe will probably have stopped // to exist. (the ECL problem will finish the simulation explicitly @@ -333,7 +333,7 @@ public: damarisWriter_ = std::make_unique(simulator); enableDamarisOutput_ = Parameters::Get(); #endif - enableDriftCompensation_ = Parameters::get(); + enableDriftCompensation_ = Parameters::Get(); enableEclOutput_ = Parameters::get(); enableVtkOutput_ = Parameters::Get(); @@ -346,14 +346,14 @@ public: // 1. Command line value (--num-pressure-points-equil=N) // 2. EQLDIMS item 2 // Default value is defined in opm-common/src/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS - if (Parameters::isSet()) + if (Parameters::IsSet()) { - this->numPressurePointsEquil_ = Parameters::get(); + this->numPressurePointsEquil_ = Parameters::Get(); } else { this->numPressurePointsEquil_ = simulator.vanguard().eclState().getTableManager().getEqldims().getNumDepthNodesP(); } - explicitRockCompaction_ = Parameters::get(); + explicitRockCompaction_ = Parameters::Get(); RelpermDiagnostics relpermDiagnostics; diff --git a/opm/simulators/flow/FlowProblemParameters.hpp b/opm/simulators/flow/FlowProblemParameters.hpp index bd2607f66..ba615e980 100644 --- a/opm/simulators/flow/FlowProblemParameters.hpp +++ b/opm/simulators/flow/FlowProblemParameters.hpp @@ -28,29 +28,27 @@ #ifndef OPM_FLOW_PROBLEM_PARAMETERS_HPP #define OPM_FLOW_PROBLEM_PARAMETERS_HPP -#include +#include namespace Opm::Parameters { -// Enable partial compensation of systematic mass losses via the source term of the next time -// step -template -struct EnableDriftCompensation { using type = Properties::UndefinedProperty; }; + +// Enable partial compensation of systematic mass losses via +// the source term of the next time step +struct EnableDriftCompensation { static constexpr bool value = true; }; // implicit or explicit pressure in rock compaction -template -struct ExplicitRockCompaction { using type = Properties::UndefinedProperty; }; +struct ExplicitRockCompaction { static constexpr bool value = false; }; // Parameterize equilibration accuracy -template -struct NumPressurePointsEquil { using type = Properties::UndefinedProperty; }; +struct NumPressurePointsEquil +{ static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue; }; -template -struct OutputMode { using type = Properties::UndefinedProperty; }; +struct OutputMode { static constexpr auto value = "all"; }; -// The number of time steps skipped between writing two consequtive restart files -template -struct RestartWritingInterval { using type = Properties::UndefinedProperty; }; +// The frequency of writing restart (*.ers) files. This is the number of time steps +// between writing restart files +struct RestartWritingInterval { static constexpr int value = 0xffffff; }; // disable } // namespace Opm::Parameters diff --git a/opm/simulators/flow/FlowProblemProperties.hpp b/opm/simulators/flow/FlowProblemProperties.hpp index 604259a8e..ae3083210 100644 --- a/opm/simulators/flow/FlowProblemProperties.hpp +++ b/opm/simulators/flow/FlowProblemProperties.hpp @@ -28,8 +28,6 @@ #ifndef OPM_FLOW_PROBLEM_PROPERTIES_HPP #define OPM_FLOW_PROBLEM_PROPERTIES_HPP -#include - #include #include @@ -311,26 +309,6 @@ template struct EnableWriteAllSolutions { static constexpr bool value = false; }; -// By default, use implicit pressure in rock compaction -template -struct ExplicitRockCompaction -{ static constexpr bool value = false; }; - -// Parameterize equilibration accuracy -template -struct NumPressurePointsEquil -{ static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue; }; - -template -struct OutputMode -{ static constexpr auto value = "all"; }; - -// The frequency of writing restart (*.ers) files. This is the number of time steps -// between writing restart files -template -struct RestartWritingInterval -{ static constexpr int value = 0xffffff; }; // disable - } // namespace Opm::Parameters #endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index 8036f14a9..bc4288f59 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -406,7 +406,7 @@ private: std::string cmdline_params; if (outputCout_) { printFlowBanner(FlowGenericVanguard::comm().size(), - getNumThreads(), + getNumThreads(), Opm::moduleVersionName()); std::ostringstream str; Parameters::printValues(str); @@ -417,12 +417,12 @@ private: try { this->readDeck(deckFilename, outputDir, - Parameters::get(), + Parameters::Get(), !Parameters::Get(), Parameters::Get(), Parameters::Get(), Parameters::Get(), - getNumThreads(), + getNumThreads(), Parameters::Get(), cmdline_params, Opm::moduleVersion(), @@ -705,7 +705,6 @@ private: void setupVanguard(); - template static int getNumThreads() {