cyclicAMIFvPatch.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) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::cyclicAMIFvPatch
28 
29 Description
30  Cyclic patch for Arbitrary Mesh Interface (AMI)
31 
32 SourceFiles
33  cyclicAMIFvPatch.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef cyclicAMIFvPatch_H
38 #define cyclicAMIFvPatch_H
39 
40 #include "coupledFvPatch.H"
41 #include "cyclicAMILduInterface.H"
42 #include "cyclicAMIPolyPatch.H"
43 #include "fvBoundaryMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cyclicAMIFvPatch Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class cyclicAMIFvPatch
55 :
56  public coupledFvPatch,
58 {
59  // Private data
60 
61  const cyclicAMIPolyPatch& cyclicAMIPolyPatch_;
62 
63 
64 protected:
65 
66  // Protected Member functions
67 
68  //- Make patch weighting factors
69  void makeWeights(scalarField&) const;
70 
71  //- Correct patch deltaCoeffs
72  virtual void makeDeltaCoeffs(scalarField&) const;
73 
74  //- Correct patch non-ortho deltaCoeffs
75  virtual void makeNonOrthoDeltaCoeffs(scalarField&) const;
76 
77  //- Correct patch non-ortho correction vectors
78  virtual void makeNonOrthoCorrVectors(vectorField&) const;
79 
80  //- Correct patches after moving points
81  virtual void movePoints();
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName(cyclicAMIPolyPatch::typeName_());
88 
89 
90  // Constructors
91 
92  //- Construct from polyPatch
94  :
95  coupledFvPatch(patch, bm),
97  cyclicAMIPolyPatch_(refCast<const cyclicAMIPolyPatch>(patch))
98  {}
99 
100 
101  // Member functions
102 
103  // Access
104 
105  //- Return local reference cast into the cyclic patch
106  const cyclicAMIPolyPatch& cyclicAMIPatch() const
107  {
108  return cyclicAMIPolyPatch_;
109  }
110 
111  //- Return neighbour
112  virtual label neighbPatchID() const
113  {
114  return cyclicAMIPolyPatch_.neighbPatchID();
115  }
116 
117  virtual bool owner() const
118  {
119  return cyclicAMIPolyPatch_.owner();
120  }
121 
122  //- Return processor number
123  virtual const cyclicAMIFvPatch& neighbPatch() const
124  {
125  return refCast<const cyclicAMIFvPatch>
126  (
127  this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
128  );
129  }
130 
131  //- Return a reference to the AMI interpolator
132  virtual const AMIPatchToPatchInterpolation& AMI() const
133  {
134  return cyclicAMIPolyPatch_.AMI();
135  }
136 
137  //- Return true if applying the low weight correction
138  virtual bool applyLowWeightCorrection() const
139  {
140  return cyclicAMIPolyPatch_.applyLowWeightCorrection();
141  }
142 
143 
144  //- Are the cyclic planes parallel
145  virtual bool parallel() const
146  {
147  return cyclicAMIPolyPatch_.parallel();
148  }
149 
150  //- Return face transformation tensor
151  virtual const tensorField& forwardT() const
152  {
153  return cyclicAMIPolyPatch_.forwardT();
154  }
155 
156  //- Return neighbour-cell transformation tensor
157  virtual const tensorField& reverseT() const
158  {
159  return cyclicAMIPolyPatch_.reverseT();
160  }
161 
162  const cyclicAMIFvPatch& neighbFvPatch() const
163  {
164  return refCast<const cyclicAMIFvPatch>
165  (
166  this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
167  );
168  }
169 
170  //- Return true if this patch is coupled. This is equivalent
171  //- to the coupledPolyPatch::coupled() if parallel running or
172  //- both sides present, false otherwise
173  virtual bool coupled() const;
174 
175  //- Return delta (P to N) vectors across coupled patch
176  virtual tmp<vectorField> delta() const;
177 
178  template<class Type>
180  (
181  const Field<Type>& fld,
182  const UList<Type>& defaultValues = UList<Type>()
183  ) const
184  {
185  return cyclicAMIPolyPatch_.interpolate(fld, defaultValues);
186  }
187 
188  template<class Type>
190  (
191  const tmp<Field<Type>>& tFld,
192  const UList<Type>& defaultValues = UList<Type>()
193  ) const
194  {
195  return cyclicAMIPolyPatch_.interpolate(tFld, defaultValues);
196  }
197 
198 
199  // Interface transfer functions
200 
201  //- Return the values of the given internal data adjacent to
202  //- the interface as a field
204  (
205  const labelUList& internalData
206  ) const;
207 
208  //- Return neighbour field
210  (
211  const Pstream::commsTypes commsType,
212  const labelUList& internalData
213  ) const;
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
Foam::cyclicAMIFvPatch::neighbPatchID
virtual label neighbPatchID() const
Return neighbour.
Definition: cyclicAMIFvPatch.H:111
Foam::cyclicAMIFvPatch::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Definition: cyclicAMIFvPatch.H:179
Foam::cyclicAMIFvPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
Definition: cyclicAMIFvPatch.C:194
Foam::cyclicAMIPolyPatch::owner
virtual bool owner() const
Does this side own the patch?
Definition: cyclicAMIPolyPatch.C:848
Foam::cyclicAMIFvPatch::AMI
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Definition: cyclicAMIFvPatch.H:131
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::cyclicAMIFvPatch::delta
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
Definition: cyclicAMIFvPatch.C:125
Foam::cyclicAMILduInterface
An abstract base class for cyclic AMI coupled interfaces.
Definition: cyclicAMILduInterface.H:52
Foam::coupledPolyPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: coupledPolyPatch.H:296
Foam::cyclicAMIFvPatch::makeNonOrthoDeltaCoeffs
virtual void makeNonOrthoDeltaCoeffs(scalarField &) const
Correct patch non-ortho deltaCoeffs.
Definition: cyclicAMIFvPatch.C:111
Foam::coupledPolyPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: coupledPolyPatch.H:302
Foam::cyclicAMIFvPatch::neighbPatch
virtual const cyclicAMIFvPatch & neighbPatch() const
Return processor number.
Definition: cyclicAMIFvPatch.H:122
Foam::cyclicAMIFvPatch::neighbFvPatch
const cyclicAMIFvPatch & neighbFvPatch() const
Definition: cyclicAMIFvPatch.H:161
Foam::cyclicAMIFvPatch::applyLowWeightCorrection
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
Definition: cyclicAMIFvPatch.H:137
Foam::cyclicAMIFvPatch::makeDeltaCoeffs
virtual void makeDeltaCoeffs(scalarField &) const
Correct patch deltaCoeffs.
Definition: cyclicAMIFvPatch.C:105
Foam::cyclicAMIFvPatch::makeNonOrthoCorrVectors
virtual void makeNonOrthoCorrVectors(vectorField &) const
Correct patch non-ortho correction vectors.
Definition: cyclicAMIFvPatch.C:118
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::cyclicAMIFvPatch::TypeName
TypeName(cyclicAMIPolyPatch::typeName_())
Runtime type information.
Foam::Field< scalar >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::cyclicAMIFvPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: cyclicAMIFvPatch.H:156
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::cyclicAMIPolyPatch::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
fvBoundaryMesh.H
Foam::cyclicAMIFvPatch::coupled
virtual bool coupled() const
Definition: cyclicAMIFvPatch.C:54
Foam::cyclicAMIPolyPatch::neighbPatchID
virtual label neighbPatchID() const
Neighbour patch ID.
Definition: cyclicAMIPolyPatch.C:812
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::refCast
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:131
cyclicAMIPolyPatch.H
Foam::cyclicAMIPolyPatch::AMI
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
Definition: cyclicAMIPolyPatch.C:861
Foam::cyclicAMIFvPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Definition: cyclicAMIFvPatch.C:185
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::cyclicAMIFvPatch::owner
virtual bool owner() const
Definition: cyclicAMIFvPatch.H:116
Foam::cyclicAMIPolyPatch::applyLowWeightCorrection
bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
Definition: cyclicAMIPolyPatch.C:879
Foam::cyclicAMIFvPatch::makeWeights
void makeWeights(scalarField &) const
Make patch weighting factors.
Definition: cyclicAMIFvPatch.C:62
Foam::AMIInterpolation
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
Definition: AMIInterpolation.H:79
Foam::UList< Type >
Foam::cyclicAMIFvPatch::cyclicAMIFvPatch
cyclicAMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
Definition: cyclicAMIFvPatch.H:92
Foam::fvPatch::patch
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:161
Foam::cyclicAMIFvPatch::cyclicAMIPatch
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic patch.
Definition: cyclicAMIFvPatch.H:105
Foam::cyclicAMIFvPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIFvPatch.H:53
Foam::coupledFvPatch
An abstract base class for patches that couple regions of the computational domain e....
Definition: coupledFvPatch.H:53
cyclicAMILduInterface.H
Foam::cyclicAMIFvPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: cyclicAMIFvPatch.H:150
Foam::cyclicAMIFvPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: cyclicAMIFvPatch.H:144
Foam::cyclicAMIFvPatch::movePoints
virtual void movePoints()
Correct patches after moving points.
Definition: cyclicAMIFvPatch.C:203
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:67