move EnableGridAdaptation to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent f6abb4671e
commit 805e0a4bb7
3 changed files with 7 additions and 13 deletions

View File

@ -291,11 +291,6 @@ template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FvBaseDiscretization> struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
//! Disable grid adaptation by default
template<class TypeTag>
struct EnableGridAdaptation<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; };
//! by default, disable the intensive quantity cache. If the intensive quantities are //! by default, disable the intensive quantity cache. If the intensive quantities are
//! relatively cheap to calculate, the cache basically does not yield any performance //! 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 //! impact because of the intensive quantity cache will cause additional pressure on the
@ -484,7 +479,7 @@ public:
, newtonMethod_(simulator) , newtonMethod_(simulator)
, localLinearizer_(ThreadManager::maxThreads()) , localLinearizer_(ThreadManager::maxThreads())
, linearizer_(new Linearizer()) , linearizer_(new Linearizer())
, enableGridAdaptation_(Parameters::get<TypeTag, Parameters::EnableGridAdaptation>() ) , enableGridAdaptation_(Parameters::Get<Parameters::EnableGridAdaptation>() )
, enableIntensiveQuantityCache_(Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>()) , enableIntensiveQuantityCache_(Parameters::get<TypeTag, Parameters::EnableIntensiveQuantityCache>())
, enableStorageCache_(Parameters::get<TypeTag, Parameters::EnableStorageCache>()) , enableStorageCache_(Parameters::get<TypeTag, Parameters::EnableStorageCache>())
, enableThermodynamicHints_(Parameters::get<TypeTag, Parameters::EnableThermodynamicHints>()) , enableThermodynamicHints_(Parameters::get<TypeTag, Parameters::EnableThermodynamicHints>())
@ -541,7 +536,7 @@ public:
// register runtime parameters of the output modules // register runtime parameters of the output modules
VtkPrimaryVarsModule<TypeTag>::registerParameters(); VtkPrimaryVarsModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableGridAdaptation> Parameters::Register<Parameters::EnableGridAdaptation>
("Enable adaptive grid refinement/coarsening"); ("Enable adaptive grid refinement/coarsening");
Parameters::registerParam<TypeTag, Parameters::EnableVtkOutput> Parameters::registerParam<TypeTag, Parameters::EnableVtkOutput>
("Global switch for turning on writing VTK files"); ("Global switch for turning on writing VTK files");

View File

@ -34,9 +34,6 @@
namespace Opm::Parameters { namespace Opm::Parameters {
//! \brief Number of threads per process.
struct ThreadsPerProcess { static constexpr int value = 1; };
/*! /*!
* \brief Determines if the VTK output is written to disk asynchronously * \brief Determines if the VTK output is written to disk asynchronously
* *
@ -54,8 +51,10 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; };
* Currently grid adaptation requires the presence of the dune-FEM module. If it is not * Currently grid adaptation requires the presence of the dune-FEM module. If it is not
* available and grid adaptation is enabled, an exception is thrown. * available and grid adaptation is enabled, an exception is thrown.
*/ */
template<class TypeTag, class MyTypeTag> struct EnableGridAdaptation { static constexpr bool value = false; };
struct EnableGridAdaptation { using type = Properties::UndefinedProperty; };
//! \brief Number of threads per process.
struct ThreadsPerProcess { static constexpr int value = 1; };
/*! /*!
* \brief The directory to which simulation output ought to be written to. * \brief The directory to which simulation output ought to be written to.

View File

@ -147,7 +147,7 @@ public:
// asynchonous VTK output currently does not work in conjunction with grid // asynchonous VTK output currently does not work in conjunction with grid
// adaptivity because the async-IO code assumes that the grid stays // adaptivity because the async-IO code assumes that the grid stays
// constant. complain about that case. // constant. complain about that case.
bool enableGridAdaptation = Parameters::get<TypeTag, Parameters::EnableGridAdaptation>(); bool enableGridAdaptation = Parameters::Get<Parameters::EnableGridAdaptation>();
if (asyncVtkOutput && enableGridAdaptation) if (asyncVtkOutput && enableGridAdaptation)
throw std::runtime_error("Asynchronous VTK output currently cannot be used " throw std::runtime_error("Asynchronous VTK output currently cannot be used "
"at the same time as grid adaptivity"); "at the same time as grid adaptivity");