From 6c7f40b7860ce022f7e6e4dfbc3767f0109ccec6 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 01/16] move PredeterminedTimeStepsFile to TypeTag-free parameter system --- opm/models/utils/basicparameters.hh | 5 ++--- opm/models/utils/basicproperties.hh | 5 ----- opm/models/utils/simulator.hh | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/opm/models/utils/basicparameters.hh b/opm/models/utils/basicparameters.hh index 0e8be2bb3..348a5d795 100644 --- a/opm/models/utils/basicparameters.hh +++ b/opm/models/utils/basicparameters.hh @@ -65,9 +65,8 @@ struct InitialTimeStepSize { using type = Properties::UndefinedProperty; }; //! Set a value for the ParameterFile property struct ParameterFile { static constexpr auto value = ""; }; -//! The name of the file with a number of forced time step lengths -template -struct PredeterminedTimeStepsFile { using type = Properties::UndefinedProperty; }; +//! By default, do not force any time steps +struct PredeterminedTimeStepsFile { static constexpr auto value = ""; }; /*! * \brief Print all parameters on startup? diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index cc3e7962c..9a9370a74 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -195,11 +195,6 @@ struct InitialTimeStepSize static constexpr type value = -1e35; }; -//! By default, do not force any time steps -template -struct PredeterminedTimeStepsFile -{ static constexpr auto value = ""; }; - //! By default, print the values of the run-time parameters on startup template struct PrintParameters diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index 65bd2198e..c80f85aba 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -133,7 +133,7 @@ public: timeStepSize_ = Parameters::get(); assert(timeStepSize_ > 0); const std::string& predetTimeStepFile = - Parameters::get(); + Parameters::Get(); if (!predetTimeStepFile.empty()) { std::ifstream is(predetTimeStepFile); while (!is.eof()) { @@ -260,7 +260,7 @@ public: ("The size of the initial time step [s]"); Parameters::registerParam ("The simulation time at which a restart should be attempted [s]"); - Parameters::registerParam + Parameters::Register ("A file with a list of predetermined time step sizes (one " "time step per line)"); From 0e3d9604ab6f68a5ddb3bf22332d5996967faa3c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 02/16] move PrintParameters to TypeTag-free parameter system --- opm/models/utils/basicparameters.hh | 3 +-- opm/models/utils/basicproperties.hh | 5 ----- opm/models/utils/start.hh | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/opm/models/utils/basicparameters.hh b/opm/models/utils/basicparameters.hh index 348a5d795..2dc23cab4 100644 --- a/opm/models/utils/basicparameters.hh +++ b/opm/models/utils/basicparameters.hh @@ -74,8 +74,7 @@ struct PredeterminedTimeStepsFile { static constexpr auto value = ""; }; * 0 means 'no', 1 means 'yes', 2 means 'print only to logfiles'. The * default is 2. */ -template -struct PrintParameters { using type = Properties::UndefinedProperty; }; +struct PrintParameters { static constexpr int value = 2; }; //! The default value for the simulation's restart time template diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 9a9370a74..841384c12 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -195,11 +195,6 @@ struct InitialTimeStepSize static constexpr type value = -1e35; }; -//! By default, print the values of the run-time parameters on startup -template -struct PrintParameters -{ static constexpr int value = 2; }; - //! The default value for the simulation's restart time template struct RestartTime diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index ac6712602..88008e335 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -80,7 +80,7 @@ static inline void registerAllParameters_(bool finalizeRegistration = true) Parameters::Register ("An .ini file which contains a set of run-time parameters"); - Parameters::registerParam + Parameters::Register ("Print the values of the run-time parameters at the " "start of the simulation"); @@ -351,7 +351,7 @@ static inline int start(int argc, char **argv, bool registerParams=true) } // print the parameters if requested - int printParams = Parameters::get(); + int printParams = Parameters::Get(); if (myRank == 0) { std::string endParametersSeparator("# [end of parameters]\n"); if (printParams) { From d95c049936511f669d8b727af71ae0c76708921b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 03/16] move RestartTime to TypeTag-free parameter system --- opm/models/utils/basicparameters.hh | 4 ++-- opm/models/utils/basicproperties.hh | 8 -------- opm/models/utils/simulator.hh | 4 ++-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/opm/models/utils/basicparameters.hh b/opm/models/utils/basicparameters.hh index 2dc23cab4..05a1ef28f 100644 --- a/opm/models/utils/basicparameters.hh +++ b/opm/models/utils/basicparameters.hh @@ -77,8 +77,8 @@ struct PredeterminedTimeStepsFile { static constexpr auto value = ""; }; struct PrintParameters { static constexpr int value = 2; }; //! The default value for the simulation's restart time -template -struct RestartTime { using type = Properties::UndefinedProperty; }; +template +struct RestartTime { static constexpr Scalar value = -1e35; }; } // namespace Opm:Parameters diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 841384c12..c1553eae1 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -195,14 +195,6 @@ struct InitialTimeStepSize static constexpr type value = -1e35; }; -//! The default value for the simulation's restart time -template -struct RestartTime -{ - using type = GetPropType; - static constexpr type value = -1e35; -}; - } // namespace Opm::Parameters #endif diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index c80f85aba..3bada2a78 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -258,7 +258,7 @@ public: ("The simulation time at which the simulation is finished [s]"); Parameters::registerParam ("The size of the initial time step [s]"); - Parameters::registerParam + Parameters::Register> ("The simulation time at which a restart should be attempted [s]"); Parameters::Register ("A file with a list of predetermined time step sizes (one " @@ -649,7 +649,7 @@ public: TimerGuard writeTimerGuard(writeTimer_); setupTimer_.start(); - Scalar restartTime = Parameters::get(); + Scalar restartTime = Parameters::Get>(); if (restartTime > -1e30) { // try to restart a previous simulation time_ = restartTime; From f5c7bada370b515698ccbff46087d7d26abe9ee1 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 04/16] move EndTime to TypeTag-free parameter system --- examples/problems/co2injectionproblem.hh | 9 +-------- examples/problems/co2ptflashproblem.hh | 10 ++-------- examples/problems/cuvetteproblem.hh | 9 +-------- examples/problems/diffusionproblem.hh | 11 ++--------- examples/problems/fingerproblem.hh | 10 ++-------- examples/problems/fractureproblem.hh | 9 +-------- examples/problems/groundwaterproblem.hh | 9 +-------- examples/problems/infiltrationproblem.hh | 9 +-------- examples/problems/lensproblem.hh | 10 ++-------- examples/problems/obstacleproblem.hh | 9 +-------- examples/problems/outflowproblem.hh | 9 +-------- examples/problems/powerinjectionproblem.hh | 10 ++-------- examples/problems/reservoirproblem.hh | 16 ++++------------ examples/problems/richardslensproblem.hh | 10 ++-------- examples/problems/waterairproblem.hh | 10 ++-------- examples/tutorial1problem.hh | 10 ++-------- opm/models/utils/basicparameters.hh | 4 ++-- opm/models/utils/basicproperties.hh | 8 -------- opm/models/utils/simulator.hh | 4 ++-- opm/models/utils/start.hh | 2 +- 20 files changed, 32 insertions(+), 146 deletions(-) diff --git a/examples/problems/co2injectionproblem.hh b/examples/problems/co2injectionproblem.hh index 7b5436b4e..c2d92de4f 100644 --- a/examples/problems/co2injectionproblem.hh +++ b/examples/problems/co2injectionproblem.hh @@ -174,14 +174,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 1e4; -}; - template struct FluidSystemNumPressure { static constexpr unsigned value = 100; }; @@ -412,6 +404,7 @@ public: ("The name of the simulation used for the output files"); Parameters::SetDefault("data/co2injection.dgf"); + Parameters::SetDefault>(1e4); } /*! diff --git a/examples/problems/co2ptflashproblem.hh b/examples/problems/co2ptflashproblem.hh index 5be7e7eed..39fc1213a 100644 --- a/examples/problems/co2ptflashproblem.hh +++ b/examples/problems/co2ptflashproblem.hh @@ -161,14 +161,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 60. * 60.; -}; - // this is kinds of telling the report step length template struct EpisodeLength @@ -398,6 +390,8 @@ public: Parameters::SetDefault(1); Parameters::SetDefault>(1.0); } + + Parameters::SetDefault>(60. * 60.); } /*! diff --git a/examples/problems/cuvetteproblem.hh b/examples/problems/cuvetteproblem.hh index c504105d9..6460d9296 100644 --- a/examples/problems/cuvetteproblem.hh +++ b/examples/problems/cuvetteproblem.hh @@ -121,14 +121,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 180; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -312,6 +304,7 @@ public: ParentType::registerParameters(); Parameters::SetDefault("./data/cuvette_11x4.dgf"); + Parameters::SetDefault>(100.0); } /*! diff --git a/examples/problems/diffusionproblem.hh b/examples/problems/diffusionproblem.hh index 19b89674e..c6a20b70b 100644 --- a/examples/problems/diffusionproblem.hh +++ b/examples/problems/diffusionproblem.hh @@ -115,14 +115,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 1e6; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -223,10 +215,11 @@ public: if constexpr (dim > 1) { Parameters::SetDefault(1); } - if constexpr (dim == 3) { Parameters::SetDefault(1); } + + Parameters::SetDefault>(1e6); } /*! diff --git a/examples/problems/fingerproblem.hh b/examples/problems/fingerproblem.hh index 98b5c24fb..27f7e3357 100644 --- a/examples/problems/fingerproblem.hh +++ b/examples/problems/fingerproblem.hh @@ -136,14 +136,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 215; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -296,6 +288,8 @@ public: // Use forward differences Parameters::SetDefault(+1); + + Parameters::SetDefault>(215); } /*! diff --git a/examples/problems/fractureproblem.hh b/examples/problems/fractureproblem.hh index 9ac3b1bd5..2579c2fea 100644 --- a/examples/problems/fractureproblem.hh +++ b/examples/problems/fractureproblem.hh @@ -165,14 +165,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// Set the default value for the end time -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 3e3; -}; - // Set the default value for the initial time step size template struct InitialTimeStepSize @@ -313,6 +305,7 @@ public: ParentType::registerParameters(); Parameters::SetDefault("data/fracture.art.dgf"); + Parameters::SetDefault>(3e3); } /*! diff --git a/examples/problems/groundwaterproblem.hh b/examples/problems/groundwaterproblem.hh index dc1e28b16..2b704f29a 100644 --- a/examples/problems/groundwaterproblem.hh +++ b/examples/problems/groundwaterproblem.hh @@ -117,14 +117,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 1; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -303,6 +295,7 @@ public: ("The intrinsic permeability [m^2] of the lens."); Parameters::SetDefault("./data/groundwater_2d.dgf"); + Parameters::SetDefault>(1.0); } /*! diff --git a/examples/problems/infiltrationproblem.hh b/examples/problems/infiltrationproblem.hh index 7063f1479..6d3c11d55 100644 --- a/examples/problems/infiltrationproblem.hh +++ b/examples/problems/infiltrationproblem.hh @@ -97,14 +97,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 6e3; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -243,6 +235,7 @@ public: Parameters::SetDefault("./data/infiltration_50x3.dgf"); Parameters::SetDefault(1); + Parameters::SetDefault>(6e3); } /*! diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index f5de2d98a..c9d7b30d3 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -153,14 +153,6 @@ template struct EnableStorageCache { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 30e3; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -378,6 +370,8 @@ public: if constexpr (useFD) { Parameters::SetDefault(+1); } + + Parameters::SetDefault>(30e3); } /*! diff --git a/examples/problems/obstacleproblem.hh b/examples/problems/obstacleproblem.hh index 312f06d8f..0c1ca2577 100644 --- a/examples/problems/obstacleproblem.hh +++ b/examples/problems/obstacleproblem.hh @@ -120,14 +120,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 1e4; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -282,6 +274,7 @@ public: ParentType::registerParameters(); Parameters::SetDefault("./data/obstacle_24x16.dgf"); + Parameters::SetDefault>(1e4); } /*! diff --git a/examples/problems/outflowproblem.hh b/examples/problems/outflowproblem.hh index e9b157465..4737fb0c8 100644 --- a/examples/problems/outflowproblem.hh +++ b/examples/problems/outflowproblem.hh @@ -81,14 +81,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 100; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -190,6 +182,7 @@ public: ParentType::registerParameters(); Parameters::SetDefault("./data/outflow.dgf"); + Parameters::SetDefault>(100.0); } /*! diff --git a/examples/problems/powerinjectionproblem.hh b/examples/problems/powerinjectionproblem.hh index 7d2d39642..b35a55772 100644 --- a/examples/problems/powerinjectionproblem.hh +++ b/examples/problems/powerinjectionproblem.hh @@ -128,14 +128,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 100; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -254,6 +246,8 @@ public: Parameters::SetDefault(1); Parameters::SetDefault>(1.0); } + + Parameters::SetDefault>(100.0); } /*! diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index c65aafca7..8f891a2d7 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -139,17 +139,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -//! The default for the end time of the simulation [s]. -//! -//! By default this problem spans 1000 days (100 "settle down" days and 900 days of -//! production) -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 1000.0*24*60*60; -}; - // The default for the initial time step size of the simulation [s] template struct InitialTimeStepSize @@ -445,8 +434,11 @@ public: ("The width of producer/injector wells as a fraction of the width" " of the spatial domain"); - Parameters::SetDefault("data/reservoir.dgf"); + + //! By default this problem spans 1000 days (100 "settle down" days and 900 days of + //! production) + Parameters::SetDefault>(1000.0*24*60*60); } /*! diff --git a/examples/problems/richardslensproblem.hh b/examples/problems/richardslensproblem.hh index 2e423d85a..cf5245309 100644 --- a/examples/problems/richardslensproblem.hh +++ b/examples/problems/richardslensproblem.hh @@ -108,14 +108,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 3000; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -272,6 +264,8 @@ public: if constexpr (useFD) { Parameters::SetDefault(0); } + + Parameters::SetDefault>(3000.0); } /*! diff --git a/examples/problems/waterairproblem.hh b/examples/problems/waterairproblem.hh index 058b934c5..f10f57fe1 100644 --- a/examples/problems/waterairproblem.hh +++ b/examples/problems/waterairproblem.hh @@ -140,14 +140,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the end time of the simulation (1 year) -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 1.0 * 365 * 24 * 60 * 60; -}; - // The default for the initial time step size of the simulation template struct InitialTimeStepSize @@ -316,6 +308,8 @@ public: // Use forward differences Parameters::SetDefault(+1); + + Parameters::SetDefault>(1.0 * 365 * 24 * 60 * 60); } /*! diff --git a/examples/tutorial1problem.hh b/examples/tutorial1problem.hh index 697156b3c..e78e2845f 100644 --- a/examples/tutorial1problem.hh +++ b/examples/tutorial1problem.hh @@ -129,14 +129,6 @@ template struct EnableGravity { static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/ -// define how long the simulation should run [s] -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = 100e3; -}; /*@\label{tutorial1:default-params-begin}@*/ - // define the size of the initial time step [s] template struct InitialTimeStepSize @@ -231,6 +223,8 @@ public: Parameters::SetDefault(1); Parameters::SetDefault>(0.0); } + + Parameters::SetDefault>(100e3); } //! Specifies the problem name. This is used for files generated by the simulation. diff --git a/opm/models/utils/basicparameters.hh b/opm/models/utils/basicparameters.hh index 05a1ef28f..e871a1b4d 100644 --- a/opm/models/utils/basicparameters.hh +++ b/opm/models/utils/basicparameters.hh @@ -48,8 +48,8 @@ template struct DomainSizeZ { static constexpr Scalar value = 1.0; }; //! The default value for the simulation's end time -template -struct EndTime { using type = Properties::UndefinedProperty; }; +template +struct EndTime { static constexpr Scalar value = -1e35; }; //! Name of the grid file struct GridFile { static constexpr auto value = ""; }; diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index c1553eae1..36a9ac495 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -179,14 +179,6 @@ struct Vanguard namespace Opm::Parameters { -//! The default value for the simulation's end time -template -struct EndTime -{ - using type = GetPropType; - static constexpr type value = -1e35; -}; - //! The default value for the simulation's initial time step size template struct InitialTimeStepSize diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index 3bada2a78..aecc04adb 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -129,7 +129,7 @@ public: timeStepIdx_ = 0; startTime_ = 0.0; time_ = 0.0; - endTime_ = Parameters::get(); + endTime_ = Parameters::Get>(); timeStepSize_ = Parameters::get(); assert(timeStepSize_ > 0); const std::string& predetTimeStepFile = @@ -254,7 +254,7 @@ public: */ static void registerParameters() { - Parameters::registerParam + Parameters::Register> ("The simulation time at which the simulation is finished [s]"); Parameters::registerParam ("The size of the initial time step [s]"); diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index 88008e335..714ef616c 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -315,7 +315,7 @@ static inline int start(int argc, char **argv, bool registerParams=true) #endif // read the initial time step and the end time - Scalar endTime = Parameters::get(); + Scalar endTime = Parameters::Get>(); if (endTime < -1e50) { if (myRank == 0) Parameters::printUsage(argv[0], From a2cbb8cb02d83c4f486b843476decd1757808218 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 05/16] move InitialTimeStepSize to TypeTag-free parameter system --- examples/problems/co2injectionproblem.hh | 9 +-------- examples/problems/co2ptflashproblem.hh | 9 +-------- examples/problems/cuvetteproblem.hh | 9 +-------- examples/problems/diffusionproblem.hh | 9 +-------- examples/problems/fingerproblem.hh | 9 +-------- examples/problems/fractureproblem.hh | 9 +-------- examples/problems/groundwaterproblem.hh | 9 +-------- examples/problems/infiltrationproblem.hh | 9 +-------- examples/problems/lensproblem.hh | 9 +-------- examples/problems/obstacleproblem.hh | 9 +-------- examples/problems/outflowproblem.hh | 9 +-------- examples/problems/powerinjectionproblem.hh | 9 +-------- examples/problems/reservoirproblem.hh | 11 +++-------- examples/problems/richardslensproblem.hh | 9 +-------- examples/problems/waterairproblem.hh | 9 +-------- examples/tutorial1problem.hh | 9 +-------- opm/models/utils/basicparameters.hh | 6 ++---- opm/models/utils/basicproperties.hh | 12 ------------ opm/models/utils/simulator.hh | 4 ++-- opm/models/utils/start.hh | 2 +- 20 files changed, 23 insertions(+), 147 deletions(-) diff --git a/examples/problems/co2injectionproblem.hh b/examples/problems/co2injectionproblem.hh index c2d92de4f..404b934e7 100644 --- a/examples/problems/co2injectionproblem.hh +++ b/examples/problems/co2injectionproblem.hh @@ -210,14 +210,6 @@ struct FluidSystemTemperatureLow -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 250; -}; - template struct MaxDepth { @@ -405,6 +397,7 @@ public: Parameters::SetDefault("data/co2injection.dgf"); Parameters::SetDefault>(1e4); + Parameters::SetDefault>(250); } /*! diff --git a/examples/problems/co2ptflashproblem.hh b/examples/problems/co2ptflashproblem.hh index 39fc1213a..0b99ed78d 100644 --- a/examples/problems/co2ptflashproblem.hh +++ b/examples/problems/co2ptflashproblem.hh @@ -176,14 +176,6 @@ struct Initialpressure static constexpr type value = 75.e5; }; -// convergence control -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 0.1 * 60. * 60.; -}; - template struct LinearSolverAbsTolerance { @@ -392,6 +384,7 @@ public: } Parameters::SetDefault>(60. * 60.); + Parameters::SetDefault>(0.1 * 60. * 60.); } /*! diff --git a/examples/problems/cuvetteproblem.hh b/examples/problems/cuvetteproblem.hh index 6460d9296..53710f8da 100644 --- a/examples/problems/cuvetteproblem.hh +++ b/examples/problems/cuvetteproblem.hh @@ -121,14 +121,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 1; -}; - // Set the maximum time step template struct MaxTimeStepSize @@ -305,6 +297,7 @@ public: Parameters::SetDefault("./data/cuvette_11x4.dgf"); Parameters::SetDefault>(100.0); + Parameters::SetDefault>(1.0); } /*! diff --git a/examples/problems/diffusionproblem.hh b/examples/problems/diffusionproblem.hh index c6a20b70b..e4b480e89 100644 --- a/examples/problems/diffusionproblem.hh +++ b/examples/problems/diffusionproblem.hh @@ -115,14 +115,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 1000; -}; - } // namespace Opm::Parameters namespace Opm { @@ -220,6 +212,7 @@ public: } Parameters::SetDefault>(1e6); + Parameters::SetDefault>(1000); } /*! diff --git a/examples/problems/fingerproblem.hh b/examples/problems/fingerproblem.hh index 27f7e3357..7431e90b8 100644 --- a/examples/problems/fingerproblem.hh +++ b/examples/problems/fingerproblem.hh @@ -136,14 +136,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 10; -}; - template struct InitialWaterSaturation { @@ -290,6 +282,7 @@ public: Parameters::SetDefault(+1); Parameters::SetDefault>(215); + Parameters::SetDefault>(10); } /*! diff --git a/examples/problems/fractureproblem.hh b/examples/problems/fractureproblem.hh index 2579c2fea..83ba3986e 100644 --- a/examples/problems/fractureproblem.hh +++ b/examples/problems/fractureproblem.hh @@ -165,14 +165,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// Set the default value for the initial time step size -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 100; -}; - } // namespace Opm::Parameters namespace Opm { @@ -306,6 +298,7 @@ public: Parameters::SetDefault("data/fracture.art.dgf"); Parameters::SetDefault>(3e3); + Parameters::SetDefault>(100); } /*! diff --git a/examples/problems/groundwaterproblem.hh b/examples/problems/groundwaterproblem.hh index 2b704f29a..5e37f3e12 100644 --- a/examples/problems/groundwaterproblem.hh +++ b/examples/problems/groundwaterproblem.hh @@ -117,14 +117,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 1; -}; - template struct LensLowerLeftX { @@ -296,6 +288,7 @@ public: Parameters::SetDefault("./data/groundwater_2d.dgf"); Parameters::SetDefault>(1.0); + Parameters::SetDefault>(1.0); } /*! diff --git a/examples/problems/infiltrationproblem.hh b/examples/problems/infiltrationproblem.hh index 6d3c11d55..64c2175ed 100644 --- a/examples/problems/infiltrationproblem.hh +++ b/examples/problems/infiltrationproblem.hh @@ -97,14 +97,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 60; -}; - // Write newton convergence? template struct NewtonWriteConvergence @@ -236,6 +228,7 @@ public: Parameters::SetDefault("./data/infiltration_50x3.dgf"); Parameters::SetDefault(1); Parameters::SetDefault>(6e3); + Parameters::SetDefault>(60.0); } /*! diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index c9d7b30d3..7c1f56894 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -153,14 +153,6 @@ template struct EnableStorageCache { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 250; -}; - // define the properties specific for the lens problem template struct LensLowerLeftX @@ -372,6 +364,7 @@ public: } Parameters::SetDefault>(30e3); + Parameters::SetDefault>(250.0); } /*! diff --git a/examples/problems/obstacleproblem.hh b/examples/problems/obstacleproblem.hh index 0c1ca2577..eb299f702 100644 --- a/examples/problems/obstacleproblem.hh +++ b/examples/problems/obstacleproblem.hh @@ -120,14 +120,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 250; -}; - } // namespace Opm::Parameters namespace Opm { @@ -275,6 +267,7 @@ public: Parameters::SetDefault("./data/obstacle_24x16.dgf"); Parameters::SetDefault>(1e4); + Parameters::SetDefault>(250); } /*! diff --git a/examples/problems/outflowproblem.hh b/examples/problems/outflowproblem.hh index 4737fb0c8..f1eeaf232 100644 --- a/examples/problems/outflowproblem.hh +++ b/examples/problems/outflowproblem.hh @@ -81,14 +81,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 1; -}; - // Also write mass fractions to the output template struct VtkWriteMassFractions @@ -183,6 +175,7 @@ public: Parameters::SetDefault("./data/outflow.dgf"); Parameters::SetDefault>(100.0); + Parameters::SetDefault>(1.0); } /*! diff --git a/examples/problems/powerinjectionproblem.hh b/examples/problems/powerinjectionproblem.hh index b35a55772..71d245b44 100644 --- a/examples/problems/powerinjectionproblem.hh +++ b/examples/problems/powerinjectionproblem.hh @@ -128,14 +128,6 @@ template struct EnableGravity { static constexpr bool value = false; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 1e-3; -}; - // Write out the filter velocities for this problem template struct VtkWriteFilterVelocities @@ -248,6 +240,7 @@ public: } Parameters::SetDefault>(100.0); + Parameters::SetDefault>(1e-3); } /*! diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index 8f891a2d7..addfe62c9 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -139,14 +139,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation [s] -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 100e3; -}; - // set the defaults for some problem specific properties template struct MaxDepth @@ -439,6 +431,9 @@ public: //! By default this problem spans 1000 days (100 "settle down" days and 900 days of //! production) Parameters::SetDefault>(1000.0*24*60*60); + + Parameters::SetDefault("data/reservoir.dgf"); + Parameters::SetDefault>(100e3); } /*! diff --git a/examples/problems/richardslensproblem.hh b/examples/problems/richardslensproblem.hh index cf5245309..44dee3c30 100644 --- a/examples/problems/richardslensproblem.hh +++ b/examples/problems/richardslensproblem.hh @@ -108,14 +108,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 100; -}; - // Do not write the intermediate results of the newton method template struct NewtonWriteConvergence @@ -266,6 +258,7 @@ public: } Parameters::SetDefault>(3000.0); + Parameters::SetDefault>(100.0); } /*! diff --git a/examples/problems/waterairproblem.hh b/examples/problems/waterairproblem.hh index f10f57fe1..18716c10d 100644 --- a/examples/problems/waterairproblem.hh +++ b/examples/problems/waterairproblem.hh @@ -140,14 +140,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// The default for the initial time step size of the simulation -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 250; -}; - // Write newton convergence template struct NewtonWriteConvergence @@ -310,6 +302,7 @@ public: Parameters::SetDefault(+1); Parameters::SetDefault>(1.0 * 365 * 24 * 60 * 60); + Parameters::SetDefault>(250.0); } /*! diff --git a/examples/tutorial1problem.hh b/examples/tutorial1problem.hh index e78e2845f..e58b0ce14 100644 --- a/examples/tutorial1problem.hh +++ b/examples/tutorial1problem.hh @@ -129,14 +129,6 @@ template struct EnableGravity { static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/ -// define the size of the initial time step [s] -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 125.0; -}; - } // namespace Opm::Parameters namespace Opm { @@ -225,6 +217,7 @@ public: } Parameters::SetDefault>(100e3); + Parameters::SetDefault>(125.0); } //! Specifies the problem name. This is used for files generated by the simulation. diff --git a/opm/models/utils/basicparameters.hh b/opm/models/utils/basicparameters.hh index e871a1b4d..6b9ff8565 100644 --- a/opm/models/utils/basicparameters.hh +++ b/opm/models/utils/basicparameters.hh @@ -28,8 +28,6 @@ #ifndef EWOMS_BASIC_PARAMETERS_HH #define EWOMS_BASIC_PARAMETERS_HH -#include - namespace Opm::Parameters { //! grid resolution @@ -59,8 +57,8 @@ struct GridFile { static constexpr auto value = ""; }; struct GridGlobalRefinements { static constexpr unsigned value = 0; }; //! The default value for the simulation's initial time step size -template -struct InitialTimeStepSize { using type = Properties::UndefinedProperty; }; +template +struct InitialTimeStepSize { static constexpr Scalar value = -1e35; }; //! Set a value for the ParameterFile property struct ParameterFile { static constexpr auto value = ""; }; diff --git a/opm/models/utils/basicproperties.hh b/opm/models/utils/basicproperties.hh index 36a9ac495..9d751ba9c 100644 --- a/opm/models/utils/basicproperties.hh +++ b/opm/models/utils/basicproperties.hh @@ -177,16 +177,4 @@ struct Vanguard } // namespace Opm::Properties -namespace Opm::Parameters { - -//! The default value for the simulation's initial time step size -template -struct InitialTimeStepSize -{ - using type = GetPropType; - static constexpr type value = -1e35; -}; - -} // namespace Opm::Parameters - #endif diff --git a/opm/models/utils/simulator.hh b/opm/models/utils/simulator.hh index aecc04adb..116da39c6 100644 --- a/opm/models/utils/simulator.hh +++ b/opm/models/utils/simulator.hh @@ -130,7 +130,7 @@ public: startTime_ = 0.0; time_ = 0.0; endTime_ = Parameters::Get>(); - timeStepSize_ = Parameters::get(); + timeStepSize_ = Parameters::Get>(); assert(timeStepSize_ > 0); const std::string& predetTimeStepFile = Parameters::Get(); @@ -256,7 +256,7 @@ public: { Parameters::Register> ("The simulation time at which the simulation is finished [s]"); - Parameters::registerParam + Parameters::Register> ("The size of the initial time step [s]"); Parameters::Register> ("The simulation time at which a restart should be attempted [s]"); diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index 714ef616c..2284ffcc3 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -323,7 +323,7 @@ static inline int start(int argc, char **argv, bool registerParams=true) return 1; } - Scalar initialTimeStepSize = Parameters::get(); + Scalar initialTimeStepSize = Parameters::Get>(); if (initialTimeStepSize < -1e50) { if (myRank == 0) Parameters::printUsage(argv[0], From f6abb4671ea92cb199cb4f73cfe2da20cecf981e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 06/16] move ThreadsPerProcess to TypeTag-free parameter system --- opm/models/discretization/common/fvbasediscretization.hh | 5 ----- opm/models/discretization/common/fvbaseparameters.hh | 4 ++-- opm/models/parallel/threadmanager.hh | 4 ++-- opm/models/utils/start.hh | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 3eaa52123..fbcee5f93 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -366,11 +366,6 @@ template struct OutputDir { static constexpr auto value = "."; }; - -template -struct ThreadsPerProcess -{ static constexpr int value = 1; }; - } // namespace Opm::Parameters namespace Opm { diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index a3fb320fe..23ea6411c 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -34,8 +34,8 @@ namespace Opm::Parameters { -template -struct ThreadsPerProcess { using type = Properties::UndefinedProperty; }; +//! \brief Number of threads per process. +struct ThreadsPerProcess { static constexpr int value = 1; }; /*! * \brief Determines if the VTK output is written to disk asynchronously diff --git a/opm/models/parallel/threadmanager.hh b/opm/models/parallel/threadmanager.hh index fda9689ab..2aa83d8fc 100644 --- a/opm/models/parallel/threadmanager.hh +++ b/opm/models/parallel/threadmanager.hh @@ -60,7 +60,7 @@ public: */ static void registerParameters() { - Parameters::registerParam + Parameters::Register ("The maximum number of threads to be instantiated per process " "('-1' means 'automatic')"); } @@ -78,7 +78,7 @@ public: { if (queryCommandLineParameter) { - numThreads_ = Parameters::get(); + numThreads_ = Parameters::Get(); // some safety checks. This is pretty ugly macro-magic, but so what? #if !defined(_OPENMP) diff --git a/opm/models/utils/start.hh b/opm/models/utils/start.hh index 2284ffcc3..62604c471 100644 --- a/opm/models/utils/start.hh +++ b/opm/models/utils/start.hh @@ -84,8 +84,8 @@ static inline void registerAllParameters_(bool finalizeRegistration = true) ("Print the values of the run-time parameters at the " "start of the simulation"); - Simulator::registerParameters(); ThreadManager::registerParameters(); + Simulator::registerParameters(); if (finalizeRegistration) { Parameters::endRegistration(); From 805e0a4bb77646a3c2e33ced0f725c26162b1fc7 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 07/16] move EnableGridAdaptation to TypeTag-free parameter system --- opm/models/discretization/common/fvbasediscretization.hh | 9 ++------- opm/models/discretization/common/fvbaseparameters.hh | 9 ++++----- opm/models/discretization/common/fvbaseproblem.hh | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index fbcee5f93..d1b1d39fa 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -291,11 +291,6 @@ template struct ContinueOnConvergenceError { static constexpr bool value = false; }; -//! Disable grid adaptation by default -template -struct EnableGridAdaptation -{ static constexpr bool value = false; }; - //! by default, disable the intensive quantity cache. If the intensive quantities are //! relatively cheap to calculate, the cache basically does not yield any performance //! impact because of the intensive quantity cache will cause additional pressure on the @@ -484,7 +479,7 @@ public: , newtonMethod_(simulator) , localLinearizer_(ThreadManager::maxThreads()) , linearizer_(new Linearizer()) - , enableGridAdaptation_(Parameters::get() ) + , enableGridAdaptation_(Parameters::Get() ) , enableIntensiveQuantityCache_(Parameters::get()) , enableStorageCache_(Parameters::get()) , enableThermodynamicHints_(Parameters::get()) @@ -541,7 +536,7 @@ public: // register runtime parameters of the output modules VtkPrimaryVarsModule::registerParameters(); - Parameters::registerParam + Parameters::Register ("Enable adaptive grid refinement/coarsening"); Parameters::registerParam ("Global switch for turning on writing VTK files"); diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index 23ea6411c..ed3dd45ba 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -34,9 +34,6 @@ namespace Opm::Parameters { -//! \brief Number of threads per process. -struct ThreadsPerProcess { static constexpr int value = 1; }; - /*! * \brief Determines if the VTK output is written to disk asynchronously * @@ -54,8 +51,10 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; }; * Currently grid adaptation requires the presence of the dune-FEM module. If it is not * available and grid adaptation is enabled, an exception is thrown. */ -template -struct EnableGridAdaptation { using type = Properties::UndefinedProperty; }; +struct EnableGridAdaptation { static constexpr bool value = false; }; + +//! \brief Number of threads per process. +struct ThreadsPerProcess { static constexpr int value = 1; }; /*! * \brief The directory to which simulation output ought to be written to. diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index 09aed8cf9..ee406456b 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -147,7 +147,7 @@ public: // asynchonous VTK output currently does not work in conjunction with grid // adaptivity because the async-IO code assumes that the grid stays // constant. complain about that case. - bool enableGridAdaptation = Parameters::get(); + bool enableGridAdaptation = Parameters::Get(); if (asyncVtkOutput && enableGridAdaptation) throw std::runtime_error("Asynchronous VTK output currently cannot be used " "at the same time as grid adaptivity"); From 8a67f44793ca214d064447003532f4770ae82a54 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 08/16] move OutputDir parameter to TypeTag-less implementation --- opm/models/discretization/common/fvbasediscretization.hh | 7 +------ opm/models/discretization/common/fvbaseparameters.hh | 9 ++++----- opm/models/discretization/common/fvbaseproblem.hh | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index d1b1d39fa..190748026 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -356,11 +356,6 @@ struct MinTimeStepSize static constexpr type value = 0.0; }; -//! By default, write the simulation output to the current working directory -template -struct OutputDir -{ static constexpr auto value = "."; }; - } // namespace Opm::Parameters namespace Opm { @@ -546,7 +541,7 @@ public: ("Turn on caching of intensive quantities"); Parameters::registerParam ("Store previous storage terms and avoid re-calculating them."); - Parameters::registerParam + Parameters::Register ("The directory to which result files are written"); } diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index ed3dd45ba..22dacce31 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -53,14 +53,13 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; }; */ struct EnableGridAdaptation { static constexpr bool value = false; }; -//! \brief Number of threads per process. -struct ThreadsPerProcess { static constexpr int value = 1; }; - /*! * \brief The directory to which simulation output ought to be written to. */ -template -struct OutputDir { using type = Properties::UndefinedProperty; }; +struct OutputDir { static constexpr auto value = ""; }; + +//! \brief Number of threads per process. +struct ThreadsPerProcess { static constexpr int value = 1; }; /*! * \brief Global switch to enable or disable the writing of VTK output files diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index ee406456b..d697b0c13 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -204,7 +204,7 @@ public: */ std::string outputDir() const { - std::string outputDir = Parameters::get(); + std::string outputDir = Parameters::Get(); if (outputDir.empty()) outputDir = "."; From c979eae2017682996d57512a60093ef8c09024d4 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 09/16] move EnableVtkOutput to TypeTag-free parameter system --- .../common/fvbasediscretization.hh | 7 +------ .../discretization/common/fvbaseparameters.hh | 17 ++++++++--------- .../discretization/common/fvbaseproblem.hh | 2 +- opm/models/io/vtkblackoilenergymodule.hh | 6 ++++-- opm/models/io/vtkblackoilmicpmodule.hh | 6 ++++-- opm/models/io/vtkblackoilmodule.hh | 3 ++- opm/models/io/vtkblackoilpolymermodule.hh | 6 ++++-- opm/models/io/vtkblackoilsolventmodule.hh | 6 ++++-- opm/models/io/vtkcompositionmodule.hh | 3 ++- opm/models/io/vtkdiffusionmodule.hh | 3 ++- opm/models/io/vtkdiscretefracturemodule.hh | 3 ++- opm/models/io/vtkenergymodule.hh | 3 ++- opm/models/io/vtkmultiphasemodule.hh | 3 ++- opm/models/io/vtkphasepresencemodule.hh | 3 ++- opm/models/io/vtkprimaryvarsmodule.hh | 3 ++- opm/models/io/vtkptflashmodule.hh | 3 ++- opm/models/io/vtktemperaturemodule.hh | 3 ++- 17 files changed, 46 insertions(+), 34 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 190748026..21b31bf6d 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -304,11 +304,6 @@ template struct EnableStorageCache { static constexpr bool value = false; }; -//! Enable the VTK output by default -template -struct EnableVtkOutput -{ static constexpr bool value = true; }; - // do not use thermodynamic hints by default. If you enable this, make sure to also // enable the intensive quantity cache above to avoid getting an exception... template @@ -533,7 +528,7 @@ public: Parameters::Register ("Enable adaptive grid refinement/coarsening"); - Parameters::registerParam + Parameters::Register ("Global switch for turning on writing VTK files"); Parameters::registerParam ("Enable thermodynamic hints"); diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index 22dacce31..175385fe3 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -53,6 +53,14 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; }; */ struct EnableGridAdaptation { static constexpr bool value = false; }; +/*! + * \brief Global switch to enable or disable the writing of VTK output files + * + * If writing VTK files is disabled, then the WriteVtk$FOO options do + * not have any effect... + */ +struct EnableVtkOutput { static constexpr bool value = true; }; + /*! * \brief The directory to which simulation output ought to be written to. */ @@ -61,15 +69,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Global switch to enable or disable the writing of VTK output files - * - * If writing VTK files is disabled, then the WriteVtk$FOO options do - * not have any effect... - */ -template -struct EnableVtkOutput { using type = Properties::UndefinedProperty; }; - /*! * \brief Specify the maximum size of a time integration [s]. * diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index d697b0c13..1bd01e993 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -812,7 +812,7 @@ protected: private: bool enableVtkOutput_() const - { return Parameters::get(); } + { return Parameters::Get(); } //! Returns the implementation of the problem (i.e. static polymorphism) Implementation& asImp_() diff --git a/opm/models/io/vtkblackoilenergymodule.hh b/opm/models/io/vtkblackoilenergymodule.hh index 0ce68f4ad..a72a100c2 100644 --- a/opm/models/io/vtkblackoilenergymodule.hh +++ b/opm/models/io/vtkblackoilenergymodule.hh @@ -141,8 +141,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableEnergy) return; @@ -163,8 +164,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableEnergy) return; diff --git a/opm/models/io/vtkblackoilmicpmodule.hh b/opm/models/io/vtkblackoilmicpmodule.hh index ebb95e54a..9c22e96e6 100644 --- a/opm/models/io/vtkblackoilmicpmodule.hh +++ b/opm/models/io/vtkblackoilmicpmodule.hh @@ -148,8 +148,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableMICP) return; @@ -172,8 +173,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableMICP) return; diff --git a/opm/models/io/vtkblackoilmodule.hh b/opm/models/io/vtkblackoilmodule.hh index 75ed870cd..6ec841f12 100644 --- a/opm/models/io/vtkblackoilmodule.hh +++ b/opm/models/io/vtkblackoilmodule.hh @@ -249,8 +249,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) { const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState(); diff --git a/opm/models/io/vtkblackoilpolymermodule.hh b/opm/models/io/vtkblackoilpolymermodule.hh index 96024d089..31942f59f 100644 --- a/opm/models/io/vtkblackoilpolymermodule.hh +++ b/opm/models/io/vtkblackoilpolymermodule.hh @@ -160,8 +160,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enablePolymer) return; @@ -186,8 +187,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enablePolymer) return; diff --git a/opm/models/io/vtkblackoilsolventmodule.hh b/opm/models/io/vtkblackoilsolventmodule.hh index 6707c2ddc..3b4c5adea 100644 --- a/opm/models/io/vtkblackoilsolventmodule.hh +++ b/opm/models/io/vtkblackoilsolventmodule.hh @@ -150,8 +150,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableSolvent) return; @@ -174,8 +175,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableSolvent) return; diff --git a/opm/models/io/vtkcompositionmodule.hh b/opm/models/io/vtkcompositionmodule.hh index ce92e7913..f062032a3 100644 --- a/opm/models/io/vtkcompositionmodule.hh +++ b/opm/models/io/vtkcompositionmodule.hh @@ -191,8 +191,9 @@ public: { using Toolbox = MathToolbox; - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtkdiffusionmodule.hh b/opm/models/io/vtkdiffusionmodule.hh index 0515e285c..023fd8a27 100644 --- a/opm/models/io/vtkdiffusionmodule.hh +++ b/opm/models/io/vtkdiffusionmodule.hh @@ -147,8 +147,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtkdiscretefracturemodule.hh b/opm/models/io/vtkdiscretefracturemodule.hh index 1d8f2e5a9..785e2715e 100644 --- a/opm/models/io/vtkdiscretefracturemodule.hh +++ b/opm/models/io/vtkdiscretefracturemodule.hh @@ -210,8 +210,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } const auto& fractureMapper = elemCtx.simulator().vanguard().fractureMapper(); diff --git a/opm/models/io/vtkenergymodule.hh b/opm/models/io/vtkenergymodule.hh index 868dc873d..411c12798 100644 --- a/opm/models/io/vtkenergymodule.hh +++ b/opm/models/io/vtkenergymodule.hh @@ -162,8 +162,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtkmultiphasemodule.hh b/opm/models/io/vtkmultiphasemodule.hh index 5417b19e4..881135211 100644 --- a/opm/models/io/vtkmultiphasemodule.hh +++ b/opm/models/io/vtkmultiphasemodule.hh @@ -273,8 +273,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } const auto& problem = elemCtx.problem(); for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { diff --git a/opm/models/io/vtkphasepresencemodule.hh b/opm/models/io/vtkphasepresencemodule.hh index 9a62eaf4c..37bec49a3 100644 --- a/opm/models/io/vtkphasepresencemodule.hh +++ b/opm/models/io/vtkphasepresencemodule.hh @@ -106,8 +106,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { // calculate the phase presence diff --git a/opm/models/io/vtkprimaryvarsmodule.hh b/opm/models/io/vtkprimaryvarsmodule.hh index 4c06212e1..1bc02d2d7 100644 --- a/opm/models/io/vtkprimaryvarsmodule.hh +++ b/opm/models/io/vtkprimaryvarsmodule.hh @@ -131,8 +131,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } const auto& elementMapper = elemCtx.model().elementMapper(); unsigned elemIdx = static_cast(elementMapper.index(elemCtx.element())); diff --git a/opm/models/io/vtkptflashmodule.hh b/opm/models/io/vtkptflashmodule.hh index c0baad6e5..f8b9758c1 100644 --- a/opm/models/io/vtkptflashmodule.hh +++ b/opm/models/io/vtkptflashmodule.hh @@ -131,8 +131,9 @@ public: { using Toolbox = MathToolbox; - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtktemperaturemodule.hh b/opm/models/io/vtktemperaturemodule.hh index 28ff584d3..d001569ed 100644 --- a/opm/models/io/vtktemperaturemodule.hh +++ b/opm/models/io/vtktemperaturemodule.hh @@ -112,8 +112,9 @@ public: { using Toolbox = MathToolbox; - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); From 08002caa53fd532ffef38686aa0f5b8d15542403 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 10/16] move MaxTimestepSize to TypeTag-free parameter system --- examples/problems/cuvetteproblem.hh | 9 +-------- .../common/fvbasediscretization.hh | 8 -------- .../discretization/common/fvbaseparameters.hh | 18 ++++++++++-------- .../discretization/common/fvbaseproblem.hh | 4 ++-- 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/examples/problems/cuvetteproblem.hh b/examples/problems/cuvetteproblem.hh index 53710f8da..b8f248323 100644 --- a/examples/problems/cuvetteproblem.hh +++ b/examples/problems/cuvetteproblem.hh @@ -121,14 +121,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// Set the maximum time step -template -struct MaxTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 600.; -}; - } // namespace Opm::Parameters namespace Opm { @@ -298,6 +290,7 @@ public: Parameters::SetDefault("./data/cuvette_11x4.dgf"); Parameters::SetDefault>(100.0); Parameters::SetDefault>(1.0); + Parameters::SetDefault>(600.0); } /*! diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 21b31bf6d..0cb9f5d8f 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -329,14 +329,6 @@ struct LinearSolverTolerance static constexpr type value = 1e-3; }; -//! use an unlimited time step size by default -template -struct MaxTimeStepSize -{ - using type = GetPropType; - static constexpr type value = std::numeric_limits::infinity(); -}; - //! The maximum allowed number of timestep divisions for the //! Newton solver template diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index 175385fe3..d9cc4dc31 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -32,6 +32,8 @@ #include +#include + namespace Opm::Parameters { /*! @@ -61,6 +63,14 @@ struct EnableGridAdaptation { static constexpr bool value = false; }; */ struct EnableVtkOutput { static constexpr bool value = true; }; +/*! + * \brief Specify the maximum size of a time integration [s]. + * + * The default is to not limit the step size. + */ +template +struct MaxTimeStepSize { static constexpr Scalar value = std::numeric_limits::infinity(); }; + /*! * \brief The directory to which simulation output ought to be written to. */ @@ -69,14 +79,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Specify the maximum size of a time integration [s]. - * - * The default is to not limit the step size. - */ -template -struct MaxTimeStepSize { using type = Properties::UndefinedProperty; }; - /*! * \brief Specify the minimal size of a time integration [s]. * diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index 1bd01e993..522e60af6 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -169,7 +169,7 @@ public: static void registerParameters() { Model::registerParameters(); - Parameters::registerParam + Parameters::Register> ("The maximum size to which all time steps are limited to [s]"); Parameters::registerParam ("The minimum size to which all time steps are limited to [s]"); @@ -593,7 +593,7 @@ public: if (nextTimeStepSize_ > 0.0) return nextTimeStepSize_; - Scalar dtNext = std::min(Parameters::get(), + Scalar dtNext = std::min(Parameters::Get>(), newtonMethod().suggestTimeStepSize(simulator().timeStepSize())); if (dtNext < simulator().maxTimeStepSize() From 508422faf558bb17b30c2416ad658cfdd55956ca Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 11/16] move MinTimestepSize to TypeTag-free parameter system --- .../common/fvbasediscretization.hh | 8 -------- .../discretization/common/fvbaseparameters.hh | 16 ++++++++-------- .../discretization/common/fvbaseproblem.hh | 4 ++-- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 0cb9f5d8f..bfab37424 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -335,14 +335,6 @@ template struct MaxTimeStepDivisions { static constexpr unsigned value = 10; }; -//! By default, accept any time step larger than zero -template -struct MinTimeStepSize -{ - using type = GetPropType; - static constexpr type value = 0.0; -}; - } // namespace Opm::Parameters namespace Opm { diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index d9cc4dc31..c8baea3c5 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -71,6 +71,14 @@ struct EnableVtkOutput { static constexpr bool value = true; }; template struct MaxTimeStepSize { static constexpr Scalar value = std::numeric_limits::infinity(); }; +/*! + * \brief Specify the minimal size of a time integration [s]. + * + * The default is to not limit the step size. + */ +template +struct MinTimeStepSize { static constexpr Scalar value = 0.0; }; + /*! * \brief The directory to which simulation output ought to be written to. */ @@ -79,14 +87,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Specify the minimal size of a time integration [s]. - * - * The default is to not limit the step size. - */ -template -struct MinTimeStepSize { using type = Properties::UndefinedProperty; }; - /*! * \brief The maximum allowed number of timestep divisions for the * Newton solver. diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index 522e60af6..fed5e3dd7 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -171,7 +171,7 @@ public: Model::registerParameters(); Parameters::Register> ("The maximum size to which all time steps are limited to [s]"); - Parameters::registerParam + Parameters::Register> ("The minimum size to which all time steps are limited to [s]"); Parameters::registerParam ("The maximum number of divisions by two of the timestep size " @@ -560,7 +560,7 @@ public: * \brief Returns the minimum allowable size of a time step. */ Scalar minTimeStepSize() const - { return Parameters::get(); } + { return Parameters::Get>(); } /*! * \brief Returns the maximum number of subsequent failures for the time integration From 07dcd1a431b91c1011310debd7719367c5b5654f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 12/16] move MaxTimestepDivisions to TypeTag-free parameter system --- .../discretization/common/fvbasediscretization.hh | 6 ------ .../discretization/common/fvbaseparameters.hh | 13 ++++++------- opm/models/discretization/common/fvbaseproblem.hh | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index bfab37424..e7654c32d 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -329,12 +329,6 @@ struct LinearSolverTolerance static constexpr type value = 1e-3; }; -//! The maximum allowed number of timestep divisions for the -//! Newton solver -template -struct MaxTimeStepDivisions -{ static constexpr unsigned value = 10; }; - } // namespace Opm::Parameters namespace Opm { diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index c8baea3c5..abb019fc9 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -71,6 +71,12 @@ struct EnableVtkOutput { static constexpr bool value = true; }; template struct MaxTimeStepSize { static constexpr Scalar value = std::numeric_limits::infinity(); }; +/*! + * \brief The maximum allowed number of timestep divisions for the + * Newton solver. + */ +struct MaxTimeStepDivisions { static constexpr unsigned value = 10; }; + /*! * \brief Specify the minimal size of a time integration [s]. * @@ -87,13 +93,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief The maximum allowed number of timestep divisions for the - * Newton solver. - */ -template -struct MaxTimeStepDivisions { using type = Properties::UndefinedProperty; }; - /*! * \brief Continue with a non-converged solution instead of giving up * if we encounter a time step size smaller than the minimum time diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index fed5e3dd7..7081055fe 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -173,7 +173,7 @@ public: ("The maximum size to which all time steps are limited to [s]"); Parameters::Register> ("The minimum size to which all time steps are limited to [s]"); - Parameters::registerParam + Parameters::Register ("The maximum number of divisions by two of the timestep size " "before the simulation bails out"); Parameters::Register @@ -567,7 +567,7 @@ public: * before giving up. */ unsigned maxTimeIntegrationFailures() const - { return Parameters::get(); } + { return Parameters::Get(); } /*! * \brief Returns if we should continue with a non-converged solution instead of From af30ebf0f78f9226fee02607d14a85f4fc192b5e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 13/16] move ContinueOnConvergenceError to TypeTag-free parameter system --- .../discretization/common/fvbasediscretization.hh | 7 ------- .../discretization/common/fvbaseparameters.hh | 15 +++++++-------- opm/models/discretization/common/fvbaseproblem.hh | 4 ++-- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index e7654c32d..0ad86f82d 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -284,13 +284,6 @@ struct DiscreteFunction namespace Opm::Parameters { -//! By default, do not continue with a non-converged solution instead of giving up -//! if we encounter a time step size smaller than the minimum time -//! step size. -template -struct ContinueOnConvergenceError -{ static constexpr bool value = false; }; - //! by default, disable the intensive quantity cache. If the intensive quantities are //! relatively cheap to calculate, the cache basically does not yield any performance //! impact because of the intensive quantity cache will cause additional pressure on the diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index abb019fc9..eefec01cc 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -36,6 +36,13 @@ namespace Opm::Parameters { +/*! + * \brief Continue with a non-converged solution instead of giving up + * if we encounter a time step size smaller than the minimum time + * step size. + */ +struct ContinueOnConvergenceError { static constexpr bool value = false; }; + /*! * \brief Determines if the VTK output is written to disk asynchronously * @@ -93,14 +100,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Continue with a non-converged solution instead of giving up - * if we encounter a time step size smaller than the minimum time - * step size. - */ -template -struct ContinueOnConvergenceError { using type = Properties::UndefinedProperty; }; - /*! * \brief Specify whether all intensive quantities for the grid should be * cached in the discretization. diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index 7081055fe..76701c007 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -178,7 +178,7 @@ public: "before the simulation bails out"); Parameters::Register ("Dispatch a separate thread to write the VTK output"); - Parameters::registerParam + Parameters::Register ("Continue with a non-converged solution instead of giving up " "if we encounter a time step size smaller than the minimum time " "step size."); @@ -575,7 +575,7 @@ public: * step size. */ bool continueOnConvergenceError() const - { return Parameters::get(); } + { return Parameters::Get(); } /*! * \brief Impose the next time step size to be used externally. From 5b7fd50d1e5109cb5b0e08242942d8ff5aefd7b8 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 14/16] move EnableIntensiveQuantityCache to TypeTag-free parameter system --- examples/problems/lensproblem.hh | 6 +---- .../discretefracture/discretefracturemodel.hh | 22 +++++++----------- .../common/fvbasediscretization.hh | 12 ++-------- .../discretization/common/fvbaseparameters.hh | 23 +++++++++---------- opm/models/flash/flashmodel.hh | 10 ++++---- opm/models/ptflash/flashmodel.hh | 7 +----- 6 files changed, 27 insertions(+), 53 deletions(-) diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index 7c1f56894..a669be7ff 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -143,11 +143,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// enable the cache for intensive quantities by default for this problem -template -struct EnableIntensiveQuantityCache -{ static constexpr bool value = true; }; - // enable the storage cache by default for this problem template struct EnableStorageCache @@ -364,6 +359,7 @@ public: } Parameters::SetDefault>(30e3); + Parameters::SetDefault(true); Parameters::SetDefault>(250.0); } diff --git a/opm/models/discretefracture/discretefracturemodel.hh b/opm/models/discretefracture/discretefracturemodel.hh index d82a720f9..7c0cc8ac1 100644 --- a/opm/models/discretefracture/discretefracturemodel.hh +++ b/opm/models/discretefracture/discretefracturemodel.hh @@ -95,19 +95,6 @@ struct UseTwoPointGradients { static const } // namespace Opm::Properties -namespace Opm::Parameters { - -// The intensive quantity cache cannot be used by the discrete fracture model, because -// the intensive quantities of a control degree of freedom are not identical to the -// intensive quantities of the other intensive quantities of the same of the same degree -// of freedom. This is because the fracture properties (volume, permeability, etc) are -// specific for each... -template -struct EnableIntensiveQuantityCache -{ static constexpr bool value = false; }; - -} // namespace Opm::Parameters - namespace Opm { /*! @@ -137,7 +124,7 @@ public: DiscreteFractureModel(Simulator& simulator) : ParentType(simulator) { - if (Parameters::get()) { + if (Parameters::Get()) { throw std::runtime_error("The discrete fracture model does not work in conjunction " "with intensive quantities caching"); } @@ -152,6 +139,13 @@ public: // register runtime parameters of the VTK output modules Opm::VtkDiscreteFractureModule::registerParameters(); + + // The intensive quantity cache cannot be used by the discrete fracture model, because + // the intensive quantities of a control degree of freedom are not identical to the + // intensive quantities of the other intensive quantities of the same of the same degree + // of freedom. This is because the fracture properties (volume, permeability, etc) are + // specific for each... + Parameters::SetDefault(false); } /*! diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 0ad86f82d..bac0a9f7d 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -284,14 +284,6 @@ struct DiscreteFunction namespace Opm::Parameters { -//! by default, disable the intensive quantity cache. If the intensive quantities are -//! relatively cheap to calculate, the cache basically does not yield any performance -//! impact because of the intensive quantity cache will cause additional pressure on the -//! CPU caches... -template -struct EnableIntensiveQuantityCache -{ static constexpr bool value = false; }; - // disable caching the storage term by default template struct EnableStorageCache @@ -441,7 +433,7 @@ public: , localLinearizer_(ThreadManager::maxThreads()) , linearizer_(new Linearizer()) , enableGridAdaptation_(Parameters::Get() ) - , enableIntensiveQuantityCache_(Parameters::get()) + , enableIntensiveQuantityCache_(Parameters::Get()) , enableStorageCache_(Parameters::get()) , enableThermodynamicHints_(Parameters::get()) { @@ -503,7 +495,7 @@ public: ("Global switch for turning on writing VTK files"); Parameters::registerParam ("Enable thermodynamic hints"); - Parameters::registerParam + Parameters::Register ("Turn on caching of intensive quantities"); Parameters::registerParam ("Store previous storage terms and avoid re-calculating them."); diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index eefec01cc..a635f2053 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -62,6 +62,17 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; }; */ struct EnableGridAdaptation { static constexpr bool value = false; }; +/*! + * \brief Specify whether all intensive quantities for the grid should be + * cached in the discretization. + * + * This potentially reduces the CPU time, but comes at the cost of + * higher memory consumption. In turn, the higher memory requirements + * may cause the simulation to exhibit worse cache coherence behavior + * which eats some of the computational benefits again. + */ +struct EnableIntensiveQuantityCache { static constexpr bool value = false; }; + /*! * \brief Global switch to enable or disable the writing of VTK output files * @@ -100,18 +111,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Specify whether all intensive quantities for the grid should be - * cached in the discretization. - * - * This potentially reduces the CPU time, but comes at the cost of - * higher memory consumption. In turn, the higher memory requirements - * may cause the simulation to exhibit worse cache coherence behavior - * which eats some of the computational benefits again. - */ -template -struct EnableIntensiveQuantityCache { using type = Properties::UndefinedProperty; }; - /*! * \brief Specify whether the storage terms for previous solutions should be cached. * diff --git a/opm/models/flash/flashmodel.hh b/opm/models/flash/flashmodel.hh index 38f4d615a..2a456f56e 100644 --- a/opm/models/flash/flashmodel.hh +++ b/opm/models/flash/flashmodel.hh @@ -120,12 +120,6 @@ struct EnableEnergy { static constexpr bool value = f namespace Opm::Parameters { -// The updates of intensive quantities tend to be _very_ expensive for this -// model, so let's try to minimize the number of required ones -template -struct EnableIntensiveQuantityCache -{ static constexpr bool value = true; }; - // since thermodynamic hints are basically free if the cache for intensive quantities is // enabled, and this model usually shows quite a performance improvment if they are // enabled, let's enable them by default. @@ -239,6 +233,10 @@ public: Parameters::Register> ("The maximum tolerance for the flash solver to " "consider the solution converged"); + + // The updates of intensive quantities tend to be _very_ expensive for this + // model, so let's try to minimize the number of required ones + Parameters::SetDefault(true); } /*! diff --git a/opm/models/ptflash/flashmodel.hh b/opm/models/ptflash/flashmodel.hh index d03a1af66..fcdb6a038 100644 --- a/opm/models/ptflash/flashmodel.hh +++ b/opm/models/ptflash/flashmodel.hh @@ -143,12 +143,6 @@ struct EnableEnergy namespace Opm::Parameters { -// The updates of intensive quantities tend to be _very_ expensive for this -// model, so let's try to minimize the number of required ones -template -struct EnableIntensiveQuantityCache -{ static constexpr bool value = true; }; - // since thermodynamic hints are basically free if the cache for intensive quantities is // enabled, and this model usually shows quite a performance improvment if they are // enabled, let's enable them by default. @@ -253,6 +247,7 @@ public: "ssi, newton, ssi+newton"); Parameters::SetDefault>(1e-12); + Parameters::SetDefault(true); } /*! From 32667526e03fb001860a70fd417c910a089957c0 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 15/16] move EnableStorageCache to TypeTag-free parameter system --- examples/problems/lensproblem.hh | 6 +----- examples/problems/reservoirproblem.hh | 2 ++ examples/reservoir_ncp_vcfv.cpp | 10 ---------- .../common/fvbasediscretization.hh | 11 ++--------- .../common/fvbaseelementcontext.hh | 2 +- .../discretization/common/fvbaseparameters.hh | 17 ++++++++--------- 6 files changed, 14 insertions(+), 34 deletions(-) diff --git a/examples/problems/lensproblem.hh b/examples/problems/lensproblem.hh index a669be7ff..22409c556 100644 --- a/examples/problems/lensproblem.hh +++ b/examples/problems/lensproblem.hh @@ -143,11 +143,6 @@ template struct EnableGravity { static constexpr bool value = true; }; -// enable the storage cache by default for this problem -template -struct EnableStorageCache -{ static constexpr bool value = true; }; - // define the properties specific for the lens problem template struct LensLowerLeftX @@ -360,6 +355,7 @@ public: Parameters::SetDefault>(30e3); Parameters::SetDefault(true); + Parameters::SetDefault(true); Parameters::SetDefault>(250.0); } diff --git a/examples/problems/reservoirproblem.hh b/examples/problems/reservoirproblem.hh index addfe62c9..e6f44df83 100644 --- a/examples/problems/reservoirproblem.hh +++ b/examples/problems/reservoirproblem.hh @@ -46,6 +46,7 @@ #include +#include #include #include @@ -432,6 +433,7 @@ public: //! production) Parameters::SetDefault>(1000.0*24*60*60); + Parameters::SetDefault(true); Parameters::SetDefault("data/reservoir.dgf"); Parameters::SetDefault>(100e3); } diff --git a/examples/reservoir_ncp_vcfv.cpp b/examples/reservoir_ncp_vcfv.cpp index 1ad4f9650..e573238de 100644 --- a/examples/reservoir_ncp_vcfv.cpp +++ b/examples/reservoir_ncp_vcfv.cpp @@ -62,16 +62,6 @@ struct BaseEpsilon } // namespace Opm::Properties -namespace Opm::Parameters { - -// enable the storage cache for this problem so that the storage cache receives wider -// testing -template -struct EnableStorageCache -{ static constexpr bool value = true; }; - -} // namespace Opm::Parameters - int main(int argc, char **argv) { using ProblemTypeTag = Opm::Properties::TTag::ReservoirNcpVcfvProblem; diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index bac0a9f7d..a52c02e79 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -284,11 +284,6 @@ struct DiscreteFunction namespace Opm::Parameters { -// disable caching the storage term by default -template -struct EnableStorageCache -{ static constexpr bool value = false; }; - // do not use thermodynamic hints by default. If you enable this, make sure to also // enable the intensive quantity cache above to avoid getting an exception... template @@ -434,7 +429,7 @@ public: , linearizer_(new Linearizer()) , enableGridAdaptation_(Parameters::Get() ) , enableIntensiveQuantityCache_(Parameters::Get()) - , enableStorageCache_(Parameters::get()) + , enableStorageCache_(Parameters::Get()) , enableThermodynamicHints_(Parameters::get()) { bool isEcfv = std::is_same >::value; @@ -443,8 +438,6 @@ public: "element-centered finite volume discretization (is: " +Dune::className()+")"); - enableStorageCache_ = Parameters::get(); - PrimaryVariables::init(); size_t numDof = asImp_().numGridDof(); for (unsigned timeIdx = 0; timeIdx < historySize; ++timeIdx) { @@ -497,7 +490,7 @@ public: ("Enable thermodynamic hints"); Parameters::Register ("Turn on caching of intensive quantities"); - Parameters::registerParam + Parameters::Register ("Store previous storage terms and avoid re-calculating them."); Parameters::Register ("The directory to which result files are written"); diff --git a/opm/models/discretization/common/fvbaseelementcontext.hh b/opm/models/discretization/common/fvbaseelementcontext.hh index 8d36126fe..5f552ae9f 100644 --- a/opm/models/discretization/common/fvbaseelementcontext.hh +++ b/opm/models/discretization/common/fvbaseelementcontext.hh @@ -97,7 +97,7 @@ public: { // remember the simulator object simulatorPtr_ = &simulator; - enableStorageCache_ = Parameters::get(); + enableStorageCache_ = Parameters::Get(); stashedDofIdx_ = -1; focusDofIdx_ = -1; } diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index a635f2053..eec31d8b9 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -73,6 +73,14 @@ struct EnableGridAdaptation { static constexpr bool value = false; }; */ struct EnableIntensiveQuantityCache { static constexpr bool value = false; }; +/*! + * \brief Specify whether the storage terms for previous solutions should be cached. + * + * This potentially reduces the CPU time, but comes at the cost of higher memory + * consumption. + */ +struct EnableStorageCache { static constexpr bool value = false; }; + /*! * \brief Global switch to enable or disable the writing of VTK output files * @@ -111,15 +119,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Specify whether the storage terms for previous solutions should be cached. - * - * This potentially reduces the CPU time, but comes at the cost of higher memory - * consumption. - */ -template -struct EnableStorageCache { using type = Properties::UndefinedProperty; }; - /*! * \brief Specify whether to use the already calculated solutions as * starting values of the intensive quantities. From a480fe56b86647a75770740cc34eb85af8497f8c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH 16/16] move EnableThermodynamicHints to TypeTag-free parameter system --- .../common/fvbasediscretization.hh | 10 ++------ .../discretization/common/fvbaseparameters.hh | 23 ++++++++----------- opm/models/flash/flashmodel.hh | 16 ++++--------- opm/models/ptflash/flashmodel.hh | 16 ++++--------- 4 files changed, 22 insertions(+), 43 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index a52c02e79..135ef828b 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -284,12 +284,6 @@ struct DiscreteFunction namespace Opm::Parameters { -// do not use thermodynamic hints by default. If you enable this, make sure to also -// enable the intensive quantity cache above to avoid getting an exception... -template -struct EnableThermodynamicHints -{ static constexpr bool value = false; }; - // use default initialization based on rule-of-thumb of Newton tolerance template struct LinearSolverAbsTolerance @@ -430,7 +424,7 @@ public: , enableGridAdaptation_(Parameters::Get() ) , enableIntensiveQuantityCache_(Parameters::Get()) , enableStorageCache_(Parameters::Get()) - , enableThermodynamicHints_(Parameters::get()) + , enableThermodynamicHints_(Parameters::Get()) { bool isEcfv = std::is_same >::value; if (enableGridAdaptation_ && !isEcfv) @@ -486,7 +480,7 @@ public: ("Enable adaptive grid refinement/coarsening"); Parameters::Register ("Global switch for turning on writing VTK files"); - Parameters::registerParam + Parameters::Register ("Enable thermodynamic hints"); Parameters::Register ("Turn on caching of intensive quantities"); diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index eec31d8b9..ee6e37681 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -30,8 +30,6 @@ #ifndef EWOMS_FV_BASE_PARAMETERS_HH #define EWOMS_FV_BASE_PARAMETERS_HH -#include - #include namespace Opm::Parameters { @@ -81,6 +79,16 @@ struct EnableIntensiveQuantityCache { static constexpr bool value = false; }; */ struct EnableStorageCache { static constexpr bool value = false; }; +/*! + * \brief Specify whether to use the already calculated solutions as + * starting values of the intensive quantities. + * + * This only makes sense if the calculation of the intensive quantities is + * very expensive (e.g. for non-linear fugacity functions where the + * solver converges faster). + */ +struct EnableThermodynamicHints { static constexpr bool value = false; }; + /*! * \brief Global switch to enable or disable the writing of VTK output files * @@ -119,17 +127,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Specify whether to use the already calculated solutions as - * starting values of the intensive quantities. - * - * This only makes sense if the calculation of the intensive quantities is - * very expensive (e.g. for non-linear fugacity functions where the - * solver converges faster). - */ -template -struct EnableThermodynamicHints { using type = Properties::UndefinedProperty; }; - } // namespace Opm::Parameters #endif diff --git a/opm/models/flash/flashmodel.hh b/opm/models/flash/flashmodel.hh index 2a456f56e..b0d7db9fd 100644 --- a/opm/models/flash/flashmodel.hh +++ b/opm/models/flash/flashmodel.hh @@ -118,17 +118,6 @@ struct EnableEnergy { static constexpr bool value = f } // namespace Opm::Properties -namespace Opm::Parameters { - -// since thermodynamic hints are basically free if the cache for intensive quantities is -// enabled, and this model usually shows quite a performance improvment if they are -// enabled, let's enable them by default. -template -struct EnableThermodynamicHints -{ static constexpr bool value = true; }; - -} // namespace Opm::Parameters - namespace Opm { /*! @@ -237,6 +226,11 @@ public: // The updates of intensive quantities tend to be _very_ expensive for this // model, so let's try to minimize the number of required ones Parameters::SetDefault(true); + + // since thermodynamic hints are basically free if the cache for intensive quantities is + // enabled, and this model usually shows quite a performance improvment if they are + // enabled, let's enable them by default. + Parameters::SetDefault(true); } /*! diff --git a/opm/models/ptflash/flashmodel.hh b/opm/models/ptflash/flashmodel.hh index fcdb6a038..279be8d06 100644 --- a/opm/models/ptflash/flashmodel.hh +++ b/opm/models/ptflash/flashmodel.hh @@ -141,17 +141,6 @@ struct EnableEnergy } // namespace Opm::Properties -namespace Opm::Parameters { - -// since thermodynamic hints are basically free if the cache for intensive quantities is -// enabled, and this model usually shows quite a performance improvment if they are -// enabled, let's enable them by default. -template -struct EnableThermodynamicHints -{ static constexpr bool value = true; }; - -} // namespace Opm::Parameters - namespace Opm { /*! @@ -248,6 +237,11 @@ public: Parameters::SetDefault>(1e-12); Parameters::SetDefault(true); + + // since thermodynamic hints are basically free if the cache for intensive quantities is + // enabled, and this model usually shows quite a performance improvment if they are + // enabled, let's enable them by default. + Parameters::SetDefault(true); } /*!