symmetryPlanePolyPatch.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2015 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
30#include "symmetryPolyPatch.H"
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
37
40}
41
42
43// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
44
46{
47 if (n_ == vector::rootMax)
48 {
49 if (returnReduce(size(), sumOp<label>()))
50 {
51 const vectorField& nf(faceNormals());
52 n_ = gAverage(nf);
53
54 if (debug)
55 {
56 Info<< "Patch " << name() << " calculated average normal "
57 << n_ << endl;
58 }
59
60
61 // Check the symmetry plane is planar
62 forAll(nf, facei)
63 {
64 if (magSqr(n_ - nf[facei]) > SMALL)
65 {
67 << "Symmetry plane '" << name() << "' is not planar."
68 << endl
69 << "At local face at "
71 << " the normal " << nf[facei]
72 << " differs from the average normal " << n_
73 << " by " << magSqr(n_ - nf[facei]) << endl
74 << "Either split the patch into planar parts"
75 << " or use the " << symmetryPolyPatch::typeName
76 << " patch type"
77 << exit(FatalError);
78 }
79 }
80 }
81 }
82}
83
84
85// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
86
88(
89 const word& name,
90 const label size,
91 const label start,
92 const label index,
93 const polyBoundaryMesh& bm,
94 const word& patchType
95)
96:
97 polyPatch(name, size, start, index, bm, patchType),
98 n_(vector::rootMax)
99{}
100
101
103(
104 const word& name,
105 const dictionary& dict,
106 const label index,
107 const polyBoundaryMesh& bm,
108 const word& patchType
109)
110:
111 polyPatch(name, dict, index, bm, patchType),
112 n_(vector::rootMax)
113{}
114
115
117(
118 const symmetryPlanePolyPatch& pp,
119 const polyBoundaryMesh& bm
120)
121:
122 polyPatch(pp, bm),
123 n_(pp.n_)
124{}
125
126
128(
129 const symmetryPlanePolyPatch& pp,
130 const polyBoundaryMesh& bm,
131 const label index,
132 const label newSize,
133 const label newStart
134)
135:
136 polyPatch(pp, bm, index, newSize, newStart),
137 n_(pp.n_)
138{}
139
140
142(
143 const symmetryPlanePolyPatch& pp,
144 const polyBoundaryMesh& bm,
145 const label index,
146 const labelUList& mapAddressing,
147 const label newStart
148)
149:
150 polyPatch(pp, bm, index, mapAddressing, newStart),
151 n_(pp.n_)
152{}
153
154
155// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
const Field< point_type > & faceCentres() const
Return face centres for patch.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
void calcGeometry()
Calculate the geometry for the patches.
static const complex rootMax
complex (ROOTVGREAT, ROOTVGREAT)
Definition: complex.H:295
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
Type gAverage(const FieldField< Field, Type > &f)
error FatalError
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
static const char *const typeName
The type name used in ensight case files.