move GridFile to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent b4f3e65740
commit 4905289325
14 changed files with 82 additions and 62 deletions

View File

@ -218,11 +218,6 @@ struct FluidSystemTemperatureLow<TypeTag, Properties::TTag::Co2InjectionBaseProb
static constexpr type value = 290; static constexpr type value = 290;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
{ static constexpr auto value = "data/co2injection.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::Co2InjectionBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
@ -415,6 +410,8 @@ public:
("The maximum depth [m] of the reservoir"); ("The maximum depth [m] of the reservoir");
Parameters::registerParam<TypeTag, Parameters::SimulationName> Parameters::registerParam<TypeTag, Parameters::SimulationName>
("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");
} }
/*! /*!

View File

@ -129,11 +129,6 @@ struct EndTime<TypeTag, Properties::TTag::CuvetteBaseProblem>
static constexpr type value = 180; static constexpr type value = 180;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::CuvetteBaseProblem>
{ static constexpr auto value = "./data/cuvette_11x4.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::CuvetteBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::CuvetteBaseProblem>
@ -309,6 +304,16 @@ public:
initInjectFluidState_(); initInjectFluidState_();
} }
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/cuvette_11x4.dgf");
}
/*! /*!
* \name Auxiliary methods * \name Auxiliary methods
*/ */

View File

@ -173,11 +173,6 @@ struct EndTime<TypeTag, Properties::TTag::FractureProblem>
static constexpr type value = 3e3; static constexpr type value = 3e3;
}; };
// Set the default value for the file name of the grid
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::FractureProblem>
{ static constexpr auto value = "data/fracture.art.dgf"; };
// Set the default value for the initial time step size // Set the default value for the initial time step size
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::FractureProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::FractureProblem>
@ -310,6 +305,16 @@ public:
initEnergyParams_(thermalConductionParams_, matrixPorosity_); initEnergyParams_(thermalConductionParams_, matrixPorosity_);
} }
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("data/fracture.art.dgf");
}
/*! /*!
* \name Auxiliary methods * \name Auxiliary methods
*/ */

View File

@ -125,11 +125,6 @@ struct EndTime<TypeTag, Properties::TTag::GroundWaterBaseProblem>
static constexpr type value = 1; static constexpr type value = 1;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::GroundWaterBaseProblem>
{ static constexpr auto value = "./data/groundwater_2d.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::GroundWaterBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::GroundWaterBaseProblem>
@ -306,6 +301,8 @@ public:
("The intrinsic permeability [m^2] of the ambient material."); ("The intrinsic permeability [m^2] of the ambient material.");
Parameters::registerParam<TypeTag, Parameters::PermeabilityLens> Parameters::registerParam<TypeTag, Parameters::PermeabilityLens>
("The intrinsic permeability [m^2] of the lens."); ("The intrinsic permeability [m^2] of the lens.");
Parameters::SetDefault<Parameters::GridFile>("./data/groundwater_2d.dgf");
} }
/*! /*!

View File

@ -105,11 +105,6 @@ struct EndTime<TypeTag, Properties::TTag::InfiltrationBaseProblem>
static constexpr type value = 6e3; static constexpr type value = 6e3;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::InfiltrationBaseProblem>
{ static constexpr auto value = "./data/infiltration_50x3.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::InfiltrationBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::InfiltrationBaseProblem>
@ -244,6 +239,16 @@ public:
materialParams_.checkDefined(); materialParams_.checkDefined();
} }
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/infiltration_50x3.dgf");
}
/*! /*!
* \name Problem parameters * \name Problem parameters
*/ */

View File

@ -128,11 +128,6 @@ struct EndTime<TypeTag, Properties::TTag::ObstacleBaseProblem>
static constexpr type value = 1e4; static constexpr type value = 1e4;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::ObstacleBaseProblem>
{ static constexpr auto value = "./data/obstacle_24x16.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ObstacleBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::ObstacleBaseProblem>
@ -279,6 +274,16 @@ public:
initFluidStates_(); initFluidStates_();
} }
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/obstacle_24x16.dgf");
}
/*! /*!
* \copydoc FvBaseProblem::endTimeStep * \copydoc FvBaseProblem::endTimeStep
*/ */

View File

@ -89,11 +89,6 @@ struct EndTime<TypeTag, Properties::TTag::OutflowBaseProblem>
static constexpr type value = 100; static constexpr type value = 100;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::OutflowBaseProblem>
{ static constexpr auto value = "./data/outflow.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::OutflowBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::OutflowBaseProblem>
@ -187,6 +182,16 @@ public:
tortuosity_ = 0.28; tortuosity_ = 0.28;
} }
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/outflow.dgf");
}
/*! /*!
* \name Problem parameters * \name Problem parameters
*/ */

View File

