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-2020 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 nbrPatchID() const
105  {
106  return cyclicAMIPolyPatch_.nbrPatchID();
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& nbrPatch() const
117  {
118  return refCast<const cyclicAMIFvPatch>
119  (
120  this->boundaryMesh()[cyclicAMIPolyPatch_.nbrPatchID()]
121  );
122  }
123 
124  //- Return a reference to the AMI interpolators
125  virtual const PtrList<AMIInterpolation>& AMIs() const
126  {
127  return cyclicAMIPolyPatch_.AMIs();
128  }
129 
130  //- Return a reference to the AMI transforms
131  virtual const List<transformer>& 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  //- Return transformation between the coupled patches
143  virtual const transformer& transform() const
144  {
145  return cyclicAMIPolyPatch_.transform();
146  }
148  const cyclicAMIFvPatch& neighbFvPatch() const
149  {
150  return refCast<const cyclicAMIFvPatch>
151  (
152  this->boundaryMesh()[cyclicAMIPolyPatch_.nbrPatchID()]
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 // ************************************************************************* //
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:180
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
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
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
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:59
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.
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
const cyclicAMIFvPatch & neighbFvPatch() const
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
const List< transformer > & AMITransforms() const
Return a reference to the AMI transforms.
virtual label nbrPatchID() const
Neighbour patch ID.
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic patch.
An abstract base class for cyclic AMI coupled interfaces.
const PtrList< AMIInterpolation > & AMIs() const
Return a reference to the AMI interpolators.
tmp< scalarField > nbrDeltan() const
Return the neighbour patch-normal component of the deltas.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:138
virtual const PtrList< AMIInterpolation > & AMIs() const
Return a reference to the AMI interpolators.
virtual const transformer & transform() const
Return transformation between the coupled patches.
cyclicAMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
Cyclic patch for Arbitrary Mesh Interface (AMI)
tmp< scalarField > deltan() const
Return the patch-normal component of the deltas.
virtual const transformer & transform() const
Return transformation between the coupled patches.
virtual bool owner() const
Is this side the owner?
virtual const cyclicAMIFvPatch & nbrPatch() 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:70
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 label nbrPatchID() const
Return the neighbour patch ID.
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
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.
virtual const List< transformer > & AMITransforms() const
Return a reference to the AMI transforms.