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
8d26153e
Commit
8d26153e
authored
17 years ago
by
Oliver Sander
Committed by
sander@PCPOOL.MI.FU-BERLIN.DE
17 years ago
Browse files
Options
Downloads
Patches
Plain Diff
allow Neumann damping, even anisotropic damping
[[Imported from SVN: r1639]]
parent
439f7bfd
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
dirneucoupling.cc
+78
-12
78 additions, 12 deletions
dirneucoupling.cc
with
78 additions
and
12 deletions
dirneucoupling.cc
+
78
−
12
View file @
8d26153e
...
@@ -71,6 +71,7 @@ int main (int argc, char *argv[]) try
...
@@ -71,6 +71,7 @@ int main (int argc, char *argv[]) try
const
int
maxDirichletNeumannSteps
=
parameterSet
.
get
<
int
>
(
"maxDirichletNeumannSteps"
);
const
int
maxDirichletNeumannSteps
=
parameterSet
.
get
<
int
>
(
"maxDirichletNeumannSteps"
);
const
double
trTolerance
=
parameterSet
.
get
<
double
>
(
"trTolerance"
);
const
double
trTolerance
=
parameterSet
.
get
<
double
>
(
"trTolerance"
);
const
int
maxTrustRegionSteps
=
parameterSet
.
get
<
int
>
(
"maxTrustRegionSteps"
);
const
int
maxTrustRegionSteps
=
parameterSet
.
get
<
int
>
(
"maxTrustRegionSteps"
);
const
int
trVerbosity
=
parameterSet
.
get
<
int
>
(
"trVerbosity"
);
const
int
multigridIterations
=
parameterSet
.
get
<
int
>
(
"numIt"
);
const
int
multigridIterations
=
parameterSet
.
get
<
int
>
(
"numIt"
);
const
int
nu1
=
parameterSet
.
get
<
int
>
(
"nu1"
);
const
int
nu1
=
parameterSet
.
get
<
int
>
(
"nu1"
);
const
int
nu2
=
parameterSet
.
get
<
int
>
(
"nu2"
);
const
int
nu2
=
parameterSet
.
get
<
int
>
(
"nu2"
);
...
@@ -79,7 +80,12 @@ int main (int argc, char *argv[]) try
...
@@ -79,7 +80,12 @@ int main (int argc, char *argv[]) try
const
double
mgTolerance
=
parameterSet
.
get
<
double
>
(
"mgTolerance"
);
const
double
mgTolerance
=
parameterSet
.
get
<
double
>
(
"mgTolerance"
);
const
double
baseTolerance
=
parameterSet
.
get
<
double
>
(
"baseTolerance"
);
const
double
baseTolerance
=
parameterSet
.
get
<
double
>
(
"baseTolerance"
);
const
double
initialTrustRegionRadius
=
parameterSet
.
get
<
double
>
(
"initialTrustRegionRadius"
);
const
double
initialTrustRegionRadius
=
parameterSet
.
get
<
double
>
(
"initialTrustRegionRadius"
);
const
double
damping
=
parameterSet
.
get
<
double
>
(
"damping"
);
const
double
dirichletDamping
=
parameterSet
.
get
<
double
>
(
"dirichletDamping"
);
FieldVector
<
double
,
3
>
neumannDamping
;
neumannDamping
=
parameterSet
.
get
<
double
>
(
"neumannDamping"
);
neumannDamping
[
0
]
=
parameterSet
.
get
<
double
>
(
"neumannDampingT"
);
neumannDamping
[
1
]
=
parameterSet
.
get
<
double
>
(
"neumannDampingT"
);
neumannDamping
[
2
]
=
parameterSet
.
get
<
double
>
(
"neumannDampingL"
);
std
::
string
resultPath
=
parameterSet
.
get
(
"resultPath"
,
""
);
std
::
string
resultPath
=
parameterSet
.
get
(
"resultPath"
,
""
);
// Problem settings
// Problem settings
...
@@ -183,7 +189,7 @@ int main (int argc, char *argv[]) try
...
@@ -183,7 +189,7 @@ int main (int argc, char *argv[]) try
readBoundaryPatch
(
interfaceBoundary
[
0
],
path
+
interfaceNodesFile
);
readBoundaryPatch
(
interfaceBoundary
[
0
],
path
+
interfaceNodesFile
);
PatchProlongator
<
GridType
>::
prolong
(
interfaceBoundary
);
PatchProlongator
<
GridType
>::
prolong
(
interfaceBoundary
);
// //////////////////////////////////////////
// //////////////////////////////////////////
// Assemble 3d linear elasticity problem
// Assemble 3d linear elasticity problem
// //////////////////////////////////////////
// //////////////////////////////////////////
LeafP1Function
<
GridType
,
double
,
dim
>
u
(
grid
),
f
(
grid
);
LeafP1Function
<
GridType
,
double
,
dim
>
u
(
grid
),
f
(
grid
);
...
@@ -228,7 +234,15 @@ int main (int argc, char *argv[]) try
...
@@ -228,7 +234,15 @@ int main (int argc, char *argv[]) try
baseTolerance
,
baseTolerance
,
false
);
false
);
rodSolver
.
verbosity_
=
Solver
::
QUIET
;
switch
(
trVerbosity
)
{
case
0
:
rodSolver
.
verbosity_
=
Solver
::
QUIET
;
break
;
case
1
:
rodSolver
.
verbosity_
=
Solver
::
REDUCED
;
break
;
default:
rodSolver
.
verbosity_
=
Solver
::
FULL
;
break
;
}
// ////////////////////////////////
// ////////////////////////////////
// Create a multigrid solver
// Create a multigrid solver
...
@@ -282,6 +296,8 @@ int main (int argc, char *argv[]) try
...
@@ -282,6 +296,8 @@ int main (int argc, char *argv[]) try
// Init interface value
// Init interface value
Configuration
referenceInterface
=
rodX
[
0
];
Configuration
referenceInterface
=
rodX
[
0
];
Configuration
lambda
=
referenceInterface
;
Configuration
lambda
=
referenceInterface
;
FieldVector
<
double
,
3
>
lambdaForce
(
0
);
FieldVector
<
double
,
3
>
lambdaTorque
(
0
);
//
//
double
normOfOldCorrection
=
0
;
double
normOfOldCorrection
=
0
;
...
@@ -305,6 +321,9 @@ int main (int argc, char *argv[]) try
...
@@ -305,6 +321,9 @@ int main (int argc, char *argv[]) try
rodX
=
rodSolver
.
getSol
();
rodX
=
rodSolver
.
getSol
();
for
(
int
j
=
0
;
j
<
rodX
.
size
();
j
++
)
std
::
cout
<<
rodX
[
j
]
<<
std
::
endl
;
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Extract Neumann values and transfer it to the 3d object
// Extract Neumann values and transfer it to the 3d object
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
...
@@ -314,12 +333,47 @@ int main (int argc, char *argv[]) try
...
@@ -314,12 +333,47 @@ int main (int argc, char *argv[]) try
couplingBitfield
[
0
]
=
true
;
couplingBitfield
[
0
]
=
true
;
BoundaryPatch
<
RodGridType
>
couplingBoundary
(
rodGrid
,
rodGrid
.
maxLevel
(),
couplingBitfield
);
BoundaryPatch
<
RodGridType
>
couplingBoundary
(
rodGrid
,
rodGrid
.
maxLevel
(),
couplingBitfield
);
FieldVector
<
double
,
dim
>
resultantTorque
;
FieldVector
<
double
,
dim
>
resultantForce
,
resultantTorque
;
FieldVector
<
double
,
dim
>
resultantForce
=
rodAssembler
.
getResultantForce
(
couplingBoundary
,
rodX
,
resultantTorque
);
resultantForce
=
rodAssembler
.
getResultantForce
(
couplingBoundary
,
rodX
,
resultantTorque
);
std
::
cout
<<
"resultant force: "
<<
resultantForce
<<
std
::
endl
;
std
::
cout
<<
"resultant force: "
<<
resultantForce
<<
std
::
endl
;
std
::
cout
<<
"resultant torque: "
<<
resultantTorque
<<
std
::
endl
;
std
::
cout
<<
"resultant torque: "
<<
resultantTorque
<<
std
::
endl
;
#if 0
for (int j=0; j<dim; j++) {
lambdaForce[j] = (1-neumannDamping[j]) * lambdaForce[j] + neumannDamping[j] * resultantForce[j];
lambdaTorque[j] = (1-neumannDamping[j]) * lambdaTorque[j] + neumannDamping[j] * resultantTorque[j];
}
#else
// damp in local coordinate system
FieldVector
<
double
,
dim
>
lambdaForceLocal
,
lambdaTorqueLocal
;
FieldVector
<
double
,
dim
>
resultantForceLocal
,
resultantTorqueLocal
;
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
{
lambdaForceLocal
[
j
]
=
lambdaForce
*
rodX
[
0
].
q
.
director
(
j
);
lambdaTorqueLocal
[
j
]
=
lambdaTorque
*
rodX
[
0
].
q
.
director
(
j
);
resultantForceLocal
[
j
]
=
resultantForce
*
rodX
[
0
].
q
.
director
(
j
);
resultantTorqueLocal
[
j
]
=
resultantTorque
*
rodX
[
0
].
q
.
director
(
j
);
// Anisotropic damping
lambdaForceLocal
[
j
]
=
(
1
-
neumannDamping
[
j
])
*
lambdaForceLocal
[
j
]
+
neumannDamping
[
j
]
*
resultantForceLocal
[
j
];
lambdaTorqueLocal
[
j
]
=
(
1
-
neumannDamping
[
j
])
*
lambdaTorqueLocal
[
j
]
+
neumannDamping
[
j
]
*
resultantTorqueLocal
[
j
];
}
// Back to canonical coordinates
FieldMatrix
<
double
,
3
,
3
>
orientationMatrix
;
rodX
[
0
].
q
.
matrix
(
orientationMatrix
);
lambdaForce
=
0
;
lambdaTorque
=
0
;
orientationMatrix
.
umv
(
lambdaForceLocal
,
lambdaForce
);
orientationMatrix
.
umv
(
lambdaTorqueLocal
,
lambdaTorque
);
#endif
// For the time being the Neumann data coming from the rod is a dg function (== not continuous)
// For the time being the Neumann data coming from the rod is a dg function (== not continuous)
// Maybe that is not necessary
// Maybe that is not necessary
DGIndexSet
<
GridType
>
dgIndexSet
(
grid
,
grid
.
maxLevel
());
DGIndexSet
<
GridType
>
dgIndexSet
(
grid
,
grid
.
maxLevel
());
...
@@ -328,7 +382,7 @@ int main (int argc, char *argv[]) try
...
@@ -328,7 +382,7 @@ int main (int argc, char *argv[]) try
VectorType
neumannValues
(
dgIndexSet
.
size
());
VectorType
neumannValues
(
dgIndexSet
.
size
());
// Using that index 0 is always the left boundary for a uniformly refined OneDGrid
// Using that index 0 is always the left boundary for a uniformly refined OneDGrid
computeAveragePressure
<
GridType
>
(
resultantForce
,
resultant
Torque
,
computeAveragePressure
<
GridType
>
(
lambdaForce
,
lambda
Torque
,
interfaceBoundary
[
grid
.
maxLevel
()],
interfaceBoundary
[
grid
.
maxLevel
()],
rodX
[
0
],
rodX
[
0
],
neumannValues
);
neumannValues
);
...
@@ -358,16 +412,25 @@ int main (int argc, char *argv[]) try
...
@@ -358,16 +412,25 @@ int main (int argc, char *argv[]) try
Configuration
averageInterface
;
Configuration
averageInterface
;
computeAverageInterface
(
interfaceBoundary
[
toplevel
],
x3d
,
averageInterface
);
computeAverageInterface
(
interfaceBoundary
[
toplevel
],
x3d
,
averageInterface
);
//averageInterface.r[0] = averageInterface.r[1] = 0;
//averageInterface.q = Quaternion<double>::identity();
std
::
cout
<<
"average interface: "
<<
averageInterface
<<
std
::
endl
;
std
::
cout
<<
"average interface: "
<<
averageInterface
<<
std
::
endl
;
std
::
cout
<<
"director 0: "
<<
averageInterface
.
q
.
director
(
0
)
<<
std
::
endl
;
std
::
cout
<<
"director 1: "
<<
averageInterface
.
q
.
director
(
1
)
<<
std
::
endl
;
std
::
cout
<<
"director 2: "
<<
averageInterface
.
q
.
director
(
2
)
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Compute new damped interface value
// Compute new damped interface value
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
for
(
int
j
=
0
;
j
<
dim
;
j
++
)
lambda
.
r
[
j
]
=
(
1
-
damping
)
*
lambda
.
r
[
j
]
+
damping
*
(
referenceInterface
.
r
[
j
]
+
averageInterface
.
r
[
j
]);
lambda
.
r
[
j
]
=
(
1
-
dirichletDamping
)
*
lambda
.
r
[
j
]
+
dirichletDamping
*
(
referenceInterface
.
r
[
j
]
+
averageInterface
.
r
[
j
]);
lambda
.
q
=
Quaternion
<
double
>::
interpolate
(
lambda
.
q
,
averageInterface
.
q
,
dirichletDamping
);
lambda
.
q
=
Quaternion
<
double
>::
interpolate
(
lambda
.
q
,
averageInterface
.
q
,
damping
)
;
std
::
cout
<<
"Lambda: "
<<
lambda
<<
std
::
endl
;
// ////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// Write the two iterates to disk for later convergence rate measurement
// Write the two iterates to disk for later convergence rate measurement
...
@@ -545,13 +608,16 @@ int main (int argc, char *argv[]) try
...
@@ -545,13 +608,16 @@ int main (int argc, char *argv[]) try
}
}
int
backTrace
=
1
;
int
backTrace
=
std
::
min
(
size_t
(
4
),
totalConvRate
.
size
());
std
::
cout
<<
"damping: "
<<
damping
std
::
cout
<<
"Dirichlet damping: "
<<
dirichletDamping
<<
"Neumann damping: "
<<
neumannDamping
<<
" convRate: "
<<
std
::
pow
(
totalConvRate
[
i
+
1
-
backTrace
],
1
/
((
double
)
i
+
1
-
backTrace
))
<<
" convRate: "
<<
std
::
pow
(
totalConvRate
[
i
+
1
-
backTrace
],
1
/
((
double
)
i
+
1
-
backTrace
))
<<
std
::
endl
;
<<
std
::
endl
;
std
::
ofstream
convRateFile
(
"convrate"
);
std
::
ofstream
convRateFile
(
"convrate"
);
convRateFile
<<
damping
<<
" "
<<
std
::
pow
(
totalConvRate
[
i
+
1
-
backTrace
],
1
/
((
double
)
i
+
1
-
backTrace
))
convRateFile
<<
dirichletDamping
<<
" "
<<
neumannDamping
<<
" "
<<
std
::
pow
(
totalConvRate
[
i
+
1
-
backTrace
],
1
/
((
double
)
i
+
1
-
backTrace
))
<<
std
::
endl
;
<<
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