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-2016 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 parallel() const
Are the cyclic planes parallel.
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic patch.
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 const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual const cyclicAMIFvPatch & neighbPatch() const
Return processor number.
Cyclic patch for Arbitrary Mesh Interface (AMI)
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
virtual 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...
bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual label neighbPatchID() const
Return neighbour.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
An abstract base class for cyclic AMI coupled interfaces.
virtual label neighbPatchID() const
Neighbour patch ID.
const cyclicAMIFvPatch & neighbFvPatch() const
virtual bool owner() const
Does this side own the patch?
void makeWeights(scalarField &) const
Make patch weighting factors.
cyclicAMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual bool parallel() const
Are the cyclic planes parallel.
Cyclic patch for Arbitrary Mesh Interface (AMI)
virtual bool coupled() const
Return true if this patch is coupled. This is equivalent.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
TypeName(cyclicAMIPolyPatch::typeName_())
Runtime type information.
Foam::fvBoundaryMesh.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
virtual bool owner() const
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual const tensorField & forwardT() const
Return face transformation tensor.
A class for managing temporary objects.
Definition: PtrList.H:54
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185