fvMeshTopoChangersMeshToMesh.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) 2022-2023 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::fvMeshTopoChangers::meshToMesh
26 
27 Description
28  fvMeshTopoChanger which maps the fields to a new mesh or sequence of meshes
29 
30  which can optionally be mapped to repeatedly for example in multi-cycle
31  engine cases or cycled through for symmetric forward and reverse motion.
32 
33 Usage
34  \table
35  Property | Description | Required | Default value
36  libs | Libraries to load | no |
37  times | List of times for the meshes | yes |
38  repeat | Repetition period | no |
39  cycle | Cycle period | no |
40  begin | Begin time for the meshes | no | Time::beginTime()
41  timeDelta | Time tolerance used for time -> index | yes |
42  \endtable
43 
44  Examples of the mesh-to-mesh mapping for the multi-cycle
45  tutorials/incompressibleFluid/movingCone case:
46  \verbatim
47  topoChanger
48  {
49  type meshToMesh;
50 
51  libs ("libmeshToMeshTopoChanger.so");
52 
53  times (0.0015 0.003);
54 
55  cycle #calc "1.0/300.0";
56  begin 0;
57 
58  timeDelta 1e-6;
59  }
60  \endverbatim
61 
62 SourceFiles
63  fvMeshTopoChangersMeshToMesh.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef fvMeshTopoChangersMeshToMesh_H
68 #define fvMeshTopoChangersMeshToMesh_H
69 
70 #include "fvMeshTopoChanger.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76 namespace fvMeshTopoChangers
77 {
78 
79 /*---------------------------------------------------------------------------*\
80  Class fvMeshTopoChangers::meshToMesh Declaration
81 \*---------------------------------------------------------------------------*/
82 
83 class meshToMesh
84 :
85  public fvMeshTopoChanger
86 {
87  // Private Data
88 
89  //- Mesh-to-mesh control dictionary
90  dictionary dict_;
91 
92  //- List of mesh mapping times
93  scalarList times_;
94 
95  //- Time delta used for time -> index
96  scalar timeDelta_;
97 
98  //- Hash set of mesh mapping time indices
99  HashSet<int64_t, Hash<int64_t>> timeIndices_;
100 
101  //- Optional begin time for the meshes
102  scalar begin_;
103 
104  //- Optional repetition period
105  scalar repeat_;
106 
107  //- Optional cycle period
108  scalar cycle_;
109 
110  //- The time index used for updating
111  label timeIndex_;
112 
113 
114  // Private Member Functions
115 
116  //- Return true if the set of meshes are being traversed in the forward
117  // sequence or false if cycling is currently traversing the meshes in
118  // revers order
119  bool forward() const;
120 
121  //- Return the user time mapped to the mesh sequence
122  // handling the repeat or cycle option
123  scalar meshTime() const;
124 
125  //- Interpolate U's to Uf's
126  void interpolateUfs();
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("meshToMesh");
133 
134 
135  // Constructors
136 
137  //- Construct from fvMesh and dictionary
138  meshToMesh(fvMesh&, const dictionary& dict);
139 
140  //- Disallow default bitwise copy construction
141  meshToMesh(const meshToMesh&) = delete;
142 
143 
144  //- Destructor
145  virtual ~meshToMesh();
146 
147 
148  // Member Functions
149 
150  scalar timeToNextMesh() const;
151 
152  //- Update the mesh for both mesh motion and topology change
153  virtual bool update();
154 
155  //- Update corresponding to the given map
156  virtual void topoChange(const polyTopoChangeMap&);
157 
158  //- Update from another mesh using the given map
159  virtual void mapMesh(const polyMeshMap&);
160 
161  //- Update corresponding to the given distribution map
162  virtual void distribute(const polyDistributionMap&);
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const meshToMesh&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace fvMeshTopoChangers
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
fvMeshTopoChanger which maps the fields to a new mesh or sequence of meshes
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
TypeName("meshToMesh")
Runtime type information.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool update()
Update the mesh for both mesh motion and topology change.
void operator=(const meshToMesh &)=delete
Disallow default bitwise assignment.
meshToMesh(fvMesh &, const dictionary &dict)
Construct from fvMesh and dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:50
dictionary dict