move EndTime to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving
2024-07-05 17:49:51 +02:00
parent d95c049936
commit f5c7bada37
20 changed files with 32 additions and 146 deletions

View File

@@ -174,14 +174,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e4;
};
template<class TypeTag>
struct FluidSystemNumPressure<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr unsigned value = 100; };
@@ -412,6 +404,7 @@ public:
("The name of the simulation used for the output files");
Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
}
/*!

View File

@@ -161,14 +161,6 @@ template <class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = false; };
// The default for the end time of the simulation
template <class TypeTag>
struct EndTime<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 60. * 60.;
};
// this is kinds of telling the report step length
template <class TypeTag>
struct EpisodeLength<TypeTag, Properties::TTag::CO2PTBaseProblem>
@@ -398,6 +390,8 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
}
Parameters::SetDefault<Parameters::EndTime<Scalar>>(60. * 60.);
}
/*!

View File

@@ -121,14 +121,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::CuvetteBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::CuvetteBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 180;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::CuvetteBaseProblem>
@@ -312,6 +304,7 @@ public:
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/cuvette_11x4.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
}
/*!

View File

@@ -115,14 +115,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::DiffusionBaseProblem>
{ static constexpr bool value = false; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e6;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::DiffusionBaseProblem>
@@ -223,10 +215,11 @@ public:
if constexpr (dim > 1) {
Parameters::SetDefault<Parameters::CellsY>(1);
}
if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1);
}
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e6);
}
/*!

View File

@@ -136,14 +136,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::FingerBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::FingerBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 215;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::FingerBaseProblem>
@@ -296,6 +288,8 @@ public:
// Use forward differences
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(215);
}
/*!

View File

@@ -165,14 +165,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::FractureProblem>
{ static constexpr bool value = false; };
// Set the default value for the end time
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::FractureProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 3e3;
};
// Set the default value for the initial time step size
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::FractureProblem>
@@ -313,6 +305,7 @@ public:
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("data/fracture.art.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(3e3);
}
/*!

View File

@@ -117,14 +117,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::GroundWaterBaseProblem>
@@ -303,6 +295,7 @@ public:
("The intrinsic permeability [m^2] of the lens.");
Parameters::SetDefault<Parameters::GridFile>("./data/groundwater_2d.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0);
}
/*!

View File

@@ -97,14 +97,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 6e3;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::InfiltrationBaseProblem>
@@ -243,6 +235,7 @@ public:
Parameters::SetDefault<Parameters::GridFile>("./data/infiltration_50x3.dgf");
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(6e3);
}
/*!

View File

@@ -153,14 +153,6 @@ template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 30e3;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::LensBaseProblem>
@@ -378,6 +370,8 @@ public:
if constexpr (useFD) {
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
}
Parameters::SetDefault<Parameters::EndTime<Scalar>>(30e3);
}
/*!

View File

@@ -120,14 +120,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::ObstacleBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::ObstacleBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e4;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ObstacleBaseProblem>
@@ -282,6 +274,7 @@ public:
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/obstacle_24x16.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
}
/*!

View File

@@ -81,14 +81,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::OutflowBaseProblem>
{ static constexpr bool value = false; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::OutflowBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::OutflowBaseProblem>
@@ -190,6 +182,7 @@ public:
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
}
/*!

View File

@@ -128,14 +128,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr bool value = false; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
@@ -254,6 +246,8 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
}
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
}
/*!

View File

@@ -139,17 +139,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::ReservoirBaseProblem>
{ 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<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1000.0*24*60*60;
};
// The default for the initial time step size of the simulation [s]
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ReservoirBaseProblem>
@@ -445,8 +434,11 @@ public:
("The width of producer/injector wells as a fraction of the width"
" of the spatial domain");
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
//! By default this problem spans 1000 days (100 "settle down" days and 900 days of
//! production)
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1000.0*24*60*60);
}
/*!

View File

@@ -108,14 +108,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::RichardsLensProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 3000;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::RichardsLensProblem>
@@ -272,6 +264,8 @@ public:
if constexpr (useFD) {
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(0);
}
Parameters::SetDefault<Parameters::EndTime<Scalar>>(3000.0);
}
/*!

View File

@@ -140,14 +140,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr bool value = true; };
// The default for the end time of the simulation (1 year)
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::WaterAirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0 * 365 * 24 * 60 * 60;
};
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::WaterAirBaseProblem>
@@ -316,6 +308,8 @@ public:
// Use forward differences
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0 * 365 * 24 * 60 * 60);
}
/*!

View File

@@ -129,14 +129,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Tutorial1Problem>
{ static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/
// define how long the simulation should run [s]
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100e3;
}; /*@\label{tutorial1:default-params-begin}@*/
// define the size of the initial time step [s]
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::Tutorial1Problem>
@@ -231,6 +223,8 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(0.0);
}
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100e3);
}
//! Specifies the problem name. This is used for files generated by the simulation.

View File

@@ -48,8 +48,8 @@ template<class Scalar>
struct DomainSizeZ { static constexpr Scalar value = 1.0; };
//! The default value for the simulation's end time
template<class TypeTag, class MyTypeTag>
struct EndTime { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct EndTime { static constexpr Scalar value = -1e35; };
//! Name of the grid file
struct GridFile { static constexpr auto value = ""; };

View File

@@ -179,14 +179,6 @@ struct Vanguard<TypeTag, TTag::NumericModel>
namespace Opm::Parameters {
//! The default value for the simulation's end time
template<class TypeTag>
struct EndTime<TypeTag, Properties::TTag::NumericModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1e35;
};
//! The default value for the simulation's initial time step size
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::NumericModel>

View File

@@ -129,7 +129,7 @@ public:
timeStepIdx_ = 0;
startTime_ = 0.0;
time_ = 0.0;
endTime_ = Parameters::get<TypeTag, Parameters::EndTime>();
endTime_ = Parameters::Get<Parameters::EndTime<Scalar>>();
timeStepSize_ = Parameters::get<TypeTag, Parameters::InitialTimeStepSize>();
assert(timeStepSize_ > 0);
const std::string& predetTimeStepFile =
@@ -254,7 +254,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::EndTime>
Parameters::Register<Parameters::EndTime<Scalar>>
("The simulation time at which the simulation is finished [s]");
Parameters::registerParam<TypeTag, Parameters::InitialTimeStepSize>
("The size of the initial time step [s]");

View File

@@ -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<TypeTag, Parameters::EndTime>();
Scalar endTime = Parameters::Get<Parameters::EndTime<Scalar>>();
if (endTime < -1e50) {
if (myRank == 0)
Parameters::printUsage(argv[0],