cyclicAMIFvPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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  //- Return the patch-normal component of the deltas
67  tmp<scalarField> deltan() const;
68 
69  //- Return the neighbour patch-normal component of the deltas
71 
72  //- Make patch weighting factors
73  virtual void makeWeights(scalarField&) const;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName(cyclicAMIPolyPatch::typeName_());
80 
81 
82  // Constructors
83 
84  //- Construct from polyPatch
86  :
87  coupledFvPatch(patch, bm),
89  cyclicAMIPolyPatch_(refCast<const cyclicAMIPolyPatch>(patch))
90  {}
91 
92 
93  // Member functions
94 
95  // Access
96 
97  //- Return local reference cast into the cyclic patch
98  const cyclicAMIPolyPatch& cyclicAMIPatch() const
99  {
100  return cyclicAMIPolyPatch_;
101  }
102 
103  //- Return the neighbour patch ID
104  virtual label neighbPatchID() const
105  {
106  return cyclicAMIPolyPatch_.neighbPatchID();
107  }
108 
109  //- Is this side the owner?
110  virtual bool owner() const
111  {
112  return cyclicAMIPolyPatch_.owner();
113  }
114 
115  //- Return the neighbour patch
116  virtual const cyclicAMIFvPatch& neighbPatch() const
117  {
118  return refCast<const cyclicAMIFvPatch>
119  (
120  this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
121  );
122  }
123 
124  //- Return a reference to the AMI interpolators
125  virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
126  {
127  return cyclicAMIPolyPatch_.AMIs();
128  }
129 
130  //- Return a reference to the AMI transforms
131  virtual const List<vectorTensorTransform>& AMITransforms() const
132  {
133  return cyclicAMIPolyPatch_.AMITransforms();
134  }
135 
136  //- Return true if applying the low weight correction
137  virtual bool applyLowWeightCorrection() const
138  {
139  return cyclicAMIPolyPatch_.applyLowWeightCorrection();
140  }
141 
142  //- Are the cyclic planes parallel
143  virtual bool parallel() const
144  {
145  return cyclicAMIPolyPatch_.parallel();
146  }
147 
148  //- Return face transformation tensor
149  virtual const tensorField& forwardT() const
150  {
151  return cyclicAMIPolyPatch_.forwardT();
152  }
153 
154  //- Return neighbour-cell transformation tensor
155  virtual const tensorField& reverseT() const
156  {
157  return cyclicAMIPolyPatch_.reverseT();
158  }
160  const cyclicAMIFvPatch& neighbFvPatch() const
161  {
162  return refCast<const cyclicAMIFvPatch>
163  (
164  this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
165  );
166  }
167 
168  //- Return true if this patch is coupled. This is equivalent
169  // to the coupledPolyPatch::coupled() if parallel running or
170  // both sides present, false otherwise
171  virtual bool coupled() const;
172 
173  //- Return delta (P to N) vectors across coupled patch
174  virtual tmp<vectorField> delta() const;
175 
176  template<class Type>
178  (
179  const Field<Type>& fld,
180  const UList<Type>& defaultValues = UList<Type>()
181  ) const
182  {
183  return cyclicAMIPolyPatch_.interpolate(fld, defaultValues);
184  }
185 
186  template<class Type>
188  (
189  const tmp<Field<Type>>& tFld,
190  const UList<Type>& defaultValues = UList<Type>()
191  ) const
192  {
193  return cyclicAMIPolyPatch_.interpolate(tFld, defaultValues);
194  }
195 
196 
197  // Interface transfer functions
198 
199  //- Return the values of the given internal data adjacent to
200  // the interface as a field
202  (
203  const labelUList& internalData
204  ) const;
205 
206  //- Return neighbour field
208  (
209  const Pstream::commsTypes commsType,
210  const labelUList& internalData
211  ) const;
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
virtual label neighbPatchID() const
Neighbour patch ID.
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
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
virtual bool parallel() const
Are the cyclic planes parallel.
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
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
Cyclic patch for Arbitrary Mesh Interface (AMI)
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
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.
const PtrList< AMIPatchToPatchInterpolation > & AMIs() const
Return a reference to the AMI interpolators.
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
virtual const tensorField & forwardT() const
Return face transformation tensor.
const cyclicAMIFvPatch & neighbFvPatch() const
virtual const PtrList< AMIPatchToPatchInterpolation > & AMIs() const
Return a reference to the AMI interpolators.
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
const List< vectorTensorTransform > & AMITransforms() const
Return a reference to the AMI transforms.
virtual bool parallel() const
Are the cyclic planes parallel.
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic patch.
An abstract base class for cyclic AMI coupled interfaces.
tmp< scalarField > nbrDeltan() const
Return the neighbour patch-normal component of the deltas.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
cyclicAMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
Cyclic patch for Arbitrary Mesh Interface (AMI)
virtual label neighbPatchID() const
Return the neighbour patch ID.
tmp< scalarField > deltan() const
Return the patch-normal component of the deltas.
virtual bool owner() const
Is this side the owner?
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual const List< vectorTensorTransform > & AMITransforms() const
Return a reference to the AMI transforms.
virtual const cyclicAMIFvPatch & neighbPatch() const
Return the neighbour patch.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
TypeName(cyclicAMIPolyPatch::typeName_())
Runtime type information.
Foam::fvBoundaryMesh.
virtual bool coupled() const
Return true if this patch is coupled. This is equivalent.
virtual bool owner() const
Does this side own the patch?
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual void makeWeights(scalarField &) const
Make patch weighting factors.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual const tensorField & forwardT() const
Return face transformation tensor.
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.
Namespace for OpenFOAM.