orientation of intersection.centerUnitOuterNormal()?
The question can be drastically simplified! :) See below for my previous rambling...
Given two grids and a GridGlue
between them, there seems to be an obvious orientation of the glue induced by the ordering of the grids (or rather the ordering of the grid views provided in the constructors of the extractors provided in the constructor of GridGlue
).
From what I understand, the grid given first can be interpreted as the inside grid, while the grid given second can be interpreted as the outside grid.
I would thus expect the outer normals of all intersections contained in the glue to point from the inside grid in the direction of the outside grid.
My original questions from below stand:
- is my expectation wrong?
- does the code behave wrong?
- is there a way for me to guarantee that the created intersections' normals have the "correct" orientation?
Thank you very much in advance!
==================================================
This was the old question:
Dear all,
I encountered the following situation and I am not sure whether I have the wrong expectations, I am using the code wrong, or whether this could be a bug:
- I am currently on the 2.3.1 core modules (sorry for that) and the
releases/2.4
branch of dune-grid-glue. - I have some piece of code which
- creates an
SGrid<2, 2>
with3x3
entities (I will call this the macro grid), - for each entity of the macro grid I create a separate
SGrid<2, 2>
as a grid of the physical domain spanned by the macro entity (I will call those local grids) and do some refinements (not necessarily the same amount of levels in different macro entities), - for each inner intersection of the macro grid, I create a glue, using
GridGlue::Codim1Extractor
,GridGlue::ContactMerge
and a custom class based onGridGlue::ExtractorPredicate<GridView, 1>
.
- creates an
This works as expected and for each macro intersection I obtain a glue wich allows me to iterate over the glued intersections and access the corresponding entities of the local grids on either side. What I noticed, however, is that the orientation of the coupling normal does not coincide with the orientation of the normal of the "matching" local intersection. What I mean by that is the following. Consider the following Picture, showing
- a local grid on the left with refinement level 0 and one intersection
LI0
involved, - a local grid on the right with refinement level 1 and two intersections
RI0
andRI1
involved, - the coupling glue inbetween with its two intersections
CI0
andCI1
Note that the physical domains of the left and the right grid match exactly, so there is no actual distance between them.
-------+ + +-------
| | |
| CI0 RI0 RE0
| | |
LE0 LI0 + +------
| | |
| CI1 RI1 RE1
| | |
-------+ + +------
Regarding the glue, say I created it looking from the left, i.e. the left grid is given first and the right grid second.
Now in order to assemble a DG coupling integral w.r.t to the physical integral covering LI0
(or (CI0
and CI1
) or (RI0
and RI1
), which should all be the same integral), I iterate over the coupling and on each coupling intersection, say CI0
- I get the inside, which is
LE0
*I get the outside, which isRE0
- I get the
centerUnitOuterNormal()
My expectation now is the following: the centerUnitOuterNormal()
of LI0
and CI0
(and CI1
) should coincide.
What happens is: the centerUnitOuterNormal()
of LI0
is [1 0]
, the centerUnitOuterNormal()
of CI0
or CI1
can be either [1 0]
or [-1 0]
, where I could not yet determine a rule.
My expectation is due to the fact that I have created the glue looking from the left and LE0
is given as inside, RE0
is given as outside and I am accessing an outer normal.
Now the question is as follows:
- is my expectation wrong?
- does the code behave wrong?
- is there a way for me to guarantee that the created intersections' normals have the "correct" orientation?
Thank you very much in advance!