mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-25 08:41:00 -06:00
move EnableStorageCache to TypeTag-free parameter system
This commit is contained in:
parent
5b7fd50d1e
commit
32667526e0
@ -143,11 +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 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
|
// 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>
|
||||||
@ -360,6 +355,7 @@ public:
|
|||||||
|
|
||||||
Parameters::SetDefault<Parameters::EndTime<Scalar>>(30e3);
|
Parameters::SetDefault<Parameters::EndTime<Scalar>>(30e3);
|
||||||
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(true);
|
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(true);
|
||||||
|
Parameters::SetDefault<Parameters::EnableStorageCache>(true);
|
||||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
|
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>
|
||||||
@ -432,6 +433,7 @@ public:
|
|||||||
//! 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::EnableStorageCache>(true);
|
||||||
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
|
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
|
||||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100e3);
|
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100e3);
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -284,11 +284,6 @@ struct DiscreteFunction<TypeTag, TTag::FvBaseDiscretization>
|
|||||||
|
|
||||||
namespace Opm::Parameters {
|
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
|
// 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...
|
// enable the intensive quantity cache above to avoid getting an exception...
|
||||||
template<class TypeTag>
|
template<class TypeTag>
|
||||||
@ -434,7 +429,7 @@ public:
|
|||||||
, linearizer_(new Linearizer())
|
, linearizer_(new Linearizer())
|
||||||
, enableGridAdaptation_(Parameters::Get<Parameters::EnableGridAdaptation>() )
|
, enableGridAdaptation_(Parameters::Get<Parameters::EnableGridAdaptation>() )
|
||||||
, enableIntensiveQuantityCache_(Parameters::Get<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<TypeTag, Parameters::EnableThermodynamicHints>())
|
||||||
{
|
{
|
||||||
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
|
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
|
||||||
@ -443,8 +438,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) {
|
||||||
@ -497,7 +490,7 @@ public:
|
|||||||
("Enable thermodynamic hints");
|
("Enable thermodynamic hints");
|
||||||
Parameters::Register<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::Register<Parameters::OutputDir>
|
Parameters::Register<Parameters::OutputDir>
|
||||||
("The directory to which result files are written");
|
("The directory to which result files are written");
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,14 @@ struct EnableGridAdaptation { static constexpr bool value = false; };
|
|||||||
*/
|
*/
|
||||||
struct EnableIntensiveQuantityCache { 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
|
* \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.
|
//! \brief Number of threads per process.
|
||||||
struct ThreadsPerProcess { static constexpr int value = 1; };
|
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
|
* \brief Specify whether to use the already calculated solutions as
|
||||||
* starting values of the intensive quantities.
|
* starting values of the intensive quantities.
|
||||||
|
Loading…
Reference in New Issue
Block a user