changed: move the EnableIntensiveQuantitiesCache parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving
2024-06-28 12:16:28 +02:00
parent f77c12bce9
commit e3222a6dd6
7 changed files with 57 additions and 36 deletions

View File

@@ -229,11 +229,16 @@ struct VtkWriteIntrinsicPermeabilities<TypeTag, TTag::LensBaseProblem> { static
template<class TypeTag>
struct EnableStorageCache<TypeTag, TTag::LensBaseProblem> { static constexpr bool value = true; };
} // namespace Opm::Properties
namespace Opm::Parameters {
// enable the cache for intensive quantities by default for this problem
template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, TTag::LensBaseProblem> { static constexpr bool value = true; };
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::LensBaseProblem>
{ static constexpr bool value = true; };
} // namespace Opm::Properties
} // namespace Opm::Parameters
namespace Opm {

View File

@@ -93,15 +93,20 @@ struct ExtensiveQuantities<TypeTag, TTag::DiscreteFractureModel>
template<class TypeTag>
struct UseTwoPointGradients<TypeTag, TTag::DiscreteFractureModel> { static constexpr bool value = true; };
} // 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, TTag::DiscreteFractureModel> { static constexpr bool value = false; };
struct EnableIntensiveQuantityCache<TypeTag, Properties::TTag::DiscreteFractureModel>
{ static constexpr bool value = false; };
} // namespace Opm::Properties
} // namespace Opm::Parameters
namespace Opm {
@@ -132,7 +137,7 @@ public:
DiscreteFractureModel(Simulator& simulator)
: ParentType(simulator)
{
if (Parameters::get<TypeTag, Properties::EnableIntensiveQuantityCache>()) {
if (Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>()) {
throw std::runtime_error("The discrete fracture model does not work in conjunction "
"with intensive quantities caching");
}

View File

@@ -221,13 +221,6 @@ struct EnableStorageCache<TypeTag, TTag::FvBaseDiscretization> { static constexp
template<class TypeTag>
struct EnableConstraints<TypeTag, 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, 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>
@@ -346,6 +339,14 @@ template<class TypeTag>
struct ContinueOnConvergenceError<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; };
} // namespace Opm::Parameters
namespace Opm {
@@ -465,7 +466,7 @@ public:
, localLinearizer_(ThreadManager::maxThreads())
, linearizer_(new Linearizer())
, enableGridAdaptation_(Parameters::get<TypeTag, Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::get<TypeTag, Properties::EnableIntensiveQuantityCache>())
, enableIntensiveQuantityCache_(Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::get<TypeTag, Properties::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Properties::EnableThermodynamicHints>())
{
@@ -527,7 +528,7 @@ public:
("Global switch for turning on writing VTK files");
Parameters::registerParam<TypeTag, Properties::EnableThermodynamicHints>
("Enable thermodynamic hints");
Parameters::registerParam<TypeTag, Properties::EnableIntensiveQuantityCache>
Parameters::registerParam<TypeTag, Parameters::EnableIntensiveQuantityCache>
("Turn on caching of intensive quantities");
Parameters::registerParam<TypeTag, Properties::EnableStorageCache>
("Store previous storage terms and avoid re-calculating them.");

View File

@@ -104,6 +104,18 @@ struct MaxTimeStepDivisions { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ContinueOnConvergenceError { using type = Properties::UndefinedProperty; };
/*!
* \brief Specify whether all intensive quantities for the grid should be
* cached in the discretization.
*
* This potentially reduces the CPU time, but comes at the cost of
* higher memory consumption. In turn, the higher memory requirements
* may cause the simulation to exhibit worse cache coherence behavior
* which eats some of the computational benefits again.
*/
template<class TypeTag, class MyTypeTag>
struct EnableIntensiveQuantityCache { using type = Properties::UndefinedProperty; };
} // namespace Opm::Parameters
#endif

View File

@@ -215,18 +215,6 @@ struct VtkOutputFormat { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableConstraints { using type = UndefinedProperty; };
/*!
* \brief Specify whether all intensive quantities for the grid should be
* cached in the discretization.
*
* This potentially reduces the CPU time, but comes at the cost of
* higher memory consumption. In turn, the higher memory requirements
* may cause the simulation to exhibit worse cache coherence behavior
* which eats some of the computational benefits again.
*/
template<class TypeTag, class MyTypeTag>
struct EnableIntensiveQuantityCache { using type = UndefinedProperty; };
/*!
* \brief Specify whether the storage terms for previous solutions should be cached.
*

View File

@@ -112,11 +112,6 @@ struct ExtensiveQuantities<TypeTag, TTag::FlashModel> { using type = Opm::FlashE
template<class TypeTag>
struct Indices<TypeTag, TTag::FlashModel> { using type = Opm::FlashIndices<TypeTag, /*PVIdx=*/0>; };
// 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, 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.
@@ -133,6 +128,16 @@ struct EnableEnergy<TypeTag, TTag::FlashModel> { static constexpr bool value = f
} // 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; };
} // namespace Opm::Parameters
namespace Opm {
/*!

View File

@@ -127,11 +127,6 @@ struct ExtensiveQuantities<TypeTag, TTag::FlashModel> { using type = Opm::FlashE
template<class TypeTag>
struct Indices<TypeTag, TTag::FlashModel> { using type = Opm::FlashIndices<TypeTag, /*PVIdx=*/0>; };
// 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, 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.
@@ -148,6 +143,16 @@ struct EnableEnergy<TypeTag, TTag::FlashModel> { static constexpr bool value = f
} // 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; };
} // namespace Opm::Parameters
namespace Opm {
/*!