Loading...
Searching...
No Matches
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-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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 "faMesh.H"
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35namespace Foam
36{
39}
40
41// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
42
43void Foam::wedgeFaPatch::findAxisPoint() const
44{
45 // Find axis point
46
47 const labelList& ptLabels = pointLabels();
48
49 const labelListList& ptEdges = pointEdges();
50
52
53 const scalarField& magL = magEdgeLengths();
54
55 forAll(ptEdges, pointI)
56 {
57 if (ptEdges[pointI].size() == 1)
58 {
59 scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]);
60
61 if (r < magL[ptEdges[pointI][0]])
62 {
63 axisPoint_ = ptLabels[pointI];
64 break;
65 }
66 }
67 }
69 axisPointChecked_ = true;
70}
71
72
73// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
74
76(
77 const word& name,
78 const dictionary& dict,
79 const label index,
80 const faBoundaryMesh& bm,
81 const word& patchType
82)
83:
84 faPatch(name, dict, index, bm, patchType),
85 wedgePolyPatchPtr_(nullptr),
86 axisPoint_(-1),
87 axisPointChecked_(false)
88{
89 if (ngbPolyPatchIndex() < 0)
90 {
92 << "Neighbour polyPatch index is not specified for faPatch "
93 << this->name() << exit(FatalError);
94 }
95
96 wedgePolyPatchPtr_ = isA<wedgePolyPatch>
97 (
98 bm.mesh().mesh().boundaryMesh()[ngbPolyPatchIndex()]
99 );
100
101 if (!wedgePolyPatchPtr_)
102 {
104 << "Neighbour polyPatch is not of type "
105 << wedgePolyPatch::typeName
106 << exit(FatalError);
107 }
108}
109
110
111// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Finite area boundary mesh, which is a faPatch list with registered IO, a reference to the associated ...
const faMesh & mesh() const noexcept
Return the mesh reference.
const pointField & points() const
Return local points.
Definition faMeshI.H:60
static const faMesh & mesh(const polyMesh &pMesh)
The single-region finite-area region on the polyMesh. Uses lookupObject semantics - Fatal if non-exis...
Definition faMesh.C:164
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
virtual label size() const
Patch size is the number of edge labels, but can be overloaded.
Definition faPatch.H:392
const labelListList & pointEdges() const
Return patch point-edge addressing.
Definition faPatch.C:278
const labelList & pointLabels() const
Return patch point labels.
Definition faPatch.C:267
const scalarField & magEdgeLengths() const
Return edge length magnitudes, like the faMesh::magLe() method.
Definition faPatch.C:450
label ngbPolyPatchIndex() const noexcept
The neighbour polyPatch index.
Definition faPatch.H:359
friend class faBoundaryMesh
The faPatch geometry initialisation is called by faBoundaryMesh.
Definition faPatch.H:130
const faBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
Definition faPatch.C:174
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
Wedge front and back plane patch.
wedgeFaPatch(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm, const word &patchType)
Construct from dictionary.
const vector & axis() const noexcept
Return axis of the wedge.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
const pointField & points
Namespace for OpenFOAM.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
static const Identity< scalar > I
Definition Identity.H:100
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299