cyclicAMIFvPatch.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) 2011-2014 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::cyclicAMIFvPatch
26 
27 Description
28  Cyclic patch for Arbitrary Mesh Interface (AMI)
29 
30 SourceFiles
31  cyclicAMIFvPatch.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cyclicAMIFvPatch_H
36 #define cyclicAMIFvPatch_H
37 
38 #include "coupledFvPatch.H"
39 #include "cyclicAMILduInterface.H"
40 #include "cyclicAMIPolyPatch.H"
41 #include "fvBoundaryMesh.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class cyclicAMIFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class cyclicAMIFvPatch
53 :
54  public coupledFvPatch,
56 {
57  // Private data
58 
59  const cyclicAMIPolyPatch& cyclicAMIPolyPatch_;
60 
61 
62 protected:
63 
64  // Protected Member functions
65 
66  //- Make patch weighting factors
67  void makeWeights(scalarField&) const;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName(cyclicAMIPolyPatch::typeName_());
74 
75 
76  // Constructors
77 
78  //- Construct from polyPatch
80  :
81  coupledFvPatch(patch, bm),
83  cyclicAMIPolyPatch_(refCast<const cyclicAMIPolyPatch>(patch))
84  {}
85 
86 
87  // Member functions
88 
89  // Access
90 
91  //- Return local reference cast into the cyclic patch
92  const cyclicAMIPolyPatch& cyclicAMIPatch() const
93  {
94  return cyclicAMIPolyPatch_;
95  }
96 
97  //- Return neighbour
98  virtual label neighbPatchID() const
99  {
100  return cyclicAMIPolyPatch_.neighbPatchID();
101  }
103  virtual bool owner() const
104  {
105  return cyclicAMIPolyPatch_.owner();
106  }
107 
108  //- Return processor number
109  virtual const cyclicAMIFvPatch& neighbPatch() const
110  {
111  return refCast<const cyclicAMIFvPatch>
112  (
113  this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
114  );
115  }
116 
117  //- Return a reference to the AMI interpolator
118  virtual const AMIPatchToPatchInterpolation& AMI() const
119  {
120  return cyclicAMIPolyPatch_.AMI();
121  }
122 
123  //- Return true if applying the low weight correction
124  virtual bool applyLowWeightCorrection() const
125  {
126  return cyclicAMIPolyPatch_.applyLowWeightCorrection();
127  }
128 
129 
130  //- Are the cyclic planes parallel
131  virtual bool parallel() const
132  {
133  return cyclicAMIPolyPatch_.parallel();
134  }
135 
136  //- Return face transformation tensor
137  virtual const tensorField& forwardT() const
138  {
139  return cyclicAMIPolyPatch_.forwardT();
140  }
141 
142  //- Return neighbour-cell transformation tensor
143  virtual const tensorField& reverseT() const
144  {
145  return cyclicAMIPolyPatch_.reverseT();
146  }
148  const cyclicAMIFvPatch& neighbFvPatch() const
149  {
150  return refCast<const cyclicAMIFvPatch>
151  (
152  this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
153  );
154  }
155 
156  //- Return true if this patch is coupled. This is equivalent
157  // to the coupledPolyPatch::coupled() if parallel running or
158  // both sides present, false otherwise
159  virtual bool coupled() const;
160 
161  //- Return delta (P to N) vectors across coupled patch
162  virtual tmp<vectorField> delta() const;
163 
164  template<class Type>
166  (
167  const Field<Type>& fld,
168  const UList<Type>& defaultValues = UList<Type>()
169  ) const
170  {
171  return cyclicAMIPolyPatch_.interpolate(fld, defaultValues);
172  }
173 
174  template<class Type>
176  (
177  const tmp<Field<Type> >& tFld,
178  const UList<Type>& defaultValues = UList<Type>()
179  ) const
180  {
181  return cyclicAMIPolyPatch_.interpolate(tFld, defaultValues);
182  }
183 
184 
185  // Interface transfer functions
186 
187  //- Return the values of the given internal data adjacent to
188  // the interface as a field
190  (
191  const labelUList& internalData
192  ) const;
193 
194  //- Return neighbour field
196  (
197  const Pstream::commsTypes commsType,
198  const labelUList& internalData
199  ) const;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
virtual bool owner() const
Does this side own the patch?
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual label neighbPatchID() const
Return neighbour.
Cyclic patch for Arbitrary Mesh Interface (AMI)
Cyclic patch for Arbitrary Mesh Interface (AMI)
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
virtual bool coupled() const
Return true if this patch is coupled. This is equivalent.
virtual const tensorField & forwardT() const
Return face transformation tensor.
An abstract base class for cyclic AMI coupled interfaces.
Foam::fvBoundaryMesh.
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
cyclicAMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic patch.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual label neighbPatchID() const
Neighbour patch ID.
Namespace for OpenFOAM.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
TypeName(cyclicAMIPolyPatch::typeName_())
Runtime type information.
void makeWeights(scalarField &) const
Make patch weighting factors.
virtual bool parallel() const
Are the cyclic planes parallel.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185
commsTypes
Types of communications.
Definition: UPstream.H:64
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
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...
const cyclicAMIFvPatch & neighbFvPatch() const
virtual const cyclicAMIFvPatch & neighbPatch() const
Return processor number.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual bool owner() const
A class for managing temporary objects.
Definition: PtrList.H:118
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.