diff --git a/flowexperimental/FlowExpNewtonMethod.hpp b/flowexperimental/FlowExpNewtonMethod.hpp index 20385d798..ebe91747f 100644 --- a/flowexperimental/FlowExpNewtonMethod.hpp +++ b/flowexperimental/FlowExpNewtonMethod.hpp @@ -156,7 +156,7 @@ public: { const auto& constraintsMap = this->model().linearizer().constraintsMap(); this->lastError_ = this->error_; - Scalar newtonMaxError = Parameters::get(); + Scalar newtonMaxError = Parameters::get(); // calculate the error as the maximum weighted tolerance of // the solution's residual diff --git a/flowexperimental/flowexp.hpp b/flowexperimental/flowexp.hpp index 389756743..c64131238 100644 --- a/flowexperimental/flowexp.hpp +++ b/flowexperimental/flowexp.hpp @@ -28,15 +28,20 @@ #ifndef FLOW_EXP_HPP #define FLOW_EXP_HPP +#include + +#include +#include + +#include + #include #include -#include -#include - -#include #include + #include + #include namespace Opm { @@ -125,13 +130,6 @@ struct LinearSolverBackend { using type = ISTLSolver; }; -// the default for the allowed volumetric error for oil per second -template -struct NewtonTolerance { - using type = GetPropType; - static constexpr type value = 1e-1; -}; - // set fraction of the pore volume where the volumetric residual may be violated during // strict Newton iterations template @@ -140,13 +138,6 @@ struct EclNewtonRelaxedVolumeFraction { static constexpr type value = 0.05; }; -// the maximum volumetric error of a cell in the relaxed region -template -struct EclNewtonRelaxedTolerance { - using type = GetPropType; - static constexpr type value = 1e6*getPropValue(); -}; - // the tolerated amount of "incorrect" amount of oil per time step for the complete // reservoir. this is scaled by the pore volume of the reservoir, i.e., larger reservoirs // will tolerate larger residuals. @@ -169,13 +160,6 @@ struct EclNewtonStrictIterations { static constexpr int value = 100; }; -// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit -// relatively often) -template -struct NewtonMaxIterations { - static constexpr int value = 8; -}; - template struct LinearSolverBackend { using type = ISTLSolver; @@ -199,8 +183,33 @@ template struct ContinueOnConvergenceError { static constexpr bool value = true; }; +// the default for the allowed volumetric error for oil per second +template +struct NewtonTolerance +{ + using type = GetPropType; + static constexpr type value = 1e-1; +}; + +// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit +// relatively often) +template +struct NewtonMaxIterations +{ static constexpr int value = 8; }; + } // namespace Opm::Parameters +namespace Opm::Properties { + +// the maximum volumetric error of a cell in the relaxed region +template +struct EclNewtonRelaxedTolerance { + using type = GetPropType; + static constexpr type value = 1e6*Parameters::NewtonTolerance::value; +}; + +} + namespace Opm { template class FlowExpProblem : public FlowProblem //, public FvBaseProblem diff --git a/flowexperimental/flowexp_blackoil.cpp b/flowexperimental/flowexp_blackoil.cpp index 7c50aaed7..186d49c9f 100644 --- a/flowexperimental/flowexp_blackoil.cpp +++ b/flowexperimental/flowexp_blackoil.cpp @@ -21,6 +21,7 @@ #include "flowexp.hpp" #include +#include #include #include @@ -61,14 +62,6 @@ struct EclNewtonSumTolerance static constexpr type value = 1e-5; }; -// the default for the allowed volumetric error for oil per second -template -struct NewtonTolerance -{ - using type = GetPropType; - static constexpr type value = 1e-2; -}; - // set fraction of the pore volume where the volumetric residual may be violated during // strict Newton iterations template @@ -78,13 +71,6 @@ struct EclNewtonRelaxedVolumeFraction static constexpr type value = 0.0; }; -template -struct EclNewtonRelaxedTolerance -{ - using type = GetPropType; - static constexpr type value = 10*getPropValue(); -}; - template struct EnableDiffusion { @@ -103,7 +89,7 @@ struct Simulator using type = Opm::Simulator; }; -} +} // namespace Opm::Properties namespace Opm::Parameters { @@ -115,8 +101,27 @@ template struct ContinueOnConvergenceError { static constexpr bool value = false; }; +// the default for the allowed volumetric error for oil per second +template +struct NewtonTolerance +{ + using type = GetPropType; + static constexpr type value = 1e-2; +}; + } // namespace Opm::Parameters +namespace Opm::Properties { + +template +struct EclNewtonRelaxedTolerance +{ + using type = GetPropType; + static constexpr type value = 10 * Parameters::NewtonTolerance::value; +}; + +} // namespace Opm::Properties + int main(int argc, char** argv) { using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil; diff --git a/opm/simulators/flow/FlowMain.hpp b/opm/simulators/flow/FlowMain.hpp index 37476d919..3793c7b8e 100644 --- a/opm/simulators/flow/FlowMain.hpp +++ b/opm/simulators/flow/FlowMain.hpp @@ -151,11 +151,11 @@ namespace Opm { Parameters::hideParam(); // flow also does not use the eWoms Newton method - Parameters::hideParam(); - Parameters::hideParam(); - Parameters::hideParam(); - Parameters::hideParam(); - Parameters::hideParam(); + Parameters::hideParam(); + Parameters::hideParam(); + Parameters::hideParam(); + Parameters::hideParam(); + Parameters::hideParam(); // the default eWoms checkpoint/restart mechanism does not work with flow Parameters::hideParam(); diff --git a/opm/simulators/flow/FlowProblemProperties.hpp b/opm/simulators/flow/FlowProblemProperties.hpp index 6d955162b..6587f3e68 100644 --- a/opm/simulators/flow/FlowProblemProperties.hpp +++ b/opm/simulators/flow/FlowProblemProperties.hpp @@ -290,13 +290,6 @@ struct InitialTimeStepSize { static constexpr type value = 3600*24; }; -// the default for the allowed volumetric error for oil per second -template -struct NewtonTolerance { - using type = GetPropType; - static constexpr type value = 1e-2; -}; - // ... but enable the ECL output by default template struct EnableEclOutput { @@ -521,6 +514,14 @@ template struct EnableStorageCache { static constexpr bool value = true; }; +// the default for the allowed volumetric error for oil per second +template +struct NewtonTolerance +{ + using type = GetPropType; + static constexpr type value = 1e-2; +}; + } // namespace Opm::Parameters #endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP diff --git a/opm/simulators/flow/NonlinearSolver.hpp b/opm/simulators/flow/NonlinearSolver.hpp index 2b85becfe..5daf6c656 100644 --- a/opm/simulators/flow/NonlinearSolver.hpp +++ b/opm/simulators/flow/NonlinearSolver.hpp @@ -21,18 +21,22 @@ #ifndef OPM_NON_LINEAR_SOLVER_HPP #define OPM_NON_LINEAR_SOLVER_HPP -#include +#include +#include + #include -#include +#include + +#include +#include #include #include #include -#include -#include -#include -#include +#include +#include + #include namespace Opm::Properties { @@ -64,10 +68,6 @@ struct NewtonMaxRelax { static constexpr type value = 0.5; }; template -struct NewtonMaxIterations { - static constexpr int value = 20; -}; -template struct NewtonMinIterations { static constexpr int value = 2; }; @@ -78,6 +78,14 @@ struct NewtonRelaxationType { } // namespace Opm::Properties +namespace Opm::Parameters { + +template +struct NewtonMaxIterations +{ 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(); - maxIter_ = Parameters::get(); + maxIter_ = Parameters::get(); minIter_ = Parameters::get(); const auto& relaxationTypeString = Parameters::get(); @@ -146,7 +154,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld, { Parameters::registerParam ("The maximum relaxation factor of a Newton iteration"); - Parameters::registerParam + Parameters::registerParam ("The maximum number of Newton iterations per time step"); Parameters::registerParam ("The minimum number of Newton iterations per time step"); diff --git a/tests/TestTypeTag.hpp b/tests/TestTypeTag.hpp index 929764def..1499979ea 100644 --- a/tests/TestTypeTag.hpp +++ b/tests/TestTypeTag.hpp @@ -112,20 +112,6 @@ struct LinearSolverBackend { using type = ISTLSolver; }; -// the default for the allowed volumetric error for oil per second -template -struct NewtonTolerance { - using type = GetPropType; - static constexpr type value = 1e-1; -}; - -// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit -// relatively often) -template -struct NewtonMaxIterations { - static constexpr int value = 8; -}; - } // namespace Opm::Properties namespace Opm::Parameters { @@ -144,6 +130,20 @@ template struct ContinueOnConvergenceError { static constexpr bool value = true; }; +// the default for the allowed volumetric error for oil per second +template +struct NewtonTolerance +{ + using type = GetPropType; + static constexpr type value = 1e-1; +}; + +// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit +// relatively often) +template +struct NewtonMaxIterations +{ static constexpr int value = 8; }; + } // namespace Opm::Parameters #endif // OPM_TEST_TYPETAG_HPP