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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::cyclicACMIPolyPatch
29 
30 Description
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 
37 Usage
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 
52 See also
53  cyclicAMIPolyPatch.C
54 
55 SourceFiles
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 
72 namespace Foam
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class cyclicACMIPolyPatch Declaration
77 \*---------------------------------------------------------------------------*/
78 
80 :
81  public cyclicAMIPolyPatch
82 {
83 
84 private:
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 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 
129 protected:
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 
181 public:
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,
269  neighbPatchName(),
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 // ************************************************************************* //
Foam::PrimitivePatch::points
const Field< point_type > & points() const noexcept
Return reference to global points.
Definition: PrimitivePatch.H:299
Foam::cyclicACMIPolyPatch::calcGeometry
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: cyclicACMIPolyPatch.C:412
Foam::cyclicACMIPolyPatch::movePoints
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
Definition: cyclicACMIPolyPatch.C:441
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.C:94
vectorList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:63
Foam::cyclicACMIPolyPatch::upToDate
bool upToDate(const regIOobject &) const
Return true if given object is up to date with *this.
Definition: cyclicACMIPolyPatch.C:142
PatchFunction1.H
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:88
Foam::cyclicACMIPolyPatch::tolerance
static scalar tolerance()
Overlap tolerance.
Definition: cyclicACMIPolyPatchI.H:65
Foam::cyclicACMIPolyPatch::setUpToDate
void setUpToDate(regIOobject &) const
Set object up to date with *this.
Definition: cyclicACMIPolyPatch.C:151
Foam::cyclicACMIPolyPatch::resetAMI
virtual void resetAMI() const
Reset the AMI interpolator, use current patch points.
Definition: cyclicACMIPolyPatch.C:265
Foam::cyclicACMIPolyPatch::newInternalProcFaces
virtual void newInternalProcFaces(label &, label &) const
Return number of new internal sub-faces and new proc faces.
Definition: cyclicACMIPolyPatch.C:744
Foam::cyclicACMIPolyPatch::nonOverlapPatchName
const word & nonOverlapPatchName() const
Non-overlapping patch name.
Definition: cyclicACMIPolyPatchI.H:30
Foam::cyclicACMIPolyPatch::TypeName
TypeName("cyclicACMI")
Runtime type information.
Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch
virtual ~cyclicACMIPolyPatch()=default
Destructor.
Foam::cyclicACMIPolyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: cyclicACMIPolyPatch.C:461
Foam::UniformDimensionedField< scalar >
Foam::cyclicACMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicACMIPolyPatch.C:908
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::cyclicACMIPolyPatch::srcMask
virtual const scalarField & srcMask() const
Return the mask/weighting for the source patch.
Definition: cyclicACMIPolyPatch.C:477
Foam::coupledPolyPatch::UNKNOWN
Definition: coupledPolyPatch.H:62
Foam::cyclicACMIPolyPatch::clearGeom
virtual void clearGeom()
Clear geometry.
Definition: cyclicACMIPolyPatch.C:469
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
cyclicACMIPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform=UNKNOWN, const word &defaultAMIMethod=faceAreaWeightAMI::typeName)
Construct from (base coupled patch) components.
Definition: cyclicACMIPolyPatch.C:512
Foam::cyclicACMIPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: cyclicACMIPolyPatch.C:897
Foam::cyclicACMIPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: cyclicACMIPolyPatch.C:887
Foam::cyclicACMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicACMIPolyPatch.H:244
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::cyclicACMIPolyPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Definition: cyclicACMIPolyPatch.C:820
AMIPatchToPatchInterpolation.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchIdentifier::index
label index() const noexcept
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:147
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:361
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:263
cyclicAMIPolyPatch.H
Foam::cyclicACMIPolyPatch::initMovePoints
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
Definition: cyclicACMIPolyPatch.C:421
Foam::cyclicACMIPolyPatch::scalePatchFaceAreas
virtual void scalePatchFaceAreas()
Scale patch face areas to maintain physical area.
Definition: cyclicACMIPolyPatch.C:353
uniformDimensionedFields.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::cyclicACMIPolyPatch::neighbPatch
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
Definition: cyclicACMIPolyPatch.C:802
Foam::cyclicACMIPolyPatch::mapCollocatedFaces
virtual refPtr< labelListList > mapCollocatedFaces() const
Return collocated faces.
Definition: cyclicACMIPolyPatch.C:779
Foam::List< vector >
Foam::cyclicACMIPolyPatch::updateAreas
virtual bool updateAreas() const
Update the AMI and patch areas. Return true if anything.
Definition: cyclicACMIPolyPatch.C:46
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::cyclicAMIPolyPatch::neighbPatchName
const word & neighbPatchName() const
Neighbour patch name.
Definition: cyclicAMIPolyPatchI.H:49
polyBoundaryMesh.H
Foam::cyclicACMIPolyPatch::nonOverlapPatch
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
Definition: cyclicACMIPolyPatchI.H:36
Foam::patchIdentifier::name
const word & name() const noexcept
The patch name.
Definition: patchIdentifier.H:135
Foam::cyclicACMIPolyPatch::tgtMask
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
Definition: cyclicACMIPolyPatch.C:493
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cyclicACMIPolyPatch
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
Definition: cyclicACMIPolyPatch.H:78
cyclicACMIPolyPatchI.H
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:60
Foam::cyclicACMIPolyPatch::mask
const scalarField & mask() const
Mask field where 1 = overlap(coupled), 0 = no-overlap.
Definition: cyclicACMIPolyPatchI.H:54
Foam::refPtr
A class for managing references or pointers (no reference counting)
Definition: PtrList.H:60
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79
Foam::cyclicACMIPolyPatch::initGeometry
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: cyclicACMIPolyPatch.C:394
Foam::cyclicACMIPolyPatch::reportCoverage
void reportCoverage(const word &name, const scalarField &weightSum) const
Definition: cyclicACMIPolyPatch.C:158
Foam::cyclicACMIPolyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: cyclicACMIPolyPatch.C:453
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:68