Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
podlesny
dune-tectonic
Commits
d8df82d3
Commit
d8df82d3
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a second solution: A nonlinear Gauss-Seidel
With a zero nonlinearity
parent
88deafe7
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
src/one-body-sample.cc
+46
-3
46 additions, 3 deletions
src/one-body-sample.cc
with
46 additions
and
3 deletions
src/one-body-sample.cc
+
46
−
3
View file @
d8df82d3
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include
<dune/fufem/assemblers/operatorassembler.hh>
#include
<dune/fufem/assemblers/operatorassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/stvenantkirchhoffassembler.hh>
#include
<dune/fufem/assemblers/localassemblers/stvenantkirchhoffassembler.hh>
//
#include <dune/tnnmg/iterationsteps/genericnonlineargs.hh>
#include
<dune/tnnmg/iterationsteps/genericnonlineargs.hh>
#include
<dune/solvers/iterationsteps/blockgsstep.hh>
#include
<dune/solvers/iterationsteps/blockgsstep.hh>
#include
<dune/solvers/solvers/loopsolver.hh>
#include
<dune/solvers/solvers/loopsolver.hh>
...
@@ -28,9 +28,15 @@
...
@@ -28,9 +28,15 @@
#include
<dune/grid/common/mcmgmapper.hh>
#include
<dune/grid/common/mcmgmapper.hh>
#include
<dune/tnnmg/problem-classes/convexproblem.hh>
#include
<dune/tnnmg/problem-classes/nonlinearity.hh>
#include
<dune/tnnmg/nonlinearities/zerononlinearity.hh>
#include
<exception>
#include
<exception>
#include
<iostream>
#include
<iostream>
#include
"myblockproblem.hh"
int
const
dim
=
2
;
int
const
dim
=
2
;
int
main
()
{
int
main
()
{
...
@@ -131,6 +137,36 @@ int main() {
...
@@ -131,6 +137,36 @@ int main() {
std
::
cout
<<
"Number of bounding nodes: "
<<
bounding_nodes
<<
std
::
endl
;
std
::
cout
<<
"Number of bounding nodes: "
<<
bounding_nodes
<<
std
::
endl
;
std
::
cout
<<
"Number of extremal nodes: "
<<
extremal_nodes
<<
std
::
endl
;
std
::
cout
<<
"Number of extremal nodes: "
<<
extremal_nodes
<<
std
::
endl
;
}
}
VectorType
copy_of_u
=
u
;
{
// experiment with convex problems and the like
typedef
ZeroNonlinearity
<
SmallVector
,
SmallMatrix
>
NonlinearityType
;
NonlinearityType
phi
;
typedef
ConvexProblem
<
NonlinearityType
,
OperatorType
>
ConvexProblemType
;
VectorType
unused_vector
(
grid
.
size
(
grid
.
maxLevel
(),
dim
),
0
);
ConvexProblemType
myConvexProblem
(
1
,
stiffnessMatrix
,
0
,
unused_vector
,
phi
,
f
,
copy_of_u
);
typedef
MyBlockProblem
<
ConvexProblemType
>
MyBlockProblemType
;
MyBlockProblemType
myBlockProblem
(
myConvexProblem
);
GenericNonlinearGS
<
MyBlockProblemType
>
nonlinearGSStep
;
nonlinearGSStep
.
ignoreNodes_
=
&
ignoreNodes
;
nonlinearGSStep
.
setProblem
(
copy_of_u
,
myBlockProblem
);
// FIXME: Does this make any sense?
EnergyNorm
<
OperatorType
,
VectorType
>
energyNorm
(
stiffnessMatrix
);
LoopSolver
<
VectorType
>
solver
(
&
nonlinearGSStep
,
solver_maxIterations
,
solver_tolerance
,
&
energyNorm
,
// Solver::QUIET);
Solver
::
FULL
);
solver
.
solve
();
}
// TODO: Why does blockGSStep even provide a default constructor?
// TODO: Why does blockGSStep even provide a default constructor?
BlockGSStep
<
OperatorType
,
VectorType
>
blockGSStep
(
stiffnessMatrix
,
u
,
f
);
BlockGSStep
<
OperatorType
,
VectorType
>
blockGSStep
(
stiffnessMatrix
,
u
,
f
);
blockGSStep
.
ignoreNodes_
=
&
ignoreNodes
;
blockGSStep
.
ignoreNodes_
=
&
ignoreNodes
;
...
@@ -138,10 +174,17 @@ int main() {
...
@@ -138,10 +174,17 @@ int main() {
// FIXME: Does this make any sense?
// FIXME: Does this make any sense?
EnergyNorm
<
OperatorType
,
VectorType
>
energyNorm
(
stiffnessMatrix
);
EnergyNorm
<
OperatorType
,
VectorType
>
energyNorm
(
stiffnessMatrix
);
LoopSolver
<
VectorType
>
solver
(
&
blockGSStep
,
solver_maxIterations
,
LoopSolver
<
VectorType
>
solver
(
&
blockGSStep
,
solver_maxIterations
,
solver_tolerance
,
&
energyNorm
,
Solver
::
FULL
);
solver_tolerance
,
&
energyNorm
,
// Solver::QUIET);
Solver
::
FULL
);
solver
.
solve
();
solver
.
solve
();
return
0
;
VectorType
diff
=
u
;
diff
-=
copy_of_u
;
std
::
cout
<<
diff
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
diff
.
infinity_norm
()
<<
std
::
endl
;
}
}
catch
(
Dune
::
Exception
&
e
)
{
catch
(
Dune
::
Exception
&
e
)
{
Dune
::
derr
<<
"Dune reported error: "
<<
e
<<
std
::
endl
;
Dune
::
derr
<<
"Dune reported error: "
<<
e
<<
std
::
endl
;
...
...
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