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
a3d2b71b
Commit
a3d2b71b
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make multiple runs
parent
170ac694
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
+55
-49
55 additions, 49 deletions
src/one-body-sample.cc
with
55 additions
and
49 deletions
src/one-body-sample.cc
+
55
−
49
View file @
a3d2b71b
...
@@ -128,6 +128,7 @@ int main() {
...
@@ -128,6 +128,7 @@ int main() {
typedef
Dune
::
BlockVector
<
SmallVector
>
VectorType
;
typedef
Dune
::
BlockVector
<
SmallVector
>
VectorType
;
// FIXME: Random values
// FIXME: Random values
size_t
const
runs
=
3
;
double
const
E
=
1
;
double
const
E
=
1
;
double
const
nu
=
0.3
;
double
const
nu
=
0.3
;
int
const
refinements
=
5
;
int
const
refinements
=
5
;
...
@@ -179,55 +180,60 @@ int main() {
...
@@ -179,55 +180,60 @@ int main() {
u1
=
0
;
u1
=
0
;
VectorType
u2
=
u1
;
VectorType
u2
=
u1
;
VectorType
f
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
for
(
size_t
run
=
1
;
run
<=
runs
;
++
run
)
{
f
=
0
;
VectorType
f
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
VectorType
neumannTerm
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
f
=
0
;
assemble_neumann
<
GridType
,
GridType
::
LeafGridView
,
SmallVector
,
P1Basis
>
(
VectorType
neumannTerm
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
leafView
,
p1Basis
,
neumannNodes
,
neumannTerm
);
assemble_neumann
<
GridType
,
GridType
::
LeafGridView
,
SmallVector
,
P1Basis
>
(
f
+=
neumannTerm
;
leafView
,
p1Basis
,
neumannNodes
,
neumannTerm
);
f
+=
neumannTerm
;
// {{{ Assemble terms for the nonlinearity
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>
nodalIntegrals
;
// {{{ Assemble terms for the nonlinearity
assemble_frictional
<
GridType
,
GridType
::
LeafGridView
,
SmallVector
,
P1Basis
>
(
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>
nodalIntegrals
;
leafView
,
p1Basis
,
frictionalNodes
,
nodalIntegrals
);
assemble_frictional
<
GridType
,
GridType
::
LeafGridView
,
SmallVector
,
P1Basis
>
(
leafView
,
p1Basis
,
frictionalNodes
,
// TODO: populate on S_F
nodalIntegrals
);
std
::
vector
<
double
>
normalStress
;
normalStress
.
resize
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
// TODO: populate on S_F
std
::
fill
(
normalStress
.
begin
(),
normalStress
.
end
(),
0.0
);
std
::
vector
<
double
>
normalStress
;
normalStress
.
resize
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
// TODO: populate on S_F
std
::
fill
(
normalStress
.
begin
(),
normalStress
.
end
(),
0.0
);
std
::
vector
<
double
>
coefficientOfFriction
;
coefficientOfFriction
.
resize
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
// TODO: populate on S_F
std
::
fill
(
coefficientOfFriction
.
begin
(),
coefficientOfFriction
.
end
(),
0.0
);
std
::
vector
<
double
>
coefficientOfFriction
;
coefficientOfFriction
.
resize
(
grid
.
size
(
grid
.
maxLevel
(),
dim
));
Dune
::
GlobalNonlinearity
<
dim
,
Dune
::
LinearFunction
>
myGlobalNonlinearity
(
std
::
fill
(
coefficientOfFriction
.
begin
(),
coefficientOfFriction
.
end
(),
coefficientOfFriction
,
normalStress
,
nodalIntegrals
);
0.0
);
// }}}
Dune
::
GlobalNonlinearity
<
dim
,
Dune
::
LinearFunction
>
myGlobalNonlinearity
(
{
coefficientOfFriction
,
normalStress
,
nodalIntegrals
);
MyConvexProblemType
myConvexProblem
(
stiffnessMatrix
,
myGlobalNonlinearity
,
// }}}
f
,
u1
);
MyBlockProblemType
myBlockProblem
(
myConvexProblem
);
{
nonlinearGSStep
.
setProblem
(
u1
,
myBlockProblem
);
MyConvexProblemType
myConvexProblem
(
stiffnessMatrix
,
myGlobalNonlinearity
,
f
,
u1
);
LoopSolver
<
VectorType
>
solver
(
&
nonlinearGSStep
,
solver_maxIterations
,
MyBlockProblemType
myBlockProblem
(
myConvexProblem
);
solver_tolerance
,
&
energyNorm
,
nonlinearGSStep
.
setProblem
(
u1
,
myBlockProblem
);
Solver
::
FULL
);
// Solver::QUIET);
solver
.
solve
();
LoopSolver
<
VectorType
>
solver
(
&
nonlinearGSStep
,
solver_maxIterations
,
}
solver_tolerance
,
&
energyNorm
,
Solver
::
FULL
);
// Solver::QUIET);
// Use a linear solver for comparison; should return roughly the
solver
.
solve
();
// same results if phi vanishes (e.g. because the normalstress is zero)
}
{
// TODO: Why does blockGSStep even provide a default constructor?
// Use a linear solver for comparison; should return roughly the
BlockGSStep
<
OperatorType
,
VectorType
>
blockGSStep
(
stiffnessMatrix
,
u2
,
f
);
// same results if phi vanishes (e.g. because the normalstress is zero)
blockGSStep
.
ignoreNodes_
=
&
ignoreNodes
;
{
// TODO: Why does blockGSStep even provide a default constructor?
LoopSolver
<
VectorType
>
solver
(
&
blockGSStep
,
solver_maxIterations
,
BlockGSStep
<
OperatorType
,
VectorType
>
blockGSStep
(
stiffnessMatrix
,
u2
,
solver_tolerance
,
&
energyNorm
,
f
);
Solver
::
FULL
);
// Solver::QUIET);
blockGSStep
.
ignoreNodes_
=
&
ignoreNodes
;
solver
.
solve
();
LoopSolver
<
VectorType
>
solver
(
&
blockGSStep
,
solver_maxIterations
,
solver_tolerance
,
&
energyNorm
,
Solver
::
FULL
);
// Solver::QUIET);
solver
.
solve
();
}
}
}
VectorType
diff
=
u2
;
VectorType
diff
=
u2
;
...
...
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