move InitialTimeStepSize to TypeTag-free parameter system

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

View File

@ -210,14 +210,6 @@ struct FluidSystemTemperatureLow<TypeTag, Properties::TTag::Co2InjectionBaseProb
static constexpr type value = 290; static constexpr type value = 290;
}; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 250;
};
template<class TypeTag> template<class TypeTag>
struct MaxDepth<TypeTag, Properties::TTag::Co2InjectionBaseProblem> struct MaxDepth<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ {
@ -405,6 +397,7 @@ public:
Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf"); Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4); Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250);
} }
/*! /*!

View File

@ -176,14 +176,6 @@ struct Initialpressure<TypeTag, Properties::TTag::CO2PTBaseProblem>
static constexpr type value = 75.e5; static constexpr type value = 75.e5;
}; };
// convergence control
template <class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::CO2PTBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.1 * 60. * 60.;
};
template <class TypeTag> template <class TypeTag>
struct LinearSolverAbsTolerance<TypeTag, Properties::TTag::CO2PTBaseProblem> struct LinearSolverAbsTolerance<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ {
@ -392,6 +384,7 @@ public:
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(60. * 60.); Parameters::SetDefault<Parameters::EndTime<Scalar>>(60. * 60.);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(0.1 * 60. * 60.);
} }
/*! /*!

View File

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

View File

@ -115,14 +115,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::DiffusionBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::DiffusionBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::DiffusionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1000;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -220,6 +212,7 @@ public:
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e6); Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e6);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1000);
} }
/*! /*!

View File

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

View File

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

View File

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

View File

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

View File

@ -153,14 +153,6 @@ template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::LensBaseProblem> struct EnableStorageCache<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::LensBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 250;
};
// define the properties specific for the lens problem // define the properties specific for the lens problem
template<class TypeTag> template<class TypeTag>
struct LensLowerLeftX<TypeTag, Properties::TTag::LensBaseProblem> struct LensLowerLeftX<TypeTag, Properties::TTag::LensBaseProblem>
@ -372,6 +364,7 @@ public:
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(30e3); Parameters::SetDefault<Parameters::EndTime<Scalar>>(30e3);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
} }
/*! /*!

View File

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

View File

@ -81,14 +81,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::OutflowBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::OutflowBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::OutflowBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1;
};
// Also write mass fractions to the output // Also write mass fractions to the output
template<class TypeTag> template<class TypeTag>
struct VtkWriteMassFractions<TypeTag, Properties::TTag::OutflowBaseProblem> struct VtkWriteMassFractions<TypeTag, Properties::TTag::OutflowBaseProblem>
@ -183,6 +175,7 @@ public:
Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf"); Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0); Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1.0);
} }
/*! /*!

View File

@ -128,14 +128,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-3;
};
// Write out the filter velocities for this problem // Write out the filter velocities for this problem
template<class TypeTag> template<class TypeTag>
struct VtkWriteFilterVelocities<TypeTag, Properties::TTag::PowerInjectionBaseProblem> struct VtkWriteFilterVelocities<TypeTag, Properties::TTag::PowerInjectionBaseProblem>
@ -248,6 +240,7 @@ public:
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0); Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1e-3);
} }
/*! /*!

View File

@ -139,14 +139,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::ReservoirBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::ReservoirBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// The default for the initial time step size of the simulation [s]
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ReservoirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100e3;
};
// set the defaults for some problem specific properties // set the defaults for some problem specific properties
template<class TypeTag> template<class TypeTag>
struct MaxDepth<TypeTag, Properties::TTag::ReservoirBaseProblem> struct MaxDepth<TypeTag, Properties::TTag::ReservoirBaseProblem>
@ -439,6 +431,9 @@ public:
//! By default this problem spans 1000 days (100 "settle down" days and 900 days of //! By default this problem spans 1000 days (100 "settle down" days and 900 days of
//! production) //! production)
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1000.0*24*60*60); Parameters::SetDefault<Parameters::EndTime<Scalar>>(1000.0*24*60*60);
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100e3);
} }
/*! /*!

View File

@ -108,14 +108,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::RichardsLensProblem> struct EnableGravity<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::RichardsLensProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100;
};
// Do not write the intermediate results of the newton method // Do not write the intermediate results of the newton method
template<class TypeTag> template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::RichardsLensProblem> struct NewtonWriteConvergence<TypeTag, Properties::TTag::RichardsLensProblem>
@ -266,6 +258,7 @@ public:
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(3000.0); Parameters::SetDefault<Parameters::EndTime<Scalar>>(3000.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100.0);
} }
/*! /*!

View File

@ -140,14 +140,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::WaterAirBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// The default for the initial time step size of the simulation
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::WaterAirBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 250;
};
// Write newton convergence // Write newton convergence
template<class TypeTag> template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::WaterAirBaseProblem> struct NewtonWriteConvergence<TypeTag, Properties::TTag::WaterAirBaseProblem>
@ -310,6 +302,7 @@ public:
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1); Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0 * 365 * 24 * 60 * 60); Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0 * 365 * 24 * 60 * 60);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
} }
/*! /*!

View File

@ -129,14 +129,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Tutorial1Problem> struct EnableGravity<TypeTag, Properties::TTag::Tutorial1Problem>
{ static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/ { static constexpr bool value = false; }; /*@\label{tutorial1:gravity}@*/
// define the size of the initial time step [s]
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::Tutorial1Problem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 125.0;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -225,6 +217,7 @@ public:
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100e3); Parameters::SetDefault<Parameters::EndTime<Scalar>>(100e3);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(125.0);
} }
//! Specifies the problem name. This is used for files generated by the simulation. //! Specifies the problem name. This is used for files generated by the simulation.

