1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Partial overlap generalised grid interface (GGI) patch. Master and slave
29 sides are copied as much as the given number to complete the 360 degree
30 cicumferential surface.
32 The data interpolation between master and slave patches do not depend on
33 relative position of them, because of the full circumferential expansion
37 Hrvoje Jasak, Wikki Ltd. All rights reserved
38 Fethi Tekin, All rights reserved.
39 Oliver Borm, All rights reserved.
43 overlapGgiPolyPatchGeometry.C
45 \*---------------------------------------------------------------------------*/
47 #ifndef overlapGgiPolyPatch_H
48 #define overlapGgiPolyPatch_H
50 #include "coupledPolyPatch.H"
51 #include "standAlonePatch.H"
52 #include "overlapGgiInterpolation.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 /*---------------------------------------------------------------------------*\
61 Class overlapGgiPolyPatch Declaration
62 \*---------------------------------------------------------------------------*/
64 class overlapGgiPolyPatch
66 public coupledPolyPatch
71 const word shadowName_;
73 //- Interpolation zone name
76 //- Shadow patch index. Delayed evaluation for construction
77 mutable label shadowIndex_;
79 //- Interpolation zone index. Delayed evaluation for construction
80 mutable label zoneIndex_;
82 //- Rotation parameter for the overlap
85 const vector rotationAxis_;
87 // Number of copies in order to complete 360 degrees
93 //- Pointer to expanded master patch
94 mutable standAlonePatch* expandedMasterPtr_;
96 //- Pointer to expanded slave patch
97 mutable standAlonePatch* expandedSlavePtr_;
99 //- Patch-to-expanded-patch interpolation
100 mutable overlapGgiInterpolation* patchToPatchPtr_;
102 //- Is the patch localised on a single processor
103 // (single processor in a parallel run)?
104 // Used for parallel optimisation
105 mutable bool* localParallelPtr_;
107 //- Reconstructed patch neighbour cell centres
108 mutable vectorField* reconFaceCellCentresPtr_;
111 // Private member functions
113 //- Return reference to patch-to-patch interpolation
114 const overlapGgiInterpolation& patchToPatch() const;
116 //- Calculate expanded patch geometry
117 standAlonePatch* calcExpandedGeometry(label ncp, label index) const;
119 //- Return reference to expanded master patch
120 const standAlonePatch& expandedMaster() const;
122 //- Return reference to expanded slave patch
123 const standAlonePatch& expandedSlave() const;
125 //- Calculate local parallel switch
126 void calcLocalParallel() const;
128 //- Calculate interpolation
129 void calcPatchToPatch() const;
131 //- Calculate reconstructed cell centres
132 void calcReconFaceCellCentres() const;
134 //- Force calculation of transformation tensors
135 void calcTransforms() const;
137 //- Check definition: angles and offsets
138 void checkDefinition() const;
149 // Protected Member functions
151 //- Is the GGI active? (zone and shadow present)
154 //- Initialise the calculation of the patch addressing
155 virtual void initAddressing();
157 //- Calculate the patch addressing
158 virtual void calcAddressing();
160 //- Initialise the calculation of the patch geometry
161 virtual void initGeometry();
163 //- Calculate the patch geometry
164 virtual void calcGeometry();
166 //- Initialise the patches for moving points
167 virtual void initMovePoints(const pointField&);
169 //- Correct patches after moving points
170 virtual void movePoints(const pointField&);
172 //- Initialise the update of the patch topology
173 virtual void initUpdateMesh();
175 //- Update of the patch topology
176 virtual void updateMesh();
181 //- Runtime type information
182 TypeName("overlapGgi");
187 //- Construct from components
194 const polyBoundaryMesh& bm
197 //- Construct from components
204 const polyBoundaryMesh& bm,
205 const word& shadowName,
206 const word& zoneName,
211 //- Construct from dictionary
215 const dictionary& dict,
217 const polyBoundaryMesh&
220 //- Construct as copy, resetting the boundary mesh
223 const overlapGgiPolyPatch&,
224 const polyBoundaryMesh&
227 //- Construct as given the original patch and resetting the
228 // face list and boundary mesh information
231 const overlapGgiPolyPatch& pp,
232 const polyBoundaryMesh& bm,
238 //- Construct and return a clone, resetting the boundary mesh
239 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
241 return autoPtr<polyPatch>(new overlapGgiPolyPatch(*this, bm));
244 //- Construct and return a clone, resetting the face list
246 virtual autoPtr<polyPatch> clone
248 const polyBoundaryMesh& bm,
254 return autoPtr<polyPatch>
256 new overlapGgiPolyPatch
258 refCast<const overlapGgiPolyPatch>(*this),
270 virtual ~overlapGgiPolyPatch();
275 //- Return shadow patch name
276 const word& shadowName() const
281 //- Return name of interpolation face zone
282 const word& zoneName() const
287 //- Return shadow patch index
288 label shadowIndex() const;
290 //- Return zone patch index
291 label zoneIndex() const;
293 //- Return shadow patch
294 const overlapGgiPolyPatch& shadow() const;
296 //- Return interpolation face zone
297 const faceZone& zone() const;
299 //- Return rotation axis
300 const vector& rotationAxis() const
302 return rotationAxis_;
305 //- Return wedge angle
308 return 360.0/scalar(nCopies());
311 //- Return number of slave copies
312 const label& nCopies() const;
314 //- Is this the master side?
317 //- Is this the slave side?
323 //- Is the patch localised on a single processor
324 bool localParallel() const;
326 //- Expand face field to full for 360 degrees coverage
328 tmp<Field<Type> > expandData(const Field<Type>& spf) const;
330 //- Interpolate face field: given field on the shadow side,
331 // create an interpolated field on this side
333 tmp<Field<Type> > interpolate(const Field<Type>& pf) const;
336 tmp<Field<Type> > interpolate(const tmp<Field<Type> >& tpf) const;
338 //- Filter zone field to patch size
340 tmp<Field<Type> > filter(const Field<Type>& zf) const;
342 //- Return reconstructed cell centres
343 const vectorField& reconFaceCellCentres() const;
345 //- Initialize ordering for primitivePatch. Does not
346 // refer to *this (except for name() and type() etc.)
347 virtual void initOrder(const primitivePatch&) const;
349 //- Return new ordering for primitivePatch.
350 // Ordering is -faceMap: for every face
351 // index of the new face -rotation: for every new face the clockwise
352 // shift of the original face. Return false if nothing changes
353 // (faceMap is identity, rotation is 0), true otherwise.
356 const primitivePatch&,
361 //- Synchronise communications of ordering for primitivePatch
362 // Used in cases when no topological change happens locally,
363 // but is happening on other processors
364 virtual void syncOrder() const;
368 virtual void write(Ostream&) const;
372 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
374 } // End namespace Foam
376 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
379 # include "overlapGgiPolyPatchTemplates.C"
382 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
386 // ************************************************************************* //