nonConformalFvPatch.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "nonConformalFvPatch.H"
27 #include "surfaceFields.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(nonConformalFvPatch, 0);
34 }
35 
36 
37 // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
38 
40 (
41  const fvPatch& patch
42 )
43 :
44  patch_(patch),
45  nonConformalPolyPatch_(refCast<const nonConformalPolyPatch>(patch.patch())),
46  faceCells_()
47 {}
48 
49 
50 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
51 
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
60 {
61  return nonConformalPolyPatch_;
62 }
63 
64 
66 {
67  return nonConformalPolyPatch_.origPatchName();
68 }
69 
70 
72 {
73  return nonConformalPolyPatch_.origPatchID();
74 }
75 
76 
78 {
79  return patch_.boundaryMesh()[origPatchID()];
80 }
81 
82 
84 {
85  const fvMesh& mesh = patch_.boundaryMesh().mesh();
86 
87  return
88  mesh.conformal()
89  ? labelList::null()
90  : mesh.polyFacesBf()[patch_.index()];
91 }
92 
93 
95 {
96  if (size())
97  {
99  << "The start face is not defined for a " << typeName
100  << " patch with a non-zero number of faces"
101  << exit(FatalError);
102  }
103 
104  return patch_.patch().start();
105 }
106 
107 
109 {
110  return polyFaces().size();
111 }
112 
113 
115 {
116  // !!! This needs an update mechanism, rather than re-calculating the
117  // face-cells every time
118 
119  const fvMesh& mesh = patch_.boundaryMesh().mesh();
120 
121  faceCells_ = UIndirectList<label>(mesh.faceOwner(), polyFaces());
122 
123  return faceCells_;
124 }
125 
126 
127 // ************************************************************************* //
Foam::surfaceFields.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:181
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:453
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
static const List< label > & null()
Return a null List.
Definition: ListI.H:118
fvMesh & mesh
virtual label start() const
Return the start label of this patch in the polyMesh face list.
const nonConformalPolyPatch & nonConformalPatch() const
Return the reference to the polyPatch.
const word & origPatchName() const
Original patch name.
bool conformal() const
Return whether the fvMesh is conformal with the polyMesh.
Definition: fvMesh.C:817
A class for handling words, derived from string.
Definition: word.H:59
const GeometricBoundaryField< label, fvsPatchField, surfaceMesh > & polyFacesBf() const
Return face-poly-face addressing.
Definition: fvMesh.C:839
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:139
nonConformalFvPatch(const fvPatch &patch)
Construct from a patch.
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1237
const polyMesh & mesh() const
Return the mesh reference.
Non-conformal poly patch. This patch is a placeholder and must have no faces. This patch is linked to...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
defineTypeNameAndDebug(combustionModel, 0)
const labelList & polyFaces() const
Return face face-poly-faces.
virtual const labelUList & faceCells() const
Return the face-cells.
const fvPatch & origPatch() const
Original patch.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
A List with indirect addressing.
Definition: fvMatrix.H:106
label origPatchID() const
Original patch ID.
virtual ~nonConformalFvPatch()
Destructor.
Namespace for OpenFOAM.
virtual label size() const
Return the size.