Merge pull request #923 from akva2/typetag_free_params1

Move more parameters to typetag-free parameter system
This commit is contained in:
Bård Skaflestad 2024-08-13 19:43:58 +02:00 committed by GitHub
commit b76dd13afc
43 changed files with 204 additions and 570 deletions

View File

@ -174,14 +174,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::Co2InjectionBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr bool value = true; }; { 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> template<class TypeTag>
struct FluidSystemNumPressure<TypeTag, Properties::TTag::Co2InjectionBaseProblem> struct FluidSystemNumPressure<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr unsigned value = 100; }; { static constexpr unsigned value = 100; };
@ -218,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>
{ {
@ -412,6 +396,8 @@ public:
("The name of the simulation used for the output files"); ("The name of the simulation used for the output files");
Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf"); Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250);
} }
/*! /*!

View File

@ -161,14 +161,6 @@ template <class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::CO2PTBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::CO2PTBaseProblem>
{ static constexpr bool value = false; }; { 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 // this is kinds of telling the report step length
template <class TypeTag> template <class TypeTag>
struct EpisodeLength<TypeTag, Properties::TTag::CO2PTBaseProblem> struct EpisodeLength<TypeTag, Properties::TTag::CO2PTBaseProblem>
@ -184,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>
{ {
@ -398,6 +382,9 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(1); Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0); Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(60. * 60.);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(0.1 * 60. * 60.);
} }
/*! /*!

View File

@ -121,30 +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 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>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1;
};
// 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::Parameters
namespace Opm { namespace Opm {
@ -312,6 +288,9 @@ public:
ParentType::registerParameters(); ParentType::registerParameters();
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::InitialTimeStepSize<Scalar>>(1.0);
Parameters::SetDefault<Parameters::MaxTimeStepSize<Scalar>>(600.0);
} }
/*! /*!

View File

@ -115,22 +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 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>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1000;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -223,10 +207,12 @@ public:
if constexpr (dim > 1) { if constexpr (dim > 1) {
Parameters::SetDefault<Parameters::CellsY>(1); Parameters::SetDefault<Parameters::CellsY>(1);
} }
if constexpr (dim == 3) { if constexpr (dim == 3) {
Parameters::SetDefault<Parameters::CellsZ>(1); Parameters::SetDefault<Parameters::CellsZ>(1);
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e6);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1000);
} }
/*! /*!

View File

@ -136,22 +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 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>
{
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>
{ {
@ -296,6 +280,9 @@ public:
// Use forward differences // Use forward differences
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1); Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(215);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(10);
} }
/*! /*!

View File

@ -165,22 +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 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>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -313,6 +297,8 @@ public:
ParentType::registerParameters(); ParentType::registerParameters();
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::InitialTimeStepSize<Scalar>>(100);
} }
/*! /*!

View File

@ -117,22 +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 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>
{
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>
{ {
@ -303,6 +287,8 @@ public:
("The intrinsic permeability [m^2] of the lens."); ("The intrinsic permeability [m^2] of the lens.");
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::InitialTimeStepSize<Scalar>>(1.0);
} }
/*! /*!

View File

@ -97,22 +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 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>
{
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>
@ -243,6 +227,8 @@ 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::InitialTimeStepSize<Scalar>>(60.0);
} }
/*! /*!

View File

@ -143,32 +143,6 @@ template<class TypeTag>
struct EnableGravity<TypeTag, Properties::TTag::LensBaseProblem> struct EnableGravity<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// enable the cache for intensive quantities by default for this problem
template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; };
// enable the storage cache by default for this problem
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>
{
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>
@ -378,6 +352,11 @@ public:
if constexpr (useFD) { if constexpr (useFD) {
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1); Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(30e3);
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(true);
Parameters::SetDefault<Parameters::EnableStorageCache>(true);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
} }
/*! /*!

View File

@ -120,22 +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 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>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 250;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -282,6 +266,8 @@ public:
ParentType::registerParameters(); ParentType::registerParameters();
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::InitialTimeStepSize<Scalar>>(250);
} }
/*! /*!

View File

@ -81,22 +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 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>
{
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>
@ -190,6 +174,8 @@ public:
ParentType::registerParameters(); ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf"); Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf");
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1.0);
} }
/*! /*!

View File

@ -128,22 +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 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>
{
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>
@ -254,6 +238,9 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(1); Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0); Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1e-3);
} }
/*! /*!

View File

@ -46,6 +46,7 @@
#include <opm/models/blackoil/blackoilproperties.hh> #include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/discretization/common/fvbaseproperties.hh> #include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/nonlinear/newtonmethodparameters.hh> #include <opm/models/nonlinear/newtonmethodparameters.hh>
@ -139,25 +140,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 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>
{
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>
@ -445,8 +427,15 @@ public:
("The width of producer/injector wells as a fraction of the width" ("The width of producer/injector wells as a fraction of the width"
" of the spatial domain"); " of the spatial domain");
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf"); 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);
Parameters::SetDefault<Parameters::EnableStorageCache>(true);
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100e3);
} }
/*! /*!

View File

@ -108,22 +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 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>
{
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>
@ -272,6 +256,9 @@ public:
if constexpr (useFD) { if constexpr (useFD) {
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(0); Parameters::SetDefault<Parameters::NumericDifferenceMethod>(0);
} }
Parameters::SetDefault<Parameters::EndTime<Scalar>>(3000.0);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100.0);
} }
/*! /*!

View File

@ -140,22 +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 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>
{
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>
@ -316,6 +300,9 @@ public:
// Use forward differences // Use forward differences
Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1); Parameters::SetDefault<Parameters::NumericDifferenceMethod>(+1);
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0 * 365 * 24 * 60 * 60);
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
} }
/*! /*!

View File

@ -62,16 +62,6 @@ struct BaseEpsilon<TypeTag, TTag::ReservoirNcpVcfvProblem>
} // namespace Opm::Properties } // namespace Opm::Properties
namespace Opm::Parameters {
// enable the storage cache for this problem so that the storage cache receives wider
// testing
template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::ReservoirNcpVcfvProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
using ProblemTypeTag = Opm::Properties::TTag::ReservoirNcpVcfvProblem; using ProblemTypeTag = Opm::Properties::TTag::ReservoirNcpVcfvProblem;

View File

@ -129,22 +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 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>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 125.0;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -231,6 +215,9 @@ public:
Parameters::SetDefault<Parameters::CellsZ>(1); Parameters::SetDefault<Parameters::CellsZ>(1);
Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(0.0); Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(0.0);
} }
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

@ -95,19 +95,6 @@ struct UseTwoPointGradients<TypeTag, TTag::DiscreteFractureModel> { static const
} // namespace Opm::Properties } // 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<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::DiscreteFractureModel>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm { namespace Opm {
/*! /*!
@ -137,7 +124,7 @@ public:
DiscreteFractureModel(Simulator& simulator) DiscreteFractureModel(Simulator& simulator)
: ParentType(simulator) : ParentType(simulator)
{ {
if (Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>()) { if (Parameters::Get<Parameters::EnableIntensiveQuantityCache>()) {
throw std::runtime_error("The discrete fracture model does not work in conjunction " throw std::runtime_error("The discrete fracture model does not work in conjunction "
"with intensive quantities caching"); "with intensive quantities caching");
} }
@ -152,6 +139,13 @@ public:
// register runtime parameters of the VTK output modules // register runtime parameters of the VTK output modules
Opm::VtkDiscreteFractureModule<TypeTag>::registerParameters(); Opm::VtkDiscreteFractureModule<TypeTag>::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<Parameters::EnableIntensiveQuantityCache>(false);
} }
/*! /*!

View File

@ -284,42 +284,6 @@ struct DiscreteFunction<TypeTag, TTag::FvBaseDiscretization>
namespace Opm::Parameters { 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<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
//! Disable grid adaptation by default
template<class TypeTag>
struct EnableGridAdaptation<TypeTag, Properties::TTag::FvBaseDiscretization>
{ 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
//! CPU caches...
template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
// disable caching the storage term by default
template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
//! Enable the VTK output by default
template<class TypeTag>
struct EnableVtkOutput<TypeTag, Properties::TTag::FvBaseDiscretization>
{ 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<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
// use default initialization based on rule-of-thumb of Newton tolerance // use default initialization based on rule-of-thumb of Newton tolerance
template<class TypeTag> template<class TypeTag>
struct LinearSolverAbsTolerance<TypeTag, Properties::TTag::FvBaseDiscretization> struct LinearSolverAbsTolerance<TypeTag, Properties::TTag::FvBaseDiscretization>
@ -339,38 +303,6 @@ struct LinearSolverTolerance<TypeTag, Properties::TTag::FvBaseDiscretization>
static constexpr type value = 1e-3; 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>
struct MaxTimeStepDivisions<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr unsigned value = 10; };
//! By default, accept any time step larger than zero
template<class TypeTag>
struct MinTimeStepSize<TypeTag, Properties::TTag::FvBaseDiscretization>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.0;
};
//! By default, write the simulation output to the current working directory
template<class TypeTag>
struct OutputDir<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr auto value = "."; };
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr int value = 1; };
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -489,10 +421,10 @@ public:
, newtonMethod_(simulator) , newtonMethod_(simulator)
, localLinearizer_(ThreadManager::maxThreads()) , localLinearizer_(ThreadManager::maxThreads())
, linearizer_(new Linearizer()) , linearizer_(new Linearizer())
, enableGridAdaptation_(Parameters::get<TypeTag, Parameters::EnableGridAdaptation>() ) , enableGridAdaptation_(Parameters::Get<Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>()) , enableIntensiveQuantityCache_(Parameters::Get<Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::get<TypeTag, Parameters::EnableStorageCache>()) , enableStorageCache_(Parameters::Get<Parameters::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Parameters::EnableThermodynamicHints>()) , enableThermodynamicHints_(Parameters::Get<Parameters::EnableThermodynamicHints>())
{ {
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value; bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
if (enableGridAdaptation_ && !isEcfv) if (enableGridAdaptation_ && !isEcfv)
@ -500,8 +432,6 @@ public:
"element-centered finite volume discretization (is: " "element-centered finite volume discretization (is: "
+Dune::className<Discretization>()+")"); +Dune::className<Discretization>()+")");
enableStorageCache_ = Parameters::get<TypeTag, Parameters::EnableStorageCache>();
PrimaryVariables::init(); PrimaryVariables::init();
size_t numDof = asImp_().numGridDof(); size_t numDof = asImp_().numGridDof();
for (unsigned timeIdx = 0; timeIdx < historySize; ++timeIdx) { for (unsigned timeIdx = 0; timeIdx < historySize; ++timeIdx) {
@ -546,17 +476,17 @@ public:
// register runtime parameters of the output modules // register runtime parameters of the output modules
VtkPrimaryVarsModule<TypeTag>::registerParameters(); VtkPrimaryVarsModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableGridAdaptation> Parameters::Register<Parameters::EnableGridAdaptation>
("Enable adaptive grid refinement/coarsening"); ("Enable adaptive grid refinement/coarsening");
Parameters::registerParam<TypeTag, Parameters::EnableVtkOutput> Parameters::Register<Parameters::EnableVtkOutput>
("Global switch for turning on writing VTK files"); ("Global switch for turning on writing VTK files");
Parameters::registerParam<TypeTag, Parameters::EnableThermodynamicHints> Parameters::Register<Parameters::EnableThermodynamicHints>
("Enable thermodynamic hints"); ("Enable thermodynamic hints");
Parameters::registerParam<TypeTag, Parameters::EnableIntensiveQuantityCache> Parameters::Register<Parameters::EnableIntensiveQuantityCache>
("Turn on caching of intensive quantities"); ("Turn on caching of intensive quantities");
Parameters::registerParam<TypeTag, Parameters::EnableStorageCache> Parameters::Register<Parameters::EnableStorageCache>
("Store previous storage terms and avoid re-calculating them."); ("Store previous storage terms and avoid re-calculating them.");
Parameters::registerParam<TypeTag, Parameters::OutputDir> Parameters::Register<Parameters::OutputDir>
("The directory to which result files are written"); ("The directory to which result files are written");
} }

View File

@ -97,7 +97,7 @@ public:
{ {
// remember the simulator object // remember the simulator object
simulatorPtr_ = &simulator; simulatorPtr_ = &simulator;
enableStorageCache_ = Parameters::get<TypeTag, Parameters::EnableStorageCache>(); enableStorageCache_ = Parameters::Get<Parameters::EnableStorageCache>();
stashedDofIdx_ = -1; stashedDofIdx_ = -1;
focusDofIdx_ = -1; focusDofIdx_ = -1;
} }

View File

@ -30,12 +30,16 @@
#ifndef EWOMS_FV_BASE_PARAMETERS_HH #ifndef EWOMS_FV_BASE_PARAMETERS_HH
#define EWOMS_FV_BASE_PARAMETERS_HH #define EWOMS_FV_BASE_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh> #include <limits>
namespace Opm::Parameters { namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag> /*!
struct ThreadsPerProcess { 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
* step size.
*/
struct ContinueOnConvergenceError { static constexpr bool value = false; };
/*! /*!
* \brief Determines if the VTK output is written to disk asynchronously * \brief Determines if the VTK output is written to disk asynchronously
@ -54,54 +58,7 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; };
* Currently grid adaptation requires the presence of the dune-FEM module. If it is not * 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. * available and grid adaptation is enabled, an exception is thrown.
*/ */
template<class TypeTag, class MyTypeTag> struct EnableGridAdaptation { static constexpr bool value = false; };
struct EnableGridAdaptation { using type = Properties::UndefinedProperty; };
/*!
* \brief The directory to which simulation output ought to be written to.
*/
template<class TypeTag, class MyTypeTag>
struct OutputDir { using type = Properties::UndefinedProperty; };
/*!
* \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<class TypeTag, class MyTypeTag>
struct EnableVtkOutput { using type = Properties::UndefinedProperty; };
/*!
* \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].
*
* The default is to not limit the step size.
*/
template<class TypeTag, class MyTypeTag>
struct MinTimeStepSize { using type = Properties::UndefinedProperty; };
/*!
* \brief The maximum allowed number of timestep divisions for the
* Newton solver.
*/
template<class TypeTag, class MyTypeTag>
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
* step size.
*/
template<class TypeTag, class MyTypeTag>
struct ContinueOnConvergenceError { using type = Properties::UndefinedProperty; };
/*! /*!
* \brief Specify whether all intensive quantities for the grid should be * \brief Specify whether all intensive quantities for the grid should be
@ -112,8 +69,7 @@ struct ContinueOnConvergenceError { using type = Properties::UndefinedProperty;
* may cause the simulation to exhibit worse cache coherence behavior * may cause the simulation to exhibit worse cache coherence behavior
* which eats some of the computational benefits again. * which eats some of the computational benefits again.
*/ */
template<class TypeTag, class MyTypeTag> struct EnableIntensiveQuantityCache { static constexpr bool value = false; };
struct EnableIntensiveQuantityCache { using type = Properties::UndefinedProperty; };
/*! /*!
* \brief Specify whether the storage terms for previous solutions should be cached. * \brief Specify whether the storage terms for previous solutions should be cached.
@ -121,8 +77,7 @@ struct EnableIntensiveQuantityCache { using type = Properties::UndefinedProperty
* This potentially reduces the CPU time, but comes at the cost of higher memory * This potentially reduces the CPU time, but comes at the cost of higher memory
* consumption. * consumption.
*/ */
template<class TypeTag, class MyTypeTag> struct EnableStorageCache { static constexpr bool value = false; };
struct EnableStorageCache { using type = Properties::UndefinedProperty; };
/*! /*!
* \brief Specify whether to use the already calculated solutions as * \brief Specify whether to use the already calculated solutions as
@ -132,8 +87,45 @@ struct EnableStorageCache { using type = Properties::UndefinedProperty; };
* very expensive (e.g. for non-linear fugacity functions where the * very expensive (e.g. for non-linear fugacity functions where the
* solver converges faster). * solver converges faster).
*/ */
template<class TypeTag, class MyTypeTag> struct EnableThermodynamicHints { static constexpr bool value = false; };
struct EnableThermodynamicHints { using type = Properties::UndefinedProperty; };
/*!
* \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 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 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].
*
* The default is to not limit the step size.
*/
template<class Scalar>
struct MinTimeStepSize { static constexpr Scalar value = 0.0; };
/*!
* \brief The directory to which simulation output ought to be written to.
*/
struct OutputDir { static constexpr auto value = ""; };
//! \brief Number of threads per process.
struct ThreadsPerProcess { static constexpr int value = 1; };
} // namespace Opm::Parameters } // namespace Opm::Parameters

