nonConformalCyclicPolyPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::nonConformalCyclicPolyPatch
26 
27 Description
28  Non-conformal cyclic poly patch. As nonConformalCoupledPolyPatch, but the
29  neighbouring patch is local and known and is made available by this class.
30 
31 See also
32  Foam::nonConformalCoupledPolyPatch
33 
34 SourceFiles
35  nonConformalCyclicPolyPatch.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef nonConformalCyclicPolyPatch_H
40 #define nonConformalCyclicPolyPatch_H
41 
42 #include "cyclicPolyPatch.H"
45 #include "raysPatchToPatch.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class nonConformalCyclicPolyPatch Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public cyclicPolyPatch,
60 {
61 public:
62 
63  // Public types
64 
65  //- Enumeration for the condition that triggers re-calculation of the
66  // intersection following mesh motion.
67  //
68  // 'always' will re-calculate the intersection, 'never' will not, and
69  // 'detect' will compare the new and old points and re-calculate if
70  // there is any difference.
71  //
72  // The comparison that 'detect' does has an expense associated with it,
73  // so it should only really be used if the patch is both moving and
74  // static at different times. If the patch is always in motion or is
75  // fully stationary, then it is more efficient to specify 'always' or
76  // 'never'.
77  //
78  // 'always' is the default, as it is safest to assume that motion
79  // always affects the intersection. Most non-conformal interfaces are
80  // used for sliding interfaces that are in motion for the entirety of
81  // the simulation, so 'always' is also typically more efficient than
82  // 'detect'.
83  enum class moveUpdate
84  {
85  always,
86  detect,
87  never
88  };
89 
90  //- Names of the move-update conditions
92 
93 
94 protected:
95 
96  // Protected data
97 
98  //- Is the intersection engine up to date? Zero if out of date. One if
99  // out of date (or potentially not out of date) because of motion. Two
100  // if up to date.
101  mutable label intersectionIsValid_;
102 
103  //- Patch-to-patch intersection engine
105 
106  //- Is the rays engine up to date? Zero if out of date. One if out of
107  // date (or potentially not out of date) because of motion. Two if up
108  // to date.
109  mutable label raysIsValid_;
110 
111  //- Patch-to-patch rays engine
112  mutable patchToPatches::rays rays_;
113 
114  //- The condition that triggers re-calculation following motion
115  const moveUpdate moveUpdate_;
116 
117 
118  // Protected Member Functions
119 
120  //- Initialise the calculation of the patch geometry
121  virtual void initCalcGeometry(PstreamBuffers&);
122 
123  //- Calculate the patch geometry
124  virtual void calcGeometry(PstreamBuffers&);
125 
126  //- Initialise the patches for moving points
127  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
128 
129  //- Initialise the update of the patch topology
130  virtual void initTopoChange(PstreamBuffers&);
131 
132  //- Clear geometry
133  virtual void clearGeom();
134 
135  //- Reset the patch name
136  virtual void rename(const wordList& newNames);
137 
138  //- Reset the patch index
139  virtual void reorder(const labelUList& newToOldIndex);
140 
141 
142 public:
143 
144  //- Runtime type information
145  TypeName("nonConformalCyclic");
146 
147 
148  // Constructors
149 
150  //- Construct from components
152  (
153  const word& name,
154  const label size,
155  const label start,
156  const label index,
157  const polyBoundaryMesh& bm,
158  const word& patchType
159  );
160 
161  //- Construct from components
163  (
164  const word& name,
165  const label size,
166  const label start,
167  const label index,
168  const polyBoundaryMesh& bm,
169  const word& patchType,
170  const word& nbrPatchName,
171  const word& origPatchName,
173  );
174 
175  //- Construct from dictionary
177  (
178  const word& name,
179  const dictionary& dict,
180  const label index,
181  const polyBoundaryMesh& bm,
182  const word& patchType
183  );
184 
185  //- Construct as copy, resetting the boundary mesh
187  (
189  const polyBoundaryMesh&
190  );
191 
192  //- Construct given the original patch and resetting the
193  // face list and boundary mesh information
195  (
196  const nonConformalCyclicPolyPatch& pp,
197  const polyBoundaryMesh& bm,
198  const label index,
199  const label newSize,
200  const label newStart,
201  const word& nbrPatchName,
202  const word& origPatchName
203  );
204 
205  //- Construct and return a clone, resetting the boundary mesh
206  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
207  {
208  return autoPtr<polyPatch>
209  (
210  new nonConformalCyclicPolyPatch(*this, bm)
211  );
212  }
213 
214  //- Construct and return a clone, resetting the face list
215  // and boundary mesh
216  virtual autoPtr<polyPatch> clone
217  (
218  const polyBoundaryMesh& bm,
219  const label index,
220  const label newSize,
221  const label newStart
222  ) const
223  {
224  return autoPtr<polyPatch>
225  (
227  (
228  *this,
229  bm,
230  index,
231  newSize,
232  newStart,
233  nbrPatchName(),
234  origPatchName()
235  )
236  );
237  }
238 
239 
240  //- Destructor
242 
243 
244  // Member Functions
245 
246  //- Neighbour patch
247  const nonConformalCyclicPolyPatch& nbrPatch() const;
248 
249  //- Inherit the cyclic owner method
251 
252  //- Inherit the cyclic neighbour method
254 
255  //- Inherit the cyclic transform method
257 
258  //- Is this patch coupled? Returns false. For NCC patches the poly
259  // mesh is considered non-coupled whilst the finite volume mesh is
260  // considered coupled.
261  virtual bool coupled() const;
262 
263  //- Access the intersection engine
265 
266  //- Access the rays engine
267  const patchToPatches::rays& rays() const;
268 
269  //- Compute a ray intersection across the coupling
270  remote ray
271  (
272  const scalar fraction,
273  const label origFacei,
274  const vector& p,
275  const vector& n,
276  point& nbrP
277  ) const;
278 
279  //- Write the polyPatch data as a dictionary
280  virtual void write(Ostream&) const;
281 };
282 
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 } // End namespace Foam
287 
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 
290 #endif
291 
292 // ************************************************************************* //
label n
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
autoPtr< PrimitivePatch< SubList< face >, const pointField & > > clone() const
Construct and return a clone.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label size() const
Return the number of elements in the UList.
Definition: UListI.H:311
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Cyclic plane patch.
virtual bool owner() const
Does this side own the patch ?
const word & nbrPatchName() const
Neighbour patch name.
virtual const transformer & transform() const
Return transformation between the coupled patches.
virtual bool neighbour() const
Does the coupled side own the patch ?
Cyclic plane transformation.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Non-conformal coupled poly patch. As nonConformalPolyPatch, but this patch is coupled to another non-...
Non-conformal cyclic poly patch. As nonConformalCoupledPolyPatch, but the neighbouring patch is local...
patchToPatches::intersection intersection_
Patch-to-patch intersection engine.
TypeName("nonConformalCyclic")
Runtime type information.
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
patchToPatches::rays rays_
Patch-to-patch rays engine.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
remote ray(const scalar fraction, const label origFacei, const vector &p, const vector &n, point &nbrP) const
Compute a ray intersection across the coupling.
virtual void rename(const wordList &newNames)
Reset the patch name.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const patchToPatches::rays & rays() const
Access the rays engine.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
nonConformalCyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual const transformer & transform() const
Inherit the cyclic transform method.
virtual bool coupled() const
Is this patch coupled? Returns false. For NCC patches the poly.
const patchToPatches::intersection & intersection() const
Access the intersection engine.
const nonConformalCyclicPolyPatch & nbrPatch() const
Neighbour patch.
const moveUpdate moveUpdate_
The condition that triggers re-calculation following motion.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
static const NamedEnum< moveUpdate, 3 > moveUpdateNames_
Names of the move-update conditions.
label raysIsValid_
Is the rays engine up to date? Zero if out of date. One if out of.
moveUpdate
Enumeration for the condition that triggers re-calculation of the.
label intersectionIsValid_
Is the intersection engine up to date? Zero if out of date. One if.
const word & origPatchName() const
Original patch name.
label index() const
Return the index of this patch in the boundaryMesh.
const word & name() const
Return name.
Class to generate patchToPatch coupling geometry. A full geometric intersection is done between a fac...
Foam::polyBoundaryMesh.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:280
Struct for keeping processor, element (cell, face, point) index.
Definition: remote.H:57
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict
volScalarField & p