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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "wedgeFaPatch.H"
31 #include "faBoundaryMesh.H"
32 #include "wedgePolyPatch.H"
33 #include "polyMesh.H"
34 #include "faMesh.H"
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  defineTypeNameAndDebug(wedgeFaPatch, 0);
41  addToRunTimeSelectionTable(faPatch, wedgeFaPatch, dictionary);
42 }
43 
44 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
45 
46 void Foam::wedgeFaPatch::findAxisPoint() const
47 {
48  // Find axis point
49 
50  const labelList& ptLabels = pointLabels();
51 
52  const labelListList& ptEdges = pointEdges();
53 
54  const vectorField& points = boundaryMesh().mesh().points();
55 
56  const scalarField& magL = magEdgeLengths();
57 
58  forAll(ptEdges, pointI)
59  {
60  if (ptEdges[pointI].size() == 1)
61  {
62  scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]);
63 
64  if (r < magL[ptEdges[pointI][0]])
65  {
66  axisPoint_ = ptLabels[pointI];
67  break;
68  }
69  }
70  }
71 
72  axisPointChecked_ = true;
73 }
74 
75 
76 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
77 
79 (
80  const word& name,
81  const dictionary& dict,
82  const label index,
83  const faBoundaryMesh& bm
84 )
85 :
86  faPatch(name, dict, index, bm),
87  wedgePolyPatchPtr_(nullptr),
88  axisPoint_(-1),
89  axisPointChecked_(false)
90 {
91  if (ngbPolyPatchIndex() < 0)
92  {
94  << "Neighbour polyPatch index is not specified for faPatch "
95  << this->name() << exit(FatalError);
96  }
97 
98  const auto* wedgePtr = isA<wedgePolyPatch>
99  (
100  bm.mesh()().boundaryMesh()[ngbPolyPatchIndex()]
101  );
102 
103  if (wedgePtr)
104  {
105  wedgePolyPatchPtr_ = wedgePtr;
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:67
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:213
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
wedgePolyPatch.H
faMesh.H
polyMesh.H
Foam::faPatch::boundaryMesh
const faBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
Definition: faPatch.C:120
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:65
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::faBoundaryMesh::mesh
const faMesh & mesh() const noexcept
Return the mesh reference.
Definition: faBoundaryMesh.H:125
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:123
faBoundaryMesh.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::faMesh::points
const pointField & points() const
Return local patch points.
Definition: faMeshI.H:86
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::faPatch::pointLabels
const labelList & pointLabels() const
Return patch point labels.
Definition: faPatch.C:202
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:453
Foam::faPatch::magEdgeLengths
const scalarField & magEdgeLengths() const
Return edge length magnitudes.
Definition: faPatch.C:384
Foam::wedgeFaPatch::wedgeFaPatch
wedgeFaPatch(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm)
Construct from dictionary.
Definition: wedgeFaPatch.C:79
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
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:69
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 is the number of edge labels.
Definition: faPatch.H:264