Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-contact
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
agnumpde
dune-contact
Commits
c23f576f
Commit
c23f576f
authored
6 years ago
by
Jonathan Youett
Browse files
Options
Downloads
Patches
Plain Diff
Improve trust-region conditions a bit including the scaled inf-norm
parent
fa167704
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/contact/solvers/filtermultigridsolver.cc
+25
-9
25 additions, 9 deletions
dune/contact/solvers/filtermultigridsolver.cc
with
25 additions
and
9 deletions
dune/contact/solvers/filtermultigridsolver.cc
+
25
−
9
View file @
c23f576f
...
@@ -212,8 +212,20 @@ void FilterMultigridContactSolver<ProblemType>::solve()
...
@@ -212,8 +212,20 @@ void FilterMultigridContactSolver<ProblemType>::solve()
" and infeasibility "
<<
newInfeasibility
<<
std
::
endl
;
" and infeasibility "
<<
newInfeasibility
<<
std
::
endl
;
field_type
infNorm
=
this
->
correction_
.
infinity_norm
();
field_type
infNorm
=
this
->
correction_
.
infinity_norm
();
// if we want to properly decrease the trust-region according to the inf-norm,
// then we have to take into account the possible scaling
field_type
scaledInfNorm
=
infNorm
;
if
(
trScaling_
)
{
// Changed from not trScaling!
const
auto
&
trScaling
=
problem_
->
contactAssembler
()
->
getColNorms
();
scaledInfNorm
=
0
;
for
(
size_t
j
=
0
;
j
<
this
->
correction_
.
size
();
j
++
)
for
(
int
k
=
0
;
k
<
dim
;
k
++
)
scaledInfNorm
=
std
::
max
(
scaledInfNorm
,
std
::
fabs
(
this
->
correction_
[
j
][
k
]
/
trScaling
[
j
][
k
]));
}
if
(
!
std
::
isfinite
(
newEnergy
))
{
if
(
!
std
::
isfinite
(
newEnergy
))
{
trustRegion
=
0.1
*
std
::
min
(
trustRegion
,
i
nfNorm
);
trustRegion
=
0.1
*
std
::
min
(
trustRegion
,
scaledI
nfNorm
);
correction_
=
dirichletValues_
;
correction_
=
dirichletValues_
;
std
::
cout
<<
"Energy is not finite, reduce trust--region "
<<
trustRegion
<<
std
::
endl
;
std
::
cout
<<
"Energy is not finite, reduce trust--region "
<<
trustRegion
<<
std
::
endl
;
continue
;
continue
;
...
@@ -248,22 +260,26 @@ void FilterMultigridContactSolver<ProblemType>::solve()
...
@@ -248,22 +260,26 @@ void FilterMultigridContactSolver<ProblemType>::solve()
field_type
eps
=
1e-16
;
field_type
eps
=
1e-16
;
if
(
std
::
abs
(
modelDecrease
)
<
eps
or
std
::
abs
(
energy_
-
newEnergy
)
<
eps
or
if
(
std
::
abs
(
modelDecrease
)
<
eps
or
std
::
abs
(
energy_
-
newEnergy
)
<
eps
or
std
::
abs
(
relativeModelDecrease
)
<
eps
or
std
::
abs
(
relativeEnergyDecrease
)
<
eps
std
::
abs
(
relativeModelDecrease
)
<
eps
or
std
::
abs
(
relativeEnergyDecrease
)
<
eps
)
{
or
std
::
abs
(
newInfeasibility
)
<
eps
)
{
//
or std::abs(newInfeasibility) <eps) {
if
(
this
->
verbosity_
==
Solver
::
FULL
)
if
(
this
->
verbosity_
==
Solver
::
FULL
)
std
::
cout
<<
"Computing trust--region ratio might lead to cancellation...exiting."
<<
std
::
endl
;
std
::
cout
<<
"Computing trust--region ratio might lead to cancellation...exiting."
<<
std
::
endl
;
// if the trust-region norm is very small then increase it a bit to allow full steps
// if the trust-region norm is very small then increase it a bit to allow full steps
if
(
std
::
abs
(
i
nfNorm
-
trustRegion
)
<
eps
)
if
(
std
::
abs
(
scaledI
nfNorm
-
trustRegion
)
<
eps
)
trustRegion
=
std
::
min
(
initTR_
,
2
*
i
nfNorm
);
trustRegion
=
std
::
min
(
initTR_
,
2
*
scaledI
nfNorm
);
break
;
break
;
}
}
// if iterate is not acceptable to the filter
// if iterate is not acceptable to the filter
// then reject it and reduce the trust-region
// then reject it and reduce the trust-region
if
(
!
filter_
.
acceptable
(
std
::
make_pair
(
infeasibility_
,
energy_
),
newInfeasibility
,
newEnergy
))
{
bool
acceptable
{
true
};
if
(
it
==
0
)
acceptable
=
(
it
==
0
)
?
filter_
.
acceptable
(
newInfeasibility
,
newEnergy
)
:
filter_
.
acceptable
({
infeasibility_
,
energy_
},
newInfeasibility
,
newEnergy
);
if
(
not
acceptable
)
{
// some heuristic to reduce the trust--region
// some heuristic to reduce the trust--region
trustRegion
=
0.25
*
i
nfNorm
;
trustRegion
=
0.25
*
std
::
min
(
trustRegion
,
scaledI
nfNorm
)
;
correction_
=
dirichletValues_
;
correction_
=
dirichletValues_
;
if
(
this
->
verbosity_
==
Solver
::
FULL
)
if
(
this
->
verbosity_
==
Solver
::
FULL
)
...
@@ -280,7 +296,7 @@ void FilterMultigridContactSolver<ProblemType>::solve()
...
@@ -280,7 +296,7 @@ void FilterMultigridContactSolver<ProblemType>::solve()
if
(
suffDecrease
&&
(
ratio
<
0.1
))
{
if
(
suffDecrease
&&
(
ratio
<
0.1
))
{
// some heuristic to reduce the trust--region
// some heuristic to reduce the trust--region
trustRegion
=
0.25
*
i
nfNorm
;
trustRegion
=
0.25
*
std
::
min
(
trustRegion
,
scaledI
nfNorm
)
;
correction_
=
dirichletValues_
;
correction_
=
dirichletValues_
;
if
(
this
->
verbosity_
==
Solver
::
FULL
)
if
(
this
->
verbosity_
==
Solver
::
FULL
)
...
@@ -305,7 +321,7 @@ void FilterMultigridContactSolver<ProblemType>::solve()
...
@@ -305,7 +321,7 @@ void FilterMultigridContactSolver<ProblemType>::solve()
std
::
cout
<<
"Very successful step!
\n
"
;
std
::
cout
<<
"Very successful step!
\n
"
;
// some heuristic to enlage the trust-region
// some heuristic to enlage the trust-region
trustRegion
=
std
::
min
(
maxTR_
,
std
::
fmax
(
2.5
*
i
nfNorm
,
trustRegion
));
trustRegion
=
std
::
min
(
maxTR_
,
std
::
fmax
(
2.5
*
scaledI
nfNorm
,
trustRegion
));
break
;
break
;
// Approximation is acceptable
// Approximation is acceptable
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment