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
032e8650
Commit
032e8650
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
new implementation of the fd gradient. Hopefully less buggy
[[Imported from SVN: r7424]]
parent
48157673
Branches
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
dune/gfe/localgeodesicfestiffness.hh
+36
-7
36 additions, 7 deletions
dune/gfe/localgeodesicfestiffness.hh
with
36 additions
and
7 deletions
dune/gfe/localgeodesicfestiffness.hh
+
36
−
7
View file @
032e8650
...
...
@@ -103,6 +103,8 @@ class LocalGeodesicFEStiffnessImp
// to a neighborhood around S^n
forwardSolution
[
i
]
=
localSolution
[
i
];
backwardSolution
[
i
]
=
localSolution
[
i
];
LocalGeodesicFEStiffnessImp
<
GridView
,
TargetSpace
>::
infinitesimalVariation
(
forwardSolution
[
i
],
eps
,
j
);
LocalGeodesicFEStiffnessImp
<
GridView
,
TargetSpace
>::
infinitesimalVariation
(
backwardSolution
[
i
],
-
eps
,
j
);
...
...
@@ -184,16 +186,43 @@ assembleGradient(const Entity& element,
const
std
::
vector
<
TargetSpace
>&
localSolution
,
std
::
vector
<
typename
TargetSpace
::
TangentVector
>&
localGradient
)
const
{
std
::
vector
<
typename
TargetSpace
::
EmbeddedTangentVector
>
embeddedLocalGradient
;
// first compute the gradient in embedded coordinates
LocalGeodesicFEStiffnessImp
<
GridView
,
TargetSpace
>::
assembleEmbeddedGradient
(
element
,
localSolution
,
embeddedLocalGradient
,
this
);
// ///////////////////////////////////////////////////////////
// Compute gradient by finite-difference approximation
// ///////////////////////////////////////////////////////////
// transform to coordinates on the tangent space
localGradient
.
resize
(
embeddedLocalGradient
.
size
());
double
eps
=
1e-6
;
localGradient
.
resize
(
localSolution
.
size
());
std
::
vector
<
TargetSpace
>
forwardSolution
=
localSolution
;
std
::
vector
<
TargetSpace
>
backwardSolution
=
localSolution
;
for
(
size_t
i
=
0
;
i
<
localSolution
.
size
();
i
++
)
{
// basis vectors of the tangent space of the i-th entry of localSolution
const
Dune
::
FieldMatrix
<
double
,
blocksize
,
embeddedBlocksize
>
B
=
localSolution
[
i
].
orthonormalFrame
();
for
(
int
j
=
0
;
j
<
blocksize
;
j
++
)
{
typename
TargetSpace
::
EmbeddedTangentVector
forwardCorrection
=
B
[
j
];
forwardCorrection
*=
eps
;
typename
TargetSpace
::
EmbeddedTangentVector
backwardCorrection
=
B
[
j
];
backwardCorrection
*=
-
eps
;
forwardSolution
[
i
]
=
TargetSpace
::
exp
(
localSolution
[
i
],
forwardCorrection
);
backwardSolution
[
i
]
=
TargetSpace
::
exp
(
localSolution
[
i
],
backwardCorrection
);
localGradient
[
i
][
j
]
=
(
energy
(
element
,
forwardSolution
)
-
energy
(
element
,
backwardSolution
))
/
(
2
*
eps
);
}
forwardSolution
[
i
]
=
localSolution
[
i
];
backwardSolution
[
i
]
=
localSolution
[
i
];
}
for
(
size_t
i
=
0
;
i
<
localGradient
.
size
();
i
++
)
localSolution
[
i
].
orthonormalFrame
().
mv
(
embeddedLocalGradient
[
i
],
localGradient
[
i
]);
}
template
<
class
GridView
,
class
TargetSpace
>
...
...
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