NewtonMaxIterations moved to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-06 10:22:47 +02:00
parent 643efb7108
commit 64557a136d
3 changed files with 5 additions and 22 deletions

View File

@ -126,12 +126,6 @@ template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowExpTypeTag> struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit
// relatively often)
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr int value = 8; };
// the maximum volumetric error of a cell in the relaxed region // the maximum volumetric error of a cell in the relaxed region
template<class TypeTag> template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag> struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag>
@ -220,6 +214,7 @@ public:
// smallest time step size is reached. // smallest time step size is reached.
Parameters::SetDefault<Parameters::ContinueOnConvergenceError>(true); Parameters::SetDefault<Parameters::ContinueOnConvergenceError>(true);
Parameters::SetDefault<Parameters::NewtonMaxIterations>(8);
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-2); Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-2);
} }

View File

@ -76,14 +76,6 @@ struct NewtonRelaxationType<TypeTag, Properties::TTag::FlowNonLinearSolver>
} // namespace Opm::Parameters } // namespace Opm::Parameters
namespace Opm::Parameters {
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::FlowNonLinearSolver>
{ static constexpr int value = 20; };
} // namespace Opm::Parameters
namespace Opm { namespace Opm {
// Available relaxation scheme types. // Available relaxation scheme types.
@ -134,7 +126,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
// overload with given parameters // overload with given parameters
relaxMax_ = Parameters::get<TypeTag, Parameters::NewtonMaxRelax>(); relaxMax_ = Parameters::get<TypeTag, Parameters::NewtonMaxRelax>();
maxIter_ = Parameters::get<TypeTag, Parameters::NewtonMaxIterations>(); maxIter_ = Parameters::Get<Parameters::NewtonMaxIterations>();
minIter_ = Parameters::get<TypeTag, Parameters::NewtonMinIterations>(); minIter_ = Parameters::get<TypeTag, Parameters::NewtonMinIterations>();
const auto& relaxationTypeString = Parameters::get<TypeTag, Parameters::NewtonRelaxationType>(); const auto& relaxationTypeString = Parameters::get<TypeTag, Parameters::NewtonRelaxationType>();
@ -152,12 +144,14 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
{ {
Parameters::registerParam<TypeTag, Parameters::NewtonMaxRelax> Parameters::registerParam<TypeTag, Parameters::NewtonMaxRelax>
("The maximum relaxation factor of a Newton iteration"); ("The maximum relaxation factor of a Newton iteration");
Parameters::registerParam<TypeTag, Parameters::NewtonMaxIterations> Parameters::Register<Parameters::NewtonMaxIterations>
("The maximum number of Newton iterations per time step"); ("The maximum number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Parameters::NewtonMinIterations> Parameters::registerParam<TypeTag, Parameters::NewtonMinIterations>
("The minimum number of Newton iterations per time step"); ("The minimum number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Parameters::NewtonRelaxationType> Parameters::registerParam<TypeTag, Parameters::NewtonRelaxationType>
("The type of relaxation used by Newton method"); ("The type of relaxation used by Newton method");
Parameters::SetDefault<Parameters::NewtonMaxIterations>(20);
} }
void reset() void reset()

View File

@ -106,12 +106,6 @@ template<class TypeTag>
struct MatrixAddWellContributions<TypeTag, Properties::TTag::TestTypeTag> struct MatrixAddWellContributions<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit
// relatively often)
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr int value = 8; };
// currently, ebos uses the non-multisegment well model by default to avoid // currently, ebos uses the non-multisegment well model by default to avoid
// regressions. the --use-multisegment-well=true|false command line parameter is still // regressions. the --use-multisegment-well=true|false command line parameter is still
// available in ebos, but hidden from view. // available in ebos, but hidden from view.