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-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::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  //- Interpolate (make sure to have uptodate areas)
178  template<class Type>
180  (
181  const Field<Type>& fld
182  ) const
183  {
184  updateAreas();
185 
186  return
187  cyclicACMIPolyPatch_.cyclicAMIPolyPatch::interpolate
188  (
189  fld
190  );
191  }
192 
193  //- Interpolate (make sure to have uptodate areas)
194  template<class Type>
196  (
197  const tmp<Field<Type>>& tfld
198  ) const
199  {
200  return interpolate(tfld());
201  }
202 
203 
204  // Interface transfer functions
205 
206  //- Return the values of the given internal data adjacent to
207  // the interface as a field
209  (
210  const labelUList& internalData
211  ) const;
212 
213  //- Return neighbour field
215  (
216  const Pstream::commsTypes commsType,
217  const labelUList& internalData
218  ) const;
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
const cyclicACMIPolyPatch & cyclicACMIPatch() 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 label nonOverlapPatchID() const
Non-overlapping patch ID.
commsTypes
Types of communications.
Definition: UPstream.H:64
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
cyclicACMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
An abstract base class for patches that couple regions of the computational domain e...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual label neighbPatchID() const
Return neighbour.
virtual const tensorField & forwardT() const
Return face transformation tensor.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
virtual bool coupled() const
Return true if this patch is coupled. This is equivalent.
virtual bool owner() const
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual label neighbPatchID() const
Neighbour patch ID.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch.
virtual bool owner() const
Does this side own the patch?
void makeWeights(scalarField &) const
Make patch weighting factors.
An abstract base class for cyclic ACMI coupled interfaces.
virtual bool parallel() const
Are the cyclic planes parallel.
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
tmp< Field< Type > > interpolate(const Field< Type > &fld) const
Interpolate (make sure to have uptodate areas)
virtual const cyclicACMIFvPatch & neighbPatch() const
Return neighbour fvPatch.
TypeName(cyclicACMIPolyPatch::typeName_())
Runtime type information.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
void updateAreas() const
Update the patch areas after AMI update.
Foam::fvBoundaryMesh.
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
virtual const tensorField & forwardT() const
Return face transformation tensor.
const cyclicACMIFvPatch & neighbFvPatch() const
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
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Namespace for OpenFOAM.
virtual label nonOverlapPatchID() const
Return neighbour.
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:185