@ -150,11 +150,6 @@ struct EndTime<TypeTag, Properties::TTag::ReservoirBaseProblem>
static constexpr type value = 1000.0*24*60*60; static constexpr type value = 1000.0*24*60*60;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::ReservoirBaseProblem>
{ static constexpr auto value = "data/reservoir.dgf"; };
// The default for the initial time step size of the simulation [s] // The default for the initial time step size of the simulation [s]
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::ReservoirBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::ReservoirBaseProblem>
@ -449,6 +444,9 @@ public:
Parameters::registerParam<TypeTag, Parameters::WellWidth> Parameters::registerParam<TypeTag, Parameters::WellWidth>
("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");
} }
/*! /*!

View File

@ -116,11 +116,6 @@ struct EndTime<TypeTag, Properties::TTag::RichardsLensProblem>
static constexpr type value = 3000; static constexpr type value = 3000;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr auto value = "./data/richardslens_24x16.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::RichardsLensProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::RichardsLensProblem>
@ -267,6 +262,16 @@ public:
} }
} }
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/richardslens_24x16.dgf");
}
/*! /*!
* \name Problem parameters * \name Problem parameters
*/ */

View File

@ -145,11 +145,6 @@ struct EndTime<TypeTag, Properties::TTag::WaterAirBaseProblem>
static constexpr type value = 1.0 * 365 * 24 * 60 * 60; static constexpr type value = 1.0 * 365 * 24 * 60 * 60;
}; };
// The default DGF file to load
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr auto value = "./data/waterair.dgf"; };
// The default for the initial time step size of the simulation // The default for the initial time step size of the simulation
template<class TypeTag> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::WaterAirBaseProblem> struct InitialTimeStepSize<TypeTag, Properties::TTag::WaterAirBaseProblem>
@ -307,6 +302,15 @@ public:
* \name Problem parameters * \name Problem parameters
*/ */
//! \{ //! \{
/*!
* \copydoc FvBaseMultiPhaseProblem::registerParameters
*/
static void registerParameters()
{
ParentType::registerParameters();
Parameters::SetDefault<Parameters::GridFile>("./data/waterair.dgf");
}
/*! /*!
* \copydoc FvBaseProblem::name * \copydoc FvBaseProblem::name

View File

@ -62,7 +62,7 @@ public:
*/ */
static void registerParameters() static void registerParameters()
{ {
Parameters::registerParam<TypeTag, Parameters::GridFile> Parameters::Register<Parameters::GridFile>
("The file name of the DGF file to load"); ("The file name of the DGF file to load");
Parameters::Register<Parameters::GridGlobalRefinements> Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid " ("The number of global refinements of the grid "
@ -75,7 +75,7 @@ public:
DgfVanguard(Simulator& simulator) DgfVanguard(Simulator& simulator)
: ParentType(simulator) : ParentType(simulator)
{ {
const std::string dgfFileName = Parameters::get<TypeTag, Parameters::GridFile>(); const std::string dgfFileName = Parameters::Get<Parameters::GridFile>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>(); unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
{ {

View File

@ -55,7 +55,7 @@ class UnstructuredGridVanguard : public BaseVanguard<TypeTag> {
Parameters::Register<Parameters::GridGlobalRefinements> Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid " ("The number of global refinements of the grid "
"executed after it was loaded"); "executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::GridFile>, Parameters::Register<Parameters::GridFile>,
("The file name of the file to load"); ("The file name of the file to load");
} }
@ -64,7 +64,7 @@ class UnstructuredGridVanguard : public BaseVanguard<TypeTag> {
*/ */
UnstructuredGridVanguard(Simulator& simulator) : ParentType(simulator){ UnstructuredGridVanguard(Simulator& simulator) : ParentType(simulator){
#ifdef HAVE_OPM_GRID #ifdef HAVE_OPM_GRID
const std::string gridFileName = Parameters::get<TypeTag, Parameters::GridFile>(); const std::string gridFileName = Parameters::Get<Parameters::GridFile>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>(); unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
const char* c_str = gridFileName.c_str(); const char* c_str = gridFileName.c_str();

View File

@ -56,9 +56,8 @@ struct DomainSizeZ { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct EndTime { using type = Properties::UndefinedProperty; }; struct EndTime { using type = Properties::UndefinedProperty; };
//! name of the grid file //! Name of the grid file
template<class TypeTag, class MyTypeTag> struct GridFile { static constexpr auto value = ""; };
struct GridFile { using type = Properties::UndefinedProperty; };
//! Property which tells the Vanguard how often the grid should be refined //! Property which tells the Vanguard how often the grid should be refined
//! after creation. //! after creation.

View File

@ -187,11 +187,6 @@ struct EndTime<TypeTag, Properties::TTag::NumericModel>
static constexpr type value = -1e35; static constexpr type value = -1e35;
}; };
//! Set a value for the GridFile property
template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::NumericModel>
{ static constexpr auto value = ""; };
//! 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> template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::NumericModel> struct InitialTimeStepSize<TypeTag, Properties::TTag::NumericModel>