move EnableStorageCache to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent 5b7fd50d1e
commit 32667526e0
6 changed files with 14 additions and 34 deletions

View File

@ -143,11 +143,6 @@ template<class TypeTag>
struct EnableGravity<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; };
// define the properties specific for the lens problem
template<class TypeTag>
struct LensLowerLeftX<TypeTag, Properties::TTag::LensBaseProblem>
@ -360,6 +355,7 @@ public:
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

@ -46,6 +46,7 @@
#include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/nonlinear/newtonmethodparameters.hh>
@ -432,6 +433,7 @@ public:
//! 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

@ -62,16 +62,6 @@ struct BaseEpsilon<TypeTag, TTag::ReservoirNcpVcfvProblem>
} // 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)
{
using ProblemTypeTag = Opm::Properties::TTag::ReservoirNcpVcfvProblem;

View File

@ -284,11 +284,6 @@ struct DiscreteFunction<TypeTag, TTag::FvBaseDiscretization>
namespace Opm::Parameters {
// disable caching the storage term by default
template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
// 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>
@ -434,7 +429,7 @@ public:
, linearizer_(new Linearizer())
, enableGridAdaptation_(Parameters::Get<Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::Get<Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::get<TypeTag, Parameters::EnableStorageCache>())
, enableStorageCache_(Parameters::Get<Parameters::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Parameters::EnableThermodynamicHints>())
{
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
@ -443,8 +438,6 @@ public:
"element-centered finite volume discretization (is: "
+Dune::className<Discretization>()+")");
enableStorageCache_ = Parameters::get<TypeTag, Parameters::EnableStorageCache>();
PrimaryVariables::init();
size_t numDof = asImp_().numGridDof();
for (unsigned timeIdx = 0; timeIdx < historySize; ++timeIdx) {
@ -497,7 +490,7 @@ public:
("Enable thermodynamic hints");
Parameters::Register<Parameters::EnableIntensiveQuantityCache>
("Turn on caching of intensive quantities");
Parameters::registerParam<TypeTag, Parameters::EnableStorageCache>
Parameters::Register<Parameters::EnableStorageCache>
("Store previous storage terms and avoid re-calculating them.");
Parameters::Register<Parameters::OutputDir>
("The directory to which result files are written");

View File

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

View File

@ -73,6 +73,14 @@ struct EnableGridAdaptation { static constexpr bool value = false; };
*/
struct EnableIntensiveQuantityCache { static constexpr bool value = false; };
/*!
* \brief Specify whether the storage terms for previous solutions should be cached.
*
* This potentially reduces the CPU time, but comes at the cost of higher memory
* consumption.
*/
struct EnableStorageCache { static constexpr bool value = false; };
/*!
* \brief Global switch to enable or disable the writing of VTK output files
*
@ -111,15 +119,6 @@ struct OutputDir { static constexpr auto value = ""; };
//! \brief Number of threads per process.
struct ThreadsPerProcess { static constexpr int value = 1; };
/*!
* \brief Specify whether the storage terms for previous solutions should be cached.
*
* This potentially reduces the CPU time, but comes at the cost of higher memory
* consumption.
*/
template<class TypeTag, class MyTypeTag>
struct EnableStorageCache { using type = Properties::UndefinedProperty; };
/*!
* \brief Specify whether to use the already calculated solutions as
* starting values of the intensive quantities.