changed: NewtonMaxIterations parameter moved to Opm::Parameters namespace

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:17:13 +02:00
parent 8def6b722b
commit 82cd3a2e01
3 changed files with 32 additions and 26 deletions

View File

@ -160,13 +160,6 @@ struct EclNewtonStrictIterations<TypeTag, TTag::FlowExpTypeTag> {
static constexpr int value = 100;
};
// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit
// relatively often)
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::FlowExpTypeTag> {
static constexpr int value = 8;
};
template<class TypeTag>
struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
using type = ISTLSolver<TypeTag>;
@ -198,6 +191,12 @@ struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpTypeTag>
static constexpr type value = 1e-1;
};
// 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; };
} // namespace Opm::Parameters
namespace Opm::Properties {

View File

@ -21,18 +21,22 @@
#ifndef OPM_NON_LINEAR_SOLVER_HPP
#define OPM_NON_LINEAR_SOLVER_HPP
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <opm/common/ErrorMacros.hpp>
#include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/models/nonlinear/newtonmethodparameters.hh>
#include <opm/models/nonlinear/newtonmethodproperties.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/basicproperties.hh>
#include <opm/models/nonlinear/newtonmethodproperties.hh>
#include <opm/common/Exceptions.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
#include <memory>
namespace Opm::Properties {
@ -64,10 +68,6 @@ struct NewtonMaxRelax<TypeTag, TTag::FlowNonLinearSolver> {
static constexpr type value = 0.5;
};
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::FlowNonLinearSolver> {
static constexpr int value = 20;
};
template<class TypeTag>
struct NewtonMinIterations<TypeTag, TTag::FlowNonLinearSolver> {
static constexpr int value = 2;
};
@ -78,6 +78,14 @@ struct NewtonRelaxationType<TypeTag, TTag::FlowNonLinearSolver> {
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, Properties::TTag::FlowNonLinearSolver>
{ static constexpr int value = 20; };
} // namespace Opm::Parameters
namespace Opm {
// Available relaxation scheme types.
@ -128,7 +136,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
// overload with given parameters
relaxMax_ = Parameters::get<TypeTag, Properties::NewtonMaxRelax>();
maxIter_ = Parameters::get<TypeTag, Properties::NewtonMaxIterations>();
maxIter_ = Parameters::get<TypeTag, Parameters::NewtonMaxIterations>();
minIter_ = Parameters::get<TypeTag, Properties::NewtonMinIterations>();
const auto& relaxationTypeString = Parameters::get<TypeTag, Properties::NewtonRelaxationType>();
@ -146,7 +154,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
{
Parameters::registerParam<TypeTag, Properties::NewtonMaxRelax>
("The maximum relaxation factor of a Newton iteration");
Parameters::registerParam<TypeTag, Properties::NewtonMaxIterations>
Parameters::registerParam<TypeTag, Parameters::NewtonMaxIterations>
("The maximum number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Properties::NewtonMinIterations>
("The minimum number of Newton iterations per time step");

View File

@ -112,13 +112,6 @@ struct LinearSolverBackend<TTag::TestTypeTag, TTag::FlowIstlSolverParams> {
using type = ISTLSolver<TTag::TestTypeTag>;
};
// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit
// relatively often)
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::TestTypeTag> {
static constexpr int value = 8;
};
} // namespace Opm::Properties
namespace Opm::Parameters {
@ -145,6 +138,12 @@ struct NewtonTolerance<TypeTag, Properties::TTag::TestTypeTag>
static constexpr type value = 1e-1;
};
// 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; };
} // namespace Opm::Parameters
#endif // OPM_TEST_TYPETAG_HPP