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-2026 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  );
159 
160  //- Construct from components
162  (
163  const word& name,
164  const label size,
165  const label start,
166  const label index,
167  const polyBoundaryMesh& bm,
168  const word& nbrPatchName,
169  const word& origPatchName,
171  );
172 
173  //- Construct from dictionary
175  (
176  const word& name,
177  const dictionary& dict,
178  const label index,
179  const polyBoundaryMesh& bm
180  );
181 
182  //- Construct as copy, resetting the boundary mesh
184  (
186  const polyBoundaryMesh&
187  );
188 
189  //- Construct given the original patch and resetting the
190  // face list and boundary mesh information
192  (
193  const nonConformalCyclicPolyPatch& pp,
194  const polyBoundaryMesh& bm,
195  const label index,
196  const label newSize,
197  const label newStart,
198  const word& nbrPatchName,
199  const word& origPatchName
200  );
201 
202  //- Construct and return a clone, resetting the boundary mesh
203  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
204  {
205  return autoPtr<polyPatch>
206  (
207  new nonConformalCyclicPolyPatch(*this, bm)
208  );
209  }
210 
211  //- Construct and return a clone, resetting the face list
212  // and boundary mesh
213  virtual autoPtr<polyPatch> clone
214  (
215  const polyBoundaryMesh& bm,
216  const label index,
217  const label newSize,
218  const label newStart
219  ) const
220  {
221  return autoPtr<polyPatch>
222  (
224  (
225  *this,
226  bm,
227  index,
228  newSize,
229  newStart,
230  nbrPatchName(),
231  origPatchName()
232  )
233  );
234  }
235 
236 
237  //- Destructor
239 
240 
241  // Member Functions
242 
243  //- Return true as this patch is a constraint type
244  virtual bool constraint() const
245  {
246  return true;
247  }
248 
249  //- Neighbour patch
250  const nonConformalCyclicPolyPatch& nbrPatch() const;
251 
252  //- Inherit the cyclic owner method
254 
255  //- Inherit the cyclic neighbour method
257 
258  //- Inherit the cyclic transform method
260 
261  //- Is this patch coupled? Returns false. For NCC patches the poly
262  // mesh is considered non-coupled whilst the finite volume mesh is
263  // considered coupled.
264  virtual bool coupled() const;
265 
266  //- Access the intersection engine
268 
269  //- Access the rays engine
270  const patchToPatches::rays& rays() const;
271 
272  //- Compute a ray intersection across the coupling
273  remote ray
274  (
275  const scalar fraction,
276  const label origFacei,
277  const vector& p,
278  const vector& n,
279  point& nbrP
280  ) const;
281 
282  //- Write the polyPatch data as a dictionary
283  virtual void write(Ostream&) const;
284 };
285 
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 } // End namespace Foam
290 
291 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292 
293 #endif
294 
295 // ************************************************************************* //
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.
nonConformalCyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Construct from components.
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.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual const transformer & transform() const
Inherit the cyclic transform method.
virtual bool constraint() const
Return true as this patch is a constraint type.
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:277
Struct for keeping processor, element (cell, face, point) index.
Definition: remote.H:57
A class for handling words, derived from string.
Definition: word.H:63
const unitSet fraction
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