Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
c6cf7485
Commit
c6cf7485
authored
May 06, 2019
by
Beatrix Becker
Browse files
[newtonsolver] add runtime MinSteps with default 0 and two iterations at beginning of
simulation always
parent
7ceed081
Changes
2
Hide whitespace changes
Inline
Side-by-side
dumux/common/parameters.hh
View file @
c6cf7485
...
...
@@ -305,6 +305,7 @@ private:
params
[
"Problem.EnableInertiaTerms"
]
=
"true"
;
// parameters in the Newton group
params
[
"Newton.MinSteps"
]
=
"0"
;
params
[
"Newton.MaxSteps"
]
=
"18"
;
params
[
"Newton.TargetSteps"
]
=
"10"
;
params
[
"Newton.UseLineSearch"
]
=
"false"
;
...
...
dumux/nonlinear/newtonsolver.hh
View file @
c6cf7485
...
...
@@ -183,6 +183,15 @@ public:
void
setTargetSteps
(
int
targetSteps
)
{
targetSteps_
=
targetSteps
;
}
/*!
* \brief Set the number of minimum iterations for the Newton
* method.
*
* \param minSteps Minimum number of iterations
*/
void
setMinSteps
(
int
minSteps
)
{
minSteps_
=
minSteps
;
}
/*!
* \brief Set the number of iterations after which the Newton
* method gives up.
...
...
@@ -291,7 +300,16 @@ public:
*/
virtual
bool
newtonProceed
(
const
SolutionVector
&
uCurrentIter
,
bool
converged
)
{
if
(
converged
)
{
if
(
isInitial_
)
{
// we always do two iterations when the current solution was the initial solution,
// because here the convergence criterion may not be defined well.
if
(
numSteps_
>=
1
)
isInitial_
=
false
;
return
true
;
}
else
if
(
numSteps_
<
minSteps_
)
return
true
;
else
if
(
converged
)
{
return
false
;
// we are below the desired tolerance
}
else
if
(
numSteps_
>=
maxSteps_
)
{
...
...
@@ -734,6 +752,8 @@ protected:
//! optimal number of iterations we want to achieve
int
targetSteps_
;
//! minimum number of iterations we do
int
minSteps_
;
//! maximum number of iterations we do before giving up
int
maxSteps_
;
//! actual number of steps done so far
...
...
@@ -1160,6 +1180,7 @@ private:
setMaxAbsoluteResidual
(
getParamFromGroup
<
Scalar
>
(
group
,
"Newton.MaxAbsoluteResidual"
));
setResidualReduction
(
getParamFromGroup
<
Scalar
>
(
group
,
"Newton.ResidualReduction"
));
setTargetSteps
(
getParamFromGroup
<
int
>
(
group
,
"Newton.TargetSteps"
));
setMinSteps
(
getParamFromGroup
<
int
>
(
group
,
"Newton.MinSteps"
));
setMaxSteps
(
getParamFromGroup
<
int
>
(
group
,
"Newton.MaxSteps"
));
enablePartialReassembly_
=
getParamFromGroup
<
bool
>
(
group
,
"Newton.EnablePartialReassembly"
);
...
...
@@ -1280,6 +1301,9 @@ private:
//! convergence writer
std
::
shared_ptr
<
ConvergenceWriter
>
convergenceWriter_
=
nullptr
;
//! if we are in the very first Newton iterations (current solution was initial solution)
bool
isInitial_
=
true
;
};
}
// end namespace Dumux
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment