mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
faceZone derived
This commit is contained in:
@ -29,6 +29,10 @@ License
|
|||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "fvMatrices.H"
|
#include "fvMatrices.H"
|
||||||
|
#include "PackedList.H"
|
||||||
|
#include "syncTools.H"
|
||||||
|
|
||||||
|
#include "faceSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -39,12 +43,15 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
|
|||||||
dict_(is),
|
dict_(is),
|
||||||
cellZoneID_(mesh_.cellZones().findZoneID(name_)),
|
cellZoneID_(mesh_.cellZones().findZoneID(name_)),
|
||||||
faceZoneID_(mesh_.faceZones().findZoneID(name_)),
|
faceZoneID_(mesh_.faceZones().findZoneID(name_)),
|
||||||
|
outsideFaces_(0),
|
||||||
patchNames_(dict_.lookup("patches")),
|
patchNames_(dict_.lookup("patches")),
|
||||||
origin_(dict_.lookup("origin")),
|
origin_(dict_.lookup("origin")),
|
||||||
axis_(dict_.lookup("axis")),
|
axis_(dict_.lookup("axis")),
|
||||||
omega_(dict_.lookup("omega")),
|
omega_(dict_.lookup("omega")),
|
||||||
Omega_("Omega", omega_*axis_)
|
Omega_("Omega", omega_*axis_)
|
||||||
{
|
{
|
||||||
|
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||||
|
|
||||||
axis_ = axis_/mag(axis_);
|
axis_ = axis_/mag(axis_);
|
||||||
Omega_ = omega_*axis_;
|
Omega_ = omega_*axis_;
|
||||||
|
|
||||||
@ -65,18 +72,78 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
|
|||||||
|
|
||||||
if (!faceZoneFound)
|
if (!faceZoneFound)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"Foam::MRFZone::MRFZone(const fvMesh& , const dictionary&)"
|
"Foam::MRFZone::MRFZone(const fvMesh& , const dictionary&)"
|
||||||
) << "cannot find MRF faceZone " << name_
|
) << "cannot find MRF faceZone " << name_
|
||||||
<< exit(FatalError);
|
<< " ; taking faces on outside of cellZone."
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
// Determine faces in cell zone
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// (does not construct cells)
|
||||||
|
|
||||||
|
const labelList& own = mesh_.faceOwner();
|
||||||
|
const labelList& nei = mesh_.faceNeighbour();
|
||||||
|
|
||||||
|
// Cells in zone
|
||||||
|
PackedBoolList zoneCell(mesh_.nCells());
|
||||||
|
|
||||||
|
if (cellZoneID_ != -1)
|
||||||
|
{
|
||||||
|
const labelList& cellLabels = mesh_.cellZones()[cellZoneID_];
|
||||||
|
forAll(cellLabels, i)
|
||||||
|
{
|
||||||
|
zoneCell[cellLabels[i]] = 1u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Faces in zone
|
||||||
|
PackedBoolList zoneFacesSet(mesh_.nFaces());
|
||||||
|
|
||||||
|
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
zoneCell.get(own[faceI]) == 1u
|
||||||
|
|| zoneCell.get(nei[faceI]) == 1u
|
||||||
|
)
|
||||||
|
{
|
||||||
|
zoneFacesSet[faceI] = 1u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
syncTools::syncFaceList(mesh_, zoneFacesSet, orEqOp<unsigned int>());
|
||||||
|
|
||||||
|
|
||||||
|
// Transfer to labelList
|
||||||
|
label n = zoneFacesSet.count();
|
||||||
|
outsideFaces_.setSize(n);
|
||||||
|
n = 0;
|
||||||
|
forAll(zoneFacesSet, faceI)
|
||||||
|
{
|
||||||
|
if (zoneFacesSet.get(faceI) == 1u)
|
||||||
|
{
|
||||||
|
outsideFaces_[n++] = faceI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< "MRFZone " << name_ << " : found "
|
||||||
|
<< returnReduce(outsideFaces_.size(), sumOp<label>())
|
||||||
|
<< " faces inside cellZone." << endl;
|
||||||
|
|
||||||
|
|
||||||
|
// Flag use of outsideFaces
|
||||||
|
faceZoneID_ = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
patchLabels_.setSize(patchNames_.size());
|
patchLabels_.setSize(patchNames_.size());
|
||||||
|
|
||||||
forAll(patchNames_, i)
|
forAll(patchNames_, i)
|
||||||
{
|
{
|
||||||
patchLabels_[i] = mesh_.boundaryMesh().findPatchID(patchNames_[i]);
|
patchLabels_[i] = patches.findPatchID(patchNames_[i]);
|
||||||
|
|
||||||
if (patchLabels_[i] == -1)
|
if (patchLabels_[i] == -1)
|
||||||
{
|
{
|
||||||
@ -125,7 +192,13 @@ void Foam::MRFZone::relativeFlux(surfaceScalarField& phi) const
|
|||||||
const vector& origin = origin_.value();
|
const vector& origin = origin_.value();
|
||||||
const vector& Omega = Omega_.value();
|
const vector& Omega = Omega_.value();
|
||||||
|
|
||||||
const labelList& faces = mesh_.faceZones()[faceZoneID_];
|
// Use either zone faces or outsideFaces_
|
||||||
|
const labelList& faces =
|
||||||
|
(
|
||||||
|
faceZoneID_ == -2
|
||||||
|
? outsideFaces_
|
||||||
|
: mesh_.faceZones()[faceZoneID_]
|
||||||
|
);
|
||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::MRFZone
|
Foam::MRFZone
|
||||||
|
|
||||||
Description
|
Description
|
||||||
MRF zone definition based on both cell and face zones and parameters
|
MRF zone definition based on cell zone and optional face zone and parameters
|
||||||
obtained from a control dictionary constructed from the given stream.
|
obtained from a control dictionary constructed from the given stream.
|
||||||
|
|
||||||
The rotation of the MRF region is defined by an origin and axis of
|
The rotation of the MRF region is defined by an origin and axis of
|
||||||
@ -68,18 +68,26 @@ class MRFZone
|
|||||||
|
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
word name_;
|
const word name_;
|
||||||
|
|
||||||
dictionary dict_;
|
const dictionary dict_;
|
||||||
|
|
||||||
label cellZoneID_;
|
label cellZoneID_;
|
||||||
|
|
||||||
|
//- label of face zone with faces on outside of cell zone.
|
||||||
|
// If -2 determines outside faces itself
|
||||||
label faceZoneID_;
|
label faceZoneID_;
|
||||||
wordList patchNames_;
|
|
||||||
|
//- outside faces (only if faceZoneID = -2)
|
||||||
|
labelList outsideFaces_;
|
||||||
|
|
||||||
|
|
||||||
|
const wordList patchNames_;
|
||||||
labelList patchLabels_;
|
labelList patchLabels_;
|
||||||
|
|
||||||
dimensionedVector origin_;
|
const dimensionedVector origin_;
|
||||||
dimensionedVector axis_;
|
dimensionedVector axis_;
|
||||||
dimensionedScalar omega_;
|
const dimensionedScalar omega_;
|
||||||
dimensionedVector Omega_;
|
dimensionedVector Omega_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user