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 geodesic distance between P and N
82  void makeLPN(scalarField&) const;
83 
84  //- Make patch face - neighbour cell distances
85  void makeDeltaCoeffs(scalarField&) const;
86 
87  //- Make non-orthogonality correction vectors
88  void makeCorrectionVectors(vectorField& cv) const { cv = Zero; }
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("cyclic");
95 
96 
97  // Constructors
98 
99  //- Construct from dictionary
101  (
102  const word& name,
103  const dictionary& dict,
104  const label index,
105  const faBoundaryMesh& bm,
106  const word& patchType
107  );
108 
109 
110  //- Destructor
111  virtual ~cyclicFaPatch() = default;
112 
113 
114  // Member Functions
115 
116  // Access
117 
118  //- Does this side own the patch ?
119  //- Yes: it contains both sets of faces
120  virtual bool owner() const
121  {
122  return true;
123  }
124 
125  //- Return neighbour
126  virtual label neighbPatchID() const
127  {
129  return index();
130  }
131 
132  //- Return processor number
133  virtual const cyclicLduInterface& neighbPatch() const
134  {
136  return *this;
137  }
138 
139  //- Return face transformation tensor
140  virtual const tensorField& forwardT() const
141  {
143  }
144 
145  //- Return neighbour-cell transformation tensor
146  virtual const tensorField& reverseT() const
147  {
148  return coupledFaPatch::reverseT();
149  }
150 
151  //- Initialise the calculation of the patch geometry
152  virtual void initGeometry(PstreamBuffers&);
153 
154  //- Calculate the patch geometry
155  virtual void calcGeometry(PstreamBuffers&);
156 
157  //- Initialise the patches for moving points
158  virtual void initMovePoints(PstreamBuffers&, const pointField&);
159 
160  //- Correct patches after moving points
161  virtual void movePoints(PstreamBuffers&, const pointField&);
162 
163  //- Return delta (P to N) vectors across coupled patch
164  virtual tmp<vectorField> delta() const;
165 
166 
167  // Interface transfer functions
169  //- Return the values of the given internal data adjacent to
170  //- the interface as a field
172  (
173  const labelUList& internalData
174  ) const;
175 
176 
177  //- Return the values of the given internal data adjacent to
178  //- the interface as a field using edgeFace mapping
180  (
181  const labelUList& internalData,
182  const labelUList& edgeFaces
183  ) const;
184 
185 
186  //- Transfer and return neighbour field
187  virtual tmp<labelField> transfer
188  (
189  const Pstream::commsTypes commsType,
190  const labelUList& interfaceData
191  ) const;
192 
193  //- Return neighbour field
195  (
196  const Pstream::commsTypes commsType,
197  const labelUList& internalData
198  ) const;
199 
200 
201  //- Return neighbour field using edgeCells mapping
203  (
204  const Pstream::commsTypes commsType,
205  const labelUList& internalData,
206  const labelUList& edgeCells
207  ) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
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:77
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.
void makeCorrectionVectors(vectorField &cv) const
Make non-orthogonality correction vectors.
Definition: cyclicFaPatch.H:94
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 makeLPN(scalarField &) const
Make patch geodesic distance between P and N.
void makeWeights(scalarField &) const
Make patch weighting factors.
cyclicLduInterface() noexcept=default
Default construct.
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition: faPatch.C:424
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:40
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, which is a faPatch list with registered IO, a reference to the associated ...
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:688
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Namespace for OpenFOAM.
TypeName("cyclic")
Runtime type information.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127