coupledFvPatch.H
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) 2011-2024 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 Class
25  Foam::coupledFvPatch
26 
27 Description
28  An abstract base class for patches that couple regions of the
29  computational domain e.g. cyclic and processor-processor links.
30 
31 SourceFiles
32  coupledFvPatch.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef coupledFvPatch_H
37 #define coupledFvPatch_H
38 
39 #include "fvPatch.H"
40 #include "lduInterface.H"
41 #include "coupledPolyPatch.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class coupledFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class coupledFvPatch
53 :
54  public lduInterface,
55  public fvPatch
56 {
57  // Private Data
58 
59  //- Reference to the coupled polyPatch
60  const coupledPolyPatch& coupledPolyPatch_;
61 
62 
63 protected:
64 
65  // Protected Member functions
66 
67  //- Make patch weighting factors
68  void makeWeights
69  (
70  scalarField& w,
71  const vectorField& nbrSf,
72  const vectorField& nbrDelta
73  ) const;
74 
75  //- Return delta (P to N) vectors across coupled patch
76  tmp<vectorField> delta(const vectorField& nbrDelta) const;
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName(coupledPolyPatch::typeName_());
83 
84 
85  // Constructors
86 
87  //- Construct from polyPatch
88  coupledFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
89  :
90  fvPatch(patch, bm),
91  coupledPolyPatch_(refCast<const coupledPolyPatch>(patch))
92  {}
93 
94 
95  //- Destructor
96  virtual ~coupledFvPatch();
97 
98 
99  // Member Functions
100 
101  // Access
102 
103  //- Return true because this patch is coupled
104  virtual bool coupled() const
105  {
106  return coupledPolyPatch_.coupled();
107  }
108 
109  //- Does this side own the patch ?
110  virtual bool owner() const
111  {
112  return coupledPolyPatch_.owner();
113  }
114 
115  //- Does the coupled side own the patch ?
116  virtual bool neighbour() const
117  {
118  return !owner();
119  }
120 
121  //- Return transformation between the coupled patches
122  virtual const transformer& transform() const = 0;
123 
124  //- Return faceCell addressing
125  virtual const labelUList& faceCells() const
126  {
127  return fvPatch::faceCells();
128  }
129 
130  //- Make patch weighting factors
131  virtual void makeWeights(scalarField& w) const = 0;
132 
133  //- Return delta (P to N) vectors across coupled patch
134  virtual tmp<vectorField> delta() const = 0;
135 
136 
137  // Interface transfer functions
138 
139  //- Return the values of the given internal data adjacent to
140  // the interface as a field
142  (
143  const labelUList& internalData
144  ) const = 0;
145 
146  //- Inherit initInternalFieldTransfer from lduInterface
148 
149  //- Initialise neighbour field transfer
150  virtual void initInternalFieldTransfer
151  (
152  const Pstream::commsTypes commsType,
153  labelUList& iF
154  ) const
155  {}
156 
157  //- Return neighbour field
159  (
160  const Pstream::commsTypes commsType,
161  const labelUList& iF
162  ) const = 0;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
commsTypes
Types of communications.
Definition: UPstream.H:65
An abstract base class for patches that couple regions of the computational domain e....
TypeName(coupledPolyPatch::typeName_())
Runtime type information.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Inherit initInternalFieldTransfer from lduInterface.
Definition: lduInterface.H:95
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const =0
Return neighbour field.
virtual bool owner() const
Does this side own the patch ?
virtual bool coupled() const
Return true because this patch is coupled.
coupledFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const =0
Return the values of the given internal data adjacent to.
virtual const transformer & transform() const =0
Return transformation between the coupled patches.
virtual ~coupledFvPatch()
Destructor.
virtual const labelUList & faceCells() const
Return faceCell addressing.
void makeWeights(scalarField &w, const vectorField &nbrSf, const vectorField &nbrDelta) const
Make patch weighting factors.
virtual bool neighbour() const
Does the coupled side own the patch ?
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual bool coupled() const
Return true because this patch is coupled.
virtual bool owner() const =0
Does this side own the patch ?
Foam::fvBoundaryMesh.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:120
virtual const labelUList & faceCells() const
Return faceCells.
Definition: fvPatch.C:99
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise transfer of internal field adjacent to the interface.
Definition: lduInterface.H:95
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
A class for managing temporary objects.
Definition: tmp.H:55
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:129