move EnableThermodynamicHints to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent 32667526e0
commit a480fe56b8
4 changed files with 22 additions and 43 deletions

View File

@ -284,12 +284,6 @@ struct DiscreteFunction<TypeTag, TTag::FvBaseDiscretization>
namespace Opm::Parameters {
// 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; };
// use default initialization based on rule-of-thumb of Newton tolerance
template<class TypeTag>
struct LinearSolverAbsTolerance<TypeTag, Properties::TTag::FvBaseDiscretization>
@ -430,7 +424,7 @@ public:
, enableGridAdaptation_(Parameters::Get<Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::Get<Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::Get<Parameters::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Parameters::EnableThermodynamicHints>())
, enableThermodynamicHints_(Parameters::Get<Parameters::EnableThermodynamicHints>())
{
bool isEcfv = std::is_same<Discretization, EcfvDiscretization<TypeTag> >::value;
if (enableGridAdaptation_ && !isEcfv)
@ -486,7 +480,7 @@ public:
("Enable adaptive grid refinement/coarsening");
Parameters::Register<Parameters::EnableVtkOutput>
("Global switch for turning on writing VTK files");
Parameters::registerParam<TypeTag, Parameters::EnableThermodynamicHints>
Parameters::Register<Parameters::EnableThermodynamicHints>
("Enable thermodynamic hints");
Parameters::Register<Parameters::EnableIntensiveQuantityCache>
("Turn on caching of intensive quantities");

View File

@ -30,8 +30,6 @@
#ifndef EWOMS_FV_BASE_PARAMETERS_HH
#define EWOMS_FV_BASE_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
#include <limits>
namespace Opm::Parameters {
@ -81,6 +79,16 @@ struct EnableIntensiveQuantityCache { static constexpr bool value = false; };
*/
struct EnableStorageCache { static constexpr bool value = false; };
/*!
* \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).
*/
struct EnableThermodynamicHints { static constexpr bool value = false; };
/*!
* \brief Global switch to enable or disable the writing of VTK output files
*
@ -119,17 +127,6 @@ struct OutputDir { static constexpr auto value = ""; };
//! \brief Number of threads per process.
struct ThreadsPerProcess { static constexpr int value = 1; };
/*!
* \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

@ -118,17 +118,6 @@ struct EnableEnergy<TypeTag, TTag::FlashModel> { static constexpr bool value = f
} // namespace Opm::Properties
namespace Opm::Parameters {
// 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 {
/*!
@ -237,6 +226,11 @@ public:
// The updates of intensive quantities tend to be _very_ expensive for this
// model, so let's try to minimize the number of required ones
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(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.
Parameters::SetDefault<Parameters::EnableThermodynamicHints>(true);
}
/*!

View File

@ -141,17 +141,6 @@ struct EnableEnergy<TypeTag, TTag::FlashModel>
} // namespace Opm::Properties
namespace Opm::Parameters {
// 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 {
/*!
@ -248,6 +237,11 @@ public:
Parameters::SetDefault<Parameters::FlashTolerance<Scalar>>(1e-12);
Parameters::SetDefault<Parameters::EnableIntensiveQuantityCache>(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.
Parameters::SetDefault<Parameters::EnableThermodynamicHints>(true);
}
/*!