View File

@ -147,7 +147,7 @@ public:
// asynchonous VTK output currently does not work in conjunction with grid // asynchonous VTK output currently does not work in conjunction with grid
// adaptivity because the async-IO code assumes that the grid stays // adaptivity because the async-IO code assumes that the grid stays
// constant. complain about that case. // constant. complain about that case.
bool enableGridAdaptation = Parameters::get<TypeTag, Parameters::EnableGridAdaptation>(); bool enableGridAdaptation = Parameters::Get<Parameters::EnableGridAdaptation>();
if (asyncVtkOutput && enableGridAdaptation) if (asyncVtkOutput && enableGridAdaptation)
throw std::runtime_error("Asynchronous VTK output currently cannot be used " throw std::runtime_error("Asynchronous VTK output currently cannot be used "
"at the same time as grid adaptivity"); "at the same time as grid adaptivity");
@ -169,16 +169,16 @@ public:
static void registerParameters() static void registerParameters()
{ {
Model::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]"); ("The maximum size to which all time steps are limited to [s]");
Parameters::registerParam<TypeTag, Parameters::MinTimeStepSize> Parameters::Register<Parameters::MinTimeStepSize<Scalar>>
("The minimum size to which all time steps are limited to [s]"); ("The minimum size to which all time steps are limited to [s]");
Parameters::registerParam<TypeTag, Parameters::MaxTimeStepDivisions> Parameters::Register<Parameters::MaxTimeStepDivisions>
("The maximum number of divisions by two of the timestep size " ("The maximum number of divisions by two of the timestep size "
"before the simulation bails out"); "before the simulation bails out");
Parameters::Register<Parameters::EnableAsyncVtkOutput> Parameters::Register<Parameters::EnableAsyncVtkOutput>
("Dispatch a separate thread to write the VTK output"); ("Dispatch a separate thread to write the VTK output");
Parameters::registerParam<TypeTag, Parameters::ContinueOnConvergenceError> Parameters::Register<Parameters::ContinueOnConvergenceError>
("Continue with a non-converged solution instead of giving up " ("Continue with a non-converged solution instead of giving up "
"if we encounter a time step size smaller than the minimum time " "if we encounter a time step size smaller than the minimum time "
"step size."); "step size.");
@ -204,7 +204,7 @@ public:
*/ */
std::string outputDir() const std::string outputDir() const
{ {
std::string outputDir = Parameters::get<TypeTag, Parameters::OutputDir>(); std::string outputDir = Parameters::Get<Parameters::OutputDir>();
if (outputDir.empty()) if (outputDir.empty())
outputDir = "."; outputDir = ".";
@ -560,14 +560,14 @@ public:
* \brief Returns the minimum allowable size of a time step. * \brief Returns the minimum allowable size of a time step.
*/ */
Scalar minTimeStepSize() const Scalar minTimeStepSize() const
{ return Parameters::get<TypeTag, Parameters::MinTimeStepSize>(); } { return Parameters::Get<Parameters::MinTimeStepSize<Scalar>>(); }
/*! /*!
* \brief Returns the maximum number of subsequent failures for the time integration * \brief Returns the maximum number of subsequent failures for the time integration
* before giving up. * before giving up.
*/ */
unsigned maxTimeIntegrationFailures() const unsigned maxTimeIntegrationFailures() const
{ return Parameters::get<TypeTag, Parameters::MaxTimeStepDivisions>(); } { return Parameters::Get<Parameters::MaxTimeStepDivisions>(); }
/*! /*!
* \brief Returns if we should continue with a non-converged solution instead of * \brief Returns if we should continue with a non-converged solution instead of
@ -575,7 +575,7 @@ public:
* step size. * step size.
*/ */
bool continueOnConvergenceError() const bool continueOnConvergenceError() const
{ return Parameters::get<TypeTag, Parameters::ContinueOnConvergenceError>(); } { return Parameters::Get<Parameters::ContinueOnConvergenceError>(); }
/*! /*!
* \brief Impose the next time step size to be used externally. * \brief Impose the next time step size to be used externally.
@ -593,7 +593,7 @@ public:
if (nextTimeStepSize_ > 0.0) if (nextTimeStepSize_ > 0.0)
return nextTimeStepSize_; return nextTimeStepSize_;
Scalar dtNext = std::min(Parameters::get<TypeTag, Parameters::MaxTimeStepSize>(), Scalar dtNext = std::min(Parameters::Get<Parameters::MaxTimeStepSize<Scalar>>(),
newtonMethod().suggestTimeStepSize(simulator().timeStepSize())); newtonMethod().suggestTimeStepSize(simulator().timeStepSize()));
if (dtNext < simulator().maxTimeStepSize() if (dtNext < simulator().maxTimeStepSize()
@ -812,7 +812,7 @@ protected:
private: private:
bool enableVtkOutput_() const bool enableVtkOutput_() const
{ return Parameters::get<TypeTag, Parameters::EnableVtkOutput>(); } { return Parameters::Get<Parameters::EnableVtkOutput>(); }
//! Returns the implementation of the problem (i.e. static polymorphism) //! Returns the implementation of the problem (i.e. static polymorphism)
Implementation& asImp_() Implementation& asImp_()

View File

@ -118,23 +118,6 @@ struct EnableEnergy<TypeTag, TTag::FlashModel> { static constexpr bool value = f
} // namespace Opm::Properties } // namespace Opm::Properties
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<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::FlashModel>
{ 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.
template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm { namespace Opm {
/*! /*!
@ -239,6 +222,15 @@ public:
Parameters::Register<Parameters::FlashTolerance<Scalar>> Parameters::Register<Parameters::FlashTolerance<Scalar>>
("The maximum tolerance for the flash solver to " ("The maximum tolerance for the flash solver to "
"consider the solution converged"); "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<Parameters::EnableIntensiveQuantityCache>(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<Parameters::EnableThermodynamicHints>(true);
} }
/*! /*!

View File

@ -141,8 +141,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableEnergy) if (!enableEnergy)
return; return;
@ -163,8 +164,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableEnergy) if (!enableEnergy)
return; return;

View File

@ -148,8 +148,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableMICP) if (!enableMICP)
return; return;
@ -172,8 +173,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableMICP) if (!enableMICP)
return; return;

View File

@ -249,8 +249,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) { for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState(); const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState();

View File

@ -160,8 +160,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enablePolymer) if (!enablePolymer)
return; return;
@ -186,8 +187,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enablePolymer) if (!enablePolymer)
return; return;

View File

@ -150,8 +150,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableSolvent) if (!enableSolvent)
return; return;
@ -174,8 +175,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableSolvent) if (!enableSolvent)
return; return;

View File

@ -191,8 +191,9 @@ public:
{ {
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -147,8 +147,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -210,8 +210,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
const auto& fractureMapper = elemCtx.simulator().vanguard().fractureMapper(); const auto& fractureMapper = elemCtx.simulator().vanguard().fractureMapper();

View File

@ -162,8 +162,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -273,8 +273,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
const auto& problem = elemCtx.problem(); const auto& problem = elemCtx.problem();
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {

View File

@ -106,8 +106,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
// calculate the phase presence // calculate the phase presence

View File

@ -131,8 +131,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
const auto& elementMapper = elemCtx.model().elementMapper(); const auto& elementMapper = elemCtx.model().elementMapper();
unsigned elemIdx = static_cast<unsigned>(elementMapper.index(elemCtx.element())); unsigned elemIdx = static_cast<unsigned>(elementMapper.index(elemCtx.element()));

View File

@ -131,8 +131,9 @@ public:
{ {
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -112,8 +112,9 @@ public:
{ {
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -60,7 +60,7 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
Parameters::registerParam<TypeTag, Parameters::ThreadsPerProcess> Parameters::Register<Parameters::ThreadsPerProcess>
("The maximum number of threads to be instantiated per process " ("The maximum number of threads to be instantiated per process "
"('-1' means 'automatic')"); "('-1' means 'automatic')");
} }
@ -78,7 +78,7 @@ public:
{ {
if (queryCommandLineParameter) if (queryCommandLineParameter)
{ {
numThreads_ = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>(); numThreads_ = Parameters::Get<Parameters::ThreadsPerProcess>();
// some safety checks. This is pretty ugly macro-magic, but so what? // some safety checks. This is pretty ugly macro-magic, but so what?
#if !defined(_OPENMP) #if !defined(_OPENMP)

View File

@ -141,23 +141,6 @@ struct EnableEnergy<TypeTag, TTag::FlashModel>
} // namespace Opm::Properties } // namespace Opm::Properties
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<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::FlashModel>
{ 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.
template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm { namespace Opm {
/*! /*!
@ -253,6 +236,12 @@ public:
"ssi, newton, ssi+newton"); "ssi, newton, ssi+newton");
Parameters::SetDefault<Parameters::FlashTolerance<Scalar>>(1e-12); Parameters::SetDefault<Parameters::FlashTolerance<Scalar>>(1e-12);
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(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<Parameters::EnableThermodynamicHints>(true);
} }
/*! /*!

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
@ -48,8 +46,8 @@ template<class Scalar>
struct DomainSizeZ { static constexpr Scalar value = 1.0; }; struct DomainSizeZ { static constexpr Scalar value = 1.0; };
//! The default value for the simulation's end time //! The default value for the simulation's end time
template<class TypeTag, class MyTypeTag> template<class Scalar>
struct EndTime { using type = Properties::UndefinedProperty; }; struct EndTime { static constexpr Scalar value = -1e35; };
//! Name of the grid file //! Name of the grid file
struct GridFile { static constexpr auto value = ""; }; struct GridFile { static constexpr auto value = ""; };
@ -59,15 +57,14 @@ 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 = ""; };
//! The name of the file with a number of forced time step lengths //! By default, do not force any time steps
template<class TypeTag, class MyTypeTag> struct PredeterminedTimeStepsFile { static constexpr auto value = ""; };
struct PredeterminedTimeStepsFile { using type = Properties::UndefinedProperty; };
/*! /*!
* \brief Print all parameters on startup? * \brief Print all parameters on startup?
@ -75,12 +72,11 @@ struct PredeterminedTimeStepsFile { using type = Properties::UndefinedProperty;
* 0 means 'no', 1 means 'yes', 2 means 'print only to logfiles'. The * 0 means 'no', 1 means 'yes', 2 means 'print only to logfiles'. The
* default is 2. * default is 2.
*/ */
template<class TypeTag, class MyTypeTag> struct PrintParameters { static constexpr int value = 2; };
struct PrintParameters { using type = Properties::UndefinedProperty; };
//! The default value for the simulation's restart time //! The default value for the simulation's restart time
template<class TypeTag, class MyTypeTag> template<class Scalar>
struct RestartTime { using type = Properties::UndefinedProperty; }; struct RestartTime { static constexpr Scalar value = -1e35; };
} // namespace Opm:Parameters } // namespace Opm:Parameters

View File

@ -177,42 +177,4 @@ struct Vanguard<TypeTag, TTag::NumericModel>
} // namespace Opm::Properties } // namespace Opm::Properties
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>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1e35;
};
//! By default, do not force any time steps
template<class TypeTag>
struct PredeterminedTimeStepsFile<TypeTag, Properties::TTag::NumericModel>
{ static constexpr auto value = ""; };
//! By default, print the values of the run-time parameters on startup
template<class TypeTag>
struct PrintParameters<TypeTag, Properties::TTag::NumericModel>
{ static constexpr int value = 2; };
//! The default value for the simulation's restart time
template<class TypeTag>
struct RestartTime<TypeTag, Properties::TTag::NumericModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1e35;
};
} // namespace Opm::Parameters
#endif #endif

