move FlashTolerance to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent 00c0304fce
commit 65db009152
5 changed files with 9 additions and 24 deletions

View File

@ -107,7 +107,7 @@ public:
const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx); const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
const auto& problem = elemCtx.problem(); const auto& problem = elemCtx.problem();
Scalar flashTolerance = Parameters::get<TypeTag, Parameters::FlashTolerance>(); Scalar flashTolerance = Parameters::Get<Parameters::FlashTolerance<Scalar>>();
// extract the total molar densities of the components // extract the total molar densities of the components
ComponentVector cTotal; ComponentVector cTotal;

View File

@ -133,14 +133,6 @@ template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel> struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
//! Let the flash solver choose its tolerance by default
template<class TypeTag>
struct FlashTolerance<TypeTag, Properties::TTag::FlashModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1.0;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm { namespace Opm {
@ -244,7 +236,7 @@ public:
if (enableEnergy) if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters(); Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::FlashTolerance> Parameters::Register<Parameters::FlashTolerance<Scalar>>
("The maximum tolerance for the flash solver to " ("The maximum tolerance for the flash solver to "
"consider the solution converged"); "consider the solution converged");
} }

View File

@ -30,13 +30,12 @@
#ifndef EWOMS_FLASH_PARAMETERS_HH #ifndef EWOMS_FLASH_PARAMETERS_HH
#define EWOMS_FLASH_PARAMETERS_HH #define EWOMS_FLASH_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters { namespace Opm::Parameters {
//! The maximum accepted error of the flash solver //! The maximum accepted error of the flash solver
template<class TypeTag, class MyTypeTag> //! Let the flash solver choose its tolerance by default
struct FlashTolerance { using type = Properties::UndefinedProperty; }; template<class Scalar>
struct FlashTolerance { static constexpr Scalar value = -1.0; };
} // namespace Opm::Parameters } // namespace Opm::Parameters

View File

@ -110,7 +110,7 @@ public:
const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx); const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx);
const auto& problem = elemCtx.problem(); const auto& problem = elemCtx.problem();
const Scalar flashTolerance = Parameters::get<TypeTag, Parameters::FlashTolerance>(); const Scalar flashTolerance = Parameters::Get<Parameters::FlashTolerance<Scalar>>();
const int flashVerbosity = Parameters::get<TypeTag, Parameters::FlashVerbosity>(); const int flashVerbosity = Parameters::get<TypeTag, Parameters::FlashVerbosity>();
const std::string flashTwoPhaseMethod = Parameters::get<TypeTag, Parameters::FlashTwoPhaseMethod>(); const std::string flashTwoPhaseMethod = Parameters::get<TypeTag, Parameters::FlashTwoPhaseMethod>();

View File

@ -156,14 +156,6 @@ template<class TypeTag>
struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel> struct EnableThermodynamicHints<TypeTag, Properties::TTag::FlashModel>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
//! Let the flash solver choose its tolerance by default
template<class TypeTag>
struct FlashTolerance<TypeTag, Properties::TTag::FlashModel>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.e-12;
};
// Flash two-phase method // Flash two-phase method
template<class TypeTag> template<class TypeTag>
struct FlashTwoPhaseMethod<TypeTag, Properties::TTag::FlashModel> struct FlashTwoPhaseMethod<TypeTag, Properties::TTag::FlashModel>
@ -261,7 +253,7 @@ public:
if (enableEnergy) if (enableEnergy)
Opm::VtkEnergyModule<TypeTag>::registerParameters(); Opm::VtkEnergyModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::FlashTolerance> Parameters::Register<Parameters::FlashTolerance<Scalar>>
("The maximum tolerance for the flash solver to " ("The maximum tolerance for the flash solver to "
"consider the solution converged"); "consider the solution converged");
Parameters::registerParam<TypeTag, Parameters::FlashVerbosity> Parameters::registerParam<TypeTag, Parameters::FlashVerbosity>
@ -269,6 +261,8 @@ public:
Parameters::registerParam<TypeTag, Parameters::FlashTwoPhaseMethod> Parameters::registerParam<TypeTag, Parameters::FlashTwoPhaseMethod>
("Method for solving vapor-liquid composition. Available options include: " ("Method for solving vapor-liquid composition. Available options include: "
"ssi, newton, ssi+newton"); "ssi, newton, ssi+newton");
Parameters::SetDefault<Parameters::FlashTolerance<Scalar>>(1e-12);
} }
/*! /*!