changed: move the EnableStorageCache parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:16:28 +02:00
parent e3222a6dd6
commit 67bb6717f3
6 changed files with 38 additions and 30 deletions

View File

@ -225,10 +225,6 @@ struct InitialTimeStepSize<TypeTag, TTag::LensBaseProblem>
template<class TypeTag>
struct VtkWriteIntrinsicPermeabilities<TypeTag, TTag::LensBaseProblem> { static constexpr bool value = true; };
// enable the storage cache by default for this problem
template<class TypeTag>
struct EnableStorageCache<TypeTag, TTag::LensBaseProblem> { static constexpr bool value = true; };
} // namespace Opm::Properties
namespace Opm::Parameters {
@ -238,6 +234,11 @@ 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; };
} // namespace Opm::Parameters
namespace Opm {

View File

@ -46,11 +46,6 @@ struct ReservoirNcpVcfvProblem { using InheritsFrom = std::tuple<ReservoirBasePr
template<class TypeTag>
struct SpatialDiscretizationSplice<TypeTag, TTag::ReservoirNcpVcfvProblem> { using type = TTag::VcfvDiscretization; };
// enable the storage cache for this problem so that the storage cache receives wider
// testing
template<class TypeTag>
struct EnableStorageCache<TypeTag, TTag::ReservoirNcpVcfvProblem> { static constexpr bool value = true; };
// reduce the base epsilon for the finite difference method to 10^-11. for some reason
// the simulator converges better with this. (TODO: use automatic differentiation?)
template<class TypeTag>
@ -60,9 +55,18 @@ struct BaseEpsilon<TypeTag, TTag::ReservoirNcpVcfvProblem>
static constexpr type value = 1e-11;
};
} // 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

@ -213,10 +213,6 @@ struct Linearizer<TypeTag, TTag::FvBaseDiscretization> { using type = FvBaseLine
template<class TypeTag>
struct VtkOutputFormat<TypeTag, TTag::FvBaseDiscretization> { static constexpr int value = Dune::VTK::ascii; };
// disable caching the storage term by default
template<class TypeTag>
struct EnableStorageCache<TypeTag, TTag::FvBaseDiscretization> { static constexpr bool value = false; };
// disable constraints by default
template<class TypeTag>
struct EnableConstraints<TypeTag, TTag::FvBaseDiscretization> { static constexpr bool value = false; };
@ -347,6 +343,11 @@ 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; };
} // namespace Opm::Parameters
namespace Opm {
@ -467,7 +468,7 @@ public:
, linearizer_(new Linearizer())
, enableGridAdaptation_(Parameters::get<TypeTag, Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::get<TypeTag, Properties::EnableStorageCache>())
, enableStorageCache_(Parameters::get<TypeTag, Parameters::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Properties::EnableThermodynamicHints>())
{
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
@ -476,7 +477,7 @@ public:
"element-centered finite volume discretization (is: "
+Dune::className<Discretization>()+")");
enableStorageCache_ = Parameters::get<TypeTag, Properties::EnableStorageCache>();
enableStorageCache_ = Parameters::get<TypeTag, Parameters::EnableStorageCache>();
PrimaryVariables::init();
size_t numDof = asImp_().numGridDof();
@ -530,7 +531,7 @@ public:
("Enable thermodynamic hints");
Parameters::registerParam<TypeTag, Parameters::EnableIntensiveQuantityCache>
("Turn on caching of intensive quantities");
Parameters::registerParam<TypeTag, Properties::EnableStorageCache>
Parameters::registerParam<TypeTag, Parameters::EnableStorageCache>
("Store previous storage terms and avoid re-calculating them.");
Parameters::registerParam<TypeTag, Parameters::OutputDir>
("The directory to which result files are written");

View File

@ -30,11 +30,13 @@
#include "fvbaseproperties.hh"
#include <opm/models/discretization/common/linearizationtype.hh>
#include <opm/models/utils/alignedallocator.hh>
#include <dune/common/fvector.hh>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/discretization/common/linearizationtype.hh>
#include <opm/models/utils/alignedallocator.hh>
#include <vector>
namespace Opm {
@ -95,7 +97,7 @@ public:
{
// remember the simulator object
simulatorPtr_ = &simulator;
enableStorageCache_ = Parameters::get<TypeTag, Properties::EnableStorageCache>();
enableStorageCache_ = Parameters::get<TypeTag, Parameters::EnableStorageCache>();
stashedDofIdx_ = -1;
focusDofIdx_ = -1;
}

View File

@ -116,6 +116,15 @@ struct ContinueOnConvergenceError { using type = Properties::UndefinedProperty;
template<class TypeTag, class MyTypeTag>
struct EnableIntensiveQuantityCache { using type = Properties::UndefinedProperty; };
/*!
* \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; };
} // namespace Opm::Parameters
#endif

View File

@ -215,15 +215,6 @@ struct VtkOutputFormat { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableConstraints { using type = UndefinedProperty; };
/*!
* \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 = UndefinedProperty; };
/*!
* \brief Specify whether to use the already calculated solutions as
* starting values of the intensive quantities.