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
c2411e48
Commit
c2411e48
authored
11 years ago
by
Oliver Sander
Committed by
sander
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Test harmonic energy derivation for various unit vector and grid dimensions
[[Imported from SVN: r9419]]
parent
b71f5bf4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/adolctest.cc
+21
-20
21 additions, 20 deletions
test/adolctest.cc
with
21 additions
and
20 deletions
test/adolctest.cc
+
21
−
20
View file @
c2411e48
...
...
@@ -71,39 +71,36 @@ void compareMatrices(const Matrix<FieldMatrix<double,blocksize,blocksize> >& fdM
}
}
template
<
class
TargetSpace
,
int
gridDim
>
int
testHarmonicEnergy
()
{
typedef
UnitVector
<
double
,
3
>
TargetSpace
;
const
int
dim
=
1
;
std
::
cout
<<
" --- Testing "
<<
className
<
TargetSpace
>
()
<<
", domain dimension: "
<<
dim
<<
" ---"
<<
std
::
endl
;
std
::
cout
<<
" --- Testing "
<<
className
<
TargetSpace
>
()
<<
", domain dimension: "
<<
gridDim
<<
" ---"
<<
std
::
endl
;
// set up a test grid
typedef
YaspGrid
<
d
im
>
GridType
;
FieldVector
<
double
,
d
im
>
l
(
1
);
std
::
array
<
int
,
d
im
>
elements
;
typedef
YaspGrid
<
gridD
im
>
GridType
;
FieldVector
<
double
,
gridD
im
>
l
(
1
);
std
::
array
<
int
,
gridD
im
>
elements
;
std
::
fill
(
elements
.
begin
(),
elements
.
end
(),
1
);
GridType
grid
(
l
,
elements
);
typedef
Q1NodalBasis
<
GridType
::
LeafGridView
,
double
>
Q1Basis
;
typedef
Q1NodalBasis
<
typename
GridType
::
LeafGridView
,
double
>
Q1Basis
;
Q1Basis
q1Basis
(
grid
.
leafView
());
typedef
Q1LocalFiniteElement
<
double
,
double
,
d
im
>
LocalFE
;
typedef
Q1LocalFiniteElement
<
double
,
double
,
gridD
im
>
LocalFE
;
LocalFE
localFiniteElement
;
// Assembler using finite differences
HarmonicEnergyLocalStiffness
<
GridType
::
LeafGridView
,
Q1Basis
::
LocalFiniteElement
,
HarmonicEnergyLocalStiffness
<
typename
GridType
::
LeafGridView
,
typename
Q1Basis
::
LocalFiniteElement
,
TargetSpace
>
harmonicEnergyLocalStiffness
;
// Assembler using ADOL-C
typedef
TargetSpace
::
rebind
<
adouble
>::
other
ATargetSpace
;
HarmonicEnergyLocalStiffness
<
GridType
::
LeafGridView
,
Q1Basis
::
LocalFiniteElement
,
typedef
typename
TargetSpace
::
template
rebind
<
adouble
>
::
other
ATargetSpace
;
HarmonicEnergyLocalStiffness
<
typename
GridType
::
LeafGridView
,
typename
Q1Basis
::
LocalFiniteElement
,
ATargetSpace
>
harmonicEnergyADOLCLocalStiffness
;
LocalGeodesicFEADOLCStiffness
<
GridType
::
LeafGridView
,
Q1Basis
::
LocalFiniteElement
,
LocalGeodesicFEADOLCStiffness
<
typename
GridType
::
LeafGridView
,
typename
Q1Basis
::
LocalFiniteElement
,
TargetSpace
>
localGFEADOLCStiffness
(
&
harmonicEnergyADOLCLocalStiffness
);
size_t
nDofs
=
localFiniteElement
.
localBasis
().
size
();
...
...
@@ -132,9 +129,9 @@ int testHarmonicEnergy() {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
harmonicEnergyLocalStiffness
.
assembleHessian
(
*
grid
.
leafbegin
<
0
>
(),
localFiniteElement
,
localSolution
);
harmonicEnergyLocalStiffness
.
assembleHessian
(
*
grid
.
template
leafbegin
<
0
>(),
localFiniteElement
,
localSolution
);
localGFEADOLCStiffness
.
assembleHessian
(
*
grid
.
leafbegin
<
0
>
(),
localFiniteElement
,
localSolution
);
localGFEADOLCStiffness
.
assembleHessian
(
*
grid
.
template
leafbegin
<
0
>(),
localFiniteElement
,
localSolution
);
compareMatrices
(
harmonicEnergyLocalStiffness
.
A_
,
localGFEADOLCStiffness
.
A_
);
...
...
@@ -211,6 +208,10 @@ int testCosseratEnergy() {
int
main
()
{
testHarmonicEnergy
();
testHarmonicEnergy
<
UnitVector
<
double
,
2
>
,
1
>
();
testHarmonicEnergy
<
UnitVector
<
double
,
3
>
,
1
>
();
testHarmonicEnergy
<
UnitVector
<
double
,
2
>
,
2
>
();
testHarmonicEnergy
<
UnitVector
<
double
,
3
>
,
2
>
();
testCosseratEnergy
();
}
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