View File

@ -28,8 +28,6 @@
#ifndef EWOMS_BASIC_PARAMETERS_HH #ifndef EWOMS_BASIC_PARAMETERS_HH
#define EWOMS_BASIC_PARAMETERS_HH #define EWOMS_BASIC_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters { namespace Opm::Parameters {
//! grid resolution //! grid resolution
@ -59,8 +57,8 @@ struct GridFile { static constexpr auto value = ""; };
struct GridGlobalRefinements { static constexpr unsigned value = 0; }; struct GridGlobalRefinements { static constexpr unsigned value = 0; };
//! The default value for the simulation's initial time step size //! The default value for the simulation's initial time step size
template<class TypeTag, class MyTypeTag> template<class Scalar>
struct InitialTimeStepSize { using type = Properties::UndefinedProperty; }; struct InitialTimeStepSize { static constexpr Scalar value = -1e35; };
//! Set a value for the ParameterFile property //! Set a value for the ParameterFile property
struct ParameterFile { static constexpr auto value = ""; }; struct ParameterFile { static constexpr auto value = ""; };

View File

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

View File

@ -130,7 +130,7 @@ public:
startTime_ = 0.0; startTime_ = 0.0;
time_ = 0.0; time_ = 0.0;
endTime_ = Parameters::Get<Parameters::EndTime<Scalar>>(); endTime_ = Parameters::Get<Parameters::EndTime<Scalar>>();
timeStepSize_ = Parameters::get<TypeTag, Parameters::InitialTimeStepSize>(); timeStepSize_ = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
assert(timeStepSize_ > 0); assert(timeStepSize_ > 0);
const std::string& predetTimeStepFile = const std::string& predetTimeStepFile =
Parameters::Get<Parameters::PredeterminedTimeStepsFile>(); Parameters::Get<Parameters::PredeterminedTimeStepsFile>();
@ -256,7 +256,7 @@ public:
{ {
Parameters::Register<Parameters::EndTime<Scalar>> Parameters::Register<Parameters::EndTime<Scalar>>
("The simulation time at which the simulation is finished [s]"); ("The simulation time at which the simulation is finished [s]");
Parameters::registerParam<TypeTag, Parameters::InitialTimeStepSize> Parameters::Register<Parameters::InitialTimeStepSize<Scalar>>
("The size of the initial time step [s]"); ("The size of the initial time step [s]");
Parameters::Register<Parameters::RestartTime<Scalar>> Parameters::Register<Parameters::RestartTime<Scalar>>
("The simulation time at which a restart should be attempted [s]"); ("The simulation time at which a restart should be attempted [s]");

View File

@ -323,7 +323,7 @@ static inline int start(int argc, char **argv, bool registerParams=true)
return 1; return 1;
} }
Scalar initialTimeStepSize = Parameters::get<TypeTag, Parameters::InitialTimeStepSize>(); Scalar initialTimeStepSize = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
if (initialTimeStepSize < -1e50) { if (initialTimeStepSize < -1e50) {
if (myRank == 0) if (myRank == 0)
Parameters::printUsage(argv[0], Parameters::printUsage(argv[0],