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
726b6952
Commit
726b6952
authored
Jan 17, 2020
by
Hörl, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
[WIP] add debug output
parent
a77ce8dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/mmdg/dg.hh
+50
-3
50 additions, 3 deletions
dune/mmdg/dg.hh
with
50 additions
and
3 deletions
dune/mmdg/dg.hh
+
50
−
3
View file @
726b6952
...
@@ -36,6 +36,17 @@ public:
...
@@ -36,6 +36,17 @@ public:
//NOTE:
//NOTE:
// const int order = 3; //order of the quadrature rule
// const int order = 3; //order of the quadrature rule
for
(
const
auto
&
elem
:
elements
(
gridView_
))
{
const
auto
&
geo
=
elem
.
geometry
();
std
::
cout
<<
mapper_
.
index
(
elem
)
<<
"
\t
"
;
for
(
int
k
=
0
;
k
<
geo
.
corners
();
k
++
)
{
std
::
cout
<<
geo
.
corner
(
k
)
<<
"
\t
"
;
}
std
::
cout
<<
"
\n\n
"
;
}
//we use the basis
//we use the basis
// phi_elem,0 (x) = indicator(elem);
// phi_elem,0 (x) = indicator(elem);
...
@@ -48,6 +59,13 @@ public:
...
@@ -48,6 +59,13 @@ public:
const
double
elemVol
=
geo
.
volume
();
const
double
elemVol
=
geo
.
volume
();
const
auto
&
center
=
geo
.
center
();
const
auto
&
center
=
geo
.
center
();
std
::
cout
<<
"===============================
\n
Element "
<<
elemIdx
;
for
(
int
k
=
0
;
k
<
geo
.
corners
();
k
++
)
{
std
::
cout
<<
"
\t
"
<<
geo
.
corner
(
k
);
}
std
::
cout
<<
"
\n\n
"
;
//in the system of linear equations (SLE) Ad = b,
//in the system of linear equations (SLE) Ad = b,
//the index elemIdxSLE refers to the basis function phi_elem,0
//the index elemIdxSLE refers to the basis function phi_elem,0
//and the indices elemIdxSLE + i + 1, i = 1,...,dim, refer to the
//and the indices elemIdxSLE + i + 1, i = 1,...,dim, refer to the
...
@@ -99,6 +117,13 @@ public:
...
@@ -99,6 +117,13 @@ public:
const
double
intersctVol
=
intersctGeo
.
volume
();
const
double
intersctVol
=
intersctGeo
.
volume
();
const
auto
&
intersctCenter
=
intersctGeo
.
center
();
const
auto
&
intersctCenter
=
intersctGeo
.
center
();
std
::
cout
<<
"+++++++++++++++++++++++++++
\n
Intersection "
;
for
(
int
k
=
0
;
k
<
intersctGeo
.
corners
();
k
++
)
{
std
::
cout
<<
"
\t
"
<<
intersctGeo
.
corner
(
k
);
}
std
::
cout
<<
"
\n\n
"
;
//TODO: quadrature rule cannot be used for dim = 1!
//TODO: quadrature rule cannot be used for dim = 1!
// const Dune::QuadratureRule<double,dim-1>& secondOrderRule =
// const Dune::QuadratureRule<double,dim-1>& secondOrderRule =
// Dune::QuadratureRules<double,dim-1>::rule(
// Dune::QuadratureRules<double,dim-1>::rule(
...
@@ -121,11 +146,22 @@ public:
...
@@ -121,11 +146,22 @@ public:
{
{
const
auto
&
leftCorner
=
intersctGeo
.
corner
(
0
);
const
auto
&
leftCorner
=
intersctGeo
.
corner
(
0
);
const
auto
&
rightCorner
=
intersctGeo
.
corner
(
1
);
const
auto
&
rightCorner
=
intersctGeo
.
corner
(
1
);
std
::
cout
<<
"left corner: "
<<
leftCorner
<<
"
\t
right corner: "
<<
rightCorner
<<
"
\n
"
;
quadraticIntregrals
[
i
][
j
]
=
intersctVol
/
3
*
quadraticIntregrals
[
i
][
j
]
=
intersctVol
/
3
*
(
leftCorner
[
i
]
*
leftCorner
[
j
]
+
(
leftCorner
[
i
]
*
leftCorner
[
j
]
+
rightCorner
[
i
]
*
rightCorner
[
j
]
rightCorner
[
i
]
*
rightCorner
[
j
]
+
0.5
*
(
leftCorner
[
i
]
*
rightCorner
[
j
]
+
+
0.5
*
(
leftCorner
[
i
]
*
rightCorner
[
j
]
+
leftCorner
[
j
]
*
rightCorner
[
i
])
);
leftCorner
[
j
]
*
rightCorner
[
i
])
);
std
::
cout
<<
i
<<
", "
<<
j
<<
"
\t
"
<<
leftCorner
[
i
]
*
leftCorner
[
j
]
<<
"
\t
"
<<
rightCorner
[
i
]
*
rightCorner
[
j
]
<<
"
\t
"
<<
0.5
*
(
leftCorner
[
i
]
*
rightCorner
[
j
]
+
leftCorner
[
j
]
*
rightCorner
[
i
])
<<
"
\t
"
<<
intersctVol
/
3
*
(
leftCorner
[
i
]
*
leftCorner
[
j
]
+
rightCorner
[
i
]
*
rightCorner
[
j
]
+
0.5
*
(
leftCorner
[
i
]
*
rightCorner
[
j
]
+
leftCorner
[
j
]
*
rightCorner
[
i
])
)
<<
"
\t
"
<<
quadraticIntregrals
[
i
][
j
]
<<
"
\n\n
"
;
/*
/*
//use second order quadrature rule for exact evaluation of
//use second order quadrature rule for exact evaluation of
// int_intersct x_i*x_j ds
// int_intersct x_i*x_j ds
...
@@ -141,6 +177,8 @@ public:
...
@@ -141,6 +177,8 @@ public:
quadraticIntregrals
[
i
][
j
]
=
quadraticIntregrals
[
j
][
i
];
quadraticIntregrals
[
i
][
j
]
=
quadraticIntregrals
[
j
][
i
];
}
}
}
}
std
::
cout
<<
"linearIntegrals:
\n
"
<<
linearIntegrals
<<
"
\n\n
"
;
std
::
cout
<<
"quadraticIntregrals:
\n
"
<<
quadraticIntregrals
<<
"
\n\n
"
;
//exact evaluation of
//exact evaluation of
// int_intersct mu*jump(phi_elem,0)*jump(phi_elem,0) ds
// int_intersct mu*jump(phi_elem,0)*jump(phi_elem,0) ds
...
@@ -150,6 +188,14 @@ public:
...
@@ -150,6 +188,14 @@ public:
if
(
intersct
.
neighbor
())
//intersct has neighboring element
if
(
intersct
.
neighbor
())
//intersct has neighboring element
{
{
std
::
cout
<<
"------------------------------
\n
Neighbor
\t
"
;
for
(
int
k
=
0
;
k
<
intersct
.
outside
().
geometry
().
corners
();
k
++
)
{
std
::
cout
<<
"
\t
"
<<
intersct
.
outside
().
geometry
().
corner
(
k
);
}
std
::
cout
<<
"
\n\n
"
;
//index of the neighboring element
//index of the neighboring element
const
int
neighborIdx
=
mapper_
.
index
(
intersct
.
outside
());
const
int
neighborIdx
=
mapper_
.
index
(
intersct
.
outside
());
const
int
neighborIdxSLE
=
(
dim
+
1
)
*
neighborIdx
;
const
int
neighborIdxSLE
=
(
dim
+
1
)
*
neighborIdx
;
...
@@ -298,6 +344,7 @@ public:
...
@@ -298,6 +344,7 @@ public:
}
}
else
//boundary facet
else
//boundary facet
{
{
std
::
cout
<<
"------------------------------
\n
Boundary
\n\n
"
;
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
for
(
int
i
=
0
;
i
<
dim
;
i
++
)
{
//we use the relations
{
//we use the relations
// int_intersct mu*jump(phi_elem,0)*jump(phi_elem,i) ds
// int_intersct mu*jump(phi_elem,0)*jump(phi_elem,i) ds
...
@@ -364,10 +411,10 @@ public:
...
@@ -364,10 +411,10 @@ public:
std
::
cout
<<
i
<<
", "
<<
j
<<
std
::
endl
;
std
::
cout
<<
i
<<
", "
<<
j
<<
std
::
endl
;
//NOTE: dim = 1
//NOTE: dim = 1
auto
exactSolution
=
[](
const
auto
&
pos
)
{
return
0.5
*
pos
[
0
]
*
(
pos
[
0
]
-
1
);};
//
auto exactSolution = [](const auto& pos) {return 0.5*pos[0]*(pos[0] - 1);};
//NOTE: dim = 2
//NOTE: dim = 2
/*
auto exactSolution = [](const auto& pos)
auto
exactSolution
=
[](
const
auto
&
pos
)
{
{
double
solution
=
0.0
;
double
solution
=
0.0
;
for
(
int
m
=
1
;
m
<=
21
;
m
=
m
+
2
)
for
(
int
m
=
1
;
m
<=
21
;
m
=
m
+
2
)
...
@@ -381,7 +428,7 @@ public:
...
@@ -381,7 +428,7 @@ public:
solution
*=
-
16
/
pow
(
M_PI
,
4
);
solution
*=
-
16
/
pow
(
M_PI
,
4
);
return
solution
;
return
solution
;
};
};
*/
...
...
...
...
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
sign in
to comment