Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Sander, Oliver
dune-gfe
Commits
735cc0a5
Commit
735cc0a5
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implement a homotopy method for the Dirichlet boundary conditions
[[Imported from SVN: r7546]]
parent
2f61206c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cosserat-continuum.cc
+43
-21
43 additions, 21 deletions
cosserat-continuum.cc
cosserat-continuum.parset
+6
-0
6 additions, 0 deletions
cosserat-continuum.parset
with
49 additions
and
21 deletions
cosserat-continuum.cc
+
43
−
21
View file @
735cc0a5
...
...
@@ -49,9 +49,14 @@ void dirichletValues(const FieldVector<double,dim>& in, FieldVector<double,3>& o
out[0] = 2.2;
}
#endif
void
dirichletValues
(
const
FieldVector
<
double
,
dim
>&
in
,
FieldVector
<
double
,
3
>&
out
)
void
dirichletValues
(
const
FieldVector
<
double
,
dim
>&
in
,
FieldVector
<
double
,
3
>&
out
,
double
homotopy
)
{
double
angle
=
M_PI
/
4
;
angle
*=
homotopy
;
// center of rotation
FieldVector
<
double
,
3
>
center
(
0
);
center
[
1
]
=
0.5
;
...
...
@@ -132,6 +137,7 @@ int main (int argc, char *argv[]) try
// read solver settings
const
int
numLevels
=
parameterSet
.
get
<
int
>
(
"numLevels"
);
int
numHomotopySteps
=
parameterSet
.
get
<
int
>
(
"numHomotopySteps"
);
const
double
tolerance
=
parameterSet
.
get
<
double
>
(
"tolerance"
);
const
int
maxTrustRegionSteps
=
parameterSet
.
get
<
int
>
(
"maxTrustRegionSteps"
);
const
double
initialTrustRegionRadius
=
parameterSet
.
get
<
double
>
(
"initialTrustRegionRadius"
);
...
...
@@ -205,8 +211,6 @@ int main (int argc, char *argv[]) try
FieldVector
<
double
,
3
>
yAxis
(
0
);
yAxis
[
1
]
=
1
;
/* GridType::LeafGridView::Codim<dim>::Iterator vIt = grid.leafbegin<dim>();
GridType::LeafGridView::Codim<dim>::Iterator vEndIt = grid.leafend<dim>();*/
vIt
=
grid
.
leafbegin
<
dim
>
();
for
(;
vIt
!=
vEndIt
;
++
vIt
)
{
...
...
@@ -218,18 +222,8 @@ int main (int argc, char *argv[]) try
// x[idx].q is the identity, set by the default constructor
if
(
dirichletNodes
[
idx
][
0
]
and
vIt
->
geometry
().
corner
(
0
)[
0
]
>
upper
[
0
]
-
1e-3
)
{
// Only the positions have Dirichlet values
dirichletValues
(
vIt
->
geometry
().
corner
(
0
),
x
[
idx
].
r
);
}
}
// backup for error measurement later
SolutionType
initialIterate
=
x
;
// ////////////////////////////////////////////////////////////
// Create an assembler for the energy functional
// ////////////////////////////////////////////////////////////
...
...
@@ -259,18 +253,46 @@ int main (int argc, char *argv[]) try
baseTolerance
,
instrumented
);
// /////////////////////////////////////////////////////
// Solve!
// /////////////////////////////////////////////////////
////////////////////////////////////////////////////////
// Main homotopy loop
////////////////////////////////////////////////////////
for
(
int
i
=
0
;
i
<
numHomotopySteps
;
i
++
)
{
double
homotopyParameter
=
(
i
+
1
)
*
(
1.0
/
numHomotopySteps
);
std
::
cout
<<
"Homotopy step: "
<<
i
<<
", parameter: "
<<
homotopyParameter
<<
std
::
endl
;
////////////////////////////////////////////////////////
// Set Dirichlet values
////////////////////////////////////////////////////////
for
(
vIt
=
grid
.
leafbegin
<
dim
>
();
vIt
!=
vEndIt
;
++
vIt
)
{
int
idx
=
grid
.
leafIndexSet
().
index
(
*
vIt
);
if
(
dirichletNodes
[
idx
][
0
]
and
vIt
->
geometry
().
corner
(
0
)[
0
]
>
upper
[
0
]
-
1e-3
)
{
// Only the positions have Dirichlet values
dirichletValues
(
vIt
->
geometry
().
corner
(
0
),
x
[
idx
].
r
,
homotopyParameter
);
}
}
// /////////////////////////////////////////////////////
// Solve!
// /////////////////////////////////////////////////////
std
::
cout
<<
"Energy: "
<<
assembler
.
computeEnergy
(
x
)
<<
std
::
endl
;
//exit(0);
std
::
cout
<<
"Energy: "
<<
assembler
.
computeEnergy
(
x
)
<<
std
::
endl
;
//exit(0);
solver
.
setInitialSolution
(
x
);
solver
.
solve
();
solver
.
setInitialSolution
(
x
);
solver
.
solve
();
x
=
solver
.
getSol
();
x
=
solver
.
getSol
();
}
// //////////////////////////////
// Output result
// //////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
cosserat-continuum.parset
+
6
−
0
View file @
735cc0a5
# Number of grid levels
numLevels = 1
# Number of homotopy steps for the Dirichlet boundary conditions
numHomotopySteps = 2
# Tolerance of the trust region solver
tolerance = 1e-12
...
...
@@ -44,6 +47,9 @@ instrumented = 0
thickness = 0.05
# Lame parameters
# corresponds to E = 1e6, nu=0.3
#mu = 3.8462e+05
#lambda = 2.7149e+05
mu = 1
lambda = 1
...
...
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