cyclicACMIPolyPatch.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) 2018-2021 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::cyclicACMIPolyPatch
29
30Description
31 Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
32
33 Mixes cyclicAMI behaviour with non-coupled patch behaviour using
34 the overlap area fraction. The non-coupled patch is specified through
35 the nonOverlapPatch keyword.
36
37Usage
38 Example of the patch specification:
39
40 type cyclicACMI;
41 neighbourPatch ACMI2_couple; // cyclicAMI neighbour patch
42 nonOverlapPatch ACMI1_blockage; // patch for uncoupled faces
43
44 // Optional time-dependent scaling (PatchFunction1)
45 scale table
46 (
47 (0.00 1.0)
48 (0.02 1.0)
49 (0.0201 0.0)
50 );
51
52See also
53 cyclicAMIPolyPatch.C
54
55SourceFiles
56 cyclicACMIPolyPatch.C
57
58\*---------------------------------------------------------------------------*/
59
60#ifndef cyclicACMIPolyPatch_H
61#define cyclicACMIPolyPatch_H
62
63#include "cyclicAMIPolyPatch.H"
65#include "polyBoundaryMesh.H"
66#include "PatchFunction1.H"
68#include "vectorList.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74
75/*---------------------------------------------------------------------------*\
76 Class cyclicACMIPolyPatch Declaration
77\*---------------------------------------------------------------------------*/
80:
82{
83
84private:
85
86 // Private data
87
88 //- Name of non-overlapping patch
89 const word nonOverlapPatchName_;
90
91 //- Index of non-overlapping patch
92 mutable label nonOverlapPatchID_;
93
94 //- Mask/weighting for source patch
95 mutable scalarField srcMask_;
96
97 //- Mask/weighting for target patch
98 mutable scalarField tgtMask_;
99
100
101 // Scaling of overlap (optional)
102
103 //- Weighting for source mask
104 mutable autoPtr<PatchFunction1<scalar>> srcScalePtr_;
105
106 //- Weighting for target mask
107 mutable autoPtr<PatchFunction1<scalar>> tgtScalePtr_;
108
109 //- Stored raw/non-scaled face areas
110 mutable vectorField thisSf_;
111 mutable vectorField thisNoSf_;
112 mutable vectorField nbrSf_;
113 mutable vectorField nbrNoSf_;
114
115 //- Scaled version of source mask
116 mutable scalarField srcScaledMask_;
117
118 //- Scaled version of target mask
119 mutable scalarField tgtScaledMask_;
120
121 //- Flag to detect whether AMI is up to date with mesh points
122 mutable uniformDimensionedScalarField AMITime_;
123
124 //- Flag to detect whether scaled masks are up to date with
125 // current time
126 mutable label prevTimeIndex_;
127
128
129protected:
130
131 // Protected Member Functions
132
133 //- Report coverage statics, e.g. number of uncovered/blended/covered
134 //- faces
135 void reportCoverage
136 (
137 const word& name,
138 const scalarField& weightSum
139 ) const;
140
141 //- Reset the AMI interpolator, supply patch points
142 virtual void resetAMI(const UList<point>& points) const;
143
144 //- Reset the AMI interpolator, use current patch points
145 virtual void resetAMI() const;
146
147 //- Scale patch face areas to maintain physical area
148 virtual void scalePatchFaceAreas();
149
150 //- Scale patch face areas to maintain physical area
151 virtual void scalePatchFaceAreas
152 (
153 const cyclicACMIPolyPatch& acmipp,
154 const scalarField& mask,
155 const vectorList& faceArea,
156 const vectorList& noFaceArea
157 );
158
159 //- Initialise the calculation of the patch geometry
160 virtual void initGeometry(PstreamBuffers&);
161
162 //- Calculate the patch geometry
163 virtual void calcGeometry(PstreamBuffers&);
164
165 //- Initialise the patches for moving points
166 virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
167
168 //- Correct patches after moving points
169 virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
170
171 //- Initialise the update of the patch topology
172 virtual void initUpdateMesh(PstreamBuffers&);
173
174 //- Update of the patch topology
175 virtual void updateMesh(PstreamBuffers&);
176
177 //- Clear geometry
178 virtual void clearGeom();
179
180
181public:
182
183 //- Runtime type information
184 TypeName("cyclicACMI");
185
186
187 // Constructors
188
189 //- Construct from (base coupled patch) components
191 (
192 const word& name,
193 const label size,
194 const label start,
195 const label index,
196 const polyBoundaryMesh& bm,
197 const word& patchType,
199 const word& defaultAMIMethod = faceAreaWeightAMI::typeName
200 );
201
202 //- Construct from dictionary
204 (
205 const word& name,
206 const dictionary& dict,
207 const label index,
208 const polyBoundaryMesh& bm,
209 const word& patchType,
210 const word& defaultAMIMethod = faceAreaWeightAMI::typeName
211 );
212
213 //- Construct as copy, resetting the boundary mesh
215 (
216 const cyclicACMIPolyPatch&,
217 const polyBoundaryMesh&
218 );
219
220 //- Construct given the original patch and resetting the
221 // face list and boundary mesh information
223 (
224 const cyclicACMIPolyPatch& pp,
225 const polyBoundaryMesh& bm,
226 const label index,
227 const label newSize,
228 const label newStart,
229 const word& nbrPatchName,
231 );
232
233 //- Construct given the original patch and a map
235 (
236 const cyclicACMIPolyPatch& pp,
237 const polyBoundaryMesh& bm,
238 const label index,
239 const labelUList& mapAddressing,
240 const label newStart
241 );
242
243
244 //- Construct and return a clone, resetting the boundary mesh
245 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
246 {
248 }
249
250 //- Construct and return a clone, resetting the face list
251 // and boundary mesh
253 (
254 const polyBoundaryMesh& bm,
255 const label index,
256 const label newSize,
257 const label newStart
258 ) const
259 {
260 return autoPtr<polyPatch>
261 (
263 (
264 *this,
265 bm,
266 index,
267 newSize,
268 newStart,
270 nonOverlapPatchName_
271 )
272 );
273 }
274
275 //- Construct and return a clone, resetting the face list
276 // and boundary mesh
278 (
279 const polyBoundaryMesh& bm,
280 const label index,
281 const labelUList& mapAddressing,
282 const label newStart
283 ) const
284 {
285 return autoPtr<polyPatch>
286 (
288 (
289 *this,
290 bm,
291 index,
292 mapAddressing,
293 newStart
294 )
295 );
296 }
297
298
299 //- Destructor
300 virtual ~cyclicACMIPolyPatch() = default;
301
302
303 // Member Functions
304
305 // Implicit treatment functions
306
307 //- Return number of new internal sub-faces and new proc faces
308 virtual void newInternalProcFaces(label&, label&) const;
309
310 //- Return collocated faces
312
313
314 // Access
315
316 //- Return a reference to the neighbour patch
317 virtual const cyclicACMIPolyPatch& neighbPatch() const;
318
319 //- Non-overlapping patch name
320 inline const word& nonOverlapPatchName() const;
321
322 //- Non-overlapping patch ID
323 virtual label nonOverlapPatchID() const;
324
325 //- Return a const reference to the non-overlapping patch
326 inline const polyPatch& nonOverlapPatch() const;
327
328 //- Return a reference to the non-overlapping patch
329 inline polyPatch& nonOverlapPatch();
330
331 //- Mask field where 1 = overlap(coupled), 0 = no-overlap
332 inline const scalarField& mask() const;
333
334 //- Return the mask/weighting for the source patch
335 virtual const scalarField& srcMask() const;
336
337 //- Return the mask/weighting for the target patch
338 virtual const scalarField& tgtMask() const;
339
340 //- Overlap tolerance
341 inline static scalar tolerance();
342
343
344 //- Initialize ordering for primitivePatch. Does not
345 // refer to *this (except for name() and type() etc.)
346 virtual void initOrder
347 (
349 const primitivePatch&
350 ) const;
351
352 //- Return new ordering for primitivePatch.
353 // Ordering is -faceMap: for every face
354 // index of the new face -rotation:for every new face the clockwise
355 // shift of the original face. Return false if nothing changes
356 // (faceMap is identity, rotation is 0), true otherwise.
357 virtual bool order
358 (
360 const primitivePatch&,
362 labelList& rotation
363 ) const;
364
365 //- Write the polyPatch data as a dictionary
366 virtual void write(Ostream&) const;
367
368 // Handling optional scaling (time dependency)
369
370 //- Update the AMI and patch areas. Return true if anything
371 // updated
372 virtual bool updateAreas() const;
373
374 //- Return true if given object is up to date with *this
375 // (note : like regIOobject::upToDate but operates on object)
376 bool upToDate(const regIOobject&) const;
377
378 //- Set object up to date with *this
379 // (note : like regIOobject::setUpToDate but operates on object)
380 void setUpToDate(regIOobject&) const;
381};
382
383
384// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
385
386} // End namespace Foam
387
388// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389
390#include "cyclicACMIPolyPatchI.H"
391
392// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
393
394#endif
395
396// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of faces which address into the list of points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
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:94
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
virtual transformType transform() const
Type of transform.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
void setUpToDate(regIOobject &) const
Set object up to date with *this.
virtual void resetAMI() const
Reset the AMI interpolator, use current patch points.
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
virtual void scalePatchFaceAreas()
Scale patch face areas to maintain physical area.
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
virtual refPtr< labelListList > mapCollocatedFaces() const
Return collocated faces.
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
const scalarField & mask() const
Mask field where 1 = overlap(coupled), 0 = no-overlap.
virtual void clearGeom()
Clear geometry.
virtual ~cyclicACMIPolyPatch()=default
Destructor.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
virtual void newInternalProcFaces(label &, label &) const
Return number of new internal sub-faces and new proc faces.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
TypeName("cyclicACMI")
Runtime type information.
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
virtual const scalarField & srcMask() const
Return the mask/weighting for the source patch.
bool upToDate(const regIOobject &) const
Return true if given object is up to date with *this.
static scalar tolerance()
Overlap tolerance.
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
void reportCoverage(const word &name, const scalarField &weightSum) const
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
const word & nonOverlapPatchName() const
Non-overlapping patch name.
virtual bool updateAreas() const
Update the AMI and patch areas. Return true if anything.
Cyclic patch for Arbitrary Mesh Interface (AMI)
const word & neighbPatchName() const
Neighbour patch name.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:364
A class for managing references or pointers (no reference counting)
Definition: refPtr.H:58
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
A class for handling words, derived from Foam::string.
Definition: word.H:68
const pointField & points
Namespace for OpenFOAM.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
UList< label > labelUList
A UList of labels.
Definition: UList.H:85
runTime write()
dictionary dict
static const char *const typeName
The type name used in ensight case files.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73