changed: move the EnableThermodynamicHints parameter to Opm::Parameters

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

View File

@ -217,11 +217,6 @@ struct VtkOutputFormat<TypeTag, TTag::FvBaseDiscretization> { static constexpr i
template<class TypeTag>
struct EnableConstraints<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>
struct EnableThermodynamicHints<TypeTag, TTag::FvBaseDiscretization> { static constexpr bool value = false; };
// if the deflection of the newton method is large, we do not need to solve the linear
// approximation accurately. Assuming that the value for the current solution is quite
// close to the final value, a reduction of 3 orders of magnitude in the defect should be
@ -348,6 +343,12 @@ 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>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
@ -469,7 +470,7 @@ public:
, enableGridAdaptation_(Parameters::get<TypeTag, Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::get<TypeTag, Parameters::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Properties::EnableThermodynamicHints>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Parameters::EnableThermodynamicHints>())
{
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
if (enableGridAdaptation_ && !isEcfv)
@ -527,7 +528,7 @@ public:
("Enable adaptive grid refinement/coarsening");
Parameters::registerParam<TypeTag, Parameters::EnableVtkOutput>
("Global switch for turning on writing VTK files");
Parameters::registerParam<TypeTag, Properties::EnableThermodynamicHints>
Parameters::registerParam<TypeTag, Parameters::EnableThermodynamicHints>
("Enable thermodynamic hints");
Parameters::registerParam<TypeTag, Parameters::EnableIntensiveQuantityCache>
("Turn on caching of intensive quantities");

View File

@ -125,6 +125,17 @@ struct EnableIntensiveQuantityCache { using type = Properties::UndefinedProperty
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.
*
* This only makes sense if the calculation of the intensive quantities is
* very expensive (e.g. for non-linear fugacity functions where the
* solver converges faster).
*/
template<class TypeTag, class MyTypeTag>
struct EnableThermodynamicHints { using type = Properties::UndefinedProperty; };
} // namespace Opm::Parameters
#endif

View File

@ -215,17 +215,6 @@ struct VtkOutputFormat { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableConstraints { using type = UndefinedProperty; };
/*!
* \brief Specify whether to use the already calculated solutions as
* starting values of the intensive quantities.
*
* This only makes sense if the calculation of the intensive quantities is
* very expensive (e.g. for non-linear fugacity functions where the
* solver converges faster).
*/
template<class TypeTag, class MyTypeTag>
struct EnableThermodynamicHints { using type = UndefinedProperty; };
// mappers from local to global DOF indices
/*!

View File

@ -112,12 +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>; };
// 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.
template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, TTag::FlashModel> { static constexpr bool value = true; };
// disable molecular diffusion by default
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::FlashModel> { static constexpr bool value = false; };
@ -136,6 +130,13 @@ template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::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.
template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {

View File

@ -127,12 +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>; };
// 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.
template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, TTag::FlashModel> { static constexpr bool value = true; };
// disable molecular diffusion by default
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::FlashModel> { static constexpr bool value = false; };
@ -151,6 +145,13 @@ template<class TypeTag>
struct EnableIntensiveQuantityCache<TypeTag, Properties::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.
template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; };
} // namespace Opm::Parameters
namespace Opm {