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-2026 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  nonConformalPoly_(refCast<const nonConformalPolyPatch>(patch.poly())),
46  faceCells_()
47 {}
48 
49 
50 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
51 
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
59 {
60  return patch_;
61 }
62 
63 
65 {
66  return nonConformalPoly_.origPatchName();
67 }
68 
69 
71 {
72  return nonConformalPoly_.origPatchIndex();
73 }
74 
75 
77 {
78  return patch_.boundaryMesh()[origPatchIndex()];
79 }
80 
81 
83 {
84  const fvMesh& mesh = patch_.mesh();
85 
86  return
87  mesh.conformal()
88  ? labelList::null()
89  : mesh.polyFacesBf()[patch_.index()];
90 }
91 
92 
94 {
95  if (size())
96  {
98  << "The start face is not defined for a " << typeName
99  << " patch with a non-zero number of faces"
100  << exit(FatalError);
101  }
102 
103  return patch_.poly().start();
104 }
105 
106 
108 {
109  return polyFaces().size();
110 }
111 
112 
114 {
115  const fvMesh& mesh = patch_.mesh();
116 
117  return
118  mesh.conformal()
119  ? labelList::null()
120  : mesh.ownerBf()[patch_.index()];
121 }
122 
123 
124 // ************************************************************************* //
static const List< label > & null()
Return a null List.
Definition: ListI.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const GeometricBoundaryField< label, surfaceMesh > & ownerBf() const
Return face-owner addressing.
Definition: fvMesh.C:1073
const GeometricBoundaryField< label, surfaceMesh > & polyFacesBf() const
Return face-poly-face addressing.
Definition: fvMesh.C:955
bool conformal() const
Return whether the fvMesh is conformal with the polyMesh.
Definition: fvMesh.C:949
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:180
Non-conformal FV patch. Provides the necessary interface for a FV patch which does not conform to the...
const fvPatch & patch() const
Reference to the fvPatch.
const labelList & polyFaces() const
Return face face-poly-faces.
const fvPatch & origPatch() const
Original patch.
label origPatchIndex() const
Original patch ID.
virtual label size() const
Return the size.
const word & origPatchName() const
Original patch name.
virtual ~nonConformalFvPatch()
Destructor.
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...
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
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:141
error FatalError
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
Foam::surfaceFields.