48 bool Foam::wedgePolyPatch::isQuadFace(
const label facei)
const
55 if (
f.size() != 4)
return false;
60 for (
label fpj = fpi + 1; fpj <
f.size(); ++ fpj)
62 if (
f[fpi] ==
f[fpj])
return false;
70 bool Foam::wedgePolyPatch::isWedgeFace(
const label facei)
const
73 facei >= boundaryMesh().mesh().nInternalFaces()
74 && isA<wedgePolyPatch>
78 boundaryMesh().patchIndices()
80 facei - boundaryMesh().
mesh().nInternalFaces()
87 Foam::label Foam::wedgePolyPatch::oppositeWedgeFace(
const label thisFacei)
const
89 const polyMesh&
mesh = boundaryMesh().
mesh();
96 <<
"Wedge face not found opposite face " << thisFacei;
115 label midFacei = -1, midThisFaceEdgei = -1;
116 for (
label cfi = 0; cfi <
c.size() && midFacei == -1; ++ cfi)
118 const label facei =
c[cfi];
124 || !isQuadFace(facei)
125 || isWedgeFace(facei)
131 thisFei < thisF.size() && midFacei == -1;
135 const edge thisE = thisF.faceEdge(thisFei);
137 for (
label fei = 0; fei <
f.
size() && midFacei == -1; ++ fei)
139 const edge
e =
f.faceEdge(fei);
144 midThisFaceEdgei = fei;
150 if (midFacei == -1) error();
153 const label midOppFaceEdgei = (midThisFaceEdgei + 2) % 4;
154 const edge midOppE =
mesh.
faces()[midFacei].faceEdge(midOppFaceEdgei);
160 for (
label cfi = 0; cfi <
c.size() && oppFacei == -1; ++ cfi)
162 const label facei =
c[cfi];
169 || !isWedgeFace(facei)
172 for (
label fei = 0; fei <
f.
size() && oppFacei == -1; ++ fei)
174 const edge
e =
f.faceEdge(fei);
183 if (oppFacei == -1) error();
209 Info<<
"Patch " <<
name() <<
" calculated average normal "
228 if (maxDeltaN.
data.first() > small)
232 <<
"Wedge patch '" <<
name()
233 <<
"' may not be sufficiently planar" <<
nl;
235 wos <<
"At patch face #" << maxDeltaN.
elementi;
239 wos <<
" on processor #" << maxDeltaN.
proci;
242 wos <<
" with centre " << maxDeltaN.
data.second()
243 <<
" the normal " << maxDeltaN.
data.third()
244 <<
" differs from the average normal " << n_
245 <<
" by " << maxDeltaN.
data.first() <<
nl <<
endl;
255 centreNormal_ /=
mag(centreNormal_);
257 cosAngle_ = centreNormal_ & n_;
259 const scalar cnCmptSum =
260 centreNormal_.x() + centreNormal_.y() + centreNormal_.z();
262 if (
mag(cnCmptSum) < (1 - small))
265 <<
"wedge " <<
name()
266 <<
" centre plane does not align with a coordinate plane by "
267 << 1 -
mag(cnCmptSum)
271 axis_ = centreNormal_ ^ n_;
272 scalar magAxis =
mag(axis_);
277 <<
"wedge " <<
name()
278 <<
" plane aligns with a coordinate plane." <<
nl
279 <<
" The wedge plane should make a small angle (~2.5deg)"
280 " with the coordinate plane" <<
nl
281 <<
" and the pair of wedge planes should be symmetric"
282 <<
" about the coordinate plane." <<
nl
283 <<
" Normal of wedge plane is " << n_
284 <<
" , implied coordinate plane direction is " << centreNormal_
291 cellT_ = faceT_ & faceT_;
304 const word& patchType
309 centreNormal_(
vector::rootMax),
314 oppositePatchIndex_(-1)
324 const word& patchType
329 centreNormal_(
vector::rootMax),
334 oppositePatchIndex_(-1)
346 centreNormal_(pp.centreNormal_),
348 cosAngle_(pp.cosAngle_),
351 oppositePatchIndex_(-1)
364 polyPatch(pp, bm, index, newSize, newStart),
366 centreNormal_(pp.centreNormal_),
368 cosAngle_(pp.cosAngle_),
371 oppositePatchIndex_(-1)
379 if (oppositePatchIndex_ == -1)
383 oppositePatchIndex_ =
384 boundaryMesh().patchIndices()
386 oppositeWedgeFace(start())
387 - boundaryMesh().mesh().nInternalFaces()
394 return oppositePatchIndex_;
400 const polyPatch& pp = boundaryMesh()[oppositePatchIndex()];
401 return refCast<const wedgePolyPatch>(pp);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Field< PointType > & faceCentres() const
Return face centres for patch.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Struct for keeping processor, element (cell, face, point) and a piece of data. Used for finding minim...
A 3-tuple for storing three objects of different types.
static bool & parRun()
Is this a parallel run?
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static const Form rootMax
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
static int compare(const edge &, const edge &)
Compare edges.
const polyMesh & mesh() const
Return reference to polyMesh.
const polyMesh & mesh() const
Return the mesh reference.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
A patch is a list of labels that address the faces in the global face list.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const vectorField & faceCentres() const
const cellList & cells() const
label elementi
Element index.
label proci
Processor index.
Wedge front and back plane patch.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const wedgePolyPatch & oppositePatch() const
Return a reference to the opposite wedge patch.
wedgePolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
label oppositePatchIndex() const
Return the index of the opposite wedge patch.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from unit vector n1 to n2.
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
Ostream & endl(Ostream &os)
Add newline and flush stream.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Type gAverage(const FieldField< Field, Type > &f)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
void combineReduce(const List< UPstream::commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)