Go to the documentation of this file.
62 if (isA<wedgePolyPatch>(
patches[patchI]))
67 refCast<const wedgePolyPatch>(
patches[patchI]);
76 Pout<<
"Found normal from wedge patch " << patchI;
88 if (isA<emptyPolyPatch>(
patches[patchI]) &&
patches[patchI].size())
90 pn =
patches[patchI].faceAreas()[0];
94 Pout<<
"Found normal from empty patch " << patchI;
103 if (
mag(pn) < VSMALL)
106 <<
"Cannot determine normal vector from patches."
116 Pout<<
" twoDPointCorrector normal: " << pn <<
endl;
127 label nNormalEdges = 0;
131 const edge&
e = meshEdges[edgeI];
133 vector edgeVector =
e.vec(meshPoints)/(
e.mag(meshPoints) + VSMALL);
138 neIndices[nNormalEdges++] = edgeI;
142 neIndices.
setSize(nNormalEdges);
149 if (meshPoints.size() % 2 != 0)
152 <<
"the number of vertices in the geometry "
153 <<
"is odd - this should not be the case for a 2-D case. "
154 <<
"Please check the geometry."
158 if (2*nNormalEdges != meshPoints.size())
161 <<
"The number of points in the mesh is "
162 <<
"not equal to twice the number of edges normal to the plane "
163 <<
"- this may be OK only for wedge geometries.\n"
164 <<
" Please check the geometry or adjust "
165 <<
"the orthogonality tolerance.\n" <<
endl
166 <<
"Number of normal edges: " << nNormalEdges
167 <<
" number of points: " << meshPoints.size()
188 scalar ADash =
mag(
A - wedgeAxis_*(wedgeAxis_ &
A));
189 vector pDash = ADash*
tan(wedgeAngle_)*planeNormal();
200 required_(mesh_.nGeometricD() == 2),
201 planeNormalPtr_(NULL),
202 normalEdgeIndicesPtr_(NULL),
222 const vector& pn = planeNormal();
224 if (
mag(pn.
x()) >= edgeOrthogonalityTol)
228 else if (
mag(pn.
y()) >= edgeOrthogonalityTol)
232 else if (
mag(pn.
z()) >= edgeOrthogonalityTol)
239 <<
"Plane normal not aligned with the coordinate system" <<
nl
250 if (!planeNormalPtr_)
255 return *planeNormalPtr_;
261 if (!normalEdgeIndicesPtr_)
266 return *normalEdgeIndicesPtr_;
272 if (!required_)
return;
280 const edgeList& meshEdges = mesh_.edges();
282 const labelList& neIndices = normalEdgeIndices();
283 const vector& pn = planeNormal();
287 point& pStart =
p[meshEdges[neIndices[edgeI]].start()];
289 point& pEnd =
p[meshEdges[neIndices[edgeI]].end()];
292 point A = 0.5*(pStart + pEnd);
297 snapToWedge(pn,
A, pStart);
298 snapToWedge(pn,
A, pEnd);
303 pStart =
A + pn*(pn & (pStart -
A));
304 pEnd =
A + pn*(pn & (pEnd -
A));
316 if (!required_)
return;
324 const edgeList& meshEdges = mesh_.edges();
326 const labelList& neIndices = normalEdgeIndices();
327 const vector& pn = planeNormal();
331 const edge&
e = meshEdges[neIndices[edgeI]];
333 label startPointI =
e.start();
334 point pStart =
p[startPointI] + disp[startPointI];
336 label endPointI =
e.end();
337 point pEnd =
p[endPointI] + disp[endPointI];
340 point A = 0.5*(pStart + pEnd);
345 snapToWedge(pn,
A, pStart);
346 snapToWedge(pn,
A, pEnd);
347 disp[startPointI] = pStart -
p[startPointI];
348 disp[endPointI] = pEnd -
p[endPointI];
353 disp[startPointI] = (
A + pn*(pn & (pStart -
A))) -
p[startPointI];
354 disp[endPointI] = (
A + pn*(pn & (pEnd -
A))) -
p[endPointI];
virtual const pointField & points() const
Return raw points.
void snapToWedge(const vector &n, const point &A, point &p) const
Snap a point to the wedge patch(es)
dimensionedScalar tan(const dimensionedScalar &ds)
List< label > labelList
A List of labels.
Wedge front and back plane patch.
const vector & planeNormal() const
Return plane normal.
#define forAll(list, i)
Loop across all elements in list.
void correctDisplacement(const pointField &p, vectorField &disp) const
Correct motion displacements.
~twoDPointCorrector()
Destructor.
bool isWedge_
Flag to indicate a wedge geometry.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void clearAddressing() const
Clear addressing.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar sign(const dimensionedScalar &ds)
void calcAddressing() const
Calculate addressing.
labelList * normalEdgeIndicesPtr_
Indices of edges normal to plane.
Mesh consisting of general polyhedral cells.
simpleMatrix< scalar > A(Nc)
void deleteDemandDrivenData(DataPtr &dataPtr)
Class applies a two-dimensional correction to mesh motion point field.
const vector & axis() const
Return axis of the wedge.
scalar wedgeAngle_
Wedge angle (if wedge geometry)
vector wedgeAxis_
Wedge axis (if wedge geometry)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
twoDPointCorrector(const twoDPointCorrector &)
Disallow default bitwise copy construct.
vector * planeNormalPtr_
2-D plane unit normal
errorManip< error > abort(error &err)
const double e
Elementary charge.
Vector< scalar > vector
A scalar version of the templated Vector.
void setSize(const label)
Reset size of List.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar acos(const dimensionedScalar &ds)
static const scalar edgeOrthogonalityTol
Edge orthogonality tolerance.
const dimensionedScalar e
Elementary charge.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
bool movePoints()
Correct weighting factors for moving mesh.
scalar cosAngle() const
Return the cosine of the wedge angle.
const labelList & normalEdgeIndices() const
Return indices of normal edges.
void correctPoints(pointField &p) const
Correct motion points.
direction normalDir() const
Return direction normal to plane.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
void updateMesh(const mapPolyMesh &)
Update topology.
const vector & centreNormal() const
Return plane normal between the wedge boundaries.
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...