wedgeFaPatch.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) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
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 
28 #include "wedgeFaPatch.H"
30 #include "faBoundaryMesh.H"
31 #include "wedgePolyPatch.H"
32 #include "polyMesh.H"
33 #include "faMesh.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39  defineTypeNameAndDebug(wedgeFaPatch, 0);
40  addToRunTimeSelectionTable(faPatch, wedgeFaPatch, dictionary);
41 }
42 
43 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
44 
45 void Foam::wedgeFaPatch::findAxisPoint() const
46 {
47  // Find axis point
48 
49  const labelList& ptLabels = pointLabels();
50 
51  const labelListList& ptEdges = pointEdges();
52 
53  const vectorField& points = boundaryMesh().mesh().points();
54 
55  const scalarField& magL = magEdgeLengths();
56 
57  forAll(ptEdges, pointI)
58  {
59  if (ptEdges[pointI].size() == 1)
60  {
61  scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]);
62 
63  if (r < magL[ptEdges[pointI][0]])
64  {
65  axisPoint_ = ptLabels[pointI];
66  break;
67  }
68  }
69  }
70 
71  axisPointChecked_ = true;
72 }
73 
74 
75 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
76 
78 (
79  const word& name,
80  const dictionary& dict,
81  const label index,
82  const faBoundaryMesh& bm
83 )
84 :
85  faPatch(name, dict, index, bm),
86  wedgePolyPatchPtr_(nullptr),
87  axisPoint_(-1),
88  axisPointChecked_(false)
89 {
90  if (ngbPolyPatchIndex() == -1)
91  {
93  << "Neighbour polyPatch index is not specified for faPatch "
94  << this->name() << exit(FatalError);
95  }
96 
97  if (isA<wedgePolyPatch>(bm.mesh()().boundaryMesh()[ngbPolyPatchIndex()]))
98  {
99  const wedgePolyPatch& wedge =
100  refCast<const wedgePolyPatch>
101  (
102  bm.mesh()().boundaryMesh()[ngbPolyPatchIndex()]
103  );
104 
105  wedgePolyPatchPtr_ = &wedge;
106  }
107  else
108  {
110  << "Neighbour polyPatch is not of type "
111  << wedgePolyPatch::typeName
112  << exit(FatalError);
113  }
114 }
115 
116 
117 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::faPatch::pointEdges
const labelListList & pointEdges() const
Return patch point-edge addressing.
Definition: faPatch.C:231
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::wedgePolyPatch
Wedge front and back plane patch.
Definition: wedgePolyPatch.H:50
wedgePolyPatch.H
faMesh.H
polyMesh.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::faBoundaryMesh
Finite area boundary mesh.
Definition: faBoundaryMesh.H:66
Foam::faPatch::boundaryMesh
const faBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: faPatch.C:126
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
faBoundaryMesh.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::faMesh::points
const pointField & points() const
Return mesh points.
Definition: faMesh.C:953
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::faBoundaryMesh::mesh
const faMesh & mesh() const
Return the mesh reference.
Definition: faBoundaryMesh.C:195
Foam::faPatch::pointLabels
const labelList & pointLabels() const
Return patch point labels.
Definition: faPatch.C:138
Foam::labelListList
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
Foam::wedgeFaPatch::axis
const vector & axis() const
Return axis of the wedge.
Definition: wedgeFaPatch.H:98
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::faPatch::magEdgeLengths
const scalarField & magEdgeLengths() const
Return edge length magnitudes.
Definition: faPatch.C:392
Foam::wedgeFaPatch::wedgeFaPatch
wedgeFaPatch(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm)
Construct from dictionary.
Definition: wedgeFaPatch.C:78
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:68
wedgeFaPatch.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::I
static const Identity< scalar > I
Definition: Identity.H:95
Foam::faPatch::size
virtual label size() const
Patch size.
Definition: faPatch.H:249