fvMeshMover.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-2022 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::fvMeshMover
26 
27 Description
28  Abstract base class for fvMesh movers.
29 
30  These classes move the mesh points, update the cell volumes and generate
31  the corresponding mesh fluxes without any topology change.
32 
33 SourceFiles
34  fvMeshMover.C
35  fvMeshMoverNew.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef fvMeshMover_H
40 #define fvMeshMover_H
41 
42 #include "fvMesh.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class fvMeshMover Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class fvMeshMover
54 {
55  // Private Data
56 
57  //- Non-const fvMesh reference to allow update
58  fvMesh& mesh_;
59 
60  //- The dynamicMeshDict
61  dictionary dynamicMeshDict_;
62 
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("fvMeshMover");
68 
69 
70  // Declare run-time constructor selection table
71 
73  (
74  autoPtr,
76  fvMesh,
77  (fvMesh& mesh),
78  (mesh)
79  );
80 
81 
82  //- Helper class to update the velocity boundary conditions
83  // following mesh motion
85  {
86  // Private Data
87 
88  const fvMesh& mesh_;
89 
90  wordList velocityFields_;
91 
92  public:
93 
94  // Constructors
95 
97  (
98  const fvMesh& mesh,
99  const dictionary& dict
100  );
101 
102 
103  // Member Functions
104 
105  void update() const;
106  };
107 
108 
109  // Constructors
110 
111  //- Construct from fvMesh
112  explicit fvMeshMover(fvMesh&);
113 
114  //- Disallow default bitwise copy construction
115  fvMeshMover(const fvMeshMover&) = delete;
116 
117 
118  // Selectors
119 
120  //- Select, construct and return the fvMeshMover
121  // If the constant/dynamicMeshDict does not exist
122  // a staticFvMesh is returned
124 
125 
126  //- Destructor
127  virtual ~fvMeshMover();
128 
129 
130  // Member Functions
131 
132  //- Return the fvMesh
133  fvMesh& mesh()
134  {
135  return mesh_;
136  }
137 
138  //- Return the fvMesh
139  const fvMesh& mesh() const
140  {
141  return mesh_;
142  }
143 
144  //- Return the dynamicMeshDict/mover dict
145  const dictionary& dict() const
146  {
147  return dynamicMeshDict_.subDict("mover");
148  }
149 
150  //- Is mesh dynamic, i.e. might it change?
151  // Defaults to true, set to false in the fvMeshMovers::none
152  virtual bool dynamic() const
153  {
154  return true;
155  }
156 
157  //- Update the mesh for both mesh motion and topology change
158  virtual bool update() = 0;
159 
160  //- Update local data for topology changes
161  virtual void topoChange(const polyTopoChangeMap&) = 0;
162 
163  //- Update from another mesh using the given map
164  virtual void mapMesh(const polyMeshMap&) = 0;
165 
166  //- Update corresponding to the given distribution map
167  virtual void distribute(const polyDistributionMap&) = 0;
168 
169  //- Write the mover state
170  virtual bool write(const bool write = true) const
171  {
172  return true;
173  }
174 
175 
176  // Member Operators
177 
178  //- Disallow default bitwise assignment
179  void operator=(const fvMeshMover&) = delete;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
virtual bool write(const bool write=true) const
Write the mover state.
Definition: fvMeshMover.H:169
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Helper class to update the velocity boundary conditions.
Definition: fvMeshMover.H:83
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool dynamic() const
Is mesh dynamic, i.e. might it change?
Definition: fvMeshMover.H:151
declareRunTimeSelectionTable(autoPtr, fvMeshMover, fvMesh,(fvMesh &mesh),(mesh))
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:52
virtual void mapMesh(const polyMeshMap &)=0
Update from another mesh using the given map.
TypeName("fvMeshMover")
Runtime type information.
void operator=(const fvMeshMover &)=delete
Disallow default bitwise assignment.
virtual void topoChange(const polyTopoChangeMap &)=0
Update local data for topology changes.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:1002
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
fvMeshMover(fvMesh &)
Construct from fvMesh.
Definition: fvMeshMover.C:40
const dictionary & dict() const
Return the dynamicMeshDict/mover dict.
Definition: fvMeshMover.H:144
velocityMotionCorrection(const fvMesh &mesh, const dictionary &dict)
Definition: fvMeshMover.C:63
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
static autoPtr< fvMeshMover > New(fvMesh &)
Select, construct and return the fvMeshMover.
fvMesh & mesh()
Return the fvMesh.
Definition: fvMeshMover.H:132
virtual void distribute(const polyDistributionMap &)=0
Update corresponding to the given distribution map.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
virtual ~fvMeshMover()
Destructor.
Definition: fvMeshMover.C:75
Namespace for OpenFOAM.