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-2020 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"
67 #include "PatchFunction1.H"
69 #include "vectorList.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class cyclicACMIPolyPatch Declaration
78 \*---------------------------------------------------------------------------*/
79 
81 :
82  public cyclicAMIPolyPatch
83 {
84 
85 private:
86 
87  // Private data
88 
89  //- Name of non-overlapping patch
90  const word nonOverlapPatchName_;
91 
92  //- Index of non-overlapping patch
93  mutable label nonOverlapPatchID_;
94 
95  //- Mask/weighting for source patch
96  mutable scalarField srcMask_;
97 
98  //- Mask/weighting for target patch
99  mutable scalarField tgtMask_;
100 
101 
102  // Scaling of overlap (optional)
103 
104  //- Weighting for source mask
105  mutable autoPtr<PatchFunction1<scalar>> srcScalePtr_;
106 
107  //- Weighting for target mask
108  mutable autoPtr<PatchFunction1<scalar>> tgtScalePtr_;
109 
110  //- Stored face areas
111  mutable vectorField thisSf_;
112  mutable vectorField thisNoSf_;
113  mutable vectorField nbrSf_;
114  mutable vectorField nbrNoSf_;
115 
116  //- Scaled version of source mask
117  mutable scalarField srcScaledMask_;
118 
119  //- Scaled version of target mask
120  mutable scalarField tgtScaledMask_;
121 
122  //- Flag to detect whether AMI is up to date with mesh points
123  mutable uniformDimensionedScalarField AMITime_;
124 
125  //- Flag to detect whether scaled masks are up to date with
126  // current time
127  mutable label prevTimeIndex_;
128 
129 
130 protected:
131 
132  // Protected Member Functions
133 
134  //- Report coverage statics, e.g. number of uncovered/blended/covered
135  //- faces
136  void reportCoverage
137  (
138  const word& name,
139  const scalarField& weightSum
140  ) const;
141 
142  //- Reset the AMI interpolator, supply patch points
143  virtual void resetAMI(const UList<point>& points) const;
144 
145  //- Reset the AMI interpolator, use current patch points
146  virtual void resetAMI() const;
147 
148  //- Scale patch face areas to maintain physical area
149  virtual void scalePatchFaceAreas();
150 
151  //- Scale patch face areas to maintain physical area
152  virtual void scalePatchFaceAreas
153  (
154  const cyclicACMIPolyPatch& acmipp,
155  const scalarField& mask,
156  const vectorList& faceArea,
157  const vectorList& noFaceArea
158  );
159 
160  //- Initialise the calculation of the patch geometry
161  virtual void initGeometry(PstreamBuffers&);
162 
163  //- Calculate the patch geometry
164  virtual void calcGeometry(PstreamBuffers&);
165 
166  //- Initialise the patches for moving points
167  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
168 
169  //- Correct patches after moving points
170  virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
171 
172  //- Initialise the update of the patch topology
173  virtual void initUpdateMesh(PstreamBuffers&);
174 
175  //- Update of the patch topology
176  virtual void updateMesh(PstreamBuffers&);
177 
178  //- Clear geometry
179  virtual void clearGeom();
180 
181 
182 public:
183 
184  //- Runtime type information
185  TypeName("cyclicACMI");
186 
187 
188  // Constructors
189 
190  //- Construct from (base coupled patch) components
192  (
193  const word& name,
194  const label size,
195  const label start,
196  const label index,
197  const polyBoundaryMesh& bm,
198  const word& patchType,
200  const word& defaultAMIMethod = partialFaceAreaWeightAMI::typeName
201  );
202 
203  //- Construct from dictionary
205  (
206  const word& name,
207  const dictionary& dict,
208  const label index,
209  const polyBoundaryMesh& bm,
210  const word& patchType,
211  const word& defaultAMIMethod = partialFaceAreaWeightAMI::typeName
212  );
213 
214  //- Construct as copy, resetting the boundary mesh
216  (
217  const cyclicACMIPolyPatch&,
218  const polyBoundaryMesh&
219  );
220 
221  //- Construct given the original patch and resetting the
222  // face list and boundary mesh information
224  (
225  const cyclicACMIPolyPatch& pp,
226  const polyBoundaryMesh& bm,
227  const label index,
228  const label newSize,
229  const label newStart,
230  const word& nbrPatchName,
232  );
233 
234  //- Construct given the original patch and a map
236  (
237  const cyclicACMIPolyPatch& pp,
238  const polyBoundaryMesh& bm,
239  const label index,
240  const labelUList& mapAddressing,
241  const label newStart
242  );
243 
244 
245  //- Construct and return a clone, resetting the boundary mesh
246  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
247  {
249  }
250 
251  //- Construct and return a clone, resetting the face list
252  // and boundary mesh
254  (
255  const polyBoundaryMesh& bm,
256  const label index,
257  const label newSize,
258  const label newStart
259  ) const
260  {
261  return autoPtr<polyPatch>
262  (
264  (
265  *this,
266  bm,
267  index,
268  newSize,
269  newStart,
270  neighbPatchName(),
271  nonOverlapPatchName_
272  )
273  );
274  }
275 
276  //- Construct and return a clone, resetting the face list
277  // and boundary mesh
279  (
280  const polyBoundaryMesh& bm,
281  const label index,
282  const labelUList& mapAddressing,
283  const label newStart
284  ) const
285  {
286  return autoPtr<polyPatch>
287  (
289  (
290  *this,
291  bm,
292  index,
293  mapAddressing,
294  newStart
295  )
296  );
297  }
298 
299 
300  //- Destructor
301  virtual ~cyclicACMIPolyPatch() = default;
302 
303 
304  // Member Functions
305 
306  // Access
307 
308  //- Return a reference to the neighbour patch
309  virtual const cyclicACMIPolyPatch& neighbPatch() const;
310 
311  //- Non-overlapping patch name
312  inline const word& nonOverlapPatchName() const;
313 
314  //- Non-overlapping patch ID
315  virtual label nonOverlapPatchID() const;
316 
317  //- Return a const reference to the non-overlapping patch
318  inline const polyPatch& nonOverlapPatch() const;
319 
320  //- Return a reference to the non-overlapping patch
321  inline polyPatch& nonOverlapPatch();
322 
323  //- Mask field where 1 = overlap(coupled), 0 = no-overlap
324  inline const scalarField& mask() const;
325 
326  //- Return the mask/weighting for the source patch
327  virtual const scalarField& srcMask() const;
328 
329  //- Return the mask/weighting for the target patch
330  virtual const scalarField& tgtMask() const;
331 
332  //- Overlap tolerance
333  inline static scalar tolerance();
334 
335 
336  //- Initialize ordering for primitivePatch. Does not
337  // refer to *this (except for name() and type() etc.)
338  virtual void initOrder
339  (
341  const primitivePatch&
342  ) const;
343 
344  //- Return new ordering for primitivePatch.
345  // Ordering is -faceMap: for every face
346  // index of the new face -rotation:for every new face the clockwise
347  // shift of the original face. Return false if nothing changes
348  // (faceMap is identity, rotation is 0), true otherwise.
349  virtual bool order
350  (
352  const primitivePatch&,
354  labelList& rotation
355  ) const;
356 
357  //- Write the polyPatch data as a dictionary
358  virtual void write(Ostream&) const;
359 
360  // Handling optional scaling (time dependency)
361 
362  //- Update the AMI and patch areas. Return true if anything
363  // updated
364  virtual bool updateAreas() const;
365 
366  //- Return true if given object is up to date with *this
367  // (note : like regIOobject::upToDate but operates on object)
368  bool upToDate(const regIOobject&) const;
369 
370  //- Set object up to date with *this
371  // (note : like regIOobject::setUpToDate but operates on object)
372  void setUpToDate(regIOobject&) const;
373 };
374 
375 
376 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
377 
378 } // End namespace Foam
379 
380 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
381 
382 #include "cyclicACMIPolyPatchI.H"
383 
384 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
385 
386 #endif
387 
388 // ************************************************************************* //
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:62
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
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:87
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::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:849
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:61
Foam::cyclicACMIPolyPatch::clearGeom
virtual void clearGeom()
Clear geometry.
Definition: cyclicACMIPolyPatch.C:469
Foam::cyclicACMIPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: cyclicACMIPolyPatch.C:838
Foam::cyclicACMIPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: cyclicACMIPolyPatch.C:828
Foam::cyclicACMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicACMIPolyPatch.H:245
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::cyclicACMIPolyPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Definition: cyclicACMIPolyPatch.C:761
AMIPatchToPatchInterpolation.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::PrimitivePatch::points
const Field< point_type > & points() const
Return reference to global points.
Definition: PrimitivePatch.H:305
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=partialFaceAreaWeightAMI::typeName)
Construct from (base coupled patch) components.
Definition: cyclicACMIPolyPatch.C:512
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:313
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:258
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:71
Foam::cyclicACMIPolyPatch::neighbPatch
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
Definition: cyclicACMIPolyPatch.C:743
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::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:79
cyclicACMIPolyPatchI.H
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:59
Foam::cyclicACMIPolyPatch::mask
const scalarField & mask() const
Mask field where 1 = overlap(coupled), 0 = no-overlap.
Definition: cyclicACMIPolyPatchI.H:54
Foam::patchIdentifier::name
const word & name() const
The patch name.
Definition: patchIdentifier.H:134
Foam::patchIdentifier::index
label index() const
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:158
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85
partialFaceAreaWeightAMI.H
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:67