cyclicFaPatch.H
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) 2019-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Class
28  Foam::cyclicFaPatch
29 
30 Description
31  Cyclic-plane patch.
32 
33 Author
34  Zeljko Tukovic, FMENA
35  Hrvoje Jasak, Wikki Ltd.
36 
37 SourceFiles
38  cyclicFaPatch.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_cyclicFaPatch_H
43 #define Foam_cyclicFaPatch_H
44 
45 #include "coupledFaPatch.H"
46 #include "cyclicLduInterface.H"
47 #include "cyclicPolyPatch.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class cyclicFaPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class cyclicFaPatch
59 :
60  public coupledFaPatch,
61  public cyclicLduInterface
62 {
63  // Private Member Functions
64 
65  void calcTransforms();
66 
67 protected:
68 
69  // Protected Static Data
70 
71  //- Relative tolerance (for geometric matching). Is factor of
72  // maximum edge length per face.
73  static const scalar matchTol_;
74 
75 
76  // Protected Member functions
77 
78  //- Make patch weighting factors
79  void makeWeights(scalarField&) const;
80 
81  //- Make patch face - neighbour cell distances
82  void makeDeltaCoeffs(scalarField&) const;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("cyclic");
89 
90 
91  // Constructors
92 
93  //- Construct from dictionary
95  (
96  const word& name,
97  const dictionary& dict,
98  const label index,
99  const faBoundaryMesh& bm,
100  const word& patchType
101  );
102 
103 
104  //- Destructor
105  virtual ~cyclicFaPatch() = default;
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  //- Does this side own the patch ?
113  //- Yes: it contains both sets of faces
114  virtual bool owner() const
115  {
116  return true;
117  }
118 
119  //- Return neighbour
120  virtual label neighbPatchID() const
121  {
123  return index();
124  }
125 
126  //- Return processor number
127  virtual const cyclicLduInterface& neighbPatch() const
128  {
130  return *this;
131  }
133  //- Return face transformation tensor
134  virtual const tensorField& forwardT() const
135  {
136  return coupledFaPatch::forwardT();
137  }
138 
139  //- Return neighbour-cell transformation tensor
140  virtual const tensorField& reverseT() const
141  {
142  return coupledFaPatch::reverseT();
143  }
144 
145  //- Initialise the calculation of the patch geometry
146  virtual void initGeometry(PstreamBuffers&);
147 
148  //- Calculate the patch geometry
149  virtual void calcGeometry(PstreamBuffers&);
151  //- Initialise the patches for moving points
152  virtual void initMovePoints(PstreamBuffers&, const pointField&);
153 
154  //- Correct patches after moving points
155  virtual void movePoints(PstreamBuffers&, const pointField&);
156 
157  //- Return delta (P to N) vectors across coupled patch
158  virtual tmp<vectorField> delta() const;
159 
160 
161  // Interface transfer functions
162 
163  //- Return the values of the given internal data adjacent to
164  //- the interface as a field
166  (
167  const labelUList& internalData
168  ) const;
169 
170 
171  //- Return the values of the given internal data adjacent to
172  //- the interface as a field using edgeFace mapping
174  (
175  const labelUList& internalData,
176  const labelUList& edgeFaces
177  ) const;
178 
179 
180  //- Transfer and return neighbour field
181  virtual tmp<labelField> transfer
182  (
183  const Pstream::commsTypes commsType,
184  const labelUList& interfaceData
185  ) const;
186 
187  //- Return neighbour field
189  (
190  const Pstream::commsTypes commsType,
191  const labelUList& internalData
192  ) const;
193 
194 
195  //- Return neighbour field using edgeCells mapping
197  (
198  const Pstream::commsTypes commsType,
199  const labelUList& internalData,
200  const labelUList& edgeCells
201  ) const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
dictionary dict
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
static const scalar matchTol_
Relative tolerance (for geometric matching). Is factor of.
Definition: cyclicFaPatch.H:71
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual label neighbPatchID() const
Return neighbour.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
void makeDeltaCoeffs(scalarField &) const
Make patch face - neighbour cell distances.
An abstract base class for cyclic coupled interfaces.
virtual bool owner() const
Does this side own the patch ? Yes: it contains both sets of faces.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual ~cyclicFaPatch()=default
Destructor.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
A class for handling words, derived from Foam::string.
Definition: word.H:63
void makeWeights(scalarField &) const
Make patch weighting factors.
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition: faPatch.C:433
const word & name() const noexcept
The patch name.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
cyclicFaPatch(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm, const word &patchType)
Construct from dictionary.
Definition: cyclicFaPatch.C:42
Cyclic-plane patch.
Definition: cyclicFaPatch.H:53
coupledFaPatch is an abstract base class for patches that couple regions of the computational domain ...
virtual const cyclicLduInterface & neighbPatch() const
Return processor number.
Finite area boundary mesh.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Transfer and return neighbour field.
const tensorField & forwardT() const
Return face transformation tensor.
label index() const noexcept
The index of this patch in the boundaryMesh.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Namespace for OpenFOAM.
TypeName("cyclic")
Runtime type information.