Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
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-solvers
Commits
743a15fc
Commit
743a15fc
authored
3 years ago
by
Patrick Jaap
Browse files
Options
Downloads
Patches
Plain Diff
LoopSolver: Add getter for the current convergence rate
parent
85705ebb
No related branches found
No related tags found
1 merge request
!56
LoopSolver: Add getter for the current convergence rate
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/solvers/solvers/loopsolver.cc
+5
-5
5 additions, 5 deletions
dune/solvers/solvers/loopsolver.cc
dune/solvers/solvers/loopsolver.hh
+12
-0
12 additions, 0 deletions
dune/solvers/solvers/loopsolver.hh
with
17 additions
and
5 deletions
dune/solvers/solvers/loopsolver.cc
+
5
−
5
View file @
743a15fc
...
@@ -98,7 +98,7 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
...
@@ -98,7 +98,7 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
// Please don't replace this call to 'diff' by computing the norm of the difference.
// Please don't replace this call to 'diff' by computing the norm of the difference.
// In some nonlinear DD applications the 'diff' method may be nonlinear.
// In some nonlinear DD applications the 'diff' method may be nonlinear.
real_type
normOfCorrection
=
this
->
errorNorm_
->
diff
(
oldSolution
,
this
->
iterationStep_
->
getSol
());
real_type
normOfCorrection
=
this
->
errorNorm_
->
diff
(
oldSolution
,
this
->
iterationStep_
->
getSol
());
real_type
convRate
=
(
normOfOldCorrection
>
0
)
convRate
_
=
(
normOfOldCorrection
>
0
)
?
normOfCorrection
/
normOfOldCorrection
:
0.0
;
?
normOfCorrection
/
normOfOldCorrection
:
0.0
;
error
=
normOfCorrection
;
error
=
normOfCorrection
;
normOfOldCorrection
=
normOfCorrection
;
normOfOldCorrection
=
normOfCorrection
;
...
@@ -107,7 +107,7 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
...
@@ -107,7 +107,7 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
if
(
referenceSolution_
)
if
(
referenceSolution_
)
{
{
normOfError
=
this
->
errorNorm_
->
diff
(
this
->
iterationStep_
->
getSol
(),
*
referenceSolution_
);
normOfError
=
this
->
errorNorm_
->
diff
(
this
->
iterationStep_
->
getSol
(),
*
referenceSolution_
);
convRate
=
(
normOfOldError
>
0
)
?
normOfError
/
normOfOldError
:
0.0
;
convRate
_
=
(
normOfOldError
>
0
)
?
normOfError
/
normOfOldError
:
0.0
;
error
=
normOfError
;
error
=
normOfError
;
normOfOldError
=
normOfError
;
normOfOldError
=
normOfError
;
}
}
...
@@ -117,9 +117,9 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
...
@@ -117,9 +117,9 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
error
=
(
oldNorm
==
0
)
?
std
::
numeric_limits
<
real_type
>::
max
()
error
=
(
oldNorm
==
0
)
?
std
::
numeric_limits
<
real_type
>::
max
()
:
error
/
oldNorm
;
:
error
/
oldNorm
;
if
(
!
std
::
isinf
(
convRate
)
&&
!
std
::
isnan
(
convRate
)
&&
i
>
0
)
if
(
!
std
::
isinf
(
convRate
_
)
&&
!
std
::
isnan
(
convRate
_
)
&&
i
>
0
)
{
{
totalConvRate
*=
convRate
;
totalConvRate
*=
convRate
_
;
this
->
maxTotalConvRate_
=
std
::
max
(
this
->
maxTotalConvRate_
,
std
::
pow
(
totalConvRate
,
1
/
((
real_type
)
convRateCounter
+
1
)));
this
->
maxTotalConvRate_
=
std
::
max
(
this
->
maxTotalConvRate_
,
std
::
pow
(
totalConvRate
,
1
/
((
real_type
)
convRateCounter
+
1
)));
convRateCounter
++
;
convRateCounter
++
;
}
}
...
@@ -151,7 +151,7 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
...
@@ -151,7 +151,7 @@ void Dune::Solvers::LoopSolver<VectorType, BitVectorType>::solve()
std
::
cout
<<
" "
;
std
::
cout
<<
" "
;
else
else
std
::
cout
<<
std
::
fixed
std
::
cout
<<
std
::
fixed
<<
std
::
setw
(
9
)
<<
std
::
setprecision
(
5
)
<<
convRate
;
<<
std
::
setw
(
9
)
<<
std
::
setprecision
(
5
)
<<
convRate
_
;
std
::
cout
<<
std
::
setprecision
(
oldPrecision
);
std
::
cout
<<
std
::
setprecision
(
oldPrecision
);
std
::
cout
.
flags
(
oldFormatFlags
);
std
::
cout
.
flags
(
oldFormatFlags
);
...
...
This diff is collapsed.
Click to expand it.
dune/solvers/solvers/loopsolver.hh
+
12
−
0
View file @
743a15fc
...
@@ -107,6 +107,16 @@ public:
...
@@ -107,6 +107,16 @@ public:
return
iter_
;
return
iter_
;
}
}
/**
* \brief Get current convergence rate
*/
auto
convergenceRate
()
const
{
return
convRate_
;
}
virtual
void
preprocess
();
virtual
void
preprocess
();
/** \brief Loop, call the iteration procedure
/** \brief Loop, call the iteration procedure
...
@@ -119,6 +129,8 @@ protected:
...
@@ -119,6 +129,8 @@ protected:
std
::
vector
<
Dune
::
Solvers
::
Criterion
>
criteria_
;
std
::
vector
<
Dune
::
Solvers
::
Criterion
>
criteria_
;
int
iter_
;
int
iter_
;
real_type
convRate_
;
};
};
}
// namespace Solvers
}
// namespace Solvers
...
...
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