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
80fb8768
Commit
80fb8768
authored
8 years ago
by
Kilian Weishaupt
Committed by
Timo Koch
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[staggeredGrid] Fix stencils on for faces on the boundary
* Empty entries now get value -1
parent
404673e7
No related branches found
No related tags found
2 merge requests
!617
[WIP] Next
,
!370
Feature/staggered grid
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dumux/discretization/staggered/staggeredgeometryhelper.hh
+48
-14
48 additions, 14 deletions
dumux/discretization/staggered/staggeredgeometryhelper.hh
dumux/freeflow/staggered/fluxvariables.hh
+24
-25
24 additions, 25 deletions
dumux/freeflow/staggered/fluxvariables.hh
with
72 additions
and
39 deletions
dumux/discretization/staggered/staggeredgeometryhelper.hh
+
48
−
14
View file @
80fb8768
...
@@ -79,7 +79,7 @@ public:
...
@@ -79,7 +79,7 @@ public:
BaseStaggeredGeometryHelper
(
const
Intersection
&
intersection
,
const
GridView
&
gridView
)
BaseStaggeredGeometryHelper
(
const
Intersection
&
intersection
,
const
GridView
&
gridView
)
:
intersection_
(
intersection
),
element_
(
intersection
.
inside
()),
elementGeometry_
(
element_
.
geometry
()),
gridView_
(
gridView
),
offset_
(
gridView
.
size
(
0
))
:
intersection_
(
intersection
),
element_
(
intersection
.
inside
()),
elementGeometry_
(
element_
.
geometry
()),
gridView_
(
gridView
),
offset_
(
gridView
.
size
(
0
))
{
{
fillPairData
();
fillPairData
_
();
}
}
/*!
/*!
...
@@ -121,10 +121,11 @@ public:
...
@@ -121,10 +121,11 @@ public:
return
pairData_
;
return
pairData_
;
}
}
private
:
/*!
/*!
* \brief Fills all entries of the pair data
* \brief Fills all entries of the pair data
*/
*/
void
fillPairData
()
void
fillPairData
_
()
{
{
const
auto
&
referenceElement
=
ReferenceElements
::
general
(
element_
.
geometry
().
type
());
const
auto
&
referenceElement
=
ReferenceElements
::
general
(
element_
.
geometry
().
type
());
const
int
indexInInside
=
intersection_
.
indexInInside
();
const
int
indexInInside
=
intersection_
.
indexInInside
();
...
@@ -132,10 +133,10 @@ public:
...
@@ -132,10 +133,10 @@ public:
// initialize values that could remain unitialized if the intersection lies on a boundary
// initialize values that could remain unitialized if the intersection lies on a boundary
for
(
auto
&
data
:
pairData_
)
for
(
auto
&
data
:
pairData_
)
{
{
data
.
outerParallelFaceDofIdx
=
0
;
data
.
outerParallelFaceDofIdx
=
-
1
;
data
.
outerParallelElementDofIdx
=
0
;
data
.
outerParallelElementDofIdx
=
-
1
;
data
.
normalDistance
=
0
;
data
.
normalDistance
=
-
1
;
data
.
parallelDistance
=
0
;
data
.
parallelDistance
=
-
1
;
}
}
// set the inner parts of the normal pairs
// set the inner parts of the normal pairs
...
@@ -167,13 +168,13 @@ public:
...
@@ -167,13 +168,13 @@ public:
{
{
const
int
neighborIsIdx
=
neighborIntersection
.
indexInInside
();
const
int
neighborIsIdx
=
neighborIntersection
.
indexInInside
();
// skip the directly neighboring face itself and its opposing one
// skip the directly neighboring face itself and its opposing one
if
(
neighborIntersection
Normal
Side
_
(
neighborIsIdx
,
intersection_
.
indexInOutside
()))
if
(
facetIs
Normal_
(
neighborIsIdx
,
intersection_
.
indexInOutside
()))
{
{
// iterate over facets sub-entities
// iterate over facets sub-entities
for
(
int
i
=
0
;
i
<
numFacetSubEntities
;
++
i
)
for
(
int
i
=
0
;
i
<
numFacetSubEntities
;
++
i
)
{
{
int
localCommonEntIdx
=
referenceElement
.
subEntity
(
neighborIsIdx
,
1
,
i
,
dim
);
int
localCommonEntIdx
=
referenceElement
.
subEntity
(
neighborIsIdx
,
1
,
i
,
dim
);
int
globalCommonEntIdx
=
localToGlobalEntityIdx_
(
localCommonEntIdx
,
directNeighbor
);
int
globalCommonEntIdx
=
localToGlobal
Common
EntityIdx_
(
localCommonEntIdx
,
directNeighbor
);
// fill the normal pair entries
// fill the normal pair entries
for
(
int
pairIdx
=
0
;
pairIdx
<
numPairs
;
++
pairIdx
)
for
(
int
pairIdx
=
0
;
pairIdx
<
numPairs
;
++
pairIdx
)
...
@@ -194,12 +195,12 @@ public:
...
@@ -194,12 +195,12 @@ public:
const
auto
&
diagonalNeighbor
=
neighborIntersection
.
outside
();
const
auto
&
diagonalNeighbor
=
neighborIntersection
.
outside
();
for
(
const
auto
&
dIs
:
intersections
(
gridView_
,
diagonalNeighbor
))
for
(
const
auto
&
dIs
:
intersections
(
gridView_
,
diagonalNeighbor
))
{
{
if
(
neighborIntersection
Normal
Side
_
(
dIs
.
indexInInside
(),
neighborIntersection
.
indexInOutside
()))
if
(
facetIs
Normal_
(
dIs
.
indexInInside
(),
neighborIntersection
.
indexInOutside
()))
{
{
for
(
int
i
=
0
;
i
<
numFacetSubEntities
;
++
i
)
for
(
int
i
=
0
;
i
<
numFacetSubEntities
;
++
i
)
{
{
int
localCommonEntIdx
=
referenceElement
.
subEntity
(
dIs
.
indexInInside
(),
1
,
i
,
dim
);
int
localCommonEntIdx
=
referenceElement
.
subEntity
(
dIs
.
indexInInside
(),
1
,
i
,
dim
);
int
globalCommonEntIdx
=
localToGlobalEntityIdx_
(
localCommonEntIdx
,
diagonalNeighbor
);
int
globalCommonEntIdx
=
localToGlobal
Common
EntityIdx_
(
localCommonEntIdx
,
diagonalNeighbor
);
for
(
int
pairIdx
=
0
;
pairIdx
<
numPairs
;
++
pairIdx
)
for
(
int
pairIdx
=
0
;
pairIdx
<
numPairs
;
++
pairIdx
)
...
@@ -207,7 +208,7 @@ public:
...
@@ -207,7 +208,7 @@ public:
if
(
globalCommonEntIdx
==
pairData_
[
pairIdx
].
globalCommonEntIdx
)
if
(
globalCommonEntIdx
==
pairData_
[
pairIdx
].
globalCommonEntIdx
)
{
{
pairData_
[
pairIdx
].
outerParallelFaceDofIdx
=
gridView_
.
indexSet
().
subIndex
(
diagonalNeighbor
,
dIs
.
indexInInside
(),
dim
-
1
)
+
offset_
;
pairData_
[
pairIdx
].
outerParallelFaceDofIdx
=
gridView_
.
indexSet
().
subIndex
(
diagonalNeighbor
,
dIs
.
indexInInside
(),
dim
-
1
)
+
offset_
;
pairData_
[
pairIdx
].
outerParallelElementDofIdx
=
dIs
.
indexInO
utside
();
pairData_
[
pairIdx
].
outerParallelElementDofIdx
=
gridView_
.
indexSet
().
index
(
dIs
.
o
utside
()
)
;
const
auto
&
selfFacet
=
element_
.
template
subEntity
<
1
>
(
indexInInside
);
const
auto
&
selfFacet
=
element_
.
template
subEntity
<
1
>
(
indexInInside
);
const
auto
&
parallelFacet
=
diagonalNeighbor
.
template
subEntity
<
1
>
(
dIs
.
indexInInside
());
const
auto
&
parallelFacet
=
diagonalNeighbor
.
template
subEntity
<
1
>
(
dIs
.
indexInInside
());
pairData_
[
pairIdx
].
parallelDistance
=
(
selfFacet
.
geometry
().
center
()
-
parallelFacet
.
geometry
().
center
()).
two_norm
();
pairData_
[
pairIdx
].
parallelDistance
=
(
selfFacet
.
geometry
().
center
()
-
parallelFacet
.
geometry
().
center
()).
two_norm
();
...
@@ -220,9 +221,42 @@ public:
...
@@ -220,9 +221,42 @@ public:
}
}
}
}
}
}
else
// intersection is on boundary
{
// find an intersection normal to the face
for
(
const
auto
&
normalIntersection
:
intersections
(
gridView_
,
element_
))
{
if
(
facetIsNormal_
(
normalIntersection
.
indexInInside
(),
intersection_
.
indexInInside
())
&&
normalIntersection
.
neighbor
())
{
const
auto
&
neighbor
=
normalIntersection
.
outside
();
for
(
const
auto
&
neighborIs
:
intersections
(
gridView_
,
neighbor
))
{
// iterate over facets sub-entities
if
(
neighborIs
.
indexInInside
()
!=
normalIntersection
.
indexInOutside
())
{
for
(
int
i
=
0
;
i
<
numFacetSubEntities
;
++
i
)
{
int
localCommonEntIdx
=
referenceElement
.
subEntity
(
neighborIs
.
indexInInside
(),
1
,
i
,
dim
);
int
globalCommonEntIdx
=
localToGlobalCommonEntityIdx_
(
localCommonEntIdx
,
neighbor
);
// fill the parallel pair entries
for
(
int
pairIdx
=
0
;
pairIdx
<
numPairs
;
++
pairIdx
)
{
if
(
globalCommonEntIdx
==
pairData_
[
pairIdx
].
globalCommonEntIdx
)
{
pairData_
[
pairIdx
].
outerParallelFaceDofIdx
=
gridView_
.
indexSet
().
subIndex
(
neighbor
,
neighborIs
.
indexInInside
(),
dim
-
1
)
+
offset_
;
pairData_
[
pairIdx
].
outerParallelElementDofIdx
=
gridView_
.
indexSet
().
index
(
neighbor
);
}
}
}
}
}
}
}
}
}
}
private
:
/*!
/*!
* \brief Returns the local opposing intersection index
* \brief Returns the local opposing intersection index
*
*
...
@@ -239,7 +273,7 @@ private:
...
@@ -239,7 +273,7 @@ private:
* \param selfIdx The local index of the intersection itself
* \param selfIdx The local index of the intersection itself
* \param otherIdx The local index of the other intersection
* \param otherIdx The local index of the other intersection
*/
*/
bool
neighborIntersection
Normal
Side
_
(
const
int
selfIdx
,
const
int
otherIdx
)
const
bool
facetIs
Normal_
(
const
int
selfIdx
,
const
int
otherIdx
)
const
{
{
return
!
(
selfIdx
==
otherIdx
||
localOppositeIdx_
(
selfIdx
)
==
otherIdx
);
return
!
(
selfIdx
==
otherIdx
||
localOppositeIdx_
(
selfIdx
)
==
otherIdx
);
};
};
...
@@ -250,7 +284,7 @@ private:
...
@@ -250,7 +284,7 @@ private:
* \param localIdx The local index of the common entity
* \param localIdx The local index of the common entity
* \param element The element
* \param element The element
*/
*/
int
localToGlobalEntityIdx_
(
const
int
localIdx
,
const
Element
&
element
)
const
int
localToGlobal
Common
EntityIdx_
(
const
int
localIdx
,
const
Element
&
element
)
const
{
{
return
this
->
gridView_
.
indexSet
().
subIndex
(
element
,
localIdx
,
codimCommonEntity
);
return
this
->
gridView_
.
indexSet
().
subIndex
(
element
,
localIdx
,
codimCommonEntity
);
};
};
...
...
This diff is collapsed.
Click to expand it.
dumux/freeflow/staggered/fluxvariables.hh
+
24
−
25
View file @
80fb8768
...
@@ -112,18 +112,15 @@ public:
...
@@ -112,18 +112,15 @@ public:
const
SubControlVolumeFace
&
scvFace
)
const
SubControlVolumeFace
&
scvFace
)
{
{
Stencil
cellCenterStencil
;
Stencil
cellCenterStencil
;
// the cell center dof indices
cellCenterStencil
.
push_back
(
scvFace
.
insideScvIdx
());
// the face dof indices
cellCenterStencil
.
push_back
(
scvFace
.
dofIndexSelf
());
if
(
!
scvFace
.
boundary
())
if
(
!
scvFace
.
boundary
())
{
// the cell center dof indices
cellCenterStencil
.
push_back
(
scvFace
.
insideScvIdx
());
cellCenterStencil
.
push_back
(
scvFace
.
outsideScvIdx
());
cellCenterStencil
.
push_back
(
scvFace
.
outsideScvIdx
());
// the face dof indices
cellCenterStencil
.
push_back
(
scvFace
.
dofIndexSelf
());
}
else
cellCenterStencil
.
push_back
(
scvFace
.
insideScvIdx
());
return
cellCenterStencil
;
return
cellCenterStencil
;
}
}
...
@@ -131,27 +128,29 @@ public:
...
@@ -131,27 +128,29 @@ public:
const
SubControlVolumeFace
&
scvFace
)
const
SubControlVolumeFace
&
scvFace
)
{
{
Stencil
faceStencil
;
Stencil
faceStencil
;
// normal element dof indices
faceStencil
.
push_back
(
scvFace
.
insideScvIdx
());
if
(
!
scvFace
.
boundary
())
if
(
!
scvFace
.
boundary
())
{
// the cell center dof indices normal to the face
faceStencil
.
push_back
(
scvFace
.
insideScvIdx
());
faceStencil
.
push_back
(
scvFace
.
outsideScvIdx
());
faceStencil
.
push_back
(
scvFace
.
outsideScvIdx
());
// the cell center dof indices parallel to the face
// the normal face dof indices
for
(
const
auto
&
data
:
scvFace
.
pairData
())
faceStencil
.
push_back
(
scvFace
.
dofIndexSelf
());
{
faceStencil
.
push_back
(
scvFace
.
dofIndexOpposite
());
faceStencil
.
push_back
(
data
.
outerParallelElementDofIdx
);
faceStencil
.
push_back
(
data
.
outerParallelFaceDofIdx
);
faceStencil
.
push_back
(
data
.
normalPair
.
first
);
faceStencil
.
push_back
(
data
.
normalPair
.
second
);
}
// the face dof indices
for
(
const
auto
&
data
:
scvFace
.
pairData
())
faceStencil
.
push_back
(
scvFace
.
dofIndexSelf
());
{
faceStencil
.
push_back
(
scvFace
.
dofIndexOpposite
());
const
auto
&
outerParallelElementDofIdx
=
data
.
outerParallelElementDofIdx
;
const
auto
&
outerParallelFaceDofIdx
=
data
.
outerParallelFaceDofIdx
;
if
(
outerParallelElementDofIdx
>=
0
)
faceStencil
.
push_back
(
outerParallelElementDofIdx
);
if
(
outerParallelFaceDofIdx
>=
0
)
faceStencil
.
push_back
(
outerParallelFaceDofIdx
);
faceStencil
.
push_back
(
data
.
normalPair
.
first
);
if
(
!
scvFace
.
boundary
())
faceStencil
.
push_back
(
data
.
normalPair
.
second
);
}
}
else
faceStencil
.
push_back
(
scvFace
.
dofIndexSelf
());
return
faceStencil
;
return
faceStencil
;
}
}
...
...
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