Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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::cyclicACMIFvPatch
29
30Description
31 Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
32
33SourceFiles
34 cyclicACMIFvPatch.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef cyclicACMIFvPatch_H
39#define cyclicACMIFvPatch_H
40
41#include "coupledFvPatch.H"
43#include "cyclicACMIPolyPatch.H"
44#include "fvBoundaryMesh.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
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
69protected:
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
86public:
87
88 //- Runtime type information
89 TypeName(cyclicACMIPolyPatch::typeName_());
90
91
92 // Constructors
93
94 //- Construct from polyPatch
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
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 {
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
164 return cyclicACMIPolyPatch_.forwardT();
165 }
166
167 //- Return neighbour-cell transformation tensor
168 virtual const tensorField& reverseT() const
169 {
170 return cyclicACMIPolyPatch_.reverseT();
172
173 const cyclicACMIFvPatch& neighbFvPatch() const
174 {
176 (
177 this->boundaryMesh()[cyclicACMIPolyPatch_.neighbPatchID()]
178 );
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
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 // Interpolations (non-blocking). Subject to change
217
218 template<class Type>
219 void initInterpolate
220 (
221 const Field<Type>& fld,
222 labelRange& sendRequests,
223 labelRange& recvRequests,
224 PtrList<List<Type>>& sendBuffers,
225 PtrList<List<Type>>& recvBuffers,
226
227 labelRange& sendRequests1,
228 labelRange& recvRequests1,
229 PtrList<List<Type>>& sendBuffers1,
230 PtrList<List<Type>>& recvBuffers1
231 ) const
232 {
233 // Make sure areas are up-to-date
234 updateAreas();
235
236 cyclicACMIPolyPatch_.initInterpolate
237 (
238 fld,
239 sendRequests,
240 recvRequests,
241 sendBuffers,
242 recvBuffers,
243
244 sendRequests1,
245 recvRequests1,
246 sendBuffers1,
247 recvBuffers1
248 );
249 }
250
251 template<class Type>
253 (
254 const Field<Type>& localFld,
255 const labelRange& requests, // The receive requests
256 const PtrList<List<Type>>& recvBuffers,
257 const labelRange& requests1, // The receive requests
258 const PtrList<List<Type>>& recvBuffers1
259 ) const
260 {
261 return cyclicACMIPolyPatch_.interpolate
262 (
263 localFld,
264 requests,
265 recvBuffers,
266 requests1,
267 recvBuffers1,
269 );
270 }
271
272
273 // Interface transfer functions
274
275 //- Return the values of the given internal data adjacent to
276 //- the interface as a field
278 (
279 const labelUList& internalData
280 ) const;
281
282 //- Return the values of the given internal data adjacent to
283 //- the interface as a field using a mapping faceCell
285 (
286 const labelUList& internalData,
287 const labelUList& faceCells
288 ) const;
289
290 //- Return neighbour field
292 (
293 const Pstream::commsTypes commsType,
294 const labelUList& internalData
295 ) const;
296
297};
298
299
300// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301
302} // End namespace Foam
303
304// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
305
306#endif
307
308// ************************************************************************* //
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 array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
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
coupledFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
const cyclicACMIFvPatch & neighbFvPatch() const
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
tmp< Field< Type > > interpolate(const tmp< Field< Type > > &tfld) const
Interpolate (make sure to have up-to-date areas).
void resetPatchAreas(const fvPatch &fvp) const
Helper function to reset the FV patch areas from the primitive patch.
virtual bool owner() const
void makeWeights(scalarField &) const
Make patch weighting factors.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual label neighbPatchID() const
Return neighbour.
virtual void movePoints()
Correct patches after moving points.
TypeName(cyclicACMIPolyPatch::typeName_())
Runtime type information.
virtual bool coupled() const
Return true if this patch is coupled.
virtual bool parallel() const
Are the cyclic planes parallel.
const cyclicACMIPolyPatch & cyclicACMIPatch() const
Return local reference cast into the cyclic patch.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
cyclicACMIFvPatch(const polyPatch &patch, const fvBoundaryMesh &bm)
Construct from polyPatch.
virtual const fvPatch & nonOverlapPatch() const
Return non-overlapping fvPatch.
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.
void initInterpolate(const Field< Type > &fld, labelRange &sendRequests, labelRange &recvRequests, PtrList< List< Type > > &sendBuffers, PtrList< List< Type > > &recvBuffers, labelRange &sendRequests1, labelRange &recvRequests1, PtrList< List< Type > > &sendBuffers1, PtrList< List< Type > > &recvBuffers1) const
virtual const cyclicACMIFvPatch & neighbPatch() const
Return neighbour fvPatch.
tmp< Field< Type > > interpolate(const Field< Type > &localFld, const labelRange &requests, const PtrList< List< Type > > &recvBuffers, const labelRange &requests1, const PtrList< List< Type > > &recvBuffers1) const
virtual bool updateAreas() const
Update the AMI and patch areas. Return true if anything updated.
virtual label nonOverlapPatchID() const
Return neighbour.
tmp< Field< Type > > interpolate(const Field< Type > &fld) const
Interpolate (make sure to have uptodate areas).
virtual const tensorField & forwardT() const
Return face transformation tensor.
cyclicACMILduInterface() noexcept=default
Default construct.
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.
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 ...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
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 range or interval of labels defined by a start and a size.
Definition labelRange.H:66
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
UniformDimensionedField< scalar > uniformDimensionedScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
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