Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
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
Container Registry
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
dumux-repositories
dumux
Commits
fbc4b384
Commit
fbc4b384
authored
5 years ago
by
Dennis Gläser
Browse files
Options
Downloads
Patches
Plain Diff
[test][l2norm] test grid function integration
parent
2f4baba5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1636
Feature/l2 norm
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/common/functions/test_function_l2norm.cc
+15
-1
15 additions, 1 deletion
test/common/functions/test_function_l2norm.cc
with
15 additions
and
1 deletion
test/common/functions/test_function_l2norm.cc
+
15
−
1
View file @
fbc4b384
...
...
@@ -52,7 +52,21 @@ int main (int argc, char *argv[]) try
// a quadratic function on the grid
auto
f
=
[
&
]
(
const
auto
&
pos
)
->
R
{
return
{
pos
.
two_norm2
(),
pos
[
0
]
*
pos
[
0
]
*
pos
[
1
]};
};
// make bases
// test Dumux::integrateGridFunction with unit function
auto
basisUnit
=
makeBasis
(
gvFine
,
lagrange
<
1
>
());
using
RUnit
=
Dune
::
FieldVector
<
double
,
1
>
;
Dune
::
BlockVector
<
RUnit
>
solUnit
;
interpolate
(
basisUnit
,
solUnit
,
[
&
]
(
const
auto
&
pos
)
{
return
1.0
;
});
auto
gfUnit
=
makeDiscreteGlobalBasisFunction
<
RUnit
>
(
basisUnit
,
solUnit
);
auto
integral
=
Dumux
::
integrateGridFunction
(
gvFine
,
gfUnit
,
1
);
using
std
::
abs
;
if
(
abs
(
integral
-
1.0
)
>
1e-13
)
DUNE_THROW
(
Dune
::
MathError
,
"Integral of grid function is not 1 (error = "
<<
abs
(
integral
-
1.0
)
<<
")"
);
// test Dumux::integrateL2Error
SolutionVector
solCoarse
,
solFine
;
interpolate
(
makeBasis
(
gvCoarse
,
power
<
2
>
(
lagrange
<
2
>
())),
solCoarse
,
f
);
interpolate
(
makeBasis
(
gvFine
,
power
<
2
>
(
lagrange
<
2
>
())),
solFine
,
f
);
...
...
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