From 65db0091522664a51074ddf76abc1f0e18c366a8 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH] move FlashTolerance to TypeTag-free parameter system --- opm/models/flash/flashintensivequantities.hh | 2 +- opm/models/flash/flashmodel.hh | 10 +--------- opm/models/flash/flashparameters.hh | 7 +++---- opm/models/ptflash/flashintensivequantities.hh | 2 +- opm/models/ptflash/flashmodel.hh | 12 +++--------- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/opm/models/flash/flashintensivequantities.hh b/opm/models/flash/flashintensivequantities.hh index aae22d3c1..6bbaa12bf 100644 --- a/opm/models/flash/flashintensivequantities.hh +++ b/opm/models/flash/flashintensivequantities.hh @@ -107,7 +107,7 @@ public: const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx); const auto& problem = elemCtx.problem(); - Scalar flashTolerance = Parameters::get(); + Scalar flashTolerance = Parameters::Get>(); // extract the total molar densities of the components ComponentVector cTotal; diff --git a/opm/models/flash/flashmodel.hh b/opm/models/flash/flashmodel.hh index 888c439f8..38f4d615a 100644 --- a/opm/models/flash/flashmodel.hh +++ b/opm/models/flash/flashmodel.hh @@ -133,14 +133,6 @@ template struct EnableThermodynamicHints { static constexpr bool value = true; }; -//! Let the flash solver choose its tolerance by default -template -struct FlashTolerance -{ - using type = GetPropType; - static constexpr type value = -1.0; -}; - } // namespace Opm::Parameters namespace Opm { @@ -244,7 +236,7 @@ public: if (enableEnergy) Opm::VtkEnergyModule::registerParameters(); - Parameters::registerParam + Parameters::Register> ("The maximum tolerance for the flash solver to " "consider the solution converged"); } diff --git a/opm/models/flash/flashparameters.hh b/opm/models/flash/flashparameters.hh index b2c124d01..a365f3594 100644 --- a/opm/models/flash/flashparameters.hh +++ b/opm/models/flash/flashparameters.hh @@ -30,13 +30,12 @@ #ifndef EWOMS_FLASH_PARAMETERS_HH #define EWOMS_FLASH_PARAMETERS_HH -#include - namespace Opm::Parameters { //! The maximum accepted error of the flash solver -template -struct FlashTolerance { using type = Properties::UndefinedProperty; }; +//! Let the flash solver choose its tolerance by default +template +struct FlashTolerance { static constexpr Scalar value = -1.0; }; } // namespace Opm::Parameters diff --git a/opm/models/ptflash/flashintensivequantities.hh b/opm/models/ptflash/flashintensivequantities.hh index 29144e81b..304844ca4 100644 --- a/opm/models/ptflash/flashintensivequantities.hh +++ b/opm/models/ptflash/flashintensivequantities.hh @@ -110,7 +110,7 @@ public: const auto& priVars = elemCtx.primaryVars(dofIdx, timeIdx); const auto& problem = elemCtx.problem(); - const Scalar flashTolerance = Parameters::get(); + const Scalar flashTolerance = Parameters::Get>(); const int flashVerbosity = Parameters::get(); const std::string flashTwoPhaseMethod = Parameters::get(); diff --git a/opm/models/ptflash/flashmodel.hh b/opm/models/ptflash/flashmodel.hh index 6fe44e397..cbb9dbc44 100644 --- a/opm/models/ptflash/flashmodel.hh +++ b/opm/models/ptflash/flashmodel.hh @@ -156,14 +156,6 @@ template struct EnableThermodynamicHints { static constexpr bool value = true; }; -//! Let the flash solver choose its tolerance by default -template -struct FlashTolerance -{ - using type = GetPropType; - static constexpr type value = 1.e-12; -}; - // Flash two-phase method template struct FlashTwoPhaseMethod @@ -261,7 +253,7 @@ public: if (enableEnergy) Opm::VtkEnergyModule::registerParameters(); - Parameters::registerParam + Parameters::Register> ("The maximum tolerance for the flash solver to " "consider the solution converged"); Parameters::registerParam @@ -269,6 +261,8 @@ public: Parameters::registerParam ("Method for solving vapor-liquid composition. Available options include: " "ssi, newton, ssi+newton"); + + Parameters::SetDefault>(1e-12); } /*!