Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pacxx-projectseminar-2019
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
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Vladyslav Kucher
pacxx-projectseminar-2019
Commits
78f95bb0
Commit
78f95bb0
authored
5 years ago
by
Jö Fahlke
Browse files
Options
Downloads
Patches
Plain Diff
Implement jacobian_apply_volume() analytically
Addresses:
#6
parent
8fd52845
No related branches found
Branches containing commit
No related tags found
1 merge request
!12
Implement jacobian_apply_volume analytically
Pipeline
#19638
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nonlinearpoissonfem.hh
+57
-1
57 additions, 1 deletion
src/nonlinearpoissonfem.hh
with
57 additions
and
1 deletion
src/nonlinearpoissonfem.hh
+
57
−
1
View file @
78f95bb0
...
...
@@ -29,7 +29,6 @@ namespace PPS {
template
<
typename
Param
>
class
NonlinearPoissonFEM
:
public
NumericalJacobianVolume
<
NonlinearPoissonFEM
<
Param
>
>
,
public
NumericalNonlinearJacobianApplyVolume
<
NonlinearPoissonFEM
<
Param
>
>
,
public
FullVolumePattern
,
public
LocalOperatorDefaultFlags
{
...
...
@@ -164,6 +163,63 @@ namespace PPS {
q
*
phihat
[
i
])
*
factor
;
}
}
//! apply local jacobian of the volume term
/**
* \param lp The point at which to linearize
* \param x The point to apply the operator to
* \param y Where to add the result to
*/
template
<
class
Element
,
class
LocalBasis
,
class
X
,
class
Y
>
void
jacobian_apply_volume
(
const
Element
&
elem
,
const
LocalBasis
&
lb
,
const
X
&
lp
,
const
X
&
x
,
Y
&
y
)
const
{
// types & dimension
const
int
dim
=
Element
::
dimension
;
using
RF
=
typename
LocalBasis
::
Traits
::
RangeFieldType
;
// select quadrature rule
auto
geo
=
elem
.
geometry
();
const
int
order
=
incrementorder
()
+
2
*
lb
.
order
();
std
::
vector
<
typename
LocalBasis
::
Traits
::
RangeType
>
phihat
;
std
::
vector
<
typename
LocalBasis
::
Traits
::
JacobianType
>
gradphi
(
lb
.
size
());
std
::
vector
<
typename
LocalBasis
::
Traits
::
JacobianType
>
gradphihat
;
// loop over quadrature points
for
(
const
auto
&
ip
:
PPS
::
quadratureRule
(
geo
,
order
))
{
// evaluate basis functions
lb
.
evaluateFunction
(
ip
.
position
(),
phihat
);
// evaluate u
auto
u
=
std
::
inner_product
(
begin
(
x
),
end
(
x
),
begin
(
phihat
),
RF
(
0
));
// w is the function corresponding to coefficients lp
auto
w
=
std
::
inner_product
(
begin
(
lp
),
end
(
lp
),
begin
(
phihat
),
RF
(
0
));
// evaluate gradient of shape functions
lb
.
evaluateJacobian
(
ip
.
position
(),
gradphihat
);
// transform gradients of shape functions to real element
const
auto
S
=
geo
.
jacobianInverseTransposed
(
ip
.
position
());
for
(
auto
i
:
Dune
::
range
(
lb
.
size
()))
S
.
mv
(
gradphihat
[
i
][
0
],
gradphi
[
i
][
0
]);
// compute gradient of u
Dune
::
FieldVector
<
RF
,
dim
>
gradu
(
0.0
);
for
(
auto
i
:
Dune
::
range
(
lb
.
size
()))
gradu
.
axpy
(
x
[
i
],
gradphi
[
i
][
0
]);
// integrate (grad u)*grad phi_i + q(u)*phi_i
auto
factor
=
ip
.
weight
()
*
geo
.
integrationElement
(
ip
.
position
());
auto
qprime_u
=
param
().
qprime
(
w
)
*
u
;
for
(
auto
i
:
Dune
::
range
(
lb
.
size
()))
y
[
i
]
+=
(
gradu
*
gradphi
[
i
][
0
]
+
qprime_u
*
phihat
[
i
])
*
factor
;
}
}
};
}
...
...
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