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
55f7842f
Commit
55f7842f
authored
12 years ago
by
Elias Pipping
Committed by
Elias Pipping
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
camlCase; move writer to a block; rename variable
parent
f5206652
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
+38
-37
38 additions, 37 deletions
src/one-body-sample.cc
with
38 additions
and
37 deletions
src/one-body-sample.cc
+
38
−
37
View file @
55f7842f
...
@@ -340,30 +340,31 @@ int main(int argc, char *argv[]) {
...
@@ -340,30 +340,31 @@ int main(int argc, char *argv[]) {
// }}}
// }}}
// Set up TNNMG solver
// Set up TNNMG solver
auto
const
solver
_t
olerance
=
parset
.
get
<
double
>
(
"solver.tolerance"
);
auto
const
solver
T
olerance
=
parset
.
get
<
double
>
(
"solver.tolerance"
);
typedef
MyConvexProblem
<
MatrixType
,
VectorType
>
MyConvexProblemType
;
typedef
MyConvexProblem
<
MatrixType
,
VectorType
>
MyConvexProblemType
;
typedef
MyBlockProblem
<
MyConvexProblemType
>
MyBlockProblemType
;
typedef
MyBlockProblem
<
MyConvexProblemType
>
MyBlockProblemType
;
MySolver
<
dims
,
MatrixType
,
VectorType
,
GridType
,
MyBlockProblemType
>
MySolver
<
dims
,
MatrixType
,
VectorType
,
GridType
,
MyBlockProblemType
>
myS
olver
(
parset
.
sub
(
"solver.tnnmg"
),
refinements
,
solver
_t
olerance
,
*
grid
,
s
olver
Host
(
parset
.
sub
(
"solver.tnnmg"
),
refinements
,
solver
T
olerance
,
*
grid
,
ignoreNodes
);
ignoreNodes
);
auto
multigridStep
=
myS
olver
.
getSolver
();
auto
multigridStep
=
s
olver
Host
.
getSolver
();
Solver
::
VerbosityMode
const
verbosity
=
Solver
::
VerbosityMode
const
verbosity
=
parset
.
get
<
bool
>
(
"verbose"
)
?
Solver
::
FULL
:
Solver
::
QUIET
;
parset
.
get
<
bool
>
(
"verbose"
)
?
Solver
::
FULL
:
Solver
::
QUIET
;
std
::
fstream
coordinate_writer
(
"coordinates"
,
std
::
fstream
::
out
);
{
for
(
size_t
i
=
0
;
i
<
frictionalNodes
.
size
();
++
i
)
std
::
fstream
coordinateWriter
(
"coordinates"
,
std
::
fstream
::
out
);
if
(
frictionalNodes
[
i
][
0
])
for
(
size_t
i
=
0
;
i
<
frictionalNodes
.
size
();
++
i
)
coordinate_writer
<<
coordinates
[
i
]
<<
std
::
endl
;
if
(
frictionalNodes
[
i
][
0
])
coordinate_writer
.
close
();
coordinateWriter
<<
coordinates
[
i
]
<<
std
::
endl
;
coordinateWriter
.
close
();
std
::
fstream
state_writer
(
"states"
,
std
::
fstream
::
out
);
}
std
::
fstream
displacement_writer
(
"displacements"
,
std
::
fstream
::
out
);
std
::
fstream
stateWriter
(
"states"
,
std
::
fstream
::
out
);
std
::
fstream
velocity_writer
(
"velocities"
,
std
::
fstream
::
out
);
std
::
fstream
displacementWriter
(
"displacements"
,
std
::
fstream
::
out
);
std
::
fstream
coefficient_writer
(
"coefficients"
,
std
::
fstream
::
out
);
std
::
fstream
velocityWriter
(
"velocities"
,
std
::
fstream
::
out
);
std
::
fstream
coefficientWriter
(
"coefficients"
,
std
::
fstream
::
out
);
;
;
std
::
fstream
iteration
_w
riter
(
"iterations"
,
std
::
fstream
::
out
);
std
::
fstream
iteration
W
riter
(
"iterations"
,
std
::
fstream
::
out
);
;
;
std
::
fstream
damping
_w
riter
(
"damping"
,
std
::
fstream
::
out
);
std
::
fstream
damping
W
riter
(
"damping"
,
std
::
fstream
::
out
);
;
;
auto
timeSteppingScheme
=
auto
timeSteppingScheme
=
...
@@ -408,7 +409,7 @@ int main(int argc, char *argv[]) {
...
@@ -408,7 +409,7 @@ int main(int argc, char *argv[]) {
LoopSolver
<
VectorType
>
velocityProblemSolver
(
LoopSolver
<
VectorType
>
velocityProblemSolver
(
multigridStep
,
parset
.
get
<
size_t
>
(
"solver.tnnmg.maxiterations"
),
multigridStep
,
parset
.
get
<
size_t
>
(
"solver.tnnmg.maxiterations"
),
solver
_t
olerance
,
&
velocityEnergyNorm
,
verbosity
,
solver
T
olerance
,
&
velocityEnergyNorm
,
verbosity
,
false
);
// absolute error
false
);
// absolute error
size_t
iterationCounter
;
size_t
iterationCounter
;
...
@@ -447,11 +448,11 @@ int main(int argc, char *argv[]) {
...
@@ -447,11 +448,11 @@ int main(int argc, char *argv[]) {
if
(
state_fpi
<=
2
// Let the first two steps pass through unchanged
if
(
state_fpi
<=
2
// Let the first two steps pass through unchanged
||
correction
<
minimalCorrectionReduction
*
lastCorrection
)
{
||
correction
<
minimalCorrectionReduction
*
lastCorrection
)
{
alpha
=
computed_state
;
alpha
=
computed_state
;
damping
_w
riter
<<
"N "
;
damping
W
riter
<<
"N "
;
}
else
{
}
else
{
alpha
*=
damping
;
alpha
*=
damping
;
alpha
.
axpy
(
1.0
-
damping
,
computed_state
);
alpha
.
axpy
(
1.0
-
damping
,
computed_state
);
damping
_w
riter
<<
"Y "
;
damping
W
riter
<<
"Y "
;
}
}
lastCorrection
=
correction
;
lastCorrection
=
correction
;
}
}
...
@@ -461,7 +462,7 @@ int main(int argc, char *argv[]) {
...
@@ -461,7 +462,7 @@ int main(int argc, char *argv[]) {
timeSteppingScheme
->
extractDisplacement
(
u
);
timeSteppingScheme
->
extractDisplacement
(
u
);
timeSteppingScheme
->
extractVelocity
(
ud
);
timeSteppingScheme
->
extractVelocity
(
ud
);
iteration
_w
riter
<<
iterationCounter
<<
" "
;
iteration
W
riter
<<
iterationCounter
<<
" "
;
if
(
parset
.
get
<
bool
>
(
"printProgress"
))
{
if
(
parset
.
get
<
bool
>
(
"printProgress"
))
{
std
::
cerr
<<
'.'
;
std
::
cerr
<<
'.'
;
std
::
cerr
.
flush
();
std
::
cerr
.
flush
();
...
@@ -487,19 +488,19 @@ int main(int argc, char *argv[]) {
...
@@ -487,19 +488,19 @@ int main(int argc, char *argv[]) {
for
(
size_t
i
=
0
;
i
<
frictionalNodes
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
frictionalNodes
.
size
();
++
i
)
if
(
frictionalNodes
[
i
][
0
])
{
if
(
frictionalNodes
[
i
][
0
])
{
state
_w
riter
<<
alpha
[
i
][
0
]
<<
" "
;
state
W
riter
<<
alpha
[
i
][
0
]
<<
" "
;
displacement
_w
riter
<<
u
[
i
][
0
]
<<
" "
;
displacement
W
riter
<<
u
[
i
][
0
]
<<
" "
;
velocity
_w
riter
<<
ud
[
i
][
0
]
<<
" "
;
velocity
W
riter
<<
ud
[
i
][
0
]
<<
" "
;
coefficient
_w
riter
<<
computeCOF
(
mu0
,
a
,
b
,
V0
,
L
,
ud
[
i
].
two_norm
(),
coefficient
W
riter
<<
computeCOF
(
mu0
,
a
,
b
,
V0
,
L
,
ud
[
i
].
two_norm
(),
alpha
[
i
])
<<
" "
;
alpha
[
i
])
<<
" "
;
}
}
state
_w
riter
<<
std
::
endl
;
state
W
riter
<<
std
::
endl
;
displacement
_w
riter
<<
std
::
endl
;
displacement
W
riter
<<
std
::
endl
;
velocity
_w
riter
<<
std
::
endl
;
velocity
W
riter
<<
std
::
endl
;
coefficient
_w
riter
<<
std
::
endl
;
coefficient
W
riter
<<
std
::
endl
;
iteration
_w
riter
<<
std
::
endl
;
iteration
W
riter
<<
std
::
endl
;
damping
_w
riter
<<
std
::
endl
;
damping
W
riter
<<
std
::
endl
;
if
(
parset
.
get
<
bool
>
(
"writeVTK"
))
{
if
(
parset
.
get
<
bool
>
(
"writeVTK"
))
{
SingletonVectorType
vonMisesStress
;
SingletonVectorType
vonMisesStress
;
...
@@ -520,12 +521,12 @@ int main(int argc, char *argv[]) {
...
@@ -520,12 +521,12 @@ int main(int argc, char *argv[]) {
<<
timer
.
elapsed
()
<<
"s"
<<
std
::
endl
;
<<
timer
.
elapsed
()
<<
"s"
<<
std
::
endl
;
;
;
state
_w
riter
.
close
();
state
W
riter
.
close
();
displacement
_w
riter
.
close
();
displacement
W
riter
.
close
();
velocity
_w
riter
.
close
();
velocity
W
riter
.
close
();
coefficient
_w
riter
.
close
();
coefficient
W
riter
.
close
();
iteration
_w
riter
.
close
();
iteration
W
riter
.
close
();
damping
_w
riter
.
close
();
damping
W
riter
.
close
();
Python
::
stop
();
Python
::
stop
();
}
}
...
...
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