mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-21 08:54:08 -06:00
move MaxTimestepSize to TypeTag-free parameter system
This commit is contained in:
parent
c979eae201
commit
08002caa53
@ -121,14 +121,6 @@ template<class TypeTag>
|
||||
struct EnableGravity<TypeTag, Properties::TTag::CuvetteBaseProblem>
|
||||
{ static constexpr bool value = true; };
|
||||
|
||||
// Set the maximum time step
|
||||
template<class TypeTag>
|
||||
struct MaxTimeStepSize<TypeTag, Properties::TTag::CuvetteBaseProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 600.;
|
||||
};
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
@ -298,6 +290,7 @@ public:
|
||||
Parameters::SetDefault<Parameters::GridFile>("./data/cuvette_11x4.dgf");
|
||||
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
|
||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1.0);
|
||||
Parameters::SetDefault<Parameters::MaxTimeStepSize<Scalar>>(600.0);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -329,14 +329,6 @@ struct LinearSolverTolerance<TypeTag, Properties::TTag::FvBaseDiscretization>
|
||||
static constexpr type value = 1e-3;
|
||||
};
|
||||
|
||||
//! use an unlimited time step size by default
|
||||
template<class TypeTag>
|
||||
struct MaxTimeStepSize<TypeTag, Properties::TTag::FvBaseDiscretization>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = std::numeric_limits<type>::infinity();
|
||||
};
|
||||
|
||||
//! The maximum allowed number of timestep divisions for the
|
||||
//! Newton solver
|
||||
template<class TypeTag>
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
#include <limits>
|
||||
|
||||
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<class Scalar>
|
||||
struct MaxTimeStepSize { static constexpr Scalar value = std::numeric_limits<Scalar>::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<class TypeTag, class MyTypeTag>
|
||||
struct MaxTimeStepSize { using type = Properties::UndefinedProperty; };
|
||||
|
||||
/*!
|
||||
* \brief Specify the minimal size of a time integration [s].
|
||||
*
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
static void registerParameters()
|
||||
{
|
||||
Model::registerParameters();
|
||||
Parameters::registerParam<TypeTag, Parameters::MaxTimeStepSize>
|
||||
Parameters::Register<Parameters::MaxTimeStepSize<Scalar>>
|
||||
("The maximum size to which all time steps are limited to [s]");
|
||||
Parameters::registerParam<TypeTag, Parameters::MinTimeStepSize>
|
||||
("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<TypeTag, Parameters::MaxTimeStepSize>(),
|
||||
Scalar dtNext = std::min(Parameters::Get<Parameters::MaxTimeStepSize<Scalar>>(),
|
||||
newtonMethod().suggestTimeStepSize(simulator().timeStepSize()));
|
||||
|
||||
if (dtNext < simulator().maxTimeStepSize()
|
||||
|
Loading…
Reference in New Issue
Block a user