Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Development
openfoam
Commits
25551b23
Commit
25551b23
authored
1 year ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
BUG: faceZoneSet: allow construction of faceZone. Fixes #2024
parent
73b6ddd7
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!695
OpenFOAM v2406
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/meshTools/topoSet/topoSets/faceZoneSet.C
+77
-76
77 additions, 76 deletions
src/meshTools/topoSet/topoSets/faceZoneSet.C
with
77 additions
and
76 deletions
src/meshTools/topoSet/topoSets/faceZoneSet.C
+
77
−
76
View file @
25551b23
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
\\/ M anipulation |
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2022
,2024
OpenCFD Ltd.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
License
License
This file is part of OpenFOAM.
This file is part of OpenFOAM.
...
@@ -78,6 +78,14 @@ Foam::faceZoneSet::faceZoneSet
...
@@ -78,6 +78,14 @@ Foam::faceZoneSet::faceZoneSet
const
faceZoneMesh
&
faceZones
=
mesh
.
faceZones
();
const
faceZoneMesh
&
faceZones
=
mesh
.
faceZones
();
label
zoneID
=
faceZones
.
findZoneID
(
name
);
label
zoneID
=
faceZones
.
findZoneID
(
name
);
if
(
IOobjectOption
::
isReadRequired
(
rOpt
)
&&
zoneID
==
-
1
)
{
FatalErrorInFunction
<<
"Zone named "
<<
name
<<
" not found. "
<<
"List of available zone names: "
<<
faceZones
.
names
()
<<
exit
(
FatalError
);
}
if
if
(
(
IOobjectOption
::
isReadRequired
(
rOpt
)
IOobjectOption
::
isReadRequired
(
rOpt
)
...
@@ -227,8 +235,7 @@ void Foam::faceZoneSet::addSet(const topoSet& set)
...
@@ -227,8 +235,7 @@ void Foam::faceZoneSet::addSet(const topoSet& set)
forAll
(
zoneSet
.
addressing
(),
i
)
forAll
(
zoneSet
.
addressing
(),
i
)
{
{
label
facei
=
zoneSet
.
addressing
()[
i
];
const
label
facei
=
zoneSet
.
addressing
()[
i
];
const
auto
iter
=
faceToIndex
.
cfind
(
facei
);
const
auto
iter
=
faceToIndex
.
cfind
(
facei
);
if
(
iter
.
good
())
if
(
iter
.
good
())
...
@@ -315,57 +322,42 @@ void Foam::faceZoneSet::subtractSet(const topoSet& set)
...
@@ -315,57 +322,42 @@ void Foam::faceZoneSet::subtractSet(const topoSet& set)
void
Foam
::
faceZoneSet
::
sync
(
const
polyMesh
&
mesh
)
void
Foam
::
faceZoneSet
::
sync
(
const
polyMesh
&
mesh
)
{
{
// Make sure that the faceZone is consistent with the faceSet
// This routine serves two purposes
{
// 1. make sure that any previous faceZoneSet manipulation is
const
labelHashSet
zoneSet
(
addressing_
);
// consistent across coupled boundaries
// 2. push faceZone contents to faceSet (looses flip bit)
// Elements that are in zone but not faceSet, and
// elements that are in faceSet but not in zone
labelHashSet
badSet
(
*
this
^
zoneSet
);
const
label
nBad
=
returnReduce
(
badSet
.
size
(),
sumOp
<
label
>
());
if
(
nBad
)
{
WarningInFunction
<<
"Detected "
<<
nBad
<<
" faces that are in the faceZone but not"
<<
" in the faceSet or vice versa."
<<
" The faceZoneSet should only be manipulated"
<<
" using "
<<
setsToFaceZone
::
typeName
<<
" or "
<<
setToFaceZone
::
typeName
<<
endl
;
}
}
// Make sure that on coupled faces orientation is opposite. Pushes
// master orientation to slave in case of conflict.
// Collect all current zone info
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 0 : not in faceZone
// 0 : not in faceZone
// 1 : in faceZone and unflipped
// 1 : in faceZone and unflipped
//-1 : in faceZone and flipped
//-1 : in faceZone and flipped
const
label
UNFLIPPED
=
1
;
const
label
UNFLIPPED
=
1
;
const
label
FLIPPED
=
-
1
;
const
label
FLIPPED
=
-
1
;
labelList
myZoneFace
(
mesh
.
n
Boundary
Faces
(),
Zero
);
labelList
myZoneFace
(
mesh
.
nFaces
(),
Zero
);
forAll
(
addressing_
,
i
)
forAll
(
addressing_
,
i
)
{
{
const
label
bFacei
=
addressing_
[
i
]
-
mesh
.
nInternalFaces
();
const
label
facei
=
addressing_
[
i
];
myZoneFace
[
facei
]
=
if
(
bFacei
>=
0
)
(
{
flipMap_
[
i
]
if
(
flipMap_
[
i
])
?
FLIPPED
{
:
UNFLIPPED
myZoneFace
[
bFacei
]
=
FLIPPED
;
);
}
else
{
myZoneFace
[
bFacei
]
=
UNFLIPPED
;
}
}
}
}
labelList
neiZoneFace
(
myZoneFace
);
labelList
neiZoneFace
(
SubList
<
label
>
(
myZoneFace
,
mesh
.
nBoundaryFaces
(),
mesh
.
nInternalFaces
()
)
);
syncTools
::
swapBoundaryFaceList
(
mesh
,
neiZoneFace
);
syncTools
::
swapBoundaryFaceList
(
mesh
,
neiZoneFace
);
...
@@ -375,57 +367,66 @@ void Foam::faceZoneSet::sync(const polyMesh& mesh)
...
@@ -375,57 +367,66 @@ void Foam::faceZoneSet::sync(const polyMesh& mesh)
// Rebuild faceZone addressing and flipMap
// Rebuild faceZone addressing and flipMap
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DynamicList
<
label
>
newAddressing
(
addressing_
.
size
());
const
labelHashSet
&
set
=
*
this
;
DynamicList
<
bool
>
newFlipMap
(
flipMap_
.
size
());
forAll
(
addressing_
,
i
)
DynamicList
<
label
>
newAddressing
(
set
.
size
());
DynamicList
<
bool
>
newFlipMap
(
set
.
size
());
for
(
const
label
facei
:
set
)
{
{
const
label
facei
=
addressing_
[
i
];
// See if any info from original. If so maintain flipMap.
if
(
facei
<
mesh
.
nInternalFaces
())
if
(
facei
<
mesh
.
nInternalFaces
())
{
{
newAddressing
.
append
(
facei
);
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
flipMap_
[
i
]);
newFlipMap
.
append
(
myZoneFace
[
facei
]
==
FLIPPED
);
}
}
for
(
label
facei
=
mesh
.
nInternalFaces
();
facei
<
mesh
.
nFaces
();
facei
++
)
{
label
myStat
=
myZoneFace
[
facei
-
mesh
.
nInternalFaces
()];
label
neiStat
=
neiZoneFace
[
facei
-
mesh
.
nInternalFaces
()];
if
(
myStat
==
0
)
{
if
(
neiStat
==
UNFLIPPED
)
{
// Neighbour is unflipped so I am flipped
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
true
);
}
else
if
(
neiStat
==
FLIPPED
)
{
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
false
);
}
}
}
else
else
{
{
if
(
myStat
==
neiStat
)
const
label
myStat
=
myZoneFace
[
facei
];
const
label
neiStat
=
neiZoneFace
[
facei
-
mesh
.
nInternalFaces
()];
if
(
myStat
==
0
)
{
{
//
Conflict. masterFace wins
//
My face was not in zone. Check neighbour
newAddressing
.
append
(
facei
);
if
(
isMasterFace
[
facei
]
)
if
(
neiStat
==
UNFLIPPED
)
{
{
newFlipMap
.
append
(
myStat
==
FLIPPED
);
// Neighbour is unflipped so I am flipped
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
true
);
}
}
else
else
if
(
neiStat
==
FLIPPED
)
{
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
false
);
}
else
//if (neiStat == 0)
{
{
newFlipMap
.
append
(
neiStat
==
UNFLIPPED
);
// neighbour face not in zone either. Masterface decides.
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
!
isMasterFace
[
facei
]);
}
}
}
}
else
else
{
{
newAddressing
.
append
(
facei
);
if
(
myStat
==
neiStat
)
newFlipMap
.
append
(
myStat
==
FLIPPED
);
{
// Conflict. masterFace wins
newAddressing
.
append
(
facei
);
if
(
isMasterFace
[
facei
])
{
newFlipMap
.
append
(
myStat
==
FLIPPED
);
}
else
{
newFlipMap
.
append
(
neiStat
==
UNFLIPPED
);
}
}
else
{
newAddressing
.
append
(
facei
);
newFlipMap
.
append
(
myStat
==
FLIPPED
);
}
}
}
}
}
}
}
...
...
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