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  // Access
101 
102  //- Return local reference cast into the cyclic patch
103  const cyclicACMIPolyPatch& cyclicACMIPatch() const
104  {
105  return cyclicACMIPolyPatch_;
106  }
107 
108  //- Return neighbour
109  virtual label neighbPatchID() const
110  {
111  return cyclicACMIPolyPatch_.neighbPatchID();
112  }
113 
114  virtual bool owner() const
115  {
116  return cyclicACMIPolyPatch_.owner();
117  }
118 
119  //- Return neighbour fvPatch
120  virtual const cyclicACMIFvPatch& neighbPatch() const
121  {
122  return refCast<const cyclicACMIFvPatch>
123  (
124  this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
125  );
126  }
127 
128  //- Return neighbour
129  virtual label nonOverlapPatchID() const
130  {
131  return cyclicACMIPolyPatch_.nonOverlapPatchID();
132  }
133 
134  //- Return non-overlapping fvPatch
135  virtual const fvPatch& nonOverlapPatch() const
136  {
137  return this->boundaryMesh()[nonOverlapPatchID()];
138  }
139 
140  //- Return a reference to the AMI interpolator
141  virtual const AMIPatchToPatchInterpolation& AMI() const
142  {
143  return cyclicACMIPolyPatch_.AMI();
144  }
145 
146  //- Are the cyclic planes parallel
147  virtual bool parallel() const
148  {
149  return cyclicACMIPolyPatch_.parallel();
150  }
151 
152  //- Return face transformation tensor
153  virtual const tensorField& forwardT() const
154  {
155  return cyclicACMIPolyPatch_.forwardT();
156  }
157 
158  //- Return neighbour-cell transformation tensor
159  virtual const tensorField& reverseT() const
160  {
161  return cyclicACMIPolyPatch_.reverseT();
162  }
163 
164  const cyclicACMIFvPatch& neighbFvPatch() const
165  {
166  return refCast<const cyclicACMIFvPatch>
167  (
168  this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
169  );
170  }
171 
172  //- Return true if this patch is coupled. This is equivalent
173  //- to the coupledPolyPatch::coupled() if parallel running or
174  //- both sides present, false otherwise
175  virtual bool coupled() const;
176 
177  //- Return delta (P to N) vectors across coupled patch
178  virtual tmp<vectorField> delta() const;
179 
180  //- Interpolate (make sure to have uptodate areas)
181  template<class Type>
183  (
184  const Field<Type>& fld
185  ) const
186  {
187  // Make sure areas are up-to-date
188  updateAreas();
189 
190  return
191  cyclicACMIPolyPatch_.cyclicAMIPolyPatch::interpolate
192  (
193  fld
194  );
195  }
196 
197  //- Interpolate (make sure to have up-to-date areas)
198  template<class Type>
200  (
201  const tmp<Field<Type>>& tfld
202  ) const
203  {
204  return interpolate(tfld());
205  }
206 
207 
208  // Interface transfer functions
209 
210  //- Return the values of the given internal data adjacent to
211  //- the interface as a field
213  (
214  const labelUList& internalData
215  ) const;
216 
217  //- Return neighbour field
219  (
220  const Pstream::commsTypes commsType,
221  const labelUList& internalData
222  ) const;
223 };
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
Foam::cyclicACMIFvPatch::neighbFvPatch
const cyclicACMIFvPatch & neighbFvPatch() const
Definition: cyclicACMIFvPatch.H:163
Foam::cyclicAMIPolyPatch::owner
virtual bool owner() const
Does this side own the patch?
Definition: cyclicAMIPolyPatch.C:848
cyclicACMIPolyPatch.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::cyclicACMIFvPatch::owner
virtual bool owner() const
Definition: cyclicACMIFvPatch.H:113
Foam::coupledPolyPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: coupledPolyPatch.H:296
Foam::cyclicACMILduInterface
An abstract base class for cyclic ACMI coupled interfaces.
Definition: cyclicACMILduInterface.H:51
Foam::cyclicACMIFvPatch::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &fld) const
Interpolate (make sure to have uptodate areas)
Definition: cyclicACMIFvPatch.H:182
Foam::coupledPolyPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: coupledPolyPatch.H:302
Foam::cyclicACMIFvPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: cyclicACMIFvPatch.H:146
Foam::cyclicACMIFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicACMIFvPatch.C:177
Foam::cyclicACMIFvPatch::coupled
virtual bool coupled() const
Definition: cyclicACMIFvPatch.C:171
Foam::cyclicACMIFvPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Definition: cyclicACMIFvPatch.C:231
coupledFvPatch.H
Foam::fvPatch::boundaryMesh
const fvBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: fvPatch.H:203
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:56
Foam::coupledPolyPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: coupledPolyPatch.H:290
Foam::UniformDimensionedField< scalar >
Foam::cyclicACMIFvPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicACMIFvPatch.H:152
Foam::Field< scalar >
Foam::cyclicACMIFvPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicACMIFvPatch.H:158
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::cyclicACMIFvPatch::neighbPatch
virtual const cyclicACMIFvPatch & neighbPatch() const
Return neighbour fvPatch.
Definition: cyclicACMIFvPatch.H:119
Foam::cyclicACMIFvPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Return neighbour.
Definition: cyclicACMIFvPatch.H:128
Foam::cyclicACMIFvPatch::TypeName
TypeName(cyclicACMIPolyPatch::typeName_())
Runtime type information.
fld
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))
Definition: gmvOutputLagrangian.H:23
Foam::cyclicACMIFvPatch::neighbPatchID
virtual label neighbPatchID() const
Return neighbour.
Definition: cyclicACMIFvPatch.H:108
Foam::cyclicACMIFvPatch::movePoints
virtual void movePoints()
Correct patches after moving points.
Definition: cyclicACMIFvPatch.C:240
Foam::cyclicACMIFvPatch::nonOverlapPatch
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch.
Definition: cyclicACMIFvPatch.H:134
fvBoundaryMesh.H
Foam::cyclicACMIPolyPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Definition: cyclicACMIPolyPatch.C:761
Foam::cyclicAMIPolyPatch::neighbPatchID
virtual label neighbPatchID() const
Neighbour patch ID.
Definition: cyclicAMIPolyPatch.C:812
Foam::cyclicACMIFvPatch::AMI
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Definition: cyclicACMIFvPatch.H:140
Foam::cyclicACMIFvPatch::updateAreas
virtual bool updateAreas() const
Update the AMI and patch areas. Return true if anything updated.
Definition: cyclicACMIFvPatch.C:46
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cyclicACMIFvPatch::cyclicACMIFvPatch
cyclicACMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
Definition: cyclicACMIFvPatch.C:143
cyclicACMILduInterface.H
Foam::cyclicAMIPolyPatch::AMI
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Definition: cyclicAMIPolyPatch.C:861
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::cyclicACMIFvPatch::resetPatchAreas
void resetPatchAreas(const fvPatch &fvp) const
Helper function to reset the FV patch areas from the primitive patch.
Definition: cyclicACMIFvPatch.C:83
Foam::cyclicACMIFvPatch::cyclicACMIPatch
const cyclicACMIPolyPatch & cyclicACMIPatch() const
Return local reference cast into the cyclic patch.
Definition: cyclicACMIFvPatch.H:102
Foam::AMIInterpolation
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
Definition: AMIInterpolation.H:79
Foam::UList< label >
Foam::cyclicACMIFvPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: cyclicACMIFvPatch.C:222
Foam::fvPatch::patch
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:161
Foam::coupledFvPatch
An abstract base class for patches that couple regions of the computational domain e....
Definition: coupledFvPatch.H:53
Foam::cyclicACMIPolyPatch
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
Definition: cyclicACMIPolyPatch.H:79
Foam::cyclicACMIFvPatch::makeWeights
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: cyclicACMIFvPatch.C:94
Foam::cyclicACMIFvPatch
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
Definition: cyclicACMIFvPatch.H:54