Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
da03b803
Commit
da03b803
authored
Oct 12, 2017
by
Will Bainbridge
Committed by
Andrew Heather
Oct 12, 2017
Browse files
ENH: fvMeshSubset: Added coupled patch handling for small subsets
parent
a45b422b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/dynamicMesh/fvMeshSubset/fvMeshSubset.C
View file @
da03b803
...
...
@@ -91,10 +91,11 @@ void Foam::fvMeshSubset::markPoints
void
Foam
::
fvMeshSubset
::
doCoupledPatches
(
const
bool
syncPar
,
Map
<
label
>&
facesToSubset
,
labelList
&
nCellsUsingFace
)
const
{
// Synchronize
nCellsUsingFace
on both sides of coupled patches.
// Synchronize
facesToSubset
on both sides of coupled patches.
// Marks faces that become 'uncoupled' with 3.
const
polyBoundaryMesh
&
oldPatches
=
baseMesh
().
boundaryMesh
();
...
...
@@ -117,8 +118,31 @@ void Foam::fvMeshSubset::doCoupledPatches
UOPstream
toNeighbour
(
procPatch
.
neighbProcNo
(),
pBufs
);
toNeighbour
<<
SubList
<
label
>
(
nCellsUsingFace
,
pp
.
size
(),
pp
.
start
());
if
(
!
facesToSubset
.
empty
())
{
DynamicList
<
label
>
patchFacesToSubset
;
forAll
(
pp
,
i
)
{
if
(
facesToSubset
.
found
(
pp
.
start
()
+
i
)
&&
facesToSubset
[
pp
.
start
()
+
i
]
==
1
)
{
patchFacesToSubset
.
append
(
i
);
}
}
toNeighbour
<<
patchFacesToSubset
;
}
else
if
(
!
nCellsUsingFace
.
empty
())
{
toNeighbour
<<
SubList
<
label
>
(
nCellsUsingFace
,
pp
.
size
(),
pp
.
start
());
}
else
{
toNeighbour
<<
labelList
();
}
}
}
...
...
@@ -136,22 +160,49 @@ void Foam::fvMeshSubset::doCoupledPatches
UIPstream
fromNeighbour
(
procPatch
.
neighbProcNo
(),
pBufs
);
labelList
nbr
CellsUsingFace
(
fromNeighbour
);
const
labelList
nbr
List
(
fromNeighbour
);
// Combine with this side.
forAll
(
pp
,
i
)
if
(
!
facesToSubset
.
empty
()
)
{
if
(
nCellsUsingFace
[
pp
.
start
()
+
i
]
==
1
&&
nbrCellsUsingFace
[
i
]
==
0
)
const
labelHashSet
nbrPatchFacesToSubset
(
nbrList
);
forAll
(
pp
,
i
)
{
// Face's neighbour is no longer there. Mark face off
// as coupled
nCellsUsingFace
[
pp
.
start
()
+
i
]
=
3
;
nUncoupled
++
;
if
(
facesToSubset
.
found
(
pp
.
start
()
+
i
)
&&
facesToSubset
[
pp
.
start
()
+
i
]
==
1
&&
!
nbrPatchFacesToSubset
.
found
(
i
)
)
{
// Face's neighbour is no longer there. Mark face
// off as coupled
facesToSubset
[
pp
.
start
()
+
i
]
=
3
;
nUncoupled
++
;
}
}
}
else
if
(
!
nCellsUsingFace
.
empty
())
{
const
labelList
&
nbrCellsUsingFace
(
nbrList
);
// Combine with this side.
forAll
(
pp
,
i
)
{
if
(
nCellsUsingFace
[
pp
.
start
()
+
i
]
==
1
&&
nbrCellsUsingFace
[
i
]
==
0
)
{
// Face's neighbour is no longer there. Mark face
// off as coupled
nCellsUsingFace
[
pp
.
start
()
+
i
]
=
3
;
nUncoupled
++
;
}
}
}
}
...
...
@@ -168,19 +219,41 @@ void Foam::fvMeshSubset::doCoupledPatches
const
cyclicPolyPatch
&
cycPatch
=
refCast
<
const
cyclicPolyPatch
>
(
pp
);
forAll
(
cycPatch
,
i
)
if
(
!
facesToSubset
.
empty
())
{
forAll
(
cycPatch
,
i
)
{
label
thisFacei
=
cycPatch
.
start
()
+
i
;
label
otherFacei
=
cycPatch
.
transformGlobalFace
(
thisFacei
);
if
(
facesToSubset
.
found
(
thisFacei
)
&&
facesToSubset
[
thisFacei
]
==
1
&&
!
facesToSubset
.
found
(
otherFacei
)
)
{
facesToSubset
[
thisFacei
]
=
3
;
nUncoupled
++
;
}
}
}
else
if
(
!
nCellsUsingFace
.
empty
())
{
label
thisFacei
=
cycPatch
.
start
()
+
i
;
label
otherFacei
=
cycPatch
.
transformGlobalFace
(
thisFacei
);
if
(
nCellsUsingFace
[
thisFacei
]
==
1
&&
nCellsUsingFace
[
otherFacei
]
==
0
)
forAll
(
cycPatch
,
i
)
{
nCellsUsingFace
[
thisFacei
]
=
3
;
nUncoupled
++
;
label
thisFacei
=
cycPatch
.
start
()
+
i
;
label
otherFacei
=
cycPatch
.
transformGlobalFace
(
thisFacei
);
if
(
nCellsUsingFace
[
thisFacei
]
==
1
&&
nCellsUsingFace
[
otherFacei
]
==
0
)
{
nCellsUsingFace
[
thisFacei
]
=
3
;
nUncoupled
++
;
}
}
}
}
...
...
@@ -407,7 +480,8 @@ Foam::fvMeshSubset::fvMeshSubset(const fvMesh& baseMesh)
void
Foam
::
fvMeshSubset
::
setCellSubset
(
const
labelHashSet
&
globalCellMap
,
const
label
patchID
const
label
patchID
,
const
bool
syncPar
)
{
// Initial check on patches before doing anything time consuming.
...
...
@@ -473,6 +547,10 @@ void Foam::fvMeshSubset::setCellSubset
}
}
// Handle coupled faces. Modifies patch faces to be uncoupled to 3.
labelList
empty
;
doCoupledPatches
(
syncPar
,
facesToSubset
,
empty
);
// Mark all used points and make a global-to-local face map
Map
<
label
>
globalFaceMap
(
facesToSubset
.
size
());
...
...
@@ -536,13 +614,19 @@ void Foam::fvMeshSubset::setCellSubset
}
}
// 3. old internal faces
// 3. old internal faces
and uncoupled faces
forAll
(
facesToc
,
intFacei
)
{
if
(
baseMesh
().
isInternalFace
(
facesToc
[
intFacei
])
&&
facesToSubset
[
facesToc
[
intFacei
]]
==
1
(
baseMesh
().
isInternalFace
(
facesToc
[
intFacei
])
&&
facesToSubset
[
facesToc
[
intFacei
]]
==
1
)
||
(
!
baseMesh
().
isInternalFace
(
facesToc
[
intFacei
])
&&
facesToSubset
[
facesToc
[
intFacei
]]
==
3
)
)
{
// Mark face and increment number of points in set
...
...
@@ -665,6 +749,11 @@ void Foam::fvMeshSubset::setCellSubset
// Update count for patch
boundaryPatchSizes
[
oldInternalPatchID
]
++
;
}
else
if
(
facesToSubset
[
oldFacei
]
==
3
)
{
// Uncoupled face. Increment the old patch.
boundaryPatchSizes
[
oldInternalPatchID
]
++
;
}
else
{
// Boundary face. Increment the appropriate patch
...
...
@@ -734,6 +823,7 @@ void Foam::fvMeshSubset::setCellSubset
label
nNewPatches
=
0
;
label
patchStart
=
nInternalFaces
;
forAll
(
oldPatches
,
patchi
)
{
if
(
boundaryPatchSizes
[
patchi
]
>
0
)
...
...
@@ -888,7 +978,8 @@ void Foam::fvMeshSubset::setLargeCellSubset
faceMap_
.
setSize
(
nFacesInSet
);
// Handle coupled faces. Modifies patch faces to be uncoupled to 3.
doCoupledPatches
(
syncPar
,
nCellsUsingFace
);
Map
<
label
>
empty
;
doCoupledPatches
(
syncPar
,
empty
,
nCellsUsingFace
);
// See which patch to use for exposed internal faces.
...
...
src/dynamicMesh/fvMeshSubset/fvMeshSubset.H
View file @
da03b803
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
6
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
7
OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
...
...
@@ -115,6 +115,7 @@ private:
void
doCoupledPatches
(
const
bool
syncPar
,
Map
<
label
>&
facesToSubset
,
labelList
&
nCellsUsingFace
)
const
;
...
...
@@ -161,7 +162,8 @@ public:
void
setCellSubset
(
const
labelHashSet
&
globalCellMap
,
const
label
patchID
=
-
1
const
label
patchID
=
-
1
,
const
bool
syncPar
=
true
);
//- Set the subset from all cells with region == currentRegion.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment