cyclicACMIFvPatch.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 | Copyright (C) 2013 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::cyclicACMIFvPatch
26 
27 Description
28  Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
29 
30 SourceFiles
31  cyclicACMIFvPatch.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cyclicACMIFvPatch_H
36 #define cyclicACMIFvPatch_H
37 
38 #include "coupledFvPatch.H"
39 #include "cyclicACMILduInterface.H"
40 #include "cyclicACMIPolyPatch.H"
41 #include "fvBoundaryMesh.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class cyclicACMIFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public coupledFvPatch,
56 {
57  // Private data
58 
59  const cyclicACMIPolyPatch& cyclicACMIPolyPatch_;
60 
61 
62 protected:
63 
64  // Protected Member functions
65 
66  //- Update the patch areas after AMI update
67  void updateAreas() const;
68 
69  //- Make patch weighting factors
70  void makeWeights(scalarField&) const;
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName(cyclicACMIPolyPatch::typeName_());
77 
78 
79  // Constructors
80 
81  //- Construct from polyPatch
83  :
84  coupledFvPatch(patch, bm),
86  cyclicACMIPolyPatch_(refCast<const cyclicACMIPolyPatch>(patch))
87  {}
88 
89 
90  // Member functions
91 
92  // Access
93 
94  //- Return local reference cast into the cyclic patch
96  {
97  return cyclicACMIPolyPatch_;
98  }
99 
100  //- Return neighbour
101  virtual label neighbPatchID() const
102  {
103  return cyclicACMIPolyPatch_.neighbPatchID();
104  }
106  virtual bool owner() const
107  {
108  return cyclicACMIPolyPatch_.owner();
109  }
110 
111  //- Return neighbour fvPatch
112  virtual const cyclicACMIFvPatch& neighbPatch() const
113  {
114  return refCast<const cyclicACMIFvPatch>
115  (
116  this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
117  );
118  }
119 
120  //- Return neighbour
121  virtual label nonOverlapPatchID() const
122  {
123  return cyclicACMIPolyPatch_.nonOverlapPatchID();
124  }
125 
126  //- Return non-overlapping fvPatch
127  virtual const fvPatch& nonOverlapPatch() const
128  {
129  return this->boundaryMesh()[nonOverlapPatchID()];
130  }
131 
132  //- Return a reference to the AMI interpolator
133  virtual const AMIPatchToPatchInterpolation& AMI() const
134  {
136  cyclicACMIPolyPatch_.AMI();
137 
138  updateAreas();
139 
140  return AMI;
141  }
142 
143  //- Are the cyclic planes parallel
144  virtual bool parallel() const
145  {
146  return cyclicACMIPolyPatch_.parallel();
147  }
148 
149  //- Return face transformation tensor
150  virtual const tensorField& forwardT() const
151  {
152  return cyclicACMIPolyPatch_.forwardT();
153  }
154 
155  //- Return neighbour-cell transformation tensor
156  virtual const tensorField& reverseT() const
157  {
158  return cyclicACMIPolyPatch_.reverseT();
159  }
161  const cyclicACMIFvPatch& neighbFvPatch() const
162  {
163  return refCast<const cyclicACMIFvPatch>
164  (
165  this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
166  );
167  }
168 
169  //- Return true if this patch is coupled. This is equivalent
170  // to the coupledPolyPatch::coupled() if parallel running or
171  // both sides present, false otherwise
172  virtual bool coupled() const;
173 
174  //- Return delta (P to N) vectors across coupled patch
175  virtual tmp<vectorField> delta() const;
176 
177  template<class Type>
179  (
180  const Field<Type>& fldCoupled
181  ) const
182  {
183  updateAreas();
184 
185  return
186  cyclicACMIPolyPatch_.cyclicAMIPolyPatch::interpolate
187  (
188  fldCoupled
189  );
190  }
191 
192  template<class Type>
194  (
195  const tmp<Field<Type> >& tfldCoupled
196  ) const
197  {
198  updateAreas();
199 
200  return
201  cyclicACMIPolyPatch_.cyclicAMIPolyPatch::interpolate
202  (
203  tfldCoupled
204  );
205  }
206 
207  template<class Type>
209  (
210  const Field<Type>& fldCoupled,
211  const Field<Type>& fldNonOverlap
212  ) const
213  {
214  updateAreas();
215 
216  return
217  cyclicACMIPolyPatch_.interpolate
218  (
219  fldCoupled,
220  fldNonOverlap
221  );
222  }
223 
224  template<class Type>
226  (
227  const tmp<Field<Type> >& tFldCoupled,
228  const tmp<Field<Type> >& tFldNonOverlap
229  ) const
230  {
231  updateAreas();
232 
233  return
234  cyclicACMIPolyPatch_.interpolate
235  (
236  tFldCoupled,
237  tFldNonOverlap
238  );
239  }
240 
241 
242  // Interface transfer functions
243 
244  //- Return the values of the given internal data adjacent to
245  // the interface as a field
247  (
248  const labelUList& internalData
249  ) const;
250 
251  //- Return neighbour field
253  (
254  const Pstream::commsTypes commsType,
255  const labelUList& internalData
256  ) const;
257 };
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
virtual bool owner() const
Does this side own the patch?
virtual label nonOverlapPatchID() const
Return neighbour.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual const cyclicACMIFvPatch & neighbPatch() const
Return neighbour fvPatch.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual bool parallel() const
Are the cyclic planes parallel.
void updateAreas() const
Update the patch areas after AMI update.
Foam::fvBoundaryMesh.
virtual bool coupled() const
Return true if this patch is coupled. This is equivalent.
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
virtual label neighbPatchID() const
Neighbour patch ID.
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Namespace for OpenFOAM.
virtual label neighbPatchID() const
Return neighbour.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
void makeWeights(scalarField &) const
Make patch weighting factors.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
virtual bool parallel() const
Are the cyclic planes parallel.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
commsTypes
Types of communications.
Definition: UPstream.H:64
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch.
const cyclicACMIFvPatch & neighbFvPatch() const
tmp< Field< Type > > interpolate(const Field< Type > &fldCoupled) const
virtual bool owner() const
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
An abstract base class for cyclic ACMI coupled interfaces.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
cyclicACMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
An abstract base class for patches that couple regions of the computational domain e...
tmp< Field< Type > > interpolate(const Field< Type > &fldCouple, const Field< Type > &fldNonOverlap) const
Interpolate field.
const cyclicACMIPolyPatch & cyclicACMIPatch() const
Return local reference cast into the cyclic patch.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
TypeName(cyclicACMIPolyPatch::typeName_())
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:118
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.