Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-mmdg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hörl, Maximilian
dune-mmdg
Commits
fbef589c
Commit
fbef589c
authored
Mar 19, 2020
by
Hörl, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
add method to mmdg to compute L2 error
parent
dbffdbb9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/mmdg/dg.hh
+1
-0
1 addition, 0 deletions
dune/mmdg/dg.hh
dune/mmdg/mmdg.hh
+45
-0
45 additions, 0 deletions
dune/mmdg/mmdg.hh
src/mmdg.cc
+1
-1
1 addition, 1 deletion
src/mmdg.cc
with
47 additions
and
1 deletion
dune/mmdg/dg.hh
+
1
−
0
View file @
fbef589c
...
@@ -63,6 +63,7 @@ public:
...
@@ -63,6 +63,7 @@ public:
writeVTKoutput
();
writeVTKoutput
();
}
}
//compute L2 error using a quadrature rule
Scalar
computeL2error
(
const
int
quadratureOrder
=
5
)
const
Scalar
computeL2error
(
const
int
quadratureOrder
=
5
)
const
{
{
if
(
!
problem_
.
hasExactSolution
())
if
(
!
problem_
.
hasExactSolution
())
...
...
This diff is collapsed.
Click to expand it.
dune/mmdg/mmdg.hh
+
45
−
0
View file @
fbef589c
...
@@ -44,6 +44,51 @@ public:
...
@@ -44,6 +44,51 @@ public:
writeVTKoutput
();
writeVTKoutput
();
}
}
//compute L2 error using quadrature rules
// norm = sqrt( ||.||^2_L2(bulk) + ||.||^2_L2(interface) )
Scalar
computeL2error
(
const
int
quadratureOrder
=
5
)
const
{
const
Scalar
bulkError
=
Base
::
computeL2error
(
quadratureOrder
);
Scalar
interfaceError
(
0.0
);
for
(
const
auto
&
iElem
:
elements
(
iGridView_
))
{
const
auto
&
iGeo
=
iElem
.
geometry
();
const
int
iElemIdxSLE
=
(
dim
+
1
)
*
Base
::
gridView_
.
size
(
0
)
+
dim
*
iMapper_
.
index
(
iElem
);
const
QRuleInterface
&
qrule
=
QRulesInterface
::
rule
(
iSimplex
,
quadratureOrder
);
const
InterfaceBasis
iFrame
=
interfaceFrame
(
Base
::
grid_
.
asIntersection
(
iElem
).
centerUnitOuterNormal
());
//determine L2-error on the interface element iElem using a
//quadrature rule
for
(
const
auto
&
ip
:
qrule
)
{
const
auto
&
qpLocal
=
ip
.
position
();
const
auto
&
qpGlobal
=
iGeo
.
global
(
qpLocal
);
const
Scalar
quadratureFactor
=
ip
.
weight
()
*
iGeo
.
integrationElement
(
qpLocal
);
Scalar
numericalSolutionAtQP
=
Base
::
d
[
iElemIdxSLE
];
for
(
int
i
=
0
;
i
<
dim
-
1
;
i
++
)
{
numericalSolutionAtQP
+=
Base
::
d
[
iElemIdxSLE
+
i
+
1
]
*
(
qpGlobal
*
iFrame
[
i
]);
}
const
Scalar
errorEvaluation
=
numericalSolutionAtQP
-
Base
::
problem_
.
exactInterfaceSolution
(
qpGlobal
);
interfaceError
+=
quadratureFactor
*
errorEvaluation
*
errorEvaluation
;
}
}
return
sqrt
(
bulkError
*
bulkError
+
interfaceError
);
}
const
InterfaceGridView
&
iGridView_
;
const
InterfaceGridView
&
iGridView_
;
const
InterfaceMapper
&
iMapper_
;
const
InterfaceMapper
&
iMapper_
;
...
...
This diff is collapsed.
Click to expand it.
src/mmdg.cc
+
1
−
1
View file @
fbef589c
...
@@ -83,7 +83,7 @@ int main(int argc, char** argv)
...
@@ -83,7 +83,7 @@ int main(int argc, char** argv)
//print total run time
//print total run time
const
double
timeTotal
=
ClockHelper
::
elapsedRuntime
(
timeInitial
);
const
double
timeTotal
=
ClockHelper
::
elapsedRuntime
(
timeInitial
);
std
::
cout
<<
"Finished with a total run time of "
<<
timeTotal
<<
std
::
cout
<<
"Finished with a total run time of "
<<
timeTotal
<<
" Seconds.
\n
"
;
" Seconds.
\
n
L2-error: "
<<
mmdg
.
computeL2error
()
<<
".
\
n
"
;
return
0
;
return
0
;
}
}
...
...
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