View File

@ -129,11 +129,11 @@ public:
timeStepIdx_ = 0; timeStepIdx_ = 0;
startTime_ = 0.0; startTime_ = 0.0;
time_ = 0.0; time_ = 0.0;
endTime_ = Parameters::get<TypeTag, Parameters::EndTime>(); 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<TypeTag, Parameters::PredeterminedTimeStepsFile>(); Parameters::Get<Parameters::PredeterminedTimeStepsFile>();
if (!predetTimeStepFile.empty()) { if (!predetTimeStepFile.empty()) {
std::ifstream is(predetTimeStepFile); std::ifstream is(predetTimeStepFile);
while (!is.eof()) { while (!is.eof()) {
@ -254,13 +254,13 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
Parameters::registerParam<TypeTag, Parameters::EndTime> 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::registerParam<TypeTag, Parameters::RestartTime> 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]");
Parameters::registerParam<TypeTag, Parameters::PredeterminedTimeStepsFile> Parameters::Register<Parameters::PredeterminedTimeStepsFile>
("A file with a list of predetermined time step sizes (one " ("A file with a list of predetermined time step sizes (one "
"time step per line)"); "time step per line)");
@ -649,7 +649,7 @@ public:
TimerGuard writeTimerGuard(writeTimer_); TimerGuard writeTimerGuard(writeTimer_);
setupTimer_.start(); setupTimer_.start();
Scalar restartTime = Parameters::get<TypeTag, Parameters::RestartTime>(); Scalar restartTime = Parameters::Get<Parameters::RestartTime<Scalar>>();
if (restartTime > -1e30) { if (restartTime > -1e30) {
// try to restart a previous simulation // try to restart a previous simulation
time_ = restartTime; time_ = restartTime;

View File

@ -80,12 +80,12 @@ static inline void registerAllParameters_(bool finalizeRegistration = true)
Parameters::Register<Parameters::ParameterFile> Parameters::Register<Parameters::ParameterFile>
("An .ini file which contains a set of run-time parameters"); ("An .ini file which contains a set of run-time parameters");
Parameters::registerParam<TypeTag, Parameters::PrintParameters> Parameters::Register<Parameters::PrintParameters>
("Print the values of the run-time parameters at the " ("Print the values of the run-time parameters at the "
"start of the simulation"); "start of the simulation");
Simulator::registerParameters();
ThreadManager::registerParameters(); ThreadManager::registerParameters();
Simulator::registerParameters();
if (finalizeRegistration) { if (finalizeRegistration) {
Parameters::endRegistration(); Parameters::endRegistration();
@ -315,7 +315,7 @@ static inline int start(int argc, char **argv, bool registerParams=true)
#endif #endif
// read the initial time step and the end time // 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 (endTime < -1e50) {
if (myRank == 0) if (myRank == 0)
Parameters::printUsage(argv[0], Parameters::printUsage(argv[0],
@ -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],
@ -351,7 +351,7 @@ static inline int start(int argc, char **argv, bool registerParams=true)
} }
// print the parameters if requested // print the parameters if requested
int printParams = Parameters::get<TypeTag, Parameters::PrintParameters>(); int printParams = Parameters::Get<Parameters::PrintParameters>();
if (myRank == 0) { if (myRank == 0) {
std::string endParametersSeparator("# [end of parameters]\n"); std::string endParametersSeparator("# [end of parameters]\n");
if (printParams) { if (printParams) {