From 08002caa53fd532ffef38686aa0f5b8d15542403 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH] 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()