Loading...
Searching...
No Matches
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 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::cyclicAMIFvPatch
29
30Description
31 Cyclic patch for Arbitrary Mesh Interface (AMI)
32
33SourceFiles
34 cyclicAMIFvPatch.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_cyclicAMIFvPatch_H
39#define Foam_cyclicAMIFvPatch_H
40
41#include "cyclicAMIPolyPatch.H"
42#include "coupledFvPatch.H"
44#include "fvBoundaryMesh.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
51/*---------------------------------------------------------------------------*\
52 Class cyclicAMIFvPatch Declaration
53\*---------------------------------------------------------------------------*/
54
56:
57 public coupledFvPatch,
59{
60 // Private Data
61
62 const cyclicAMIPolyPatch& cyclicAMIPolyPatch_;
63
64
65protected:
66
67 // Protected Member functions
68
69 //- Make patch weighting factors
70 void makeWeights(scalarField&) const;
71
72 //- Correct patch deltaCoeffs
73 virtual void makeDeltaCoeffs(scalarField&) const;
74
75 //- Correct patch non-ortho deltaCoeffs
76 virtual void makeNonOrthoDeltaCoeffs(scalarField&) const;
77
78 //- Correct patch non-ortho correction vectors
79 virtual void makeNonOrthoCorrVectors(vectorField&) const;
80
81 //- Correct patches after moving points
82 virtual void movePoints();
83
84
85public:
86
87 //- Runtime type information
88 TypeName(cyclicAMIPolyPatch::typeName_());
89
90
91 // Constructors
92
93 //- Construct from polyPatch
95 :
98 cyclicAMIPolyPatch_(refCast<const cyclicAMIPolyPatch>(patch))
99 {}
100
101
102 // Member functions
104 // Access
105
106// // Implicit treatment functions
107//
108// //- Return number of new internal of this polyPatch faces
109// virtual void newInternalProcFaces(label&, label&) const;
110//
111// //- Return nbrCells
112// virtual const labelUList& nbrCells() const
113// {
114// return cyclicAMIPolyPatch_.neighbPatch().faceCells();
115// }
116//
117// //- Return nbr patch ID
118// virtual label neighbPolyPatchID() const
119// {
120// return neighbPatchID();
121// }
122//
123// //- Return collocated faces map
124// virtual refPtr<labelListList> mapCollocatedFaces() const
125// {
126// const labelListList& sourceFaces =
127// cyclicAMIPolyPatch_.AMI().srcAddress();
128// return refPtr<labelListList>
129// (
130// new labelListList(sourceFaces)
131// );
132// }
133//
134// //- Return implicit master
135// virtual bool masterImplicit() const
136// {
137// return owner();
138// }
139
140
141 //- Return local reference cast into the cyclic patch
143 {
144 return cyclicAMIPolyPatch_;
145 }
146
147 //- Does this side own the patch?
148 virtual bool owner() const
149 {
150 return cyclicAMIPolyPatch_.owner();
151 }
152
153 //- Return neighbour patch ID
154 virtual label neighbPatchID() const
155 {
156 return cyclicAMIPolyPatch_.neighbPatchID();
157 }
158
159 //- Return a reference to the neighbour patch
160 virtual const cyclicAMIFvPatch& neighbPatch() const
163 (
164 this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
165 );
166 }
167
168 //- Return a reference to the AMI interpolator
169 virtual const AMIPatchToPatchInterpolation& AMI() const
170 {
171 return cyclicAMIPolyPatch_.AMI();
172 }
173
174 //- Return true if applying the low weight correction
175 virtual bool applyLowWeightCorrection() const
176 {
177 return cyclicAMIPolyPatch_.applyLowWeightCorrection();
178 }
179
180
181 //- Are the cyclic planes parallel
182 virtual bool parallel() const
183 {
184 return cyclicAMIPolyPatch_.parallel();
185 }
186
187 //- Return face transformation tensor
188 virtual const tensorField& forwardT() const
189 {
190 return cyclicAMIPolyPatch_.forwardT();
191 }
192
193 //- Return neighbour-cell transformation tensor
194 virtual const tensorField& reverseT() const
195 {
196 return cyclicAMIPolyPatch_.reverseT();
197 }
198
199 const cyclicAMIFvPatch& neighbFvPatch() const
200 {
202 (
203 this->boundaryMesh()[cyclicAMIPolyPatch_.neighbPatchID()]
204 );
206
207
208 //- Return true if this patch is coupled. This is equivalent
209 //- to the coupledPolyPatch::coupled() if parallel running or
210 //- both sides present, false otherwise
211 virtual bool coupled() const;
212
213 //- Return delta (P to N) vectors across coupled patch
214 virtual tmp<vectorField> delta() const;
215
216 template<class Type>
218 (
219 const Field<Type>& fld,
220 const UList<Type>& defaultValues = UList<Type>()
221 ) const
222 {
223 return cyclicAMIPolyPatch_.interpolate(fld, defaultValues);
224 }
225
226 template<class Type>
228 (
229 const tmp<Field<Type>>& tFld,
230 const UList<Type>& defaultValues = UList<Type>()
231 ) const
232 {
233 return cyclicAMIPolyPatch_.interpolate(tFld, defaultValues);
234 }
235
236
237 // Interface transfer functions
238
239 //- Return the values of the given internal data adjacent to
240 //- the interface as a field
242 (
243 const labelUList& internalData
244 ) const;
245
246
247 //- Return the values of the given internal data adjacent to
248 //- the interface as a field using a mapping faceCell
250 (
251 const labelUList& internalData,
252 const labelUList& faceCells
253 ) const;
254
255
256 //- Return neighbour field
259 const Pstream::commsTypes commsType,
260 const labelUList& internalData
261 ) const;
262};
263
264
265// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266
267} // End namespace Foam
268
269// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270
271#endif
272
273// ************************************************************************* //
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
commsTypes
Communications types.
Definition UPstream.H:81
virtual const labelUList & faceCells() const
Return faceCell addressing.
coupledFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual bool parallel() const
Are the cyclic planes parallel.
Cyclic patch for Arbitrary Mesh Interface (AMI).
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
TypeName(cyclicAMIPolyPatch::typeName_())
Runtime type information.
cyclicAMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual bool owner() const
Does this side own the patch?
void makeWeights(scalarField &) const
Make patch weighting factors.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual void makeNonOrthoDeltaCoeffs(scalarField &) const
Correct patch non-ortho deltaCoeffs.
const cyclicAMIPolyPatch & cyclicAMIPatch() const
Return local reference cast into the cyclic patch.
virtual label neighbPatchID() const
Return neighbour patch ID.
virtual void makeDeltaCoeffs(scalarField &) const
Correct patch deltaCoeffs.
virtual const cyclicAMIFvPatch & neighbPatch() const
Return a reference to the neighbour patch.
virtual void movePoints()
Correct patches after moving points.
virtual bool coupled() const
Return true if this patch is coupled. This is equivalent to the coupledPolyPatch::coupled() if parall...
virtual bool parallel() const
Are the cyclic planes parallel.
const cyclicAMIFvPatch & neighbFvPatch() const
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual void makeNonOrthoCorrVectors(vectorField &) const
Correct patch non-ortho correction vectors.
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 the interface as a field.
virtual const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
tmp< Field< Type > > interpolate(const tmp< Field< Type > > &tFld, const UList< Type > &defaultValues=UList< Type >()) const
virtual bool applyLowWeightCorrection() const
Return true if applying the low weight correction.
virtual const tensorField & forwardT() const
Return face transformation tensor.
cyclicAMILduInterface() noexcept=default
Default construct.
Cyclic patch for Arbitrary Mesh Interface (AMI).
virtual bool owner() const
Does this side own the patch?
virtual label neighbPatchID() const
Neighbour patch ID.
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
const polyPatch & patch() const noexcept
Return the polyPatch.
Definition fvPatch.H:202
const fvBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
Definition fvPatch.H:268
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68