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 {
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 // ************************************************************************* //
static const List< label > & null()
Return a null List.
Definition: ListI.H:118
A List with indirect addressing.
Definition: UIndirectList.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
const GeometricBoundaryField< label, fvsPatchField, surfaceMesh > & polyFacesBf() const
Return face-poly-face addressing.
Definition: fvMesh.C:932
bool conformal() const
Return whether the fvMesh is conformal with the polyMesh.
Definition: fvMesh.C:910
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:181
Non-conformal FV patch. Provides the necessary interface for a FV patch which does not conform to the...
const labelList & polyFaces() const
Return face face-poly-faces.
const fvPatch & origPatch() const
Original patch.
virtual label size() const
Return the size.
label origPatchID() const
Original patch ID.
const word & origPatchName() const
Original patch name.
virtual ~nonConformalFvPatch()
Destructor.
const nonConformalPolyPatch & nonConformalPatch() const
Return the reference to the polyPatch.
virtual const labelUList & faceCells() const
Return the face-cells.
nonConformalFvPatch(const fvPatch &patch)
Construct from a patch.
virtual label start() const
Return the start label of this patch in the polyMesh face list.
Non-conformal poly patch. This patch is a placeholder and must have no faces. This patch is linked to...
const polyMesh & mesh() const
Return the mesh reference.
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1387
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:403
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:111
defineTypeNameAndDebug(combustionModel, 0)
error FatalError
Foam::surfaceFields.