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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::cyclicACMIFvPatch
29 
30 Description
31  Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
32 
33 SourceFiles
34  cyclicACMIFvPatch.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cyclicACMIFvPatch_H
39 #define cyclicACMIFvPatch_H
40 
41 #include "coupledFvPatch.H"
42 #include "cyclicACMILduInterface.H"
43 #include "cyclicACMIPolyPatch.H"
44 #include "fvBoundaryMesh.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class cyclicACMIFvPatch Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public coupledFvPatch,
59 {
60  // Private data
61 
62  const cyclicACMIPolyPatch& cyclicACMIPolyPatch_;
63 
64  //- Flag to detect whether AMI is up to date with mesh points
65  mutable uniformDimensionedScalarField areaTime_;
66 
67 
68 
69 protected:
70 
71  // Protected Member functions
72 
73  //- Update the AMI and patch areas. Return true if anything updated
74  virtual bool updateAreas() const;
75 
76  //- Helper function to reset the FV patch areas from the primitive patch
77  void resetPatchAreas(const fvPatch& fvp) const;
78 
79  //- Make patch weighting factors
80  void makeWeights(scalarField&) const;
81 
82  //- Correct patches after moving points
83  virtual void movePoints();
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName(cyclicACMIPolyPatch::typeName_());
90 
91 
92  // Constructors
93 
94  //- Construct from polyPatch
96 
97 
98  // Member functions
99 
100 // // Implicit treatment functions
101 //
102 // //- Return number of new internal sub-faces and new proc faces
103 // virtual void newInternalProcFaces(label&, label&) const;
104 //
105 // //- Return collocated faces
106 // virtual refPtr<labelListList> mapCollocatedFaces() const;
107 
108 
109  // Access
110 
111  //- Return local reference cast into the cyclic patch
112  const cyclicACMIPolyPatch& cyclicACMIPatch() const
113  {
114  return cyclicACMIPolyPatch_;
115  }
116 
117  //- Return neighbour
118  virtual label neighbPatchID() const
119  {
120  return cyclicACMIPolyPatch_.neighbPatchID();
121  }
122 
123  virtual bool owner() const
124  {
125  return cyclicACMIPolyPatch_.owner();
126  }
127 
128  //- Return neighbour fvPatch
129  virtual const cyclicACMIFvPatch& neighbPatch() const
130  {
131  return refCast<const cyclicACMIFvPatch>
132  (
133  this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
134  );
135  }
137  //- Return neighbour
138  virtual label nonOverlapPatchID() const
139  {
140  return cyclicACMIPolyPatch_.nonOverlapPatchID();
141  }
142 
143  //- Return non-overlapping fvPatch
144  virtual const fvPatch& nonOverlapPatch() const
145  {
146  return this->boundaryMesh()[nonOverlapPatchID()];
147  }
148 
149  //- Return a reference to the AMI interpolator
150  virtual const AMIPatchToPatchInterpolation& AMI() const
151  {
152  return cyclicACMIPolyPatch_.AMI();
153  }
154 
155  //- Are the cyclic planes parallel
156  virtual bool parallel() const
157  {
158  return cyclicACMIPolyPatch_.parallel();
159  }
160 
161  //- Return face transformation tensor
162  virtual const tensorField& forwardT() const
163  {
164  return cyclicACMIPolyPatch_.forwardT();
165  }
166 
167  //- Return neighbour-cell transformation tensor
168  virtual const tensorField& reverseT() const
169  {
170  return cyclicACMIPolyPatch_.reverseT();
171  }
172 
173  const cyclicACMIFvPatch& neighbFvPatch() const
174  {
175  return refCast<const cyclicACMIFvPatch>
176  (
177  this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
178  );
179  }
180 
181  //- Return true if this patch is coupled.
182  // This is equivalent to coupledPolyPatch::coupled()
183  // if parallel running or both sides present, false otherwise
184  virtual bool coupled() const;
185 
186  //- Return delta (P to N) vectors across coupled patch
187  virtual tmp<vectorField> delta() const;
188 
189  //- Interpolate (make sure to have uptodate areas)
190  template<class Type>
192  (
193  const Field<Type>& fld
194  ) const
195  {
196  // Make sure areas are up-to-date
197  updateAreas();
198 
199  return
200  cyclicACMIPolyPatch_.cyclicAMIPolyPatch::interpolate
201  (
202  fld
203  );
204  }
205 
206  //- Interpolate (make sure to have up-to-date areas)
207  template<class Type>
209  (
210  const tmp<Field<Type>>& tfld
211  ) const
212  {
213  return interpolate(tfld());
214  }
215 
216 
217  // Interface transfer functions
218 
219  //- Return the values of the given internal data adjacent to
220  //- the interface as a field
221  virtual tmp<labelField> interfaceInternalField
222  (
223  const labelUList& internalData
224  ) const;
225 
226  //- Return the values of the given internal data adjacent to
227  //- the interface as a field using a mapping faceCell
229  (
230  const labelUList& internalData,
231  const labelUList& faceCells
232  ) const;
233 
234  //- Return neighbour field
236  (
237  const Pstream::commsTypes commsType,
238  const labelUList& internalData
239  ) const;
240 
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
virtual bool updateAreas() const
Update the AMI and patch areas. Return true if anything updated.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
virtual label neighbPatchID() const
Neighbour patch ID.
void makeWeights(scalarField &) const
Make patch weighting factors.
commsTypes
Communications types.
Definition: UPstream.H:74
virtual bool owner() const
cyclicACMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual label nonOverlapPatchID() const
Return neighbour.
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:70
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
virtual const tensorField & forwardT() const
Return face transformation tensor.
tmp< Field< Type > > interpolate(const Field< Type > &fld) const
Interpolate (make sure to have uptodate areas)
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
virtual label neighbPatchID() const
Return neighbour.
virtual bool parallel() const
Are the cyclic planes parallel.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
void resetPatchAreas(const fvPatch &fvp) const
Helper function to reset the FV patch areas from the primitive patch.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual const cyclicACMIFvPatch & neighbPatch() const
Return neighbour fvPatch.
virtual void movePoints()
Correct patches after moving points.
An abstract base class for cyclic ACMI coupled interfaces.
virtual bool parallel() const
Are the cyclic planes parallel.
const fvBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
Definition: fvPatch.H:260
virtual bool coupled() const
Return true if this patch is coupled.
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const cyclicACMIPolyPatch & cyclicACMIPatch() const
Return local reference cast into the cyclic patch.
TypeName(cyclicACMIPolyPatch::typeName_())
Runtime type information.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Foam::fvBoundaryMesh.
virtual bool owner() const
Does this side own the patch?
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
const cyclicACMIFvPatch & neighbFvPatch() const
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const polyPatch & patch() const noexcept
Return the polyPatch.
Definition: fvPatch.H:202
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Namespace for OpenFOAM.