ENH: cellToFace: new selection option 'outside'
The new selection option 'outside' can be used to select faces with only one neighbour in the specified cellSet.
This commit is contained in:
parent
5fb0cd77f1
commit
c439968390
@ -48,11 +48,12 @@ namespace Foam
|
||||
Foam::topoSetSource::addToUsageTable Foam::cellToFace::usage_
|
||||
(
|
||||
cellToFace::typeName,
|
||||
"\n Usage: cellToFace <cellSet> all|both\n\n"
|
||||
"\n Usage: cellToFace <cellSet> all|both|outside\n\n"
|
||||
" Select -all : all faces of cells in the cellSet\n"
|
||||
" -both: faces where both neighbours are in the cellSet\n\n"
|
||||
);
|
||||
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::cellToFace::cellAction
|
||||
@ -61,6 +62,7 @@ Foam::cellToFace::cellActionNames_
|
||||
({
|
||||
{ cellAction::ALL, "all" },
|
||||
{ cellAction::BOTH, "both" },
|
||||
{ cellAction::OUTSIDE, "outside" }
|
||||
});
|
||||
|
||||
|
||||
@ -148,6 +150,65 @@ void Foam::cellToFace::combine
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (option_ == OUTSIDE)
|
||||
{
|
||||
// Add all faces where only one neighbour is in set.
|
||||
|
||||
const label nInt = mesh_.nInternalFaces();
|
||||
const labelList& own = mesh_.faceOwner();
|
||||
const labelList& nei = mesh_.faceNeighbour();
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
|
||||
// Check all internal faces
|
||||
for (label facei = 0; facei < nInt; ++facei)
|
||||
{
|
||||
if (cellLabels.found(own[facei]) != cellLabels.found(nei[facei]))
|
||||
{
|
||||
addOrDelete(set, facei, add);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get coupled cell status
|
||||
boolList neiInSet(mesh_.nBoundaryFaces(), false);
|
||||
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
if (pp.coupled())
|
||||
{
|
||||
label facei = pp.start();
|
||||
forAll(pp, i)
|
||||
{
|
||||
neiInSet[facei-nInt] = cellLabels.found(own[facei]);
|
||||
++facei;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh_, neiInSet);
|
||||
|
||||
|
||||
// Check all boundary faces
|
||||
for (const polyPatch& pp : patches)
|
||||
{
|
||||
label facei = pp.start();
|
||||
forAll(pp, i)
|
||||
{
|
||||
if (cellLabels.found(own[facei]) != neiInSet[facei-nInt])
|
||||
{
|
||||
addOrDelete(set, facei, add);
|
||||
}
|
||||
++facei;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Selected option is not available"
|
||||
<< ", option: " << cellActionNames_[option_]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,8 +33,8 @@ Description
|
||||
Operands:
|
||||
\table
|
||||
Operand | Type | Location
|
||||
input | cellSet(s) | $FOAM_CASE/constant/polyMesh/sets/\<set\>
|
||||
output | faceSet | $FOAM_CASE/constant/polyMesh/sets/\<set\>
|
||||
input | cellSet(s) | constant/polyMesh/sets/\<set\>
|
||||
output | faceSet | constant/polyMesh/sets/\<set\>
|
||||
\endtable
|
||||
|
||||
Usage
|
||||
@ -68,7 +68,7 @@ Usage
|
||||
|
||||
where the entries mean:
|
||||
\table
|
||||
Property | Description | Type | Req'd | Dflt
|
||||
Property | Description | Type | Reqd | Deflt
|
||||
name | Name of faceSet | word | yes | -
|
||||
type | Type name: faceSet | word | yes | -
|
||||
action | Action applied on faces - see below | word | yes | -
|
||||
@ -87,18 +87,20 @@ Usage
|
||||
\verbatim
|
||||
all | All faces of cells in the cellSet
|
||||
both | Faces where both neighbours are in the cellSet
|
||||
outside | Faces with only one neighbour in the cellSet
|
||||
\endverbatim
|
||||
|
||||
Options for the conditional mandatory entries:
|
||||
\verbatim
|
||||
Entry | Description | Type | Req'd | Dflt
|
||||
sets | Names of input cellSets | wordList | cond'l | -
|
||||
set | Name of input cellSet | word | cond'l | -
|
||||
Entry | Description | Type | Reqd | Deflt
|
||||
sets | Names of input cellSets | wordList | choice | -
|
||||
set | Name of input cellSet | word | choice | -
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The order of precedence among the conditional mandatory entries from the
|
||||
- The order of precedence among the conditional mandatory entries from the
|
||||
highest to the lowest is \c sets, and \c set.
|
||||
- The \c outside option applies to the cellSets individually.
|
||||
|
||||
See also
|
||||
- Foam::topoSetSource
|
||||
@ -109,8 +111,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellToFace_H
|
||||
#define cellToFace_H
|
||||
#ifndef Foam_cellToFace_H
|
||||
#define Foam_cellToFace_H
|
||||
|
||||
#include "topoSetFaceSource.H"
|
||||
#include "Enum.H"
|
||||
@ -121,7 +123,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellToFace Declaration
|
||||
Class cellToFace Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cellToFace
|
||||
@ -133,7 +135,8 @@ public:
|
||||
enum cellAction
|
||||
{
|
||||
ALL,
|
||||
BOTH
|
||||
BOTH,
|
||||
OUTSIDE
|
||||
};
|
||||
|
||||
|
||||
|
@ -303,6 +303,15 @@ actions
|
||||
set cylinder1;
|
||||
}
|
||||
|
||||
{
|
||||
name faceCell1c;
|
||||
type faceSet;
|
||||
action new;
|
||||
source cellToFace;
|
||||
option outside;
|
||||
set cylinder1;
|
||||
}
|
||||
|
||||
{
|
||||
name faceCylinder1;
|
||||
type faceSet;
|
||||
|
Loading…
Reference in New Issue
